Esempio n. 1
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. 2
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)