def req_lists():
    try:
        root_list = lolomos.get_root_list()
        ret = req_path(lolomos.my_list(root_list), lolomos.lists(root_list))
    except CacheMissException:
        connect.refresh_data()
        root_list = lolomos.get_root_list()
        ret = req_path(lolomos.my_list(root_list), lolomos.lists(root_list))
    return ret, root_list
Example #2
0
def req_lists():
    try:
        root_list = lolomos.get_root_list()
        ret = req_path(lolomos.my_list(root_list), lolomos.lists(root_list))
    except CacheMissException:
        connect.refresh_data()
        root_list = lolomos.get_root_list()
        ret = req_path(lolomos.my_list(root_list), lolomos.lists(root_list))
    return ret, root_list
Example #3
0
def track_id_list(list):
    jsn = req_path(path('"lists"', '"%s"' % list, '"trackIds"'))
    lsts = child('lists', jsn)
    lst = child(list, lsts)
    track_ids = child('trackIds', lst)
    track_id = child('trackId', track_ids)
    return track_id
Example #4
0
def track_id_list(list):
    jsn = req_path(path('"lists"', '"%s"' % list, '"trackIds"'))
    lsts = child('lists', jsn)
    lst = child(list, lsts)
    track_ids = child('trackIds', lst)
    track_id = child('trackId', track_ids)
    return track_id
Example #5
0
def get_mylist(root_list_id):
    ret = req_path(my_list(root_list_id), lists(root_list_id))
    llms = child('lolomos', ret)
    rlst = child(root_list_id, llms)
    mylist_ref1 = child('mylist', rlst)
    mylist_ref2 = deref(mylist_ref1, ret)[1]
    mylist = deref(mylist_ref2, ret)
    return mylist
Example #6
0
def get_mylist(root_list_id):
    ret = req_path(my_list(root_list_id), lists(root_list_id))
    llms = child('lolomos', ret)
    rlst = child(root_list_id, llms)
    mylist_ref1 = child('mylist', rlst)
    mylist_ref2 = deref(mylist_ref1, ret)[1]
    mylist = deref(mylist_ref2, ret)
    return mylist
Example #7
0
def get_root_list():
    root_list = '-1'
    jsn = req_path(lists(root_list, 1))
    llms = child('lolomos', jsn)
    assert len(llms) == 2
    for key in llms:
        if key != '-1':
            root_list_id = key
            break
    return root_list_id
Example #8
0
def get_root_list():
    root_list = '-1'
    jsn = req_path(lists(root_list, 1))
    llms = child('lolomos', jsn)
    assert len(llms) == 2
    for key in llms:
        if key != '-1':
            root_list_id = key
            break
    return root_list_id
Example #9
0
def videos_in_search(search_str):
    path1 = path('"search"', '"' + search_str + '"', from_to(0,99), video_infos1)
    path2 = path('"search"', '"' + search_str + '"', from_to(0,99), video_infos2)
    path3 = path('"search"', '"' + search_str + '"', from_to(0,99), video_infos3)
    path4 = path('"search"', '"' + search_str + '"', from_to(0,99), video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    search = child('search', ret)
    search_node = child(search_str, search)

    rets = []
    for video_ref in search_node:
        video_id, vjsn = deref(search_node[video_ref], ret)
        parsed = video_parser.parse_video(None, vjsn, None, video_id)
        rets.append(parsed)
    return rets
Example #10
0
def videos_in_search(search_str):
    path1 = path('"search"', '"' + search_str + '"', from_to(0,99), video_infos1)
    path2 = path('"search"', '"' + search_str + '"', from_to(0,99), video_infos2)
    path3 = path('"search"', '"' + search_str + '"', from_to(0,99), video_infos3)
    path4 = path('"search"', '"' + search_str + '"', from_to(0,99), video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    search = child('search', ret)
    search_node = child(search_str, search)

    rets = []
    for video_ref in search_node:
        video_id, vjsn = deref(search_node[video_ref], ret)
        parsed = video_parser.parse_video(None, vjsn, None, video_id)
        rets.append(parsed)
    return rets
Example #11
0
def viewing_activity_matches(video_type):
    content = viewing_activity_info()
    matches = json.loads(content)['viewedItems']

    if generic_utility.android():
        metadatas = ordered_dict_backport.OrderedDict()
    else:
        metadatas = collections.OrderedDict()

    videos_str = ''
    for match in matches:
        if 'seriesTitle' in match:
            metadata_type = 'show'
            seriesTitle = match['seriesTitle']
        else:
            metadata_type = 'movie'
            seriesTitle = ""

        video_id = unicode(match['movieID'])
        if video_type == metadata_type:
            metadatas[video_id] = {
                'topNodeId': match['topNodeId'],
                'seriesTitle': seriesTitle,
                'dateStr': match['dateStr']
            }
            videos_str += video_id + ','

    videos_str = videos_str[:-1]
    path1 = path('"videos"', '[' + videos_str + ']', video_infos1)
    path2 = path('"videos"', '[' + videos_str + ']', video_infos2)
    path3 = path('"videos"', '[' + videos_str + ']', video_infos3)
    path4 = path('"videos"', '[' + videos_str + ']', video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    videos = child('videos', ret)
    rets = []

    for video_id in metadatas:
        vjsn = videos[video_id]
        vjsn["topNodeId"] = metadatas[video_id]["topNodeId"]
        vjsn["seriesTitle"] = metadatas[video_id]["seriesTitle"]
        vjsn["dateStr"] = metadatas[video_id]["dateStr"]
        parsed = video_parser.parse_video(vjsn, video_id)
        rets.append(parsed)

    return rets
Example #12
0
def videos_in_list(list_to_browse, page):
    items_per_page = int(generic_utility.get_setting('items_per_page'))
    off_from = page * items_per_page
    off_to = off_from + items_per_page - 2

    path1 = path('"lists"', '"' + list_to_browse + '"', from_to(off_from, off_to), video_infos1)
    path2 = path('"lists"', '"' + list_to_browse + '"', from_to(off_from, off_to), video_infos2)
    path3 = path('"lists"', '"' + list_to_browse + '"', from_to(off_from, off_to), video_infos3)
    path4 = path('"lists"', '"' + list_to_browse + '"', from_to(off_from, off_to), video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    lists = child('lists', ret)
    list = child(list_to_browse, lists)
    rets = []
    for ref in list:
        video_id, vjsn = deref(list[ref], ret)
        parsed = video_parser.parse_video(None, vjsn, None, video_id)
        rets.append(parsed)
    return rets
Example #13
0
def videos_in_genre(genre_to_browse, page):
    items_per_page = int(generic_utility.get_setting('items_per_page'))
    off_from = page * items_per_page
    off_to = off_from + items_per_page - 2
    path1 = path('"genres"', '"' + genre_to_browse + '"', '"su"', from_to(off_from, off_to), video_infos1)
    path2 = path('"genres"', '"' + genre_to_browse + '"', '"su"', from_to(off_from, off_to), video_infos2)
    path3 = path('"genres"', '"' + genre_to_browse + '"', '"su"', from_to(off_from, off_to), video_infos3)
    path4 = path('"genres"', '"' + genre_to_browse + '"', '"su"', from_to(off_from, off_to), video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    gnrs = child('genres', ret)
    gnre = child(genre_to_browse, gnrs)
    sus = child('su', gnre)
    rets = []
    for ref in sus:
        video_id, vjsn = deref(sus[ref], ret)
        parsed = video_parser.parse_video(None, vjsn, None, video_id)
        rets.append(parsed)
    return rets
Example #14
0
def videos_in_genre(genre_to_browse, page):
    items_per_page = int(generic_utility.get_setting('items_per_page'))
    off_from = page * items_per_page
    off_to = off_from + items_per_page - 2
    path1 = path('"genres"', '"' + genre_to_browse + '"', '"su"', from_to(off_from, off_to), video_infos1)
    path2 = path('"genres"', '"' + genre_to_browse + '"', '"su"', from_to(off_from, off_to), video_infos2)
    path3 = path('"genres"', '"' + genre_to_browse + '"', '"su"', from_to(off_from, off_to), video_infos3)
    path4 = path('"genres"', '"' + genre_to_browse + '"', '"su"', from_to(off_from, off_to), video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    gnrs = child('genres', ret)
    gnre = child(genre_to_browse, gnrs)
    sus = child('su', gnre)
    rets = []
    for ref in sus:
        video_id, vjsn = deref(sus[ref], ret)
        parsed = video_parser.parse_video(None, vjsn, None, video_id)
        rets.append(parsed)
    return rets
Example #15
0
def videos_in_list(list_to_browse, page):
    items_per_page = int(generic_utility.get_setting('items_per_page'))
    off_from = page * items_per_page
    off_to = off_from + items_per_page - 2

    path1 = path('"lists"', '"' + list_to_browse + '"', from_to(off_from, off_to), video_infos1)
    path2 = path('"lists"', '"' + list_to_browse + '"', from_to(off_from, off_to), video_infos2)
    path3 = path('"lists"', '"' + list_to_browse + '"', from_to(off_from, off_to), video_infos3)
    path4 = path('"lists"', '"' + list_to_browse + '"', from_to(off_from, off_to), video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    lists = child('lists', ret)
    list = child(list_to_browse, lists)
    rets = []
    for ref in list:
        video_id, vjsn = deref(list[ref], ret)
        parsed = video_parser.parse_video(None, vjsn, None, video_id)
        rets.append(parsed)
    return rets
Example #16
0
def viewing_activity_matches(video_type):
    content = viewing_activity_info()
    matches = json.loads(content)['viewedItems']
    
    if generic_utility.android():
        metadatas = ordered_dict_backport.OrderedDict()
    else:
        metadatas = collections.OrderedDict()
    
    videos_str = ''
    for match in matches:
        if 'seriesTitle' in match:
            metadata_type = 'show'
            seriesTitle = match['seriesTitle']
        else:
            metadata_type = 'movie'
            seriesTitle = ""

        video_id = unicode(match['movieID'])
        if video_type == metadata_type:
            metadatas[video_id] = {'topNodeId': match['topNodeId'], 'seriesTitle': seriesTitle, 'dateStr': match['dateStr']}
            videos_str += video_id + ','

    videos_str = videos_str[:-1]
    path1 = path('"videos"', '[' + videos_str + ']', video_infos1)
    path2 = path('"videos"', '[' + videos_str + ']', video_infos2)
    path3 = path('"videos"', '[' + videos_str + ']', video_infos3)
    path4 = path('"videos"', '[' + videos_str + ']', video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    videos = child('videos', ret)
    rets = []

    for video_id in metadatas:
        vjsn = videos[video_id]
        vjsn["topNodeId"] = metadatas[video_id]["topNodeId"]
        vjsn["seriesTitle"] = metadatas[video_id]["seriesTitle"]
        vjsn["dateStr"] = metadatas[video_id]["dateStr"]
        parsed = video_parser.parse_video(vjsn, video_id)
        rets.append(parsed)

    return rets
Example #17
0
def viewing_activity_matches(video_type):
    content = viewing_activity_info()
    matches = json.loads(content)["viewedItems"]

    metadatas = collections.OrderedDict()
    videos_str = ""
    for match in matches:
        if "seriesTitle" in match:
            metadata_type = "show"
            series_title = match["seriesTitle"]
        else:
            metadata_type = "movie"
            series_title = None

        video_id = unicode(match["movieID"])
        if video_type == metadata_type:
            metadatas[video_id] = {"title": get_viewing_activity_title(match), "series_title": series_title}
            videos_str += video_id + ","

    videos_str = videos_str[:-1]
    path1 = path('"videos"', "[" + videos_str + "]", video_infos1)
    path2 = path('"videos"', "[" + videos_str + "]", video_infos2)
    path3 = path('"videos"', "[" + videos_str + "]", video_infos3)
    path4 = path('"videos"', "[" + videos_str + "]", video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    videos = child("videos", ret)
    rets = []

    for video_id in metadatas:
        vjsn = videos[video_id]
        video_metadata = metadatas[video_id]
        title = video_metadata["title"]
        series_title = video_metadata["series_title"]
        parsed = video_parser.parse_video(title, vjsn, series_title, video_id)
        rets.append(parsed)

    return rets
Example #18
0
def viewing_activity_matches(video_type):
    content = viewing_activity_info()
    matches = json.loads(content)['viewedItems']

    metadatas = collections.OrderedDict()
    videos_str = ''
    for match in matches:
        if 'seriesTitle' in match:
            metadata_type = 'show'
            series_title = match['seriesTitle']
        else:
            metadata_type = 'movie'
            series_title = None

        video_id = unicode(match['movieID'])
        if video_type == metadata_type:
            metadatas[video_id] = {'title': get_viewing_activity_title(match), 'series_title': series_title}
            videos_str += video_id + ','

    videos_str = videos_str[:-1]
    path1 = path('"videos"', '[' + videos_str + ']', video_infos1)
    path2 = path('"videos"', '[' + videos_str + ']', video_infos2)
    path3 = path('"videos"', '[' + videos_str + ']', video_infos3)
    path4 = path('"videos"', '[' + videos_str + ']', video_infos4)
    ret = req_path(path1, path2, path3, path4)
    filter_empty(ret)
    videos = child('videos', ret)
    rets = []

    for video_id in metadatas:
        vjsn = videos[video_id]
        video_metadata = metadatas[video_id]
        title = video_metadata['title']
        series_title = video_metadata['series_title']
        parsed = video_parser.parse_video(title, vjsn, series_title, video_id)
        rets.append(parsed)

    return rets