• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python plugin.url_for函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中meta.plugin.url_for函数的典型用法代码示例。如果您正苦于以下问题:Python url_for函数的具体用法?Python url_for怎么用?Python url_for使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了url_for函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: make_movie_item

def make_movie_item(movie_info):

    tmdb_id = movie_info['tmdb']
    
    context_menu = [
     (
       _("Select stream..."),
       "PlayMedia({0})".format(plugin.url_for("movies_play", src='tmdb', id=tmdb_id, mode='select'))
     ),                
     (
      _("Add to library"), 
      "RunPlugin({0})".format(plugin.url_for("movies_add_to_library", id=tmdb_id))
     ),
     (
      _("Show info"),
      'Action(Info)'
     ),
    ]
    
    return {'label': movie_info['title'],
            'path': plugin.url_for("movies_play", src='tmdb', id=tmdb_id, mode='default'),
            'context_menu': context_menu,
            'thumbnail': movie_info['poster'],
            'icon': "DefaultVideo.png",
            'poster': movie_info['poster'],
            'properties' : {'fanart_image' : movie_info['fanart']},
            'is_playable': True,
            'info_type': 'video',
            'info': movie_info}
开发者ID:itzikg,项目名称:meta4kodi,代码行数:29,代码来源:movies.py


示例2: music_top_artists_by_country

def music_top_artists_by_country(country, page):
    results = lastfm.get_top_artists_by_country(country, page)
    artists = results["topartists"]["artist"]
    items = []
    for artist in artists:
        large_image = artist["image"][-1]["#text"]
        name = to_utf8(artist["name"])
        context_menu = [
            (
                _("Scan item to library"),
                "RunPlugin({0})".format(plugin.url_for("music_add_artist_to_library", artist_name=name))
            )
        ]
        item = {
            'label': name,
            'path': plugin.url_for("music_artist_albums", artist_name=name),
            'thumbnail': large_image,
            'icon': "DefaultMusic.png",
            'poster': large_image,
            'info': {
                'artist': name,
            },
            'info_type': 'music',
            'context_menu': context_menu
        }
        items.append(item)
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
开发者ID:vphuc81,项目名称:MyRepository,代码行数:28,代码来源:music.py


示例3: people_list_show_people

def people_list_show_people(id, source, fanart):
    items = []
    try:
        if source == "imdb":
            people = trakt.get_show_people(id)
        else:
            xbmcgui.Dialog().ok("Error", "No cast info found")
            return plugin.finish(items=[])
    except:
        xbmcgui.Dialog().ok("Error", "No cast info found")
        return plugin.finish(items=[])
    if "cast" in people:
        for actor in people["cast"]:
            context_menu = [
                (
                    "Convert to bob_xml",
                    "RunPlugin({0})".format(
                        plugin.url_for("bob_convert_person_to_xml", trakt_id=actor["person"]["ids"]["trakt"]))
                )
            ]
            image = get_person_artwork(actor)
            label = "{0} ({1})".format(to_utf8(actor["person"]["name"]), to_utf8(actor["character"]))
            info = actor["person"]["biography"]
            items.append({'label': label,
                          'path': plugin.url_for("people_list_person_select", id=actor["person"]["ids"]["trakt"],
                                                 name=to_utf8(actor["person"]["name"])),
                          'info': info,
                          'thumbnail': image,
                          'poster': image,
                          'context_menu': context_menu,
                          'icon': "DefaultVideo.png",
                          'properties': {'fanart_image': fanart},
                          })
        return plugin.finish(items=items)
开发者ID:vphuc81,项目名称:MyRepository,代码行数:34,代码来源:people.py


示例4: make_tvshow_item

def make_tvshow_item(info):                        
    tvdb_id = info['tvdb_id']
    
    context_menu = [
     (   
      _("Add to library"),
      "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id))
     ),
     (
      _("Show info"), 'Action(Info)'
     ),
     (
      _("Add to list"),
      "RunPlugin({0})".format(plugin.url_for("lists_add_show_to_list", src='tvdb', id=tvdb_id,))
     )
    ]
             
    return {'label': info['title'],
            'path': plugin.url_for("tv_tvshow", id=tvdb_id),
            'context_menu': context_menu,
            'thumbnail': info['poster'],
            'icon': "DefaultVideo.png",
            'poster': info['poster'],
            'properties' : {'fanart_image' : info['fanart']},
            'info_type': 'video',
            'stream_info': {'video': {}},
            'info': info}
开发者ID:OpenELEQ,项目名称:meta4kodi,代码行数:27,代码来源:tvshows.py


示例5: lists_trakt_liked_lists

def lists_trakt_liked_lists(page):
    lists, pages = trakt.trakt_get_liked_lists(page)
    items = []
    for list in lists:
        info = list["list"]
        name = info["name"]
        user = info["user"]["username"]
        slug = info["ids"]["slug"]
        items.append({
            'label': name,
            '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))
                )
            ],
            'icon': get_icon_path("traktlikedlists"),
        })
    if pages > page:
        items.append({
            'label': _("Next >>"),
            'path': plugin.url_for("lists_trakt_liked_lists", page = int(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)
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:27,代码来源:lists.py


示例6: root

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': _("Live"),
            'path': plugin.url_for("live"),
            'icon': get_icon_path("live"),
        },
        {
            'label': _("Lists"),
            'path': plugin.url_for("lists"),
            'icon': get_icon_path("lists"),
        }
    ]
    
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : fanart}
        
    return items
开发者ID:OpenELEQ,项目名称:testing.meta.more,代码行数:30,代码来源:addon.py


示例7: make_tvshow_item

def make_tvshow_item(tvdb_show, tmdb_show=None):
    tvdb_info = get_tvshow_metadata_tvdb(tvdb_show)
    tmdb_info = get_tvshow_metadata_tmdb(tmdb_show)
    
    info = {}
    info.update(tvdb_info)
    info.update(dict((k,v) for k,v in tmdb_info.iteritems() if v))
    
    # Prefer translated info
    if LANG != "en":
        for key in ('name', 'title', 'plot'):
            if is_ascii(info.get(key,'')) and not is_ascii(tvdb_info.get(key,'')):
                info[key] = tvdb_info[key]
                        
    tvdb_id = info['tvdb_id']
    
    context_menu = [
     (   
      _("Add to library"),
      "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id))
     ),
     (
      _("Show info"), 'Action(Info)'
     )
    ]
             
    return {'label': info['title'],
            'path': plugin.url_for(tv_tvshow, id=tvdb_id),
            'context_menu': context_menu,
            'thumbnail': info['poster'],
            'icon': "DefaultVideo.png",
            'poster': info['poster'],
            'properties' : {'fanart_image' : info['fanart']},
            'info_type': 'video',
            'info': info}
开发者ID:itzikg,项目名称:meta4kodi,代码行数:35,代码来源:tvshows.py


示例8: tv

def tv():
    """ TV directory """
    items = [
        {
            'label': _("Search"),
            'path': plugin.url_for(tv_search),
            'icon': get_icon_path("search"),
        },
        {
            'label': _("Genres"),
            'path': plugin.url_for(tv_genres),
            'icon': get_icon_path("genres"),
        },
        {
            'label': _("Popular"),
            'path': plugin.url_for(tv_most_popular, page='1'),
            'icon': get_icon_path("popular"),
        },
        {
            'label': _("On the air"),
            'path': plugin.url_for(tv_now_playing, page='1'),
            'icon': get_icon_path("tv"),
        },
        {
            'label': _("Top rated"),
            'path': plugin.url_for(tv_top_rated, page='1'),
            'icon': get_icon_path("top_rated"),
        },
    ]
    
    fanart = plugin.addon.getAddonInfo('fanart')
    for item in items:
        item['properties'] = {'fanart_image' : fanart}

    return items
开发者ID:itzikg,项目名称:meta4kodi,代码行数:35,代码来源:tvshows.py


示例9: music_top_artists_by_country

def music_top_artists_by_country(country, page):
    results = lastfm.get_top_artists_by_country(country, page)
    artists = results["topartists"]["artist"]
    items = []
    for artist in artists:
        large_image = artist["image"][-1]["#text"]
        name = to_utf8(artist["name"])
        context_menu = [
            (
                _("Add to library"),
                "RunPlugin({0})".format(plugin.url_for("music_add_artist_to_library", artist_name=name)),
            )
        ]
        item = {
            "label": name,
            "path": plugin.url_for(music_artist_albums, artist_name=name),
            "thumbnail": large_image,
            "icon": "DefaultMusic.png",
            "poster": large_image,
            "info": {"artist": name},
            "info_type": "music",
            "context_menu": context_menu,
        }
        items.append(item)
    return items
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:25,代码来源:music.py


示例10: lists_trakt_my_lists

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)
开发者ID:vphuc81,项目名称:MyRepository,代码行数:28,代码来源:lists.py


示例11: music_artist_album_tracks

def music_artist_album_tracks(artist_name, album_name):
    artist_name = to_utf8(artist_name)
    album_name = to_utf8(album_name)
    results = lastfm.get_album_info(artist_name, album_name)
    items = []
    for track in results["tracks"]["track"]:
        track_name = to_utf8(track["name"])
        track_number = track["@attr"]["rank"]
        image = results["image"][-1]["#text"]
        context_menu = [
            (
                _("Context player"),
                "PlayMedia({0})".format(
                    plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode="context")
                ),
            ),
            (
                _("Add to library"),
                "RunPlugin({0})".format(
                    plugin.url_for(
                        "music_add_to_library", artist_name=artist_name, track_name=track_name, album_name=album_name
                    )
                ),
            ),
            (
                _("Musicvideo"),
                "RunPlugin({0})".format(
                    plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name, mode="default")
                ),
            ),
        ]
        if plugin.get_setting(SETTING_PREFERRED_MUSIC_TYPE) == "audio":
            item = {
                "label": "{0}. {1}".format(track_number, track_name),
                "path": plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name),
                "thumbnail": image,
                "icon": "DefaultMusic.png",
                "poster": image,
                "info_type": "music",
                "context_menu": context_menu,
            }
        else:
            item = {
                "label": "{0}. {1}".format(track_number, track_name),
                "path": plugin.url_for(
                    "music_play_video", artist_name=artist_name, album_name=album_name, track_name=track_name
                ),
                "thumbnail": image,
                "icon": "DefaultMusicVideo.png",
                "poster": image,
                "info_type": "music",
                "context_menu": context_menu,
            }
        items.append(item)
    return items
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:55,代码来源:music.py


示例12: music_search

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
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:12,代码来源:music.py


示例13: make_movie_item

def make_movie_item(movie_info, is_list = False):

    tmdb_id = movie_info.get('tmdb')
    imdb_id = movie_info.get('imdb')
    
    if tmdb_id:
        id = tmdb_id 
        src = 'tmdb'
    else:
        id = imdb_id 
        src = 'imdb'
    
    context_menu = [
     (
       _("Select stream..."),
       "PlayMedia({0})".format(plugin.url_for("movies_play", src=src, id=id, mode='select'))
     ),                
     (
      _("Add to library"), 
      "RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id))
     ),
     (
      _("Add to list"),
      "RunPlugin({0})".format(plugin.url_for("lists_add_movie_to_list", src=src, id=id))
     ),
     (
      _("Show info"),
      'Action(Info)'
     ),
    ]

    if is_list:
        context_menu.append(
            (
                _("Remove from list"),
                "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': "DefaultVideo.png",
        'poster': movie_info['poster'],
        'properties' : {'fanart_image' : movie_info['fanart']},
        'is_playable': True,
        'info_type': 'video',
        'stream_info': {'video': {}},
        'info': movie_info
    }
开发者ID:OpenELEQ,项目名称:meta4kodi,代码行数:53,代码来源:movies.py


示例14: music_search_track_term

def music_search_track_term(term, page):
    search_results = lastfm.search_track(term, page)
    tracks = search_results["trackmatches"]["track"]
    items_per_page = search_results["opensearch:itemsPerPage"]
    start_index = search_results["opensearch:startIndex"]
    total_results = search_results["opensearch:totalResults"]
    items = []
    for track in tracks:
        large_image = track["image"][-1]["#text"]
        track_name = to_utf8(track["name"])
        artist_name = to_utf8(track["artist"])
        context_menu = [
            (
                _("Context player"),
                "PlayMedia({0})".format(
                    plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode="context")
                ),
            ),
            (
                _("Add to library"),
                "RunPlugin({0})".format(
                    plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name)
                ),
            ),
            (
                _("Musicvideo"),
                "RunPlugin({0})".format(
                    plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name, mode="context")
                ),
            ),
        ]
        item = {
            "label": "{0} - {1}".format(artist_name, track_name),
            "path": plugin.url_for(music_play_audio, artist_name=artist_name, track_name=track_name),
            "thumbnail": large_image,
            "icon": "DefaultMusic.png",
            "poster": large_image,
            "info": {"artist": artist_name},
            "info_type": "music",
            "context_menu": context_menu,
        }

        items.append(item)
    if start_index + items_per_page < total_results:
        items.append(
            {
                "label": _("Next >>"),
                "icon": get_icon_path("item_next"),
                "path": plugin.url_for(music_search_track_term, term=term, page=int(page) + 1),
            }
        )
    return items
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:52,代码来源:music.py


示例15: music_search_track_term

def music_search_track_term(term, page):
    search_results = lastfm.search_track(term, page)
    tracks = search_results["trackmatches"]["track"]
    items_per_page = search_results["opensearch:itemsPerPage"]
    start_index = search_results["opensearch:startIndex"]
    total_results = search_results["opensearch:totalResults"]
    items = []
    for track in tracks:
        large_image = track["image"][-1]["#text"]
        track_name = to_utf8(track["name"])
        artist_name = to_utf8(track["artist"])
        context_menu = [
            (
                "{0} {1} {2}...".format(_("Select"), _("Audio").lower(), _("Stream").lower()),
                "PlayMedia({0})".format(plugin.url_for("music_play_audio", artist_name=artist_name,
                                                       track_name=track_name, mode='context'))
            ),
            (
                _("Scan item to library"),
                "RunPlugin({0})".format(plugin.url_for("music_add_to_library", artist_name=artist_name,
                                                       track_name=track_name))
            ),
            (
                "{0} {1} {2}...".format(_("Select"), _("Video").lower(), _("Stream").lower()),
                "RunPlugin({0})".format(plugin.url_for("music_play_video", artist_name=artist_name,
                                                       track_name=track_name, mode='context'))
            )
        ]
        item = {
            'label': "{0} - {1}".format(artist_name, track_name),
            'path': plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name),
            'thumbnail': large_image,
            'icon': "DefaultMusic.png",
            'poster': large_image,
            'info': {
                'artist': artist_name,
            },
            'info_type': 'music',
            'context_menu': context_menu
        }

        items.append(item)
    if start_index + items_per_page < total_results:
        items.append({
            'label': _("Next >>"),
            'icon': get_icon_path("item_next"),
            'path': plugin.url_for("music_search_track_term", term=term, page=int(page) + 1)
        })
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
开发者ID:vphuc81,项目名称:MyRepository,代码行数:50,代码来源:music.py


示例16: lists_search_for_lists_term

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)
开发者ID:vphuc81,项目名称:MyRepository,代码行数:49,代码来源:lists.py


示例17: music_artist_album_tracks

def music_artist_album_tracks(artist_name, album_name):
    artist_name = to_utf8(artist_name)
    album_name = to_utf8(album_name)
    results = lastfm.get_album_info(artist_name, album_name)
    items = []
    for track in results["tracks"]["track"]:
        track_name = to_utf8(track["name"])
        track_number = track["@attr"]["rank"]
        image = results["image"][-1]["#text"]
        context_menu = [
            (
                "{0} {1} {2}...".format(_("Select"), _("Audio").lower(), _("Stream").lower()),
                "PlayMedia({0})".format(plugin.url_for("music_play_audio", artist_name=artist_name,
                                                       track_name=track_name, mode='context'))
            ),
            (
                _("Scan item to library"),
                "RunPlugin({0})".format(plugin.url_for("music_add_to_library", artist_name=artist_name,
                                                       track_name=track_name, album_name=album_name))
            ),
            (
                "{0} {1} {2}...".format(_("Select"), _("Video").lower(), _("Stream").lower()),
                "RunPlugin({0})".format(plugin.url_for("music_play_video", artist_name=artist_name,
                                                       track_name=track_name, mode='default'))
            )
        ]
        if plugin.get_setting(SETTING_PREFERRED_MUSIC_TYPE, unicode) == "audio":
            item = {
                'label': "{0}. {1}".format(track_number, track_name),
                'path': plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name),
                'thumbnail': image,
                'icon': "DefaultMusic.png",
                'poster': image,
                'info_type': 'music',
                'context_menu': context_menu,
            }
        else:
            item = {
                'label': "{0}. {1}".format(track_number, track_name),
                'path': plugin.url_for("music_play_video", artist_name=artist_name, album_name=album_name, track_name=track_name),
                'thumbnail': image,
                'icon': "DefaultMusicVideo.png",
                'poster': image,
                'info_type': 'music',
                'context_menu': context_menu,
            }
        items.append(item)
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
开发者ID:vphuc81,项目名称:MyRepository,代码行数:49,代码来源:music.py


示例18: music_artist

def music_artist(name):
    name = to_utf8(name)
    items = [
        {
            "label": _("Tracks"),
            "path": plugin.url_for("music_artist_tracks", artist_name=name),
            "icon": get_icon_path("music"),
        },
        {
            "label": _("Albums"),
            "path": plugin.url_for("music_artist_albums", artist_name=name),
            "icon": get_icon_path("music"),
        },
    ]
    return items
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:15,代码来源:music.py


示例19: lists

def lists():
    """ Lists directory """
    items = [
        {
            'label': _("Trakt liked lists"),
            'path': plugin.url_for("lists_trakt_liked_lists"),
            'icon': get_icon_path("tv"),  # TODO
        },
        {
            'label': _("Trakt my lists"),
            'path': plugin.url_for("lists_trakt_my_lists"),
            'icon': get_icon_path("tv"),  # TODO
        }
    ]
    return items
开发者ID:OpenELEQ,项目名称:testing.meta,代码行数:15,代码来源:lists.py


示例20: make_movie_item

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
    }
开发者ID:vphuc81,项目名称:MyRepository,代码行数:48,代码来源:movies.py



注:本文中的meta.plugin.url_for函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python text.to_utf8函数代码示例发布时间:2022-05-27
下一篇:
Python plugin.get_setting函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap