Esempio n. 1
0
def get_video_link(players, params):
    lister = Lister()
    for lang, lang_params in params.items():
        for key, value in lang_params.items():
            if isinstance(value, basestring):
                params[lang][key + '_+'] = value.replace(' ', '+')
                params[lang][key + '_-'] = value.replace(' ', '-')
                params[lang][key + '_escaped'] = value.replace(' ', '%2520')
                params[lang][key + '_escaped+'] = value.replace(' ', '%252B')
    selection = None
    try:
        if len(players) > 1:
            index = plugin.select('Play with...',
                                  [player.title for player in players])
            if index == -1:
                return None
            players = [players[index]]
        resolve_f = lambda p: resolve_player(p, lister, params)
        result = resolve_f(players[0])
        if result:
            title, links = result
            if len(links) == 1:
                selection = links[0]
            else:
                index = plugin.select('Play with...',
                                      [x['label'] for x in links])
                if index > -1:
                    selection = links[index]
        else:
            plugin.ok('Error', 'Video not found')
    finally:
        lister.stop()
    return selection
Esempio n. 2
0
def get_tvdb_id_from_name(name, lang):
    tools.show_busy()
    search_results = TVDB.search(name, language=lang)
    if not search_results:
        tools.hide_busy()
        plugin.ok(
            'TV show not found',
            'no show information found for %s in tvdb' % text.to_utf8(name))
    items = []
    for show in search_results:
        if show['seriesname'] == name:
            if 'firstaired' in show:
                show['year'] = int(show['firstaired'].split('-')[0].strip())
            else:
                show['year'] = 'unknown'
            items.append(show)
    if len(items) > 1:
        selection = plugin.select('Choose TV Show', [
            '%s (%s)' % (text.to_utf8(s['seriesname']), s['year'])
            for s in items
        ])
    else:
        selection = 0
    tools.hide_busy()
    if selection != -1:
        return items[selection]['id']
Esempio n. 3
0
def play_by_label(label):
	types = ['Movies', 'TV shows']
	selection = plugin.select('Search for "%s"' % label, [item for item in types])
	base = 'RunPlugin(plugin://plugin.video.chappaai'
	info = xbmc.getInfoLabel
	if selection   == 0:
		xbmc.executebuiltin('%s/movies/play_by_name/%s/en)' % (base, label))
	elif selection == 1:
		xbmc.executebuiltin('%s/tv/play_by_name/%s/%s/%s/%s/en)' % (base, info('ListItem.TVShowTitle'), info('ListItem.Season'), info('ListItem.Episode'), label))
Esempio n. 4
0
def play_by_label(label):
    #	xbmc.log(str('def play_by_label(label):')+'===>OPENMETA', level=xbmc.LOGNOTICE)
    types = ['Movies', 'TV shows']
    selection = plugin.select('Search for "%s"' % label,
                              [item for item in types])
    base = 'RunPlugin(plugin://plugin.video.openmeta'
    info = xbmc.getInfoLabel
    if selection == 0:
        xbmc.executebuiltin('%s/movies/play_by_name/%s/en)' % (base, label))
    elif selection == 1:
        xbmc.executebuiltin(
            '%s/tv/play_by_name/%s/%s/%s/%s/en)' %
            (base, info('ListItem.TVShowTitle'), info('ListItem.Season'),
             info('ListItem.Episode'), label))
Esempio n. 5
0
def movies_play_by_name(name, lang='en', usedefault='True'):
	tools.show_busy()
	from resources.lib.TheMovieDB import Search
	items = Search().movie(query=name, language=lang, page=1)['results']
	if not items:
		tools.hide_busy()
		plugin.ok('Movie not found', 'No information found for ' + name)
	if len(items) > 1:
		selection = plugin.select('Movie', ['%s (%s)' % ((s['title']), text.parse_year(s['release_date'])) for s in items])
	else:
		selection = 0
	tools.hide_busy()
	if selection != -1:
		id = items[selection]['id']
		movies_play_choose_player('tmdb', id, usedefault)
Esempio n. 6
0
def setdefaultplayers():
	media = ['movies', 'tvshows']
	none = {'name':'None'}
	for i in media:
		play_plugin = meta_players.ADDON_SELECTOR.id
		players = meta_players.get_players(i)
		players = [p for p in players if p.id == play_plugin] or players
		players.append(meta_players.AddonPlayer('', '', none))
		if not players or len(players) == 0:
			xbmc.executebuiltin('Action(Info)')
			play_base.action_cancel()
			return
		index = plugin.select('Play %s with...' %i, [player.title for player in players])
		if index >= 0:
			plugin.set_setting(i + 'default', players[index].title)