Exemplo n.º 1
0
def item_images(type, tmdb_id=None, imdb_id=None, tvdb_id=None, name=None):
    poster = ""
    fanart = ""
    response = ""
    if not tmdb_id and not imdb_id and not tvdb_id and not tvrage_id and not name: return None
    if type == "movie" and tmdb_id != None and tmdb_id != "": response = tmdb.Movies(tmdb_id).info()
    elif type == "tv"  and tmdb_id != None and tmdb_id != "": response = tmdb.TV(tmdb_id).info()
    elif type == "tv"  and tvdb_id != None and tvdb_id != "": response = tmdb.Find(tvdb_id).info(external_source="tvdb_id")
    elif                   imdb_id != None and imdb_id != "": response = tmdb.Find(imdb_id).info(external_source="imdb_id")
    if response == "": return False
    if tmdb_id == None:
        if   type == "movie"  : response = response.get("movie_results")
        elif type == "tv"     : response = response.get("tv_results")
        elif type == "season" : response = response.get("season_results")
        elif type == "episode": response = response.get("episode_results")
    if isinstance(response, dict):
        if response.get("backdrop_path"): fanart = "http://image.tmdb.org/t/p/original/%s" % response.get("backdrop_path")
        else                            : fanart = get_background_path()
        if response.get("poster_path")  : poster = "http://image.tmdb.org/t/p/original/%s" % response.get("poster_path")
        else                            : poster = "https://raw.githubusercontent.com/MrBlamo420/Style/master/Chappaai/default/unavailable.png"
    elif isinstance(response, list):
        if response["backdrop_path"]: fanart = "http://image.tmdb.org/t/p/original/%s" % response["backdrop_path"]
        else                        : fanart = get_background_path()
        if response["poster_path"]  : poster = "http://image.tmdb.org/t/p/original/%s" % response["poster_path"]
        else                        : poster = "https://raw.githubusercontent.com/MrBlamo420/Style/master/Chappaai/default/unavailable.png"
    images = [poster, fanart]
    return images 
Exemplo n.º 2
0
def lists_trakt_my_lists():
    lists = trakt.trakt_get_lists()
    items = []
    for list in lists:
        name = list["name"]
        user = list["user"]["username"]
        slug = list["ids"]["slug"]
        items.append({
            'label':
            name,
            'path':
            plugin.url_for("lists_trakt_show_list", user=user, slug=slug),
            'context_menu':
            [(_("Scan item to library"), "RunPlugin({0})".format(
                plugin.url_for("lists_trakt_add_all_to_library",
                               user=user,
                               slug=slug))),
             ("{0} ({1})".format(_("Play"),
                                 _("Random").lower()), "RunPlugin({0})".format(
                                     plugin.url_for("lists_trakt_play_random",
                                                    user=user,
                                                    slug=slug)))],
            'icon':
            get_icon_path("traktmylists"),
            'thumbnail':
            get_icon_path("traktmylists"),
        })
        fanart = plugin.addon.getAddonInfo('fanart')
        for item in items:
            item['properties'] = {'fanart_image': get_background_path()}
    if FORCE == True:
        return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else:
        return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 3
0
def list_tmdb_items(result):
    if FORCE == True: plugin.set_view_mode(VIEW)
    genres_dict = get_base_genres()
    movies = [get_movie_metadata(item, None) for item in result['results']]
    items = [make_movie_item(movie) for movie in movies]
    if 'page' in result:
        page = int(result['page'])
        pages = int(result['total_pages'])
        args = caller_args()
        if pages > page:
            args['page'] = str(page + 1)
            items.append({
                'label':
                "{0}  >>  ({1}/{2})".format(_("Next page"), page + 1, pages),
                'icon':
                get_icon_path("item_next"),
                'path':
                plugin.url_for(caller_name(), **args),
                'properties': {
                    'fanart_image': get_background_path()
                },
            })
    if FORCE == True:
        return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else:
        return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 4
0
def root():
    """ Root directory """
    items = [{
        'label': _("Movies"),
        'path': plugin.url_for("movies"),
        'icon': get_icon_path("movies"),
    }, {
        'label': _("TV shows"),
        'path': plugin.url_for("tv"),
        'icon': get_icon_path("tv"),
    }, {
        'label': _("Music"),
        'path': plugin.url_for("music"),
        'icon': get_icon_path("music"),
    }, {
        'label': _("Live"),
        'path': plugin.url_for("live"),
        'icon': get_icon_path("live"),
    }, {
        'label': _("Lists"),
        'path': plugin.url_for("lists"),
        'icon': get_icon_path("lists"),
    }, {
        'label': _("Search"),
        'path': plugin.url_for("root_search"),
        'icon': get_icon_path("search"),
    }]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image': get_background_path()}
    if FORCE == True:
        plugin.set_view_mode(VIEW)
        return items
    else:
        return items
Exemplo n.º 5
0
def list_trakt_movie_items_with_genres(results, pages, page):
    from trakt import trakt
    genres_dict = dict([(x['slug'], x['name'])
                        for x in trakt.trakt_get_genres("movies")])
    movies = [
        get_trakt_movie_metadata(item["movie"], genres_dict)
        for item in results
    ]
    items = [make_movie_item(movie) for movie in movies]
    page = int(page)
    pages = int(pages)
    if pages > 1:
        args = caller_args()
        args['page'] = page + 1
        items.append({
            'label':
            "{0}  >>  ({1}/{2})".format(_("Next page"), page + 1, pages),
            'path':
            plugin.url_for(caller_name(), **args),
            'icon':
            get_icon_path("item_next"),
            'properties': {
                'fanart_image': get_background_path()
            }
        })
    if FORCE == True:
        return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else:
        return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 6
0
def list_trakt_movies_trending_paginated(results, pages, page):
    from trakt import trakt
    results = sorted(
        results,
        key=lambda item: item["movie"]["title"].lower().replace("the ", ""))
    genres_dict = dict([(x['slug'], x['name'])
                        for x in trakt.trakt_get_genres("movies")])
    movies = [
        get_trakt_movie_metadata(item["movie"], genres_dict)
        for item in results
    ]
    items = [make_movie_item(movie) for movie in movies]
    page = int(page)
    pages = int(pages)
    if pages > page:
        items.append({
            'label':
            "{0}  >>  ({1}/{2})".format(_("Next page"), page + 1, pages),
            'path':
            plugin.url_for("trakt_movies_trending", page=page + 1),
            'icon':
            get_icon_path("item_next"),
            'properties': {
                'fanart_image': get_background_path()
            },
        })
    if FORCE == True:
        return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else:
        return plugin.finish(items=items, sort_methods=SORT)
def get_tvshow_metadata_tmdb(show, genres_dict=None):
    info = {}
    if show is None: return info
    if 'id' in show: info['tmdb'] = str(show['id'])
    info['name'] = show['name']
    info['title'] = show['name']
    info['tvshowtitle'] = show['original_name']
    info['originaltitle'] = show['original_name']
    info['plot'] = show['overview']
    info['rating'] = str(show['vote_average'])
    info['votes'] = str(show['vote_count'])
    try:
        info['genre'] = u' / '.join([x['name'] for x in show['genres']])
    except KeyError:
        if genres_dict:
            try:
                info['genre'] = u' / '.join(
                    [genres_dict[x] for x in show['genre_ids']])
            except:
                info['genre'] = ''
    if show['poster_path']:
        info['poster'] = u'%s%s' % ('http://image.tmdb.org/t/p/original',
                                    show['poster_path'])
    else:
        info[
            'poster'] = "http://cellardoortv.com/style/themes/default/unavailable.png"
    if show['backdrop_path']:
        info['fanart'] = u'%s%s' % ('http://image.tmdb.org/t/p/original',
                                    show['backdrop_path'])
    else:
        info['fanart'] = get_background_path()
    return info
Exemplo n.º 8
0
def lists_trakt_my_lists():
    lists = trakt.trakt_get_lists()
    items = []
    for list in lists:
        name = list["name"]
        user = list["user"]["username"]
        slug = list["ids"]["slug"]
        items.append({
            'label': name,
            'path': plugin.url_for("lists_trakt_show_list", user = user, slug = slug),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_to_library", user=user, slug=slug))
                ),
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("lists_trakt_play_random", user=user, slug=slug))
                )
            ],
            'icon': get_icon_path("traktmylists"),
            'thumbnail': get_icon_path("traktmylists"),
        })
        fanart = plugin.addon.getAddonInfo('fanart')
        for item in items:
            item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 9
0
def tmdb_movies_genres():
    """ List all movie genres """
    genres = get_base_genres()
    items = sorted([{ 'label': name, 'icon': get_genre_icon(id), 'path': plugin.url_for("tmdb_movies_genre", id=id, page='1'), 'context_menu': [("{0} ({1})".format(_("Play"), _("Random").lower()), "RunPlugin({0})".format(plugin.url_for("tmdb_movies_play_random_genre", id = id)))]} for id, name in genres.items()], key=lambda k: k['label'])
    for item in items: item['properties'] = {'fanart_image' : get_background_path()}

    if FORCE == True: plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 10
0
def tmdb_movies_genres():
    """ List all movie genres """
    genres = get_base_genres()
    items = sorted([{ 'label': name, 'icon': get_genre_icon(id), 'path': plugin.url_for("tmdb_movies_genre", id=id, page='1'), 'context_menu': [("{0} ({1})".format(_("Play"), _("Random").lower()), "RunPlugin({0})".format(plugin.url_for("tmdb_movies_play_random_genre", id = id)))]} for id, name in genres.items()], key=lambda k: k['label'])
    for item in items: item['properties'] = {'fanart_image' : get_background_path()}

    if FORCE == True: plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 11
0
def root_search():
    """ Search directory """
    items = [
        {"label": "All", "path": plugin.url_for(root_search_term, page="1"), "icon": get_icon_path("search")},
        {
            "label": _("Movies") + ": " + _("Search (Trakt)"),
            "path": plugin.url_for("trakt_movies_search", page="1"),
            "icon": get_icon_path("movies"),
        },
        {
            "label": _("Movies") + ": " + _("Search (TMDb)"),
            "path": plugin.url_for("tmdb_movies_search", page="1"),
            "icon": get_icon_path("movies"),
        },
        {
            "label": _("TV shows") + ": " + _("Search (Trakt)"),
            "path": plugin.url_for("trakt_tv_search", page="1"),
            "icon": get_icon_path("tv"),
        },
        {
            "label": _("TV shows") + ": " + _("Search (TMDb)"),
            "path": plugin.url_for("tmdb_tv_search"),
            "icon": get_icon_path("tv"),
        },
        {
            "label": _("TV shows") + ": " + _("Search (TVDb)"),
            "path": plugin.url_for("tvdb_tv_search"),
            "icon": get_icon_path("tv"),
        },
        {
            "label": _("Music") + ": " + _("Search artist"),
            "path": plugin.url_for("music_search_artist"),
            "icon": get_icon_path("music"),
        },
        {
            "label": _("Music") + ": " + _("Search album"),
            "path": plugin.url_for("music_search_album"),
            "icon": get_icon_path("music"),
        },
        {
            "label": _("Music") + ": " + _("Search track"),
            "path": plugin.url_for("music_search_track"),
            "icon": get_icon_path("music"),
        },
        {"label": _("Live") + ": " + _("Search"), "path": plugin.url_for("live_search"), "icon": get_icon_path("live")},
        {
            "label": _("Lists") + ": " + _("Search"),
            "path": plugin.url_for("lists_trakt_search_for_lists"),
            "icon": get_icon_path("lists"),
        },
    ]
    fanart = plugin.addon.getAddonInfo("fanart")
    for item in items:
        item["properties"] = {"fanart_image": get_background_path()}
    return items
Exemplo n.º 12
0
def music_search():
    items = [
        {"label": _("Search artist"), "path": plugin.url_for("music_search_artist"), "icon": get_icon_path("search")},
        {"label": _("Search album"), "path": plugin.url_for("music_search_album"), "icon": get_icon_path("search")},
        {"label": _("Search track"), "path": plugin.url_for("music_search_track"), "icon": get_icon_path("search")},
    ]

    fanart = plugin.addon.getAddonInfo("fanart")
    for item in items:
        item["properties"] = {"fanart_image": get_background_path()}

    return items
Exemplo n.º 13
0
def get_episode_metadata_tvmaze(season_metadata, episode):
    info = copy.deepcopy(season_metadata)
    if episode == None or episode == "": return info
    info['episode'] = episode['number']
    info['season'] = episode['season']
    info['title'] = episode['name']
    info['aired'] = episode['airdate']
    info['premiered'] = episode['airdate']
    info['plot'] = re.sub(r'\<[^)].*?\>', '', str(episode['summary'])).replace("&amp;","&").replace("\t","")
    info['plotoutline'] = re.sub(r'\<[^)].*?\>', '', str(episode['summary'])).replace("&amp;","&").replace("\t","")
    if episode['image']: info['poster'] = episode['image']['original']
    info['fanart'] = get_background_path()
    return info
Exemplo n.º 14
0
def trakt_my_movies():
    items = [
        {
            'label': "{0} ({1})".format(_("Library"), "collection"),
            'path': plugin.url_for("trakt_movies_collection"),
            'icon': get_icon_path("traktcollection"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_collection_to_library"))
                ),
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_collection"))
                )
            ]
        },
        {
            'label': "{0} {1} ({2})".format(_("Unwatched"), _("movies"), "watchlist"),
            'path': plugin.url_for("trakt_movies_watchlist"),
            'icon': get_icon_path("traktwatchlist"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_watchlist_to_library"))
                ),
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_watchlist"))
                )
            ]
        },
        {
            'label':"{0} ({1})".format(_("Find similar"), "recommendations"),
            'path': plugin.url_for("trakt_movies_recommendations"),
            'icon': get_icon_path("traktrecommendations"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_recommendations_to_library"))
                ),
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_recommendation"))
                )
            ]
        }
    ]
    for item in items: item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.finish(items=items, view_mode=VIEW)
    else: return plugin.finish(items=items)
Exemplo n.º 15
0
def trakt_my_movies():
    items = [
        {
            'label': "{0} ({1})".format(_("Library"), "collection"),
            'path': plugin.url_for("trakt_movies_collection"),
            'icon': get_icon_path("traktcollection"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_collection_to_library"))
                ),
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_collection"))
                )
            ]
        },
        {
            'label': "{0} {1} ({2})".format(_("Unwatched"), _("movies"), "watchlist"),
            'path': plugin.url_for("trakt_movies_watchlist"),
            'icon': get_icon_path("traktwatchlist"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_watchlist_to_library"))
                ),
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_watchlist"))
                )
            ]
        },
        {
            'label':"{0} ({1})".format(_("Find similar"), "recommendations"),
            'path': plugin.url_for("trakt_movies_recommendations"),
            'icon': get_icon_path("traktrecommendations"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_recommendations_to_library"))
                ),
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_recommendation"))
                )
            ]
        }
    ]
    for item in items: item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 16
0
def root_search():
    """ Search directory """
    items = [{
        'label': "All",
        'path': plugin.url_for(root_search_term, page='1'),
        'icon': get_icon_path("search"),
    }, {
        'label': _("Movies") + ": " + _("Search (Trakt)"),
        'path': plugin.url_for("trakt_movies_search", page='1'),
        'icon': get_icon_path("movies"),
    }, {
        'label': _("Movies") + ": " + _("Search (TMDb)"),
        'path': plugin.url_for("tmdb_movies_search", page='1'),
        'icon': get_icon_path("movies"),
    }, {
        'label': _("TV shows") + ": " + _("Search (Trakt)"),
        'path': plugin.url_for("trakt_tv_search", page='1'),
        'icon': get_icon_path("tv"),
    }, {
        'label': _("TV shows") + ": " + _("Search (TMDb)"),
        'path': plugin.url_for("tmdb_tv_search"),
        'icon': get_icon_path("tv"),
    }, {
        'label': _("TV shows") + ": " + _("Search (TVDb)"),
        'path': plugin.url_for("tvdb_tv_search"),
        'icon': get_icon_path("tv"),
    }, {
        'label': _("Music") + ": " + _("Search artist"),
        'path': plugin.url_for("music_search_artist"),
        'icon': get_icon_path("music"),
    }, {
        'label': _("Music") + ": " + _("Search album"),
        'path': plugin.url_for("music_search_album"),
        'icon': get_icon_path("music"),
    }, {
        'label': _("Music") + ": " + _("Search track"),
        'path': plugin.url_for("music_search_track"),
        'icon': get_icon_path("music"),
    }, {
        'label': _("Live") + ": " + _("Search"),
        'path': plugin.url_for("live_search"),
        'icon': get_icon_path("live"),
    }, {
        'label': _("Lists") + ": " + _("Search"),
        'path': plugin.url_for("lists_trakt_search_for_lists"),
        'icon': get_icon_path("lists"),
    }]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image': get_background_path()}
    return items
Exemplo n.º 17
0
def root():
    """ Root directory """
    items = [
        {
            'label': _("Movies"),
            'path': plugin.url_for("movies"),
            'icon': get_icon_path("movies"),
            'thumbnail': get_icon_path("movies"),
        },
        {
            'label': _("TV shows"),
            'path': plugin.url_for("tv"),
            'icon': get_icon_path("tv"),
            'thumbnail': get_icon_path("tv"),
        },
        {
            'label': _("Music"),
            'path': plugin.url_for("music"),
            'icon': get_icon_path("music"),
            'thumbnail': get_icon_path("music"),
        },
        {
            'label': _("TV channels"),
            'path': plugin.url_for("live"),
            'icon': get_icon_path("live"),
            'thumbnail': get_icon_path("live"),
        },
        {
            'label': _("Playlists"),
            'path': plugin.url_for("lists"),
            'icon': get_icon_path("lists"),
            'thumbnail': get_icon_path("lists"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_lists_to_library"))
                )
            ],
        },
        {
            'label': _("Enter search string"),
            'path': plugin.url_for("root_search"),
            'icon': get_icon_path("search"),
            'thumbnail': get_icon_path("search"),
        }
    ]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 18
0
def root():
    """ Root directory """
    items = [
        {
            'label': _("Movies"),
            'path': plugin.url_for("movies"),
            'icon': get_icon_path("movies"),
            'thumbnail': get_icon_path("movies"),
        },
        {
            'label': _("TV shows"),
            'path': plugin.url_for("tv"),
            'icon': get_icon_path("tv"),
            'thumbnail': get_icon_path("tv"),
        },
        {
            'label': _("Music"),
            'path': plugin.url_for("music"),
            'icon': get_icon_path("music"),
            'thumbnail': get_icon_path("music"),
        },
        {
            'label': _("TV channels"),
            'path': plugin.url_for("live"),
            'icon': get_icon_path("live"),
            'thumbnail': get_icon_path("live"),
        },
        {
            'label': _("Playlists"),
            'path': plugin.url_for("lists"),
            'icon': get_icon_path("lists"),
            'thumbnail': get_icon_path("lists"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_lists_to_library"))
                )
            ],
        },
        {
            'label': _("Enter search string"),
            'path': plugin.url_for("root_search"),
            'icon': get_icon_path("search"),
            'thumbnail': get_icon_path("search"),
        }
    ]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 19
0
def lists_search_for_lists_term(term, page):
    lists, pages = trakt.search_for_list(term, page)
    page = int(page)
    pages = int(pages)
    items = []
    for list in lists:
        if "list" in list:
            list_info = list["list"]
        else:
            continue
        name = list_info["name"]
        user = list_info["username"]
        slug = list_info["ids"]["slug"]
        total = list_info["item_count"]

        info = {}
        info['title'] = name
        if "description" in list_info: info["plot"] = list_info["description"]
        else: info["plot"] = _("No description available")
        if user != None and total != None and total != 0:
            items.append({
                'label': "{0} - {1} ({2})".format(to_utf8(name), to_utf8(user), total),
                'path': plugin.url_for("lists_trakt_show_list", user=user, slug=slug),
                'context_menu': [
                    (
                        _("Scan item to library"),
                        "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_to_library", user=user, slug=slug))
                    ),
                   (
                        "{0} ({1})".format(_("Play"), _("Random").lower()),
                        "RunPlugin({0})".format(plugin.url_for("lists_trakt_play_random", user=user, slug=slug))
                    )
                ],
                'info': info,
                'icon': get_icon_path("traktlikedlists"),
                'thumbnail': get_icon_path("traktlikedlists"),
            })
            fanart = plugin.addon.getAddonInfo('fanart')
            for item in items:
                item['properties'] = {'fanart_image' : get_background_path()}
    if pages > page:
        items.append({
            'label': _("Next page").format() + "  >>  (%s/%s)" % (page + 1, pages),
            'path': plugin.url_for("lists_search_for_lists_term", term = term, page=page + 1),
            'icon': get_icon_path("item_next"),
            'thumbnail': get_icon_path("item_next"),
        })
    if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 20
0
def lists_search_for_lists_term(term, page):
    lists, pages = trakt.search_for_list(term, page)
    page = int(page)
    pages = int(pages)
    items = []
    for list in lists:
        if "list" in list:
            list_info = list["list"]
        else:
            continue
        name = list_info["name"]
        user = list_info["username"]
        slug = list_info["ids"]["slug"]
        total = list_info["item_count"]

        info = {}
        info['title'] = name
        if "description" in list_info: info["plot"] = list_info["description"]
        else: info["plot"] = _("No description available")
        if user != None and total != None and total != 0:
            items.append({
                'label': "{0} - {1} ({2})".format(to_utf8(name), to_utf8(user), total),
                'path': plugin.url_for("lists_trakt_show_list", user=user, slug=slug),
                'context_menu': [
                    (
                        _("Scan item to library"),
                        "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_to_library", user=user, slug=slug))
                    ),
                   (
                        "{0} ({1})".format(_("Play"), _("Random").lower()),
                        "RunPlugin({0})".format(plugin.url_for("lists_trakt_play_random", user=user, slug=slug))
                    )
                ],
                'info': info,
                'icon': get_icon_path("traktlikedlists"),
                'thumbnail': get_icon_path("traktlikedlists"),
            })
            fanart = plugin.addon.getAddonInfo('fanart')
            for item in items:
                item['properties'] = {'fanart_image' : get_background_path()}
    if pages > page:
        items.append({
            'label': _("Next page").format() + "  >>  (%s/%s)" % (page + 1, pages),
            'path': plugin.url_for("lists_search_for_lists_term", term = term, page=page + 1),
            'icon': get_icon_path("item_next"),
            'thumbnail': get_icon_path("item_next"),
        })
    if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 21
0
def lists_search_for_lists_term(term,page):
    lists, pages = trakt.search_for_list(term, page)
    page = int(page)
    pages = int(pages)
    items = []
    for list in lists:
        if "list" in list:
            list_info = list["list"]
        else:
            continue
        name = list_info["name"]
        user = list_info["username"]
        slug = list_info["ids"]["slug"]

        info = {}
        info['title'] = name
        if "description" in list_info:
            info["plot"] = list_info["description"]
        else:
            info["plot"] = _("No description available")
        if user != None:
            items.append({
                'label': "{0} {1} {2}".format(to_utf8(name), _("by"), to_utf8(user)),
                'path': plugin.url_for("lists_trakt_show_list", user=user, slug=slug),
                'context_menu': [
                    (
                        _("Add list to library"),
                        "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_to_library", user=user, slug=slug))
                    )
                ],
                'info': info,
                'icon': get_icon_path("traktlikedlists"),
            })
            fanart = plugin.addon.getAddonInfo('fanart')
            for item in items:
                item['properties'] = {'fanart_image' : get_background_path()}
    if (len(items) < plugin.get_setting(SETTING_TRAKT_PER_PAGE, int) and pages > page):
        page = page + 1
        results = lists_search_for_lists_term(term, page)
        return items + results
    if pages > page:
        items.append({
            'label': _("Next page").format() + "  >>  (%s/%s)" % (page + 1, pages),
            'path': plugin.url_for("lists_search_for_lists_term", term = term, page=page + 1),
            'icon': get_icon_path("traktlikedlists"),
        })
    if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 22
0
def list_trakt_movie_items(results, pages, page):
    from trakt import trakt
    movies = [get_trakt_movie_metadata(item["movie"], None) for item in results]
    items = [make_movie_item(movie) for movie in movies]
    page = int(page)
    pages = int(pages)
    if pages > 1:
        args = caller_args()
        args['page'] = page + 1
        items.append({
            'label': "{0}  >>  ({1}/{2})".format(_("Next page"), page + 1, pages),
            'path': plugin.url_for(caller_name(), **args),
            'icon': get_icon_path("item_next"),
            'properties' : {'fanart_image' : get_background_path()}})
    if FORCE == True: return  plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 23
0
def get_tvshow_metadata_tvmaze(show):
    info = {}
    if show is None: return info
    if show['externals']['thetvdb'] is not None: info['id'] = show['externals']['thetvdb']
    if show['externals']['imdb'] is not None: info['imdb'] = show['externals']['imdb']
    info['name'] = show['name']
    info['title'] = show['name']
    info['tvshowtitle'] = show['name']
    info['originaltitle'] = show['name']
    info['plot'] = re.sub(r'\<[^)].*?\>', '', show['summary']).replace("&amp;","&").replace("\t","")
    info['rating'] = str(show['rating']['average'])
    info['votes'] = str(show['weight'])
    info['genre'] = show['type']
    if show['image']['original']: info['poster'] = show['image']['original']
    info['fanart'] = get_background_path()
    return info
Exemplo n.º 24
0
def trakt_my_tv():
    """ TV directory """
    items = [
        {
            'label': _("Collection"),
            'path': plugin.url_for(trakt_tv_collection),
            'icon': get_icon_path("traktcollection"), # TODO
            'context_menu': [
                (
                    _("Add to library"),
                    "RunPlugin({0})".format(plugin.url_for(trakt_tv_collection_to_library))
                )
            ],
        },
        {
            'label': _("Watchlist"),
            'path': plugin.url_for(trakt_tv_watchlist),
            'icon': get_icon_path("traktwatchlist"), # TODO
            'context_menu': [
                (
                    _("Add to library"),
                    "RunPlugin({0})".format(plugin.url_for(trakt_tv_watchlist_to_library))
                )
            ],
        },
        {
            'label': _("Next episodes"),
            'path': plugin.url_for(trakt_tv_next_episodes),
            'icon': get_icon_path("traktnextepisodes"), # TODO
        },
        {
            'label': _("Calendar"),
            'path': plugin.url_for(trakt_tv_calendar),
            'icon': get_icon_path("traktcalendar"), # TODO
        },
        {
            'label': _("Recommendations"),
            'path': plugin.url_for(trakt_tv_recommendations),
            'icon': get_icon_path("traktrecommendations"),  # TODO
        }
    ]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 25
0
def lists():
    """ Lists directory """
    items = [
        {
            'label':
            "{0} {1} (Trakt)".format("\"Liked\"",
                                     _("Playlists").lower()),
            'path':
            plugin.url_for("lists_trakt_liked_lists", page=1),
            'icon':
            get_icon_path("traktlikedlists"),
            'thumbnail':
            get_icon_path("traktlikedlists"),
            'context_menu':
            [(_("Scan item to library"), "RunPlugin({0})".format(
                plugin.url_for("lists_trakt_add_liked_to_library")))]
        },
        {
            'label':
            "{0} {1} (Trakt)".format(_("Watch your"),
                                     _("Playlists").lower()),
            'path':
            plugin.url_for("lists_trakt_my_lists"),
            'icon':
            get_icon_path("traktmylists"),
            'thumbnail':
            get_icon_path("traktmylists"),
            'context_menu':
            [(_("Scan item to library"), "RunPlugin({0})".format(
                plugin.url_for("lists_trakt_add_my_lists_to_library")))]
        },
        {
            'label': "{0}: {1} (Trakt)".format(_("Search"), _("Playlist")),
            'path': plugin.url_for("lists_trakt_search_for_lists"),
            'icon': get_icon_path("search"),
            'thumbnail': get_icon_path("search"),
        },
    ]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image': get_background_path()}
    if FORCE == True:
        plugin.set_view_mode(VIEW)
        return items
    else:
        return items
Exemplo n.º 26
0
def list_trakt_movies_trending_paginated(results, pages, page):
    from trakt import trakt
    results = sorted(results,key=lambda item: item["movie"]["title"].lower().replace("the ", ""))
    genres_dict = dict([(x['slug'], x['name']) for x in trakt.trakt_get_genres("movies")])
    movies = [get_trakt_movie_metadata(item["movie"], genres_dict) for item in results]
    items = [make_movie_item(movie) for movie in movies]
    page = int(page)
    pages = int(pages)
    if pages > page:
        items.append({
            'label': "{0}  >>  ({1}/{2})".format(_("Next page"), page + 1, pages),
            'path': plugin.url_for("trakt_movies_trending", page=page + 1),
            'icon': get_icon_path("item_next"),
            'properties' : {'fanart_image' : get_background_path()},
        })
    if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 27
0
def root():
    """ Root directory """
    items = [
        {"label": _("Movies"), "path": plugin.url_for("movies"), "icon": get_icon_path("movies")},
        {"label": _("TV shows"), "path": plugin.url_for("tv"), "icon": get_icon_path("tv")},
        {"label": _("Music"), "path": plugin.url_for("music"), "icon": get_icon_path("music")},
        {"label": _("Live"), "path": plugin.url_for("live"), "icon": get_icon_path("live")},
        {"label": _("Lists"), "path": plugin.url_for("lists"), "icon": get_icon_path("lists")},
        {"label": _("Search"), "path": plugin.url_for("root_search"), "icon": get_icon_path("search")},
    ]
    fanart = plugin.addon.getAddonInfo("fanart")
    for item in items:
        item["properties"] = {"fanart_image": get_background_path()}
    if FORCE == True:
        plugin.set_view_mode(VIEW)
        return items
    else:
        return items
Exemplo n.º 28
0
def list_tmdb_items(result):
    if FORCE == True: plugin.set_view_mode(VIEW)
    genres_dict = get_base_genres()
    movies = [get_movie_metadata(item, None) for item in result['results']]
    items = [make_movie_item(movie) for movie in movies]
    if 'page' in result:
        page = int(result['page'])
        pages = int(result['total_pages'])
        args = caller_args()
        if pages > page:
            args['page'] = str(page + 1)
            items.append({
                'label': "{0}  >>  ({1}/{2})".format(_("Next page"), page + 1, pages),
                'icon': get_icon_path("item_next"),
                'path': plugin.url_for(caller_name(), **args),
                'properties' : {'fanart_image' : get_background_path()},
            })
    if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 29
0
def get_movie_metadata(movie, genres_dict=None):
    info = {}
    info['title'] = movie['title']
    info['year'] = movie['release_date'][:4]
    info['name'] = u'%s (%s)' % (info['title'], info['year'])
    info['premiered'] = movie['release_date']
    info['rating'] = movie['vote_average']
    info['votes'] = movie['vote_count']
    info['plot'] = movie['overview']
    info['originaltitle'] = movie['original_title']
    info['tmdb'] = str(movie['id'])
    if movie['poster_path'] and movie['poster_path'] != None and movie['poster_path'] != "": info['poster'] = u'%s%s' % ('http://image.tmdb.org/t/p/w500', movie['poster_path'])
    else: info['poster'] = "http://mrblamo.xyz/chappaaiunavailable.png"
    if movie['backdrop_path'] and movie['backdrop_path'] != None and movie['backdrop_path'] != "": info['fanart'] = u'%s%s' % ('http://image.tmdb.org/t/p/original', movie['backdrop_path'])
    else: info['fanart'] = get_background_path()
    try: info['genre'] = u' / '.join([x['name'] for x in movie['genres']])
    except KeyError:
        if genres_dict: 
            try: info['genre'] = u' / '.join([genres_dict[x] for x in movie['genre_ids']])
            except: info['genre'] = ''
    return info
Exemplo n.º 30
0
def get_movie_metadata(movie, genres_dict=None):
    info = {}
    info['title'] = movie['title']
    info['year'] = parse_year(movie['release_date'])
    info['name'] = u'%s (%s)' % (info['title'], info['year'])
    info['premiered'] = movie['release_date']
    info['rating'] = movie['vote_average']
    info['votes'] = movie['vote_count']
    info['plot'] = movie['overview']
    info['originaltitle'] = movie['original_title']
    info['tmdb'] = str(movie['id'])
    if movie['poster_path'] and movie['poster_path'] != None and movie['poster_path'] != "": info['poster'] = u'%s%s' % ('http://image.tmdb.org/t/p/w500', movie['poster_path'])
    else: info['poster'] = "https://raw.githubusercontent.com/OpenELEQ/Style/master/MetalliQ/default/unavailable.png"
    if movie['backdrop_path'] and movie['backdrop_path'] != None and movie['backdrop_path'] != "": info['fanart'] = u'%s%s' % ('http://image.tmdb.org/t/p/original', movie['backdrop_path'])
    else: info['fanart'] = get_background_path()
    try: info['genre'] = u' / '.join([x['name'] for x in movie['genres']])
    except KeyError:
        if genres_dict: 
            try: info['genre'] = u' / '.join([genres_dict[x] for x in movie['genre_ids']])
            except: info['genre'] = ''
    return info
Exemplo n.º 31
0
def lists():
    """ Lists directory """
    items = [
        {
            'label': "{0} {1}".format("\"Liked\"", _("Playlists").lower()),
            'path': plugin.url_for("lists_trakt_liked_lists", page = 1),
            'icon': get_icon_path("traktlikedlists"),
            'thumbnail': get_icon_path("traktlikedlists"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_liked_to_library"))
                )
            ]
        },
        {
            'label': "{0} {1}".format(_("Watch your"), _("Playlists").lower()),
            'path': plugin.url_for("lists_trakt_my_lists"),
            'icon': get_icon_path("traktmylists"),
            'thumbnail': get_icon_path("traktmylists"),
            'context_menu': [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_my_lists_to_library"))
                )
            ]
        },
        {
            'label': "{0}".format(_("Enter search string")),
            'path': plugin.url_for("lists_trakt_search_for_lists"),
            'icon': get_icon_path("search"),
            'thumbnail': get_icon_path("search"),
        },
    ]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 32
0
def get_movie_metadata(movie, genres_dict=None):
    info = {}
    info['title'] = movie['title']
    try:
        info['premiered'] = movie['release_date']
    except:
        info['premiered'] = "2020-02-02"
    info['year'] = info['premiered'][:4]
    info['name'] = u'%s (%s)' % (info['title'], info['year'])
    info['rating'] = movie['vote_average']
    info['votes'] = movie['vote_count']
    info['plot'] = movie['overview']
    info['originaltitle'] = movie['original_title']
    info['tmdb'] = str(movie['id'])
    if movie['poster_path'] and movie['poster_path'] != None and movie[
            'poster_path'] != "":
        info['poster'] = u'%s%s' % ('http://image.tmdb.org/t/p/original',
                                    movie['poster_path'])
    else:
        info[
            'poster'] = "https://github.com/metalmagic767/themes/raw/master/metalliq-forqed/default/unavailable.png"
    if movie['backdrop_path'] and movie['backdrop_path'] != None and movie[
            'backdrop_path'] != "":
        info['fanart'] = u'%s%s' % ('http://image.tmdb.org/t/p/original',
                                    movie['backdrop_path'])
    else:
        info['fanart'] = get_background_path()
    try:
        info['genre'] = u' / '.join([x['name'] for x in movie['genres']])
    except KeyError:
        if genres_dict:
            try:
                info['genre'] = u' / '.join(
                    [genres_dict[x] for x in movie['genre_ids']])
            except:
                info['genre'] = ''
    return info
Exemplo n.º 33
0
def lists():
    """ Lists directory """
    items = [
        {
            'label': _("Liked lists"),
            'path': plugin.url_for("lists_trakt_liked_lists", page = 1),
            'icon': get_icon_path("traktlikedlists"),
        },
        {
            'label': _("My lists"),
            'path': plugin.url_for("lists_trakt_my_lists"),
            'icon': get_icon_path("traktmylists"),
        },
        {
            'label': _("Search list"),
            'path': plugin.url_for("lists_trakt_search_for_lists"),
            'icon': get_icon_path("search"),
        },
    ]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 34
0
def trakt_my_movies():
    """ Trakt movies directory """
    items = [
        {
            'label': _("Collection"),
            'path': plugin.url_for(trakt_movies_collection),
            'icon': get_icon_path("traktcollection"),
            'context_menu': [
                (
                    _("Add to library"),
                    "RunPlugin({0})".format(plugin.url_for(trakt_movies_collection_to_library))
                )
            ],
        },
        {
            'label': _("Watchlist"),
            'path': plugin.url_for(trakt_movies_watchlist),
            'icon': get_icon_path("traktwatchlist"),
            'context_menu': [
                (
                    _("Add to library"),
                    "RunPlugin({0})".format(plugin.url_for(trakt_movies_watchlist_to_library))
                )
            ],
        },
        {
            'label': _("Recommendations"),
            'path': plugin.url_for(movies_trakt_recommendations),
            'icon': get_icon_path("traktrecommendations"),
        }
    ]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 35
0
def music_search():
    items = [
        {
            'label': _("Search artist"),
            'path': plugin.url_for("music_search_artist"),
            'icon': get_icon_path("search"),
        },
        {
            'label': _("Search album"),
            'path': plugin.url_for("music_search_album"),
            'icon': get_icon_path("search"),
        },
        {
            'label': _("Search track"),
            'path': plugin.url_for("music_search_track"),
            'icon': get_icon_path("search"),
        }
    ]

    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
        
    return items
def get_season_metadata_tvmaze(show_metadata, season):
    info = copy.deepcopy(show_metadata)
    del info['name']
    info['season'] = season['number']
    info['fanart'] = get_background_path()
    return info
Exemplo n.º 37
0
def get_episode_parameters(show, season, episode):
    articles = ['a ', 'A ', 'An ', 'an ', 'The ', 'the ']
    import_tmdb()
    if season in show and episode in show[season]:
        season_obj = show[season]
        episode_obj = show[season][episode]
    else:
        return
    # Get parameters
    parameters = {'id': show['id'], 'season': season, 'episode': episode}
    show_info = get_tvshow_metadata_tvdb(show, banners=True)
    network = show.get('network', '')
    parameters['network'] = network
    if network:
        parameters['network_clean'] = re.sub("(\(.*?\))", "", network).strip()
    else:
        parameters['network_clean'] = network
    parameters['showname'] = show['seriesname']
    parameters['clearname'] = re.sub("(\(.*?\))", "", show['seriesname']).strip()
    parameters['sortname'] = to_utf8(parameters['clearname'])
    for article in articles:
        if to_utf8(parameters['clearname']).startswith(article): parameters['sortname'] = to_utf8(parameters['clearname']).replace(article,'')
    parameters['urlname'] = urllib.quote(to_utf8(parameters['clearname']))
    articles = ['a ', 'A ', 'An ', 'an ', 'The ', 'the ']
    parameters['sortname'] = to_utf8(parameters['clearname'])
    for article in articles:
        if to_utf8(parameters['clearname']).startswith(article): parameters['sortname'] = to_utf8(parameters['clearname']).replace(article,'')
    parameters['shortname'] = to_utf8(parameters['clearname'][1:-1])
    try:
        parameters['absolute_number'] = int(episode_obj.get('absolute_number'))
    except:
        parameters['absolute_number'] = "na"
    parameters['title'] = episode_obj.get('episodename', str(episode))
    parameters['urltitle'] = urllib.quote(to_utf8(parameters['title']))
    parameters['sorttitle'] = to_utf8(parameters['title'])
    for article in articles:
        if to_utf8(parameters['title']).startswith(article): parameters['sorttitle'] = to_utf8(parameters['title']).replace(article,'')
    parameters['shorttitle'] = to_utf8(parameters['title'][1:-1])
    parameters['firstaired'] = episode_obj.get('firstaired')
    parameters['year'] = show.get('year', 0)
    trakt_ids = get_trakt_ids("tvdb", show['id'], parameters['clearname'], "show", parameters['year'])
#    if trakt_ids["slug"]:
#        if trakt_ids["slug"] != None and trakt_ids["slug"] != "": parameters['slug'] = trakt_ids["slug"]
#        else: parameters['slug'] = parameters['clearname'].lower().replace(" ","-")
    if parameters['firstaired']:
        parameters['epyear'] = int(parameters['firstaired'].split("-")[0].strip())
        parameters['epmonth'] = int(parameters['firstaired'].split("-")[1].strip())
        parameters['epday'] = int(parameters['firstaired'].split("-")[2].strip())
    else:
        parameters["epyear"] = 1980
        parameters["epmonth"] = 0
        parameters["epday"] = 0
    parameters['imdb'] = show.get('imdb_id', '')
    parameters['epid'] = episode_obj.get('id')
    if episode_obj.get('id') != "": parameters['plot'] = episode_obj.get('overview')
    else: parameters['plot'] = show['overview']
    if episode_obj.get('Rating') != "": parameters['rating'] = episode_obj.get('Rating')
    else: parameters['rating'] = show['Rating']
    if episode_obj.get('RatingCount') != "": parameters['votes'] = episode_obj.get('RatingCount')
    else: parameters['votes'] = show['RatingCount']
    parameters['writer'] = episode_obj.get('Writer')
    parameters['director'] = episode_obj.get('Director')
    parameters['status'] = show.get('Status')
    parameters['mpaa'] = show.get('ContentRating')
    parameters['actors'] = show.get('Actors')
    if show.get('Genre') != None and '|' in show.get('Genre'): parameters['genres'] = show.get('Genre').replace('|',' / ')[3:-3]
    else: parameters['genres'] = show.get('Genre')
    parameters['runtime'] = show['runtime']
    parameters['duration'] = int(show['runtime']) * 60
    tvdb_base = "http://thetvdb.com/banners/"
    if episode_obj.get('filename') != "": parameters['thumbnail'] = tvdb_base + str(episode_obj.get('filename'))
    elif show.get('poster') != "": parameters['thumbnail'] = tvdb_base + show.get('poster')
    else: parameters['thumbnail'] = get_icon("metalliq")
    if show.get('poster') != "": parameters['poster'] = tvdb_base + show.get('poster')
    else: parameters['poster'] = get_icon("metalliq")
    parameters['thumbnail'] = "http://thetvdb.com/banners/episodes/" + str(show['id']) + "/" + str(parameters['epid']) + ".jpg"
    if show.get('banner') != "": parameters['banner'] = tvdb_base + show.get('banner')
    else: parameters['banner'] = get_banner_path()
    if show.get('fanart') != None and show.get('fanart') != "": parameters['fanart'] = tvdb_base + show.get('fanart')
    else: parameters['fanart'] = get_background_path()
    is_anime = False
    if parameters['genres'] != None and parameters['absolute_number'] and parameters['absolute_number'] != '0' and "animation" in parameters['genres'].lower():
        tmdb_results = tmdb.Find(show['id']).info(external_source="tvdb_id")
        for tmdb_show in tmdb_results.get("tv_results", []):
            if "JP" in tmdb_show['origin_country']:
                is_anime = True
    if is_anime:
        parameters['name'] = u'{showname} {absolute_number}'.format(**parameters)
    else:
        parameters['name'] = u'{showname} S{season:02d}E{episode:02d}'.format(**parameters)
    parameters['now'] = datetime.datetime.now().strftime('%Y%m%d%H%M%S%f')
    return parameters
Exemplo n.º 38
0
def root_search_term(term, page):
    if term == "None":
        # Get search keyword
        search_entered = plugin.keyboard(heading=_("search for"))
        if not search_entered:
            return
    else:
        search_entered = term
    items = [
        {
            "label": "All" + ": " + search_entered,
            "path": plugin.url_for(root_search_term, term=search_entered, page="1"),
            "icon": get_icon_path("search"),
        },
        {
            "label": _("Movies") + " - " + _("Search (Trakt)") + ": " + search_entered,
            "path": plugin.url_for("trakt_movies_search_term", term=search_entered, page="1"),
            "icon": get_icon_path("movies"),
        },
        {
            "label": _("Movies") + " - " + _("Search (TMDb)") + ": " + search_entered,
            "path": plugin.url_for("tmdb_movies_search_term", term=search_entered, page="1"),
            "icon": get_icon_path("movies"),
        },
        {
            "label": _("TV shows") + " - " + _("Search (Trakt)") + ": " + search_entered,
            "path": plugin.url_for("trakt_tv_search_term", term=search_entered, page="1"),
            "icon": get_icon_path("tv"),
        },
        {
            "label": _("TV shows") + " - " + _("Search (TMDb)") + ": " + search_entered,
            "path": plugin.url_for("tmdb_tv_search_term", term=search_entered, page="1"),
            "icon": get_icon_path("tv"),
        },
        {
            "label": _("TV shows") + " - " + _("Search (TVDb)") + ": " + search_entered,
            "path": plugin.url_for("tvdb_tv_search_term", term=search_entered, page="1"),
            "icon": get_icon_path("tv"),
        },
        {
            "label": _("Music") + " - " + _("Search artist") + ": " + search_entered,
            "path": plugin.url_for("music_search_artist_term", term=search_entered, page="1"),
            "icon": get_icon_path("music"),
        },
        {
            "label": _("Music") + " - " + _("Search album") + ": " + search_entered,
            "path": plugin.url_for("music_search_album_term", term=search_entered, page="1"),
            "icon": get_icon_path("music"),
        },
        {
            "label": _("Music") + " - " + _("Search track") + ": " + search_entered,
            "path": plugin.url_for("music_search_track_term", term=search_entered, page="1"),
            "icon": get_icon_path("music"),
        },
        {
            "label": _("Live") + " - " + _("Search") + ": " + search_entered,
            "path": plugin.url_for("live_search_term", term=search_entered),
            "icon": get_icon_path("live"),
        },
        {
            "label": _("Lists") + " - " + _("Search") + ": " + search_entered,
            "path": plugin.url_for("lists_search_for_lists_term", term=search_entered, page="1"),
            "icon": get_icon_path("lists"),
        },
    ]
    fanart = plugin.addon.getAddonInfo("fanart")
    for item in items:
        item["properties"] = {"fanart_image": get_background_path()}
    return items
Exemplo n.º 39
0
def _lists_trakt_show_list(list_items):
    genres_dict = trakt.trakt_get_genres("tv")
    if type(list_items) == str:
        import urllib
        list_items = eval(urllib.unquote(list_items))
    items = []
    for list_item in list_items:
        item = None
        item_type = list_item["type"]
        if item_type == "show":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            if tvdb_id != "" and tvdb_id != None:
                show = list_item["show"]
                info = get_tvshow_metadata_trakt(show, genres_dict)
                context_menu = [
                    (
                        _("Scan item to library"),
                        "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id))
                    ),
                    (
                        _("TV show information"), 'Action(Info)'
                    ),
                    (
                        "{0}".format(_("Remove from library").replace(_("Library").lower(),_("Playlist").lower())),
                        "RunPlugin({0})".format(plugin.url_for("lists_remove_show_from_list", src="tvdb", id=tvdb_id))
                    )
                ]
                if plugin.get_setting(SETTING_TRAKT_LIST_ARTWORK, bool) == False:
                    item = ({
                        'label': info['title'],
                        'path': plugin.url_for("tv_tvshow", id=tvdb_id),
                        'context_menu': context_menu,
                        'thumbnail': info['poster'],
                        'icon': get_icon_path("tv"),
                        'poster': info['poster'],
                        'properties' : {'fanart_image' : info['fanart']},
                        'info_type': 'video',
                        'stream_info': {'video': {}},
                        'info': info
                    })
                else: item = make_tvshow_item(info)
            else: item = None
        elif item_type == "season":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            season = list_item["season"]
            show = list_item["show"]
            show_info = get_tvshow_metadata_trakt(show, genres_dict)
            season_info = get_season_metadata_trakt(show_info,season, genres_dict)
            label = "{0} - Season {1}".format(show["title"],season["number"])
            context_menu = [
                (
                    _("Scan item to library"),
                    "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id))
                ),
                (
                    "%s %s" % (_("Season"), _("Information").lower()), 'Action(Info)'
                ),
                (
                    "{0}".format(_("Remove from library").replace(_("Library").lower(),_("Playlist").lower())),
                    "RunPlugin({0})".format(plugin.url_for("lists_remove_season_from_list", src="tvdb",
                                                           id=tvdb_id, season=list_item["season"]["number"]))
                )
            ]
            item = ({
                'label': label,
                'path': plugin.url_for("tv_season", id=tvdb_id, season_num=list_item["season"]["number"]),
                'context_menu': context_menu,
                'info': season_info,
                'thumbnail': season_info['poster'],
                'icon': get_icon_path("tv"),
                'poster': season_info['poster'],
                'properties': {'fanart_image': season_info['fanart']},
            })
        elif item_type == "episode":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            episode = list_item["episode"]
            show = list_item["show"]
            season_number = episode["season"]
            episode_number = episode["number"]
            show_info = get_tvshow_metadata_trakt(show, genres_dict)
            episode_info = get_episode_metadata_trakt(show_info, episode)
            label = "{0} - S{1}E{2} - {3}".format(show_info["title"], season_number,
                                                  episode_number, episode_info["title"])
            context_menu = [
                (
                    "{0} {1}...".format(_("Select"), _("Stream").lower()),
                    "PlayMedia({0})".format(
                        plugin.url_for("tv_play", id=tvdb_id, season=season_number,
                                       episode=episode_number, mode='select'))
                ),
                (
                    "%s %s" % (_("Episode"), _("Information").lower()),
                    'Action(Info)'
                ),
                (
                    _("Add to playlist"),
                    "RunPlugin({0})".format(plugin.url_for("lists_add_episode_to_list", src='tvdb', id=tvdb_id,
                                                           season=season_number, episode=episode_number))
                ),
                (
                    "{0}".format(_("Remove from library").replace(_("Library").lower(),_("Playlist").lower())),
                    "RunPlugin({0})".format(plugin.url_for("lists_remove_season_from_list", src="tvdb", id=tvdb_id,
                                                           season=season_number, episode = episode_number))
                )
            ]
            item = ({
                'label': label,
                'path': plugin.url_for("tv_play", id=tvdb_id, season=season_number,
                                       episode=episode_number, mode='default'),
                'context_menu': context_menu,
                'info': episode_info,
                'is_playable': True,
                'info_type': 'video',
                'stream_info': {'video': {}},
                'thumbnail': episode_info['poster'],
                'poster': episode_info['poster'],
                'icon': get_icon_path("tv"),
                'properties': {'fanart_image': episode_info['fanart']},
                })
        elif item_type == "movie":
            movie = list_item["movie"]
            movie_info = get_trakt_movie_metadata(movie)
            try: tmdb_id = movie_info['tmdb']
            except: tmdb_id = ""
            try: imdb_id = movie_info['imdb']
            except: imdb_id = ""
            if tmdb_id != None and tmdb_id != "":
                src = "tmdb"
                id = tmdb_id
            elif imdb_id != None and mdb_id != "":
                src = "imdb"
                id = imdb_id
            else:
                src = ""
                id = ""
            if src == "": item = None
            else:
                if xbmc.getCondVisibility("system.hasaddon(script.qlickplay)"):
                    context_menu = [( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id))), 
                                    ("%s %s" % (_("Movie"), _("Trailer").lower()), "RunScript(script.qlickplay,info=playtrailer,id={0})".format(id)), 
                                    ("[COLOR ff0084ff]Q[/COLOR]lick[COLOR ff0084ff]P[/COLOR]lay", "RunScript(script.qlickplay,info=movieinfo,id={0})".format(id)), 
                                    ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"), "ActivateWindow(10025,plugin://script.qlickplay/?info=similarmovies&id={0})".format(id))]
                elif xbmc.getCondVisibility("system.hasaddon(script.extendedinfo)"):
                    context_menu = [( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id))),
                                    ("%s %s" % (_("Movie"), _("Trailer").lower()), "RunScript(script.extendedinfo,info=playtrailer,id={0})".format(id)), (
                                    (_("Extended movie info"),_("Extended movie info"), "RunScript(script.extendedinfo,info=extendedinfo,id={0})".format(id)), 
                                    ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"), "ActivateWindow(10025,plugin://script.extendedinfo/?info=similarmovies&id={0})".format(id)))]
                else:
                    context_menu = [( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id)))]
                    context_menu.append(("%s %s (%s)" % ("Related", _("movies"), "Trakt"), "ActivateWindow(10025,{0})".format(plugin.url_for("movies_related", id=id, page=1))))
                    context_menu.append(("{0} {1}...".format(_("Select"), _("Stream").lower()), "PlayMedia({0})".format(plugin.url_for("movies_play", src=src, id=id, mode='select'))))
                    context_menu.append((_("Add to playlist"), "RunPlugin({0})".format(plugin.url_for("lists_add_movie_to_list", src=src, id=id))))
                    context_menu.append((_("Movie information"), 'Action(Info)'))
                if imdb_id != None and imdb_id != "":
                    context_menu.append(("Show Actors", "ActivateWindow(10025,{0})".format(plugin.url_for("people_list_movie_people", id=imdb_id, source="imdb", fanart=get_background_path()))))
                elif tmdb_id != None and tmdb_id != "":
                    context_menu.append(("Show Actors", "ActivateWindow(10025,{0})".format(plugin.url_for("people_list_movie_people", id=tmdb_id, source="tmdb", fanart=get_background_path()))))
            item = make_movie_item(movie_info, True)
        elif item_type == "person":
            person_id = list_item['person']['ids']['trakt']
            person_tmdb_id = list_item['person']['ids']['tmdb']
            context_menu= []
            try:
                import_tmdb()
                person_images = tmdb.People(person_tmdb_id).images()['profiles']
                person_image = 'https://image.tmdb.org/t/p/w640' + person_images[0]['file_path']
            except: person_image = ''
            person_name = to_utf8(list_item['person']['name'])
            item = ({
                'label': person_name,
                'path': plugin.url_for("trakt_movies_person", person_id=person_id),
                'context_menu': context_menu,
                #'info': season_info,
                'thumbnail': person_image,
                'icon': get_icon_path("movies"),
                'poster': person_image,
                'properties': {'fanart_image': person_image},
            })
        if item is not None:
            items.append(item)
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    return items
Exemplo n.º 40
0
def music():
    items = [
        {"label": _("Search"), "path": plugin.url_for("music_search"), "icon": get_icon_path("search")},
        {"label": _("Top Artists"), "path": plugin.url_for("music_top_artists"), "icon": get_icon_path("top_rated")},
        {"label": _("Top Tracks"), "path": plugin.url_for("music_top_tracks"), "icon": get_icon_path("trending")},
        {
            "label": _("Top Artists (NL)"),
            "path": plugin.url_for("music_top_artists_by_country", country="netherlands"),
            "icon": get_icon_path("top_nl"),
        },
        {
            "label": _("Top Artists (UK)"),
            "path": plugin.url_for("music_top_artists_by_country", country="united kingdom"),
            "icon": get_icon_path("top_uk"),
        },
        {
            "label": _("Top Artists (US)"),
            "path": plugin.url_for("music_top_artists_by_country", country="united states"),
            "icon": get_icon_path("top_us"),
        },
        {
            "label": _("Top Artists (CA)"),
            "path": plugin.url_for("music_top_artists_by_country", country="canada"),
            "icon": get_icon_path("top_ca"),
        },
        {
            "label": _("Top Artists (AU)"),
            "path": plugin.url_for("music_top_artists_by_country", country="australia"),
            "icon": get_icon_path("top_au"),
        },
        {
            "label": _("Top Tracks (NL)"),
            "path": plugin.url_for("music_top_tracks_by_country", country="netherlands"),
            "icon": get_icon_path("trending_nl"),
        },
        {
            "label": _("Top Tracks (UK)"),
            "path": plugin.url_for("music_top_tracks_by_country", country="united kingdom"),
            "icon": get_icon_path("trending_uk"),
        },
        {
            "label": _("Top Tracks (US)"),
            "path": plugin.url_for("music_top_tracks_by_country", country="united states"),
            "icon": get_icon_path("trending_us"),
        },
        {
            "label": _("Top Tracks (CA)"),
            "path": plugin.url_for("music_top_tracks_by_country", country="canada"),
            "icon": get_icon_path("trending_ca"),
        },
        {
            "label": _("Top Tracks (AU)"),
            "path": plugin.url_for("music_top_tracks_by_country", country="australia"),
            "icon": get_icon_path("trending_au"),
        },
    ]

    fanart = plugin.addon.getAddonInfo("fanart")
    for item in items:
        item["properties"] = {"fanart_image": get_background_path()}

    return items
Exemplo n.º 41
0
def get_episode_parameters(show, season, episode):
    articles = ['a ', 'A ', 'An ', 'an ', 'The ', 'the ']
    import_tmdb()
    if season in show and episode in show[season]:
        season_obj = show[season]
        episode_obj = show[season][episode]
    else:
        return
    # Get parameters
    parameters = {'id': show['id'], 'season': season, 'episode': episode}
    show_info = get_tvshow_metadata_tvdb(show, banners=True)
    network = show.get('network', '')
    parameters['network'] = network
    if network:
        parameters['network_clean'] = re.sub("(\(.*?\))", "", network).strip()
    else:
        parameters['network_clean'] = network
    parameters['showname'] = show['seriesname']
    parameters['clearname'] = re.sub("(\(.*?\))", "", show['seriesname']).strip()
    parameters['sortname'] = to_utf8(parameters['clearname'])
    for article in articles:
        if to_utf8(parameters['clearname']).startswith(article): parameters['sortname'] = to_utf8(parameters['clearname']).replace(article,'')
    parameters['urlname'] = urllib.quote(to_utf8(parameters['clearname']))
    articles = ['a ', 'A ', 'An ', 'an ', 'The ', 'the ']
    parameters['sortname'] = to_utf8(parameters['clearname'])
    for article in articles:
        if to_utf8(parameters['clearname']).startswith(article): parameters['sortname'] = to_utf8(parameters['clearname']).replace(article,'')
    parameters['shortname'] = to_utf8(parameters['clearname'][1:-1])
    try:
        parameters['absolute_number'] = int(episode_obj.get('absolute_number'))
    except:
        parameters['absolute_number'] = "na"
    parameters['title'] = episode_obj.get('episodename', str(episode))
    parameters['urltitle'] = urllib.quote(to_utf8(parameters['title']))
    parameters['sorttitle'] = to_utf8(parameters['title'])
    for article in articles:
        if to_utf8(parameters['title']).startswith(article): parameters['sorttitle'] = to_utf8(parameters['title']).replace(article,'')
    parameters['shorttitle'] = to_utf8(parameters['title'][1:-1])
    parameters['firstaired'] = episode_obj.get('firstaired')
    parameters['year'] = show.get('year', 0)
    trakt_ids = get_trakt_ids("tvdb", show['id'], parameters['clearname'], "show", parameters['year'])
#    if trakt_ids["slug"]:
#        if trakt_ids["slug"] != None and trakt_ids["slug"] != "": parameters['slug'] = trakt_ids["slug"]
#        else: parameters['slug'] = parameters['clearname'].lower().replace(" ","-")
    if parameters['firstaired']:
        parameters['epyear'] = int(parameters['firstaired'].split("-")[0].strip())
        parameters['epmonth'] = int(parameters['firstaired'].split("-")[1].strip())
        parameters['epday'] = int(parameters['firstaired'].split("-")[2].strip())
    else:
        parameters["epyear"] = 1980
        parameters["epmonth"] = 0
        parameters["epday"] = 0
    parameters['imdb'] = show.get('imdb_id', '')
    parameters['epid'] = episode_obj.get('id')
    if episode_obj.get('id') != "": parameters['plot'] = episode_obj.get('overview')
    else: parameters['plot'] = show['overview']
    if episode_obj.get('Rating') != "": parameters['rating'] = episode_obj.get('Rating')
    else: parameters['rating'] = show['Rating']
    if episode_obj.get('RatingCount') != "": parameters['votes'] = episode_obj.get('RatingCount')
    else: parameters['votes'] = show['RatingCount']
    parameters['writer'] = episode_obj.get('Writer')
    parameters['director'] = episode_obj.get('Director')
    parameters['status'] = show.get('Status')
    parameters['mpaa'] = show.get('ContentRating')
    parameters['actors'] = show.get('Actors')
    if show.get('Genre') != None and '|' in show.get('Genre'): parameters['genres'] = show.get('Genre').replace('|',' / ')[3:-3]
    else: parameters['genres'] = show.get('Genre')
    parameters['runtime'] = show['runtime']
    parameters['duration'] = int(show['runtime']) * 60
    tvdb_base = "http://thetvdb.com/banners/"
    if episode_obj.get('filename') != "": parameters['thumbnail'] = tvdb_base + str(episode_obj.get('filename'))
    elif show.get('poster') != "": parameters['thumbnail'] = tvdb_base + show.get('poster')
    else: parameters['thumbnail'] = get_icon("metalliq")
    if show.get('poster') != "": parameters['poster'] = tvdb_base + show.get('poster')
    else: parameters['poster'] = get_icon("metalliq")
    parameters['thumbnail'] = "http://thetvdb.com/banners/episodes/" + str(show['id']) + "/" + str(parameters['epid']) + ".jpg"
    if show.get('banner') != "": parameters['banner'] = tvdb_base + show.get('banner')
    else: parameters['banner'] = get_banner_path()
    if show.get('fanart') != None and show.get('fanart') != "": parameters['fanart'] = tvdb_base + show.get('fanart')
    else: parameters['fanart'] = get_background_path()
    is_anime = False
    if parameters['genres'] != None and parameters['absolute_number'] and parameters['absolute_number'] != '0' and "animation" in parameters['genres'].lower():
        tmdb_results = tmdb.Find(show['id']).info(external_source="tvdb_id")
        for tmdb_show in tmdb_results.get("tv_results", []):
            if "JP" in tmdb_show['origin_country']:
                is_anime = True
    if is_anime:
        parameters['name'] = u'{showname} {absolute_number}'.format(**parameters)
    else:
        parameters['name'] = u'{showname} S{season:02d}E{episode:02d}'.format(**parameters)
    parameters['now'] = datetime.datetime.now().strftime('%Y%m%d%H%M%S%f')
    return parameters
Exemplo n.º 42
0
def music():
    items = [
        {
            'label': _("Search"),
            'path': plugin.url_for("music_search"),
            'icon': get_icon_path("search"),
        },
        {
            'label': _("Top Artists"),
            'path': plugin.url_for("music_top_artists"),
            'icon': get_icon_path("top_rated"),
        },
        {
            'label': _("Top Tracks"),
            'path': plugin.url_for("music_top_tracks"),
            'icon': get_icon_path("trending"),
        },
        {
            'label': _("Top Artists (NL)"),
            'path': plugin.url_for("music_top_artists_by_country", country='netherlands'),
            'icon': get_icon_path("top_nl"),
        },
        {
            'label': _("Top Artists (UK)"),
            'path': plugin.url_for("music_top_artists_by_country", country='united kingdom'),
            'icon': get_icon_path("top_uk"),
        },
        {
            'label': _("Top Artists (US)"),
            'path': plugin.url_for("music_top_artists_by_country", country='united states'),
            'icon': get_icon_path("top_us"),
        },
        {
            'label': _("Top Artists (CA)"),
            'path': plugin.url_for("music_top_artists_by_country", country='canada'),
            'icon': get_icon_path("top_ca"),
        },
        {
            'label': _("Top Artists (AU)"),
            'path': plugin.url_for("music_top_artists_by_country", country='australia'),
            'icon': get_icon_path("top_au"),
        },
        {
            'label': _("Top Tracks (NL)"),
            'path': plugin.url_for("music_top_tracks_by_country", country='netherlands'),
            'icon': get_icon_path("trending_nl"),
        },
        {
            'label': _("Top Tracks (UK)"),
            'path': plugin.url_for("music_top_tracks_by_country", country='united kingdom'),
            'icon': get_icon_path("trending_uk"),
        },
        {
            'label': _("Top Tracks (US)"),
            'path': plugin.url_for("music_top_tracks_by_country", country='united states'),
            'icon': get_icon_path("trending_us"),
        },
        {
            'label': _("Top Tracks (CA)"),
            'path': plugin.url_for("music_top_tracks_by_country", country='canada'),
            'icon': get_icon_path("trending_ca"),
        },
        {
            'label': _("Top Tracks (AU)"),
            'path': plugin.url_for("music_top_tracks_by_country", country='australia'),
            'icon': get_icon_path("trending_au"),
        }
    ]

    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
        
    return items
Exemplo n.º 43
0
def movies():
    items = [{
            'label': _("Enter search string"),
            'path': plugin.url_for("movies_search"),
            'icon': get_icon_path("search"),},
        {
            'label': "{0} ({1})".format("Blockbusters", "TMDb"),
            'path': plugin.url_for("tmdb_movies_blockbusters", page='1'),
            'icon': get_icon_path("most_voted"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("tmdb_movies_play_random_blockbuster"))
                ),
            ],
        },
        {
            'label': "{0} ({1})".format(_("Genres"), "TMDb"),
            'path': plugin.url_for("tmdb_movies_genres"),
            'icon': get_icon_path("genres"),
        },
        {
            'label': "{0} ({1})".format("In theatres", "TMDb"),
            'path': plugin.url_for("tmdb_movies_now_playing", page='1'),
            'icon': get_icon_path("intheatres"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("tmdb_movies_play_random_now_playing"))
                ),
            ],
        },
        {
            'label': "{0} ({1})".format("Popular", "TMDb"),
            'path': plugin.url_for("tmdb_movies_popular", page='1'),
            'icon': get_icon_path("popular"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("tmdb_movies_play_random_popular"))
                ),
            ],
        },
        {
            'label': "{0} ({1})".format("Top rated", "TMDb"),
            'path': plugin.url_for("tmdb_movies_top_rated", page='1'),
            'icon': get_icon_path("top_rated"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("tmdb_movies_play_random_top_rated"))
                ),
            ],
        },
        {
            'label': "{0} ({1})".format("Most played", "Trakt"),
            'path': plugin.url_for("trakt_movies_played", page='1'),
            'icon': get_icon_path("player"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_played"))
                ),
            ],
        },
        {
            'label': "{0} ({1})".format("Most watched", "Trakt"),
            'path': plugin.url_for("trakt_movies_watched", page='1'),
            'icon': get_icon_path("traktwatchlist"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_watched"))
                ),
            ],
        },
        {
            'label': "{0} ({1})".format("Most collected", "Trakt"),
            'path': plugin.url_for("trakt_movies_collected", page='1'),
            'icon': get_icon_path("traktcollection"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_collected"))
                ),
            ],
        },
        {
            'label': "{0} ({1})".format("Popular", "Trakt"),
            'path': plugin.url_for("trakt_movies_popular", page='1'),
            'icon': get_icon_path("traktrecommendations"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_popular"))
                ),
            ],
        },
        {
            'label': "{0} ({1})".format("Trending", "Trakt"),
            'path': plugin.url_for("trakt_movies_trending", page='1'),
            'icon': get_icon_path("trending"),
            'context_menu': [
                (
                    "{0} ({1})".format(_("Play"), _("Random").lower()),
                    "RunPlugin({0})".format(plugin.url_for("trakt_movies_play_random_trending"))
                ),
            ],
        },
        {
            'label': "{0} {1}".format(_("Use your"), "Trakt"),
            'path': plugin.url_for("trakt_my_movies"),
            'icon': get_icon_path("trakt"),
        }
    ]
    for item in items: item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)
Exemplo n.º 44
0
def make_movie_item(movie_info, is_list = False):
    try: tmdb_id = movie_info.get('tmdb')
    except: tmdb_id = ""
    if tmdb_id == "": 
        try: tmdb_id = info['tmdb']
        except: tmdb_id = False
    try: imdb_id = movie_info.get('imdb')
    except: imdb_id = ""
    if imdb_id == "": 
        try: imdb_id = info['imdb']
        except: imdb_id = False
    if movie_info['poster'] == None or movie_info['poster'] == "": movie_info['poster'] = "https://raw.githubusercontent.com/OpenELEQ/Style/master/MetalliQ/default/unavailable.png"
    if movie_info['fanart'] == None or movie_info['fanart'] == "": movie_info['fanart'] = get_background_path()
    if tmdb_id:
        id = tmdb_id 
        src = 'tmdb'
    elif imdb_id:
        id = imdb_id 
        src = 'imdb'
    else: dialogs.notify(msg="tmdb or imdb id", title=_("%s not found").replace("%s ",""), delay=3000, image=get_icon_path("movies"))
    if xbmc.getCondVisibility("system.hasaddon(script.qlickplay)"): context_menu = [(_("Scan item to library"),"RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id))), ("%s %s" % (_("Movie"), _("Trailer").lower()),"RunScript(script.qlickplay,info=playtrailer,id={0})".format(id)), ("[COLOR ff0084ff]Q[/COLOR]lick[COLOR ff0084ff]P[/COLOR]lay", "RunScript(script.qlickplay,info=movieinfo,id={0})".format(id)), ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"),"ActivateWindow(10025,plugin://script.qlickplay/?info=similarmovies&id={0})".format(id))]
    elif xbmc.getCondVisibility("system.hasaddon(script.extendedinfo)"): context_menu = [(_("Scan item to library"),"RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id))), ("%s %s" % (_("Movie"), _("Trailer").lower()),"RunScript(script.extendedinfo,info=playtrailer,id={0})".format(id)), (_("Extended movie info"), "RunScript(script.extendedinfo,info=extendedinfo,id={0})".format(id)), ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"),"ActivateWindow(10025,plugin://script.extendedinfo/?info=similarmovies&id={0})".format(id))]
    else: context_menu = [(_("Scan item to library"),"RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id)))]
    context_menu.append(("%s %s (%s)" % ("Related", _("movies"), "Trakt"),"ActivateWindow(10025,{0})".format(plugin.url_for("movies_related", id=id, page=1))))
    context_menu.append(("{0} {1}...".format(_("Select"), _("Stream").lower()),"PlayMedia({0})".format(plugin.url_for("movies_play", src=src, id=id, mode='select'))))
    context_menu.append((_("Add to playlist"),"RunPlugin({0})".format(plugin.url_for("lists_add_movie_to_list", src=src, id=id))))
    context_menu.append((_("Movie information"),'Action(Info)'))
    if is_list:
        context_menu.append(
            (
                "{0}".format(_("Remove from library").replace(_("Library").lower(),_("Playlist").lower())),
                "RunPlugin({0})".format(plugin.url_for("lists_remove_movie_from_list", src=src, id=id))
            )
        )
    return {
        'label': movie_info['title'],
        'path': plugin.url_for("movies_play", src=src, id=id, mode='default'),
        'context_menu': context_menu,
        'thumbnail': movie_info['poster'],
        'icon': movie_info['poster'],
        'banner': movie_info['fanart'],
        'poster': movie_info['poster'],
        'properties' : {'fanart_image' : movie_info['fanart']},
        'is_playable': True,
        'info_type': 'video',
        'stream_info': {'video': {}},
        'info': movie_info
    }
Exemplo n.º 45
0
def movies():
    """ Movies directory """
    items = [
        {
            'label': _("Search (Trakt)"),
            'path': plugin.url_for(trakt_movies_search, page='1'),
            'icon': get_icon_path("search"),
        },
        {
            'label': _("Personal (Trakt)"),
            'path': plugin.url_for(trakt_my_movies),
            'icon': get_icon_path("trakt"),
        },
        {
            'label': _("Most played (Trakt)"),
            'path': plugin.url_for(trakt_movies_played, page='1'),
            'icon': get_icon_path("player"),
        },
        {
            'label': _("Most watched (Trakt)"),
            'path': plugin.url_for(trakt_movies_watched, page='1'),
            'icon': get_icon_path("traktwatchlist"),
        },
        {
            'label': _("Most collected (Trakt)"),
            'path': plugin.url_for(trakt_movies_collected, page='1'),
            'icon': get_icon_path("traktcollection"),
        },
        {
            'label': _("Popular (Trakt)"),
            'path': plugin.url_for(trakt_movies_popular, page='1'),
            'icon': get_icon_path("traktrecommendations"),
        },
        {
            'label': _("Trending (Trakt)"),
            'path': plugin.url_for(trakt_movies_trending, page='1'),
            'icon': get_icon_path("trending"),
        },
        {
            'label': _("Search (TMDb)"),
            'path': plugin.url_for(tmdb_movies_search),
            'icon': get_icon_path("search"),
        },
        {
            'label': _("Blockbusters (TMDb)"),
            'path': plugin.url_for(tmdb_movies_blockbusters, page='1'),
            'icon': get_icon_path("most_voted"),
        },
        {
            'label': _("Genres (TMDb)"),
            'path': plugin.url_for(tmdb_movies_genres),
            'icon': get_icon_path("genres"),
        },
        {
            'label': _("In theatres (TMDb)"),
            'path': plugin.url_for(tmdb_movies_now_playing, page='1'),
            'icon': get_icon_path("intheatres"),
        },
        {
            'label': _("Popular (TMDb)"),
            'path': plugin.url_for(tmdb_movies_most_popular, page='1'),
            'icon': get_icon_path("popular"),
        },
        {
            'label': _("Top rated (TMDb)"),
            'path': plugin.url_for(tmdb_movies_top_rated, page='1'),
            'icon': get_icon_path("top_rated"),
        }
    ]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 46
0
def root_search_term(term, page):
    if term == "None":
        # Get search keyword
        search_entered = plugin.keyboard(heading=_("search for"))
        if not search_entered:
            return
    else:
        search_entered = term
    items = [{
        'label':
        "All" + ": " + search_entered,
        'path':
        plugin.url_for(root_search_term, term=search_entered, page='1'),
        'icon':
        get_icon_path("search"),
    }, {
        'label':
        _("Movies") + " - " + _("Search (Trakt)") + ": " + search_entered,
        'path':
        plugin.url_for("trakt_movies_search_term",
                       term=search_entered,
                       page='1'),
        'icon':
        get_icon_path("movies"),
    }, {
        'label':
        _("Movies") + " - " + _("Search (TMDb)") + ": " + search_entered,
        'path':
        plugin.url_for("tmdb_movies_search_term",
                       term=search_entered,
                       page='1'),
        'icon':
        get_icon_path("movies"),
    }, {
        'label':
        _("TV shows") + " - " + _("Search (Trakt)") + ": " + search_entered,
        'path':
        plugin.url_for("trakt_tv_search_term", term=search_entered, page='1'),
        'icon':
        get_icon_path("tv"),
    }, {
        'label':
        _("TV shows") + " - " + _("Search (TMDb)") + ": " + search_entered,
        'path':
        plugin.url_for("tmdb_tv_search_term", term=search_entered, page='1'),
        'icon':
        get_icon_path("tv"),
    }, {
        'label':
        _("TV shows") + " - " + _("Search (TVDb)") + ": " + search_entered,
        'path':
        plugin.url_for("tvdb_tv_search_term", term=search_entered, page='1'),
        'icon':
        get_icon_path("tv"),
    }, {
        'label':
        _("Music") + " - " + _("Search artist") + ": " + search_entered,
        'path':
        plugin.url_for("music_search_artist_term",
                       term=search_entered,
                       page='1'),
        'icon':
        get_icon_path("music"),
    }, {
        'label':
        _("Music") + " - " + _("Search album") + ": " + search_entered,
        'path':
        plugin.url_for("music_search_album_term",
                       term=search_entered,
                       page='1'),
        'icon':
        get_icon_path("music"),
    }, {
        'label':
        _("Music") + " - " + _("Search track") + ": " + search_entered,
        'path':
        plugin.url_for("music_search_track_term",
                       term=search_entered,
                       page='1'),
        'icon':
        get_icon_path("music"),
    }, {
        'label': _("Live") + " - " + _("Search") + ": " + search_entered,
        'path': plugin.url_for("live_search_term", term=search_entered),
        'icon': get_icon_path("live"),
    }, {
        'label':
        _("Lists") + " - " + _("Search") + ": " + search_entered,
        'path':
        plugin.url_for("lists_search_for_lists_term",
                       term=search_entered,
                       page='1'),
        'icon':
        get_icon_path("lists"),
    }]
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image': get_background_path()}
    return items
Exemplo n.º 47
0
def music_search_term(term, page):
    items = [
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Albums"), "LastFM"),
            'path': plugin.url_for("music_search_album_term", term=term, page='1'),
            'icon': get_icon_path("music"),
            'thumbnail': get_icon_path("music"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Artists"), "LastFM"),
            'path': plugin.url_for("music_search_artist_term", term=term, page='1'),
            'icon': get_icon_path("music"),
            'thumbnail': get_icon_path("music"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Tracks"), "LastFM"),
            'path': plugin.url_for("music_search_track_term", term=term, page='1'),
            'icon': get_icon_path("music"),
            'thumbnail': get_icon_path("music"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Channels"), "Live addons"),
            'path': plugin.url_for("live_search_term", term=term),
            'icon': get_icon_path("live"),
            'thumbnail': get_icon_path("live"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Playlists"), "Trakt"),
            'path': plugin.url_for("lists_search_for_lists_term", term=term, page='1'),
            'icon': get_icon_path("lists"),
            'thumbnail': get_icon_path("lists"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Movies"), "TMDb"),
            'path': plugin.url_for("tmdb_movies_search_term", term=term, page='1'),
            'icon': get_icon_path("movies"),
            'thumbnail': get_icon_path("movies"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Movies"), "Trakt"),
            'path': plugin.url_for("trakt_movies_search_term", term=term, page='1'),
            'icon': get_icon_path("movies"),
            'thumbnail': get_icon_path("movies"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "TMDb"),
            'path': plugin.url_for("tmdb_tv_search_term", term=term, page='1'),
            'icon': get_icon_path("tv"),
            'thumbnail': get_icon_path("tv"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "Trakt"),
            'path': plugin.url_for("trakt_tv_search_term", term=term, page='1'),
            'icon': get_icon_path("tv"),
            'thumbnail': get_icon_path("tv"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "TVDb"),
            'path': plugin.url_for("tv_search_term", term=term, page='1'),
            'icon': get_icon_path("search"),
            'thumbnail': get_icon_path("search"),
        },
        {
            'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Music"), plugin.addon.getAddonInfo('name')),
            'path': plugin.url_for("music_search_term", term=term, page='1'),
            'icon': get_icon_path("search"),
            'thumbnail': get_icon_path("search"),
        },
        {
            'label': "{0} {1}".format(_("Edit"), _("Search string").lower()),
            'path': plugin.url_for("music_search_edit", term=term),
            'icon': get_icon_path("search"),
            'thumbnail': get_icon_path("search"),
        }
    ]
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 48
0
def music():
    items = [
        {
            'label': _("Enter search string"),
            'path': plugin.url_for("music_search"),
            'icon': get_icon_path("search"),
        },
        {
            'label': "{0} {1}".format(_("Top 100"), _("Artists")),
            'path': plugin.url_for("music_top_artists"),
            'icon': get_icon_path("top_rated"),
        },
        {
            'label': "{0} {1}".format(_("Top 100"), _("Tracks")),
            'path': plugin.url_for("music_top_tracks"),
            'icon': get_icon_path("trending"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "NL"),
            'path': plugin.url_for("music_top_artists_by_country", country='netherlands'),
            'icon': get_icon_path("top_nl"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "UK"),
            'path': plugin.url_for("music_top_artists_by_country", country='united kingdom'),
            'icon': get_icon_path("top_uk"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "US"),
            'path': plugin.url_for("music_top_artists_by_country", country='united states'),
            'icon': get_icon_path("top_us"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "CA"),
            'path': plugin.url_for("music_top_artists_by_country", country='canada'),
            'icon': get_icon_path("top_ca"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "AU"),
            'path': plugin.url_for("music_top_artists_by_country", country='australia'),
            'icon': get_icon_path("top_au"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "NL"),
            'path': plugin.url_for("music_top_tracks_by_country", country='netherlands'),
            'icon': get_icon_path("trending_nl"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "UK"),
            'path': plugin.url_for("music_top_tracks_by_country", country='united kingdom'),
            'icon': get_icon_path("trending_uk"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "US"),
            'path': plugin.url_for("music_top_tracks_by_country", country='united states'),
            'icon': get_icon_path("trending_us"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "CA"),
            'path': plugin.url_for("music_top_tracks_by_country", country='canada'),
            'icon': get_icon_path("trending_ca"),
        },
        {
            'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "AU"),
            'path': plugin.url_for("music_top_tracks_by_country", country='australia'),
            'icon': get_icon_path("trending_au"),
        }
    ]
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Exemplo n.º 49
0
def music_search_term(term, page):
    items = [{
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Albums"),
                                        "LastFM"),
        'path':
        plugin.url_for("music_search_album_term", term=term, page='1'),
        'icon':
        get_icon_path("music"),
        'thumbnail':
        get_icon_path("music"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Artists"),
                                        "LastFM"),
        'path':
        plugin.url_for("music_search_artist_term", term=term, page='1'),
        'icon':
        get_icon_path("music"),
        'thumbnail':
        get_icon_path("music"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Tracks"),
                                        "LastFM"),
        'path':
        plugin.url_for("music_search_track_term", term=term, page='1'),
        'icon':
        get_icon_path("music"),
        'thumbnail':
        get_icon_path("music"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Channels"),
                                        "Live addons"),
        'path':
        plugin.url_for("live_search_term", term=term),
        'icon':
        get_icon_path("live"),
        'thumbnail':
        get_icon_path("live"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Playlists"),
                                        "Trakt"),
        'path':
        plugin.url_for("lists_search_for_lists_term", term=term, page='1'),
        'icon':
        get_icon_path("lists"),
        'thumbnail':
        get_icon_path("lists"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Movies"),
                                        "TMDb"),
        'path':
        plugin.url_for("tmdb_movies_search_term", term=term, page='1'),
        'icon':
        get_icon_path("movies"),
        'thumbnail':
        get_icon_path("movies"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Movies"),
                                        "Trakt"),
        'path':
        plugin.url_for("trakt_movies_search_term", term=term, page='1'),
        'icon':
        get_icon_path("movies"),
        'thumbnail':
        get_icon_path("movies"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"),
                                        "TMDb"),
        'path':
        plugin.url_for("tmdb_tv_search_term", term=term, page='1'),
        'icon':
        get_icon_path("tv"),
        'thumbnail':
        get_icon_path("tv"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"),
                                        "Trakt"),
        'path':
        plugin.url_for("trakt_tv_search_term", term=term, page='1'),
        'icon':
        get_icon_path("tv"),
        'thumbnail':
        get_icon_path("tv"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"),
                                        "TVDb"),
        'path':
        plugin.url_for("tv_search_term", term=term, page='1'),
        'icon':
        get_icon_path("search"),
        'thumbnail':
        get_icon_path("search"),
    }, {
        'label':
        "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Music"),
                                        plugin.addon.getAddonInfo('name')),
        'path':
        plugin.url_for("music_search_term", term=term, page='1'),
        'icon':
        get_icon_path("search"),
        'thumbnail':
        get_icon_path("search"),
    }, {
        'label': "{0} {1}".format(_("Edit"),
                                  _("Search string").lower()),
        'path': plugin.url_for("music_search_edit", term=term),
        'icon': get_icon_path("search"),
        'thumbnail': get_icon_path("search"),
    }]
    for item in items:
        item['properties'] = {'fanart_image': get_background_path()}
    if FORCE == True:
        plugin.set_view_mode(VIEW)
        return items
    else:
        return items
Exemplo n.º 50
0
def _lists_trakt_show_list(list_items):
    genres_dict = trakt.trakt_get_genres("tv")
    if type(list_items) == str:
        import urllib
        list_items = eval(urllib.unquote(list_items))
    items = []
    for list_item in list_items:
        item = None
        item_type = list_item["type"]
        if item_type == "show":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            if tvdb_id != "" and tvdb_id != None:
                show = list_item["show"]
                info = get_tvshow_metadata_trakt(show, genres_dict)
                context_menu = [
                    (_("Scan item to library"), "RunPlugin({0})".format(
                        plugin.url_for("tv_add_to_library", id=tvdb_id))),
                    (_("TV show information"), 'Action(Info)'),
                    ("{0}".format(
                        _("Remove from library").replace(
                            _("Library").lower(),
                            _("Playlist").lower())), "RunPlugin({0})".format(
                                plugin.url_for("lists_remove_show_from_list",
                                               src="tvdb",
                                               id=tvdb_id)))
                ]
                if plugin.get_setting(SETTING_TRAKT_LIST_ARTWORK,
                                      bool) == False:
                    item = ({
                        'label': info['title'],
                        'path': plugin.url_for("tv_tvshow", id=tvdb_id),
                        'context_menu': context_menu,
                        'thumbnail': info['poster'],
                        'icon': get_icon_path("tv"),
                        'poster': info['poster'],
                        'properties': {
                            'fanart_image': info['fanart']
                        },
                        'info_type': 'video',
                        'stream_info': {
                            'video': {}
                        },
                        'info': info
                    })
                else:
                    item = make_tvshow_item(info)
            else:
                item = None
        elif item_type == "season":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            season = list_item["season"]
            show = list_item["show"]
            show_info = get_tvshow_metadata_trakt(show, genres_dict)
            season_info = get_season_metadata_trakt(show_info, season,
                                                    genres_dict)
            label = "{0} - Season {1}".format(show["title"], season["number"])
            context_menu = [
                (_("Scan item to library"), "RunPlugin({0})".format(
                    plugin.url_for("tv_add_to_library", id=tvdb_id))),
                ("%s %s" % (_("Season"), _("Information").lower()),
                 'Action(Info)'),
                ("{0}".format(
                    _("Remove from library").replace(
                        _("Library").lower(),
                        _("Playlist").lower())),
                 "RunPlugin({0})".format(
                     plugin.url_for("lists_remove_season_from_list",
                                    src="tvdb",
                                    id=tvdb_id,
                                    season=list_item["season"]["number"])))
            ]
            item = ({
                'label':
                label,
                'path':
                plugin.url_for("tv_season",
                               id=tvdb_id,
                               season_num=list_item["season"]["number"]),
                'context_menu':
                context_menu,
                'info':
                season_info,
                'thumbnail':
                season_info['poster'],
                'icon':
                get_icon_path("tv"),
                'poster':
                season_info['poster'],
                'properties': {
                    'fanart_image': season_info['fanart']
                },
            })
        elif item_type == "episode":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            episode = list_item["episode"]
            show = list_item["show"]
            season_number = episode["season"]
            episode_number = episode["number"]
            show_info = get_tvshow_metadata_trakt(show, genres_dict)
            episode_info = get_episode_metadata_trakt(show_info, episode)
            label = "{0} - S{1}E{2} - {3}".format(show_info["title"],
                                                  season_number,
                                                  episode_number,
                                                  episode_info["title"])
            context_menu = [
                ("{0} {1}...".format(_("Select"),
                                     _("Stream").lower()),
                 "PlayMedia({0})".format(
                     plugin.url_for("tv_play",
                                    id=tvdb_id,
                                    season=season_number,
                                    episode=episode_number,
                                    mode='select'))),
                ("%s %s" % (_("Episode"), _("Information").lower()),
                 'Action(Info)'),
                (_("Add to playlist"), "RunPlugin({0})".format(
                    plugin.url_for("lists_add_episode_to_list",
                                   src='tvdb',
                                   id=tvdb_id,
                                   season=season_number,
                                   episode=episode_number))),
                ("{0}".format(
                    _("Remove from library").replace(
                        _("Library").lower(),
                        _("Playlist").lower())), "RunPlugin({0})".format(
                            plugin.url_for("lists_remove_season_from_list",
                                           src="tvdb",
                                           id=tvdb_id,
                                           season=season_number,
                                           episode=episode_number)))
            ]
            item = ({
                'label':
                label,
                'path':
                plugin.url_for("tv_play",
                               id=tvdb_id,
                               season=season_number,
                               episode=episode_number,
                               mode='default'),
                'context_menu':
                context_menu,
                'info':
                episode_info,
                'is_playable':
                True,
                'info_type':
                'video',
                'stream_info': {
                    'video': {}
                },
                'thumbnail':
                episode_info['poster'],
                'poster':
                episode_info['poster'],
                'icon':
                get_icon_path("tv"),
                'properties': {
                    'fanart_image': episode_info['fanart']
                },
            })
        elif item_type == "movie":
            movie = list_item["movie"]
            movie_info = get_trakt_movie_metadata(movie)
            try:
                tmdb_id = movie_info['tmdb']
            except:
                tmdb_id = ""
            try:
                imdb_id = movie_info['imdb']
            except:
                imdb_id = ""
            if tmdb_id != None and tmdb_id != "":
                src = "tmdb"
                id = tmdb_id
            elif imdb_id != None and mdb_id != "":
                src = "imdb"
                id = imdb_id
            else:
                src = ""
                id = ""
            if src == "": item = None
            else:
                if xbmc.getCondVisibility("system.hasaddon(script.qlickplay)"):
                    context_menu = [
                        (_("Scan item to library"), "RunPlugin({0})".format(
                            plugin.url_for("movies_add_to_library",
                                           src=src,
                                           id=id))),
                        ("%s %s" % (_("Movie"), _("Trailer").lower()),
                         "RunScript(script.qlickplay,info=playtrailer,id={0})".
                         format(id)),
                        ("[COLOR ff0084ff]Q[/COLOR]lick[COLOR ff0084ff]P[/COLOR]lay",
                         "RunScript(script.qlickplay,info=movieinfo,id={0})".
                         format(id)),
                        ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"),
                         "ActivateWindow(10025,plugin://script.qlickplay/?info=similarmovies&id={0})"
                         .format(id))
                    ]
                elif xbmc.getCondVisibility(
                        "system.hasaddon(script.extendedinfo)"):
                    context_menu = [
                        (_("Scan item to library"), "RunPlugin({0})".format(
                            plugin.url_for("movies_add_to_library",
                                           src=src,
                                           id=id))),
                        ("%s %s" % (_("Movie"), _("Trailer").lower()),
                         "RunScript(script.extendedinfo,info=playtrailer,id={0})"
                         .format(id)),
                        ((_("Extended movie info"), _("Extended movie info"),
                          "RunScript(script.extendedinfo,info=extendedinfo,id={0})"
                          .format(id)),
                         ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"),
                          "ActivateWindow(10025,plugin://script.extendedinfo/?info=similarmovies&id={0})"
                          .format(id)))
                    ]
                else:
                    context_menu = [
                        (_("Scan item to library"), "RunPlugin({0})".format(
                            plugin.url_for("movies_add_to_library",
                                           src=src,
                                           id=id)))
                    ]
                    context_menu.append(
                        ("%s %s (%s)" % ("Related", _("movies"), "Trakt"),
                         "ActivateWindow(10025,{0})".format(
                             plugin.url_for("movies_related", id=id, page=1))))
                    context_menu.append(
                        ("{0} {1}...".format(_("Select"),
                                             _("Stream").lower()),
                         "PlayMedia({0})".format(
                             plugin.url_for("movies_play",
                                            src=src,
                                            id=id,
                                            mode='select'))))
                    context_menu.append(
                        (_("Add to playlist"), "RunPlugin({0})".format(
                            plugin.url_for("lists_add_movie_to_list",
                                           src=src,
                                           id=id))))
                    context_menu.append(
                        (_("Movie information"), 'Action(Info)'))
                if imdb_id != None and imdb_id != "":
                    context_menu.append(
                        ("Show Actors", "ActivateWindow(10025,{0})".format(
                            plugin.url_for("people_list_movie_people",
                                           id=imdb_id,
                                           source="imdb",
                                           fanart=get_background_path()))))
                elif tmdb_id != None and tmdb_id != "":
                    context_menu.append(
                        ("Show Actors", "ActivateWindow(10025,{0})".format(
                            plugin.url_for("people_list_movie_people",
                                           id=tmdb_id,
                                           source="tmdb",
                                           fanart=get_background_path()))))
            item = make_movie_item(movie_info, True)
        elif item_type == "person":
            person_id = list_item['person']['ids']['trakt']
            person_tmdb_id = list_item['person']['ids']['tmdb']
            context_menu = []
            try:
                import_tmdb()
                person_images = tmdb.People(
                    person_tmdb_id).images()['profiles']
                person_image = 'https://image.tmdb.org/t/p/w640' + person_images[
                    0]['file_path']
            except:
                person_image = ''
            person_name = to_utf8(list_item['person']['name'])
            item = ({
                'label':
                person_name,
                'path':
                plugin.url_for("trakt_movies_person", person_id=person_id),
                'context_menu':
                context_menu,
                #'info': season_info,
                'thumbnail':
                person_image,
                'icon':
                get_icon_path("movies"),
                'poster':
                person_image,
                'properties': {
                    'fanart_image': person_image
                },
            })
        if item is not None:
            items.append(item)
    for item in items:
        item['properties'] = {'fanart_image': get_background_path()}
    return items
Exemplo n.º 51
0
def music():
    items = [{
        'label': _("Enter search string"),
        'path': plugin.url_for("music_search"),
        'icon': get_icon_path("search"),
    }, {
        'label': "{0} {1}".format(_("Top 100"), _("Artists")),
        'path': plugin.url_for("music_top_artists"),
        'icon': get_icon_path("top_rated"),
    }, {
        'label': "{0} {1}".format(_("Top 100"), _("Tracks")),
        'path': plugin.url_for("music_top_tracks"),
        'icon': get_icon_path("trending"),
    }, {
        'label':
        "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "NL"),
        'path':
        plugin.url_for("music_top_artists_by_country", country='netherlands'),
        'icon':
        get_icon_path("top_nl"),
    }, {
        'label':
        "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "UK"),
        'path':
        plugin.url_for("music_top_artists_by_country",
                       country='united kingdom'),
        'icon':
        get_icon_path("top_uk"),
    },
             {
                 'label':
                 "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "US"),
                 'path':
                 plugin.url_for("music_top_artists_by_country",
                                country='united states'),
                 'icon':
                 get_icon_path("top_us"),
             }, {
                 'label':
                 "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "CA"),
                 'path':
                 plugin.url_for("music_top_artists_by_country",
                                country='canada'),
                 'icon':
                 get_icon_path("top_ca"),
             }, {
                 'label':
                 "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "AU"),
                 'path':
                 plugin.url_for("music_top_artists_by_country",
                                country='australia'),
                 'icon':
                 get_icon_path("top_au"),
             }, {
                 'label':
                 "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "NL"),
                 'path':
                 plugin.url_for("music_top_tracks_by_country",
                                country='netherlands'),
                 'icon':
                 get_icon_path("trending_nl"),
             }, {
                 'label':
                 "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "UK"),
                 'path':
                 plugin.url_for("music_top_tracks_by_country",
                                country='united kingdom'),
                 'icon':
                 get_icon_path("trending_uk"),
             }, {
                 'label':
                 "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "US"),
                 'path':
                 plugin.url_for("music_top_tracks_by_country",
                                country='united states'),
                 'icon':
                 get_icon_path("trending_us"),
             }, {
                 'label':
                 "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "CA"),
                 'path':
                 plugin.url_for("music_top_tracks_by_country",
                                country='canada'),
                 'icon':
                 get_icon_path("trending_ca"),
             }, {
                 'label':
                 "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "AU"),
                 'path':
                 plugin.url_for("music_top_tracks_by_country",
                                country='australia'),
                 'icon':
                 get_icon_path("trending_au"),
             }]
    for item in items:
        item['properties'] = {'fanart_image': get_background_path()}
    if FORCE == True:
        plugin.set_view_mode(VIEW)
        return items
    else:
        return items
Exemplo n.º 52
0
def _lists_trakt_show_list(list_items):
    genres_dict = trakt.trakt_get_genres("tv")
    if type(list_items) == str:
        import urllib
        list_items = eval(urllib.unquote(list_items))
    items = []
    for list_item in list_items:
        item = None
        item_type = list_item["type"]
        if item_type == "show":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            show = list_item["show"]
            info = get_tvshow_metadata_trakt(show, genres_dict)
            context_menu = [
                (
                    _("Add to library"),
                    "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id))
                ),
                (
                    _("Show info"), 'Action(Info)'
                ),
                (
                    _("Remove from list"),
                    "RunPlugin({0})".format(plugin.url_for("lists_remove_show_from_list", src="tvdb", id=tvdb_id))
                )
            ]
            item = ({
                'label': info['title'],
                'path': plugin.url_for("tv_tvshow", id=tvdb_id),
                'context_menu': context_menu,
                'thumbnail': info['poster'],
                'icon': get_icon_path("tv"),
                'poster': info['poster'],
                'properties' : {'fanart_image' : info['fanart']},
                'info_type': 'video',
                'stream_info': {'video': {}},
                'info': info
            })
        elif item_type == "season":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            season = list_item["season"]
            show = list_item["show"]
            show_info = get_tvshow_metadata_trakt(show, genres_dict)
            season_info = get_season_metadata_trakt(show_info,season, genres_dict)
            label = "{0} - Season {1}".format(to_utf8(show["title"]),season["number"])
            context_menu = [
                (
                    _("Add to library"),
                    "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id))
                ),
                (
                    _("Show info"), 'Action(Info)'
                ),
                (
                    _("Remove from list"),
                    "RunPlugin({0})".format(plugin.url_for("lists_remove_season_from_list", src="tvdb",
                                                           id=tvdb_id, season=list_item["season"]["number"]))
                )
            ]
            item = ({
                'label': label,
                'path': plugin.url_for(tv_season, id=tvdb_id, season_num=list_item["season"]["number"]),
                'context_menu': context_menu,
                'info': season_info,
                'thumbnail': season_info['poster'],
                'icon': get_icon_path("tv"),
                'poster': season_info['poster'],
                'properties': {'fanart_image': season_info['fanart']},
            })
        elif item_type == "episode":
            tvdb_id = list_item["show"]["ids"]["tvdb"]
            episode = list_item["episode"]
            show = list_item["show"]
            season_number = episode["season"]
            episode_number = episode["number"]
            show_info = get_tvshow_metadata_trakt(show, genres_dict)
            episode_info = get_episode_metadata_trakt(show_info, episode)
            label = "{0} - S{1}E{2} - {3}".format(show_info["title"], season_number,
                                                  episode_number, episode_info["title"])
            context_menu = [
                (
                    _("Select stream..."),
                    "PlayMedia({0})".format(
                        plugin.url_for("tv_play", id=tvdb_id, season=season_number,
                                       episode=episode_number, mode='select'))
                ),
                (
                    _("Show info"),
                    'Action(Info)'
                ),
                (
                    _("Add to list"),
                    "RunPlugin({0})".format(plugin.url_for("lists_add_episode_to_list", src='tvdb', id=tvdb_id,
                                                           season=season_number, episode=episode_number))
                ),
                (
                    _("Remove from list"),
                    "RunPlugin({0})".format(plugin.url_for("lists_remove_season_from_list", src="tvdb", id=tvdb_id,
                                                           season=season_number, episode = episode_number))
                )
            ]
            item = ({
                'label': label,
                'path': plugin.url_for("tv_play", id=tvdb_id, season=season_number,
                                       episode=episode_number, mode='default'),
                'context_menu': context_menu,
                'info': episode_info,
                'is_playable': True,
                'info_type': 'video',
                'stream_info': {'video': {}},
                'thumbnail': episode_info['poster'],
                'poster': episode_info['poster'],
                'icon': get_icon_path("tv"),
                'properties': {'fanart_image': episode_info['fanart']},
                      })
        elif item_type == "movie":
            movie = list_item["movie"]
            movie_info = get_trakt_movie_metadata(movie)
            item = make_movie_item(movie_info, True)
        if item is not None:
            items.append(item)
    for item in items:
        item['properties'] = {'fanart_image' : get_background_path()}
    if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW)
    else: return plugin.finish(items=items, sort_methods=SORT)