当前位置: 首页>>代码示例>>Python>>正文


Python plugin.url_for函数代码示例

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


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


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