Example #1
0
def add_videos_to_directory(loading_progress, run_as_widget, video_metadatas, video_type, page = None, url=None, viewing_activity = False):

    removable = url != None and 'mylist' in url

    if not viewing_activity:
        sorted_video_metadata = sorted(video_metadatas, key=lambda t: t['title'], reverse = viewing_activity)
    else:
        sorted_video_metadata = video_metadatas

    allowed_types = calc_allowed_types(video_type, viewing_activity)

    filtered_video_metadata = []
    for video_metadata in sorted_video_metadata:
        if video_metadata['type'] in allowed_types:
            filtered_video_metadata.append(video_metadata)

    add.videos(filtered_video_metadata, removable, viewing_activity=viewing_activity)

    items_per_page = int(generic_utility.get_setting('items_per_page'))
    if (not url or 'list_viewing_activity' not in url) and len(video_metadatas) == items_per_page:
        add.add_next_item('zzz[Next]zzz', page + 1, url, video_type, 'list_videos', '')

    if len(video_metadatas) == 0:
        generic_utility.notification(generic_utility.get_string(30306))
    if not viewing_activity:
        add_sort_methods()
Example #2
0
def add_videos_to_directory(loading_progress,
                            run_as_widget,
                            video_metadatas,
                            video_type,
                            page=None,
                            url=None,
                            viewing_activity=False):

    removable = url != None and 'mylist' in url

    if viewing_activity and type != "movie":
        xbmcplugin.setContent(int(sys.argv[1]), "episodes")
    elif video_type == "movie":
        xbmcplugin.setContent(int(sys.argv[1]), "movies")
    elif video_type == "show":
        xbmcplugin.setContent(int(sys.argv[1]), "tvshows")
    elif video_type == "both":
        xbmcplugin.setContent(int(sys.argv[1]), "tvshows")

    if not viewing_activity:
        sorted_video_metadata = sorted(video_metadatas,
                                       key=lambda t: t['date_watched'],
                                       reverse=viewing_activity)
    else:
        sorted_video_metadata = video_metadatas

    allowed_types = calc_allowed_types(video_type, viewing_activity)

    filtered_video_metadata = []
    for video_metadata in sorted_video_metadata:
        if video_metadata['type'] in allowed_types:
            filtered_video_metadata.append(video_metadata)

    add.videos(filtered_video_metadata,
               removable,
               viewing_activity=viewing_activity)

    items_per_page = int(generic_utility.get_setting('items_per_page'))

    if len(video_metadatas) == 0:
        generic_utility.notification(generic_utility.get_string(30306))

    if not viewing_activity:
        add_sort_methods()
    else:
        xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL)

    if (not url or 'list_viewing_activity'
            not in url) and len(video_metadatas) == items_per_page:
        add.add_next_item(page + 1, url, video_type, 'list_videos')
Example #3
0
def add_videos_to_directory(loading_progress, run_as_widget, video_metadatas, video_type, page = None, url=None, viewing_activity = False):

    removable = url != None and 'mylist' in url
    
    if viewing_activity and type!="movie":
        xbmcplugin.setContent(int(sys.argv[1]), "episodes")
    elif video_type=="movie":
        xbmcplugin.setContent(int(sys.argv[1]), "movies")
    elif video_type == "show":
        xbmcplugin.setContent(int(sys.argv[1]), "tvshows")
    elif video_type == "both":
        xbmcplugin.setContent(int(sys.argv[1]), "tvshows")
    
    if not viewing_activity:
        sorted_video_metadata = sorted(video_metadatas, key=lambda t: t['date_watched'], reverse = viewing_activity)
    else:
        sorted_video_metadata = video_metadatas

    allowed_types = calc_allowed_types(video_type, viewing_activity)

    filtered_video_metadata = []
    for video_metadata in sorted_video_metadata:
        if video_metadata['type'] in allowed_types:
            filtered_video_metadata.append(video_metadata)

    add.videos(filtered_video_metadata, removable, viewing_activity=viewing_activity)

    items_per_page = int(generic_utility.get_setting('items_per_page'))

    if len(video_metadatas) == 0:
        generic_utility.notification(generic_utility.get_string(30306))
    
    if not viewing_activity:
        add_sort_methods()
    else:
        xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL)
    
    if page is not None and (not url or 'list_viewing_activity' not in url) and len(video_metadatas) == items_per_page:
        add.add_next_item(page + 1, url, video_type, 'list_videos')