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()
Exemple #2
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()
def play_most_recent(location, movie_id='', thumb=''):
    path = kodi.get_setting('download_path')
    trailers = scraper.get_trailers(location, movie_id)
    try:
        trailer = trailers.next()
        stream_url = local_utils.get_best_stream(trailer['streams'], 'stream')
        if path:
            file_name = utils.create_legal_filename(trailer['title'], trailer.get('year', ''))
        else:
            file_name = ''
        
        if not thumb: thumb = trailer.get('thumb', '')
        play_trailer(stream_url, thumb, file_name, playable=False, meta=trailer)
    except StopIteration:
        kodi.notify(i18n('none_available'))
Exemple #4
0
def play_most_recent(location, movie_id='', thumb=''):
    path = kodi.get_setting('download_path')
    trailers = scraper.get_trailers(location, movie_id)
    try:
        trailer = trailers.next()
        stream_url = local_utils.get_best_stream(trailer['streams'], 'stream')
        if path:
            file_name = utils.create_legal_filename(trailer['title'],
                                                    trailer.get('year', ''))
        else:
            file_name = ''

        if not thumb: thumb = trailer.get('thumb', '')
        play_trailer(stream_url,
                     thumb,
                     file_name,
                     playable=False,
                     meta=trailer)
    except StopIteration:
        kodi.notify(i18n('none_available'))