def show_trailers(location, movie_id='', poster='', fanart=''):
    path = kodi.get_setting('download_path')
    for trailer in scraper.get_trailers(location, movie_id):
        trailer['fanart'] = fanart
        trailer['poster'] = poster
        stream_url = local_utils.get_best_stream(trailer['streams'], 'stream')
        download_url = local_utils.get_best_stream(trailer['streams'], 'download')
        label = trailer['title']
        if path:
            file_name = utils.create_legal_filename(trailer['title'], trailer.get('year', ''))
            if local_utils.trailer_exists(path, file_name):
                label += ' [I](%s)[/I]' % (i18n('downloaded'))
        else:
            file_name = ''
            
        liz = utils.make_list_item(label, trailer, local_utils.make_art(trailer))
        liz.setProperty('isPlayable', 'true')
        del trailer['streams']
        liz.setInfo('video', trailer)

        menu_items = []
        queries = {'mode': MODES.DOWNLOAD_TRAILER, 'trailer_url': download_url, 'title': trailer['title'], 'year': trailer.get('year', '')}
        runstring = 'RunPlugin(%s)' % (kodi.get_plugin_url(queries))
        menu_items.append((i18n('download_trailer'), runstring),)
        liz.addContextMenuItems(menu_items, replaceItems=False)
        
        queries = {'mode': MODES.PLAY_TRAILER, 'trailer_url': stream_url, 'thumb': trailer.get('thumb', ''), 'trailer_file': file_name}
        liz_url = kodi.get_plugin_url(queries)
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), liz_url, liz, isFolder=False)
    kodi.set_view('movies', set_view=True)
    kodi.end_of_directory()
def show_movies():
    try: limit = int(kodi.get_setting('limit'))
    except: limit = 0
    try: source = int(kodi.get_setting('source'))
    except: source = 0
    list_data = local_utils.make_list_dict()
    for movie in get_movies(source, limit):
        label = movie['title']
        key = movie['title'].upper()
        if key in list_data:
            if 'year' not in movie or not movie['year'] or not list_data[key] or int(movie['year']) in list_data[key]:
                label = '[COLOR green]%s[/COLOR]' % (label)
        
        liz = utils.make_list_item(label, movie, local_utils.make_art(movie))
        liz.setInfo('video', movie)
        
        menu_items = []
        queries = {'mode': MODES.PLAY_RECENT, 'movie_id': movie['movie_id'], 'location': movie['location'], 'thumb': movie.get('poster', '')}
        runstring = 'RunPlugin(%s)' % (kodi.get_plugin_url(queries))
        menu_items.append((i18n('play_most_recent'), runstring),)
        queries = {'mode': MODES.ADD_TRAKT, 'title': movie['title'], 'year': movie.get('year', '')}
        runstring = 'RunPlugin(%s)' % (kodi.get_plugin_url(queries))
        menu_items.append((i18n('add_to_trakt'), runstring),)
        runstring = 'RunPlugin(%s)' % (CP_ADD_URL % (movie['title']))
        menu_items.append((i18n('add_to_cp'), runstring),)
        liz.addContextMenuItems(menu_items, replaceItems=False)
        
        queries = {'mode': MODES.TRAILERS, 'movie_id': movie['movie_id'], 'location': movie['location'], 'poster': movie.get('poster', ''), 'fanart': movie.get('fanart', '')}
        liz_url = kodi.get_plugin_url(queries)
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), liz_url, liz, isFolder=True)
    kodi.set_view('movies', set_sort=True)
    kodi.end_of_directory(cache_to_disc=False)
Beispiel #3
0
def show_movies():
    try:
        limit = int(kodi.get_setting('limit'))
    except:
        limit = 0
    try:
        source = int(kodi.get_setting('source'))
    except:
        source = 0
    list_data = local_utils.make_list_dict()
    for movie in get_movies(source, limit):
        label = movie['title']
        key = movie['title'].upper()
        if key in list_data:
            if 'year' not in movie or not movie['year'] or not list_data[
                    key] or int(movie['year']) in list_data[key]:
                label = '[COLOR green]%s[/COLOR]' % (label)

        liz = utils.make_list_item(label, movie, local_utils.make_art(movie))
        liz.setInfo('video', movie)

        menu_items = []
        queries = {
            'mode': MODES.PLAY_RECENT,
            'movie_id': movie['movie_id'],
            'location': movie['location'],
            'thumb': movie.get('poster', '')
        }
        runstring = 'RunPlugin(%s)' % (kodi.get_plugin_url(queries))
        menu_items.append((i18n('play_most_recent'), runstring), )
        queries = {
            'mode': MODES.ADD_TRAKT,
            'title': movie['title'],
            'year': movie.get('year', '')
        }
        runstring = 'RunPlugin(%s)' % (kodi.get_plugin_url(queries))
        menu_items.append((i18n('add_to_trakt'), runstring), )
        runstring = 'RunPlugin(%s)' % (CP_ADD_URL % (movie['title']))
        menu_items.append((i18n('add_to_cp'), runstring), )
        liz.addContextMenuItems(menu_items, replaceItems=False)

        queries = {
            'mode': MODES.TRAILERS,
            'movie_id': movie['movie_id'],
            'location': movie['location'],
            'poster': movie.get('poster', ''),
            'fanart': movie.get('fanart', '')
        }
        liz_url = kodi.get_plugin_url(queries)
        xbmcplugin.addDirectoryItem(int(sys.argv[1]),
                                    liz_url,
                                    liz,
                                    isFolder=True)
    kodi.set_view('movies', set_sort=True)
    kodi.end_of_directory(cache_to_disc=False)
Beispiel #4
0
def show_trailers(location, movie_id='', poster='', fanart=''):
    path = kodi.get_setting('download_path')
    for trailer in scraper.get_trailers(location, movie_id):
        trailer['fanart'] = fanart
        trailer['poster'] = poster
        stream_url = local_utils.get_best_stream(trailer['streams'], 'stream')
        download_url = local_utils.get_best_stream(trailer['streams'],
                                                   'download')
        label = trailer['title']
        if path:
            file_name = utils.create_legal_filename(trailer['title'],
                                                    trailer.get('year', ''))
            if local_utils.trailer_exists(path, file_name):
                label += ' [I](%s)[/I]' % (i18n('downloaded'))
        else:
            file_name = ''

        liz = utils.make_list_item(label, trailer,
                                   local_utils.make_art(trailer))
        liz.setProperty('isPlayable', 'true')
        del trailer['streams']
        liz.setInfo('video', trailer)

        menu_items = []
        queries = {
            'mode': MODES.DOWNLOAD_TRAILER,
            'trailer_url': download_url,
            'title': trailer['title'],
            'year': trailer.get('year', '')
        }
        runstring = 'RunPlugin(%s)' % (kodi.get_plugin_url(queries))
        menu_items.append((i18n('download_trailer'), runstring), )
        liz.addContextMenuItems(menu_items, replaceItems=False)

        queries = {
            'mode': MODES.PLAY_TRAILER,
            'trailer_url': stream_url,
            'thumb': trailer.get('thumb', ''),
            'trailer_file': file_name
        }
        liz_url = kodi.get_plugin_url(queries)
        xbmcplugin.addDirectoryItem(int(sys.argv[1]),
                                    liz_url,
                                    liz,
                                    isFolder=False)
    kodi.set_view('movies', set_view=True)
    kodi.end_of_directory()