def trailer(title, video_type):
    trailers = []
    content = get.trailer(video_type, title)
    if content:
        for match in content['results']:
            if match['site'] == 'YouTube':
                if match['iso_639_1']:
                    name = match['name'] + ' (' + match['iso_639_1'] + ')'
                else:
                    name = match['name']
                match = {'name': name, 'key': match['key']}
                trailers.append(match)
        if len(trailers) > 0:
            dialog = xbmcgui.Dialog()
            nr = dialog.select('Trailer',
                               [match['name'] for match in trailers])
            if nr >= 0:
                selected_trailer = trailers[nr]
                match = 'PlayMedia(plugin://plugin.video.youtube/play/?video_id=%s)' % selected_trailer[
                    'key']
                xbmc.executebuiltin(match)
        else:
            generic_utility.notification(generic_utility.get_string(30305))
    else:
        generic_utility.notification(generic_utility.get_string(30305))
        pass
def trailer(title, video_type):
    trailers = []
    content = get.trailer(video_type, title)
    if content:
        for match in content['results']:
            if match['site'] == 'YouTube':
                if match['iso_639_1']:
                    name = match['name'] + ' (' + match['iso_639_1'] + ')'
                else:
                    name = match['name']
                match = {'name': name, 'key': match['key']}
                trailers.append(match)
        if len(trailers) > 0:
            dialog = xbmcgui.Dialog()
            nr = dialog.select('Trailer', [match['name'] for match in trailers])
            if nr >= 0:
                selected_trailer = trailers[nr]
                match = 'PlayMedia(plugin://plugin.video.youtube/play/?video_id=%s)' % selected_trailer['key']
                xbmc.executebuiltin(match)
        else:
            generic_utility.notification(generic_utility.get_string(30305))
    else:
        generic_utility.notification(generic_utility.get_string(30305))
        pass
Esempio n. 3
0
def trailer(title, video_type):
    trailers = []
    content = get.trailer(video_type, title)
    if content:
        for match in content["results"]:
            if match["site"] == "YouTube":
                if match["iso_639_1"]:
                    name = match["name"] + " (" + match["iso_639_1"] + ")"
                else:
                    name = match["name"]
                match = {"name": name, "key": match["key"]}
                trailers.append(match)
        if len(trailers) > 0:
            dialog = xbmcgui.Dialog()
            nr = dialog.select("Trailer", [match["name"] for match in trailers])
            if nr >= 0:
                selected_trailer = trailers[nr]
                match = "PlayMedia(plugin://plugin.video.youtube/play/?video_id=%s)" % selected_trailer["key"]
                xbmc.executebuiltin(match)
        else:
            utility.notification(utility.get_string(30305))
    else:
        utility.notification(utility.get_string(30305))
        pass