Exemplo n.º 1
0
def read_lists(jsn, root_list):
    filter_empty(jsn)
    rets = []

    llms = child('lolomos', jsn)
    rlst = child(root_list, llms)

    if generic_utility.get_setting('is_kid') == 'false':
        mylist = child('mylist', rlst)
        mylist_idx = deref(mylist, jsn)[0]
    else:
        mylist_idx = -1
        mylist_id = None

    for list_ref_idx in rlst:
        list_ref = rlst[list_ref_idx]
        idx, elem = deref(list_ref, jsn)
        if list_ref_idx == mylist_idx:
            mylist_id = idx

        if 'displayName' in elem:
            display_name = unicode(elem['displayName'])
            ret = {'id': idx, 'name': display_name}
            rets.append(ret)

    return mylist_id, rets
Exemplo n.º 2
0
def read_lists(jsn, root_list):
    filter_empty(jsn)
    rets = []

    llms = child('lolomos', jsn)
    rlst = child(root_list, llms)

    if generic_utility.get_setting('is_kid') == 'false':
        mylist = child('mylist', rlst)
        mylist_idx = deref(mylist, jsn)[0]
    else:
        mylist_idx = -1
        mylist_id = None

    for list_ref_idx in rlst:
        list_ref = rlst[list_ref_idx]
        idx, elem = deref(list_ref, jsn)
        if list_ref_idx == mylist_idx:
            mylist_id = idx

        if 'displayName' in elem:
            display_name = unicode(elem['displayName'])
            ret = {'id': idx, 'name': display_name}
            rets.append(ret)

    return mylist_id, rets
Exemplo n.º 3
0
def genre_data(video_type):
    match = []

    content = genre_info(video_type)

    matches = json.loads(content)['value']['genres']
    filter_empty(matches)
    #genre data for show subgenres
    if len(matches) == 1:
        matches = matches['83']['subgenres']
    for key in matches:
        item = matches[key]
        if item.has_key('id') and item.has_key('name'):
            match.append((unicode(item['id']), item['name']))
    return match
Exemplo n.º 4
0
def videos_in_search(search_str):
    path1 = path('"search"', '"' + search_str + '"', '"titles"', from_to(0,99), video_infos1)
    path2 = path('"search"', '"' + search_str + '"', '"titles"', from_to(0,99), video_infos2)
    path3 = path('"search"', '"' + search_str + '"', '"titles"', from_to(0,99), video_infos3)
    path4 = path('"search"', '"' + search_str + '"', '"titles"', from_to(0,99), video_infos4)
    ret = req_json_path(path1, path2, path3, path4)
    filter_empty(ret)
    rets = []
    if 'search' in ret:
        search = ret['search']
        search_node = child(search_str, search)
        for video_ref in search_node['titles']:
            if search_node['titles'][video_ref][0] == 'videos':
                parsed = video_parser.parse_video(ret['videos'][search_node['titles'][video_ref][1]], search_node['titles'][video_ref][1])
                rets.append(parsed)
    return rets
Exemplo n.º 5
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
Exemplo n.º 6
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
Exemplo n.º 7
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
Exemplo n.º 8
0
def videos_in_search(search_str):
    path1 = path('"search"', '"byTerm"', '"|' + search_str + '"', '"titles"',
                 '99', from_to(0, 99), '"reference"', video_infos1)
    path2 = path('"search"', '"byTerm"', '"|' + search_str + '"', '"titles"',
                 '99', from_to(0, 99), '"reference"', video_infos2)
    path3 = path('"search"', '"byTerm"', '"|' + search_str + '"', '"titles"',
                 '99', from_to(0, 99), video_infos3)
    path4 = path('"search"', '"byTerm"', '"|' + search_str + '"', '"titles"',
                 '99', from_to(0, 99), '"reference"', video_infos4)
    ret = req_json_path(path1, path2, path3, path4)
    filter_empty(ret)
    rets = []
    if 'search' in ret:
        search = ret['search']
        for video_ref in ret[u'videos']:
            parsed = video_parser.parse_video(ret['videos'][video_ref],
                                              video_ref)
            rets.append(parsed)
    return rets
Exemplo n.º 9
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
Exemplo n.º 10
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
Exemplo n.º 11
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
Exemplo n.º 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
Exemplo n.º 13
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
Exemplo n.º 14
0
def read_lists(jsn, root_list):
    filter_empty(jsn)
    rets = []

    llms = child('lolomos', jsn)
    rlst = child(root_list, llms)
    mylist = child('mylist', rlst)
    mylist_idx = deref(mylist, jsn)[0]

    for list_ref_idx in rlst:
        list_ref = rlst[list_ref_idx]
        idx, elem = deref(list_ref, jsn)
        if list_ref_idx == mylist_idx:
            mylist_id = idx

        if 'displayName' in elem:
            display_name = unicode(elem['displayName'])
            ret = {'id': idx, 'name': display_name}
            rets.append(ret)

    return mylist_id, rets
Exemplo n.º 15
0
def read_lists(jsn, root_list):
    filter_empty(jsn)
    rets = []

    llms = child('lolomos', jsn)
    rlst = child(root_list, llms)
    mylist = child('mylist', rlst)
    mylist_idx = deref(mylist, jsn)[0]

    for list_ref_idx in rlst:
        list_ref = rlst[list_ref_idx]
        idx, elem = deref(list_ref, jsn)
        if list_ref_idx == mylist_idx:
            mylist_id = idx

        if 'displayName' in elem:
            display_name = unicode(elem['displayName'])
            ret = {'id': idx, 'name': display_name}
            rets.append(ret)

    return mylist_id, rets
Exemplo n.º 16
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
Exemplo n.º 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