Esempio n. 1
0
def play_trailer(trailer_url,
                 thumb='',
                 trailer_file='',
                 playable=True,
                 meta=None):
    if meta is None: meta = {}
    path = kodi.get_setting('download_path')
    if path and trailer_file:
        local_file = local_utils.trailer_exists(path, trailer_file)
        if local_file:
            trailer_url = os.path.join(path, local_file)

    if trailer_url.startswith('http'):
        trailer_url = local_utils.resolve_trailer(trailer_url)
        trailer_url += '|User-Agent=%s' % (BROWSER_UA)

    listitem = xbmcgui.ListItem(path=trailer_url,
                                iconImage=thumb,
                                thumbnailImage=thumb)
    if meta:
        if 'streams' in meta: del meta['streams']
        listitem.setInfo('video', meta)
    try:
        listitem.setArt({'thumb': thumb})
    except:
        pass
    listitem.setPath(trailer_url)
    if playable:
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
    else:
        xbmc.Player().play(trailer_url, listitem=listitem)
def download_trailer(trailer_url, title, year=''):
    path = kodi.get_setting('download_path')
    while not path:
        ret = xbmcgui.Dialog().yesno(kodi.get_name(), i18n('no_download_path'), nolabel=i18n('cancel'), yeslabel=i18n('set_it_now'))
        if not ret:
            return

        kodi.show_settings()
        path = kodi.get_setting('download_path')
        
    trailer_url = local_utils.resolve_trailer(trailer_url)
    file_name = utils.create_legal_filename(title, year)
    utils.download_media(trailer_url, path, file_name, translations)
Esempio n. 3
0
def download_trailer(trailer_url, title, year=''):
    path = kodi.get_setting('download_path')
    while not path:
        ret = xbmcgui.Dialog().yesno(kodi.get_name(),
                                     i18n('no_download_path'),
                                     nolabel=i18n('cancel'),
                                     yeslabel=i18n('set_it_now'))
        if not ret:
            return

        kodi.show_settings()
        path = kodi.get_setting('download_path')

    trailer_url = local_utils.resolve_trailer(trailer_url)
    file_name = utils.create_legal_filename(title, year)
    utils.download_media(trailer_url, path, file_name, translations)
def play_trailer(trailer_url, thumb='', trailer_file='', playable=True, meta=None):
    if meta is None: meta = {}
    path = kodi.get_setting('download_path')
    if path and trailer_file:
        local_file = local_utils.trailer_exists(path, trailer_file)
        if local_file:
            trailer_url = os.path.join(path, local_file)

    if trailer_url.startswith('http'):
        trailer_url = local_utils.resolve_trailer(trailer_url)
        trailer_url += '|User-Agent=%s' % (BROWSER_UA)
        
    listitem = xbmcgui.ListItem(path=trailer_url, iconImage=thumb, thumbnailImage=thumb)
    if meta:
        if 'streams' in meta: del meta['streams']
        listitem.setInfo('video', meta)
    try: listitem.setArt({'thumb': thumb})
    except: pass
    listitem.setPath(trailer_url)
    if playable:
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
    else:
        xbmc.Player().play(trailer_url, listitem=listitem)