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

Python meta.import_tmdb函数代码示例

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

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



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

示例1: movies_batch_add_to_library

def movies_batch_add_to_library():
    """ Batch add movies to library """
    movie_batch_file = plugin.get_setting(SETTING_MOVIES_BATCH_ADD_FILE_PATH)
    if xbmcvfs.exists(movie_batch_file):
        try:
            f = open(xbmc.translatePath(movie_batch_file), 'r')
            r = f.read()
            f.close()
            ids = r.split('\n')
        except: return plugin.notify(msg='Movies Batch Add File', title='Not found', delay=3000, image=get_icon_path("movies"))
        library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))
        import_tmdb()
        for id in ids:
            if "," in id:
                csvs = id.split(',')
                for csv in csvs:
                    if not str(csv).startswith("tt") and csv != "":
                        movie = tmdb.Movies(csv).info()
                        id = movie.get('imdb_id')
                    batch_add_movies_to_library(library_folder, id)
            else:
                if not str(id).startswith("tt") and id != "":
                    movie = tmdb.Movies(id).info()
                    id = movie.get('imdb_id')
                batch_add_movies_to_library(library_folder, id)
        os.remove(xbmc.translatePath(movie_batch_file))
        if xbmcvfs.exists(plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH)): 
            xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/tv/batch_add_to_library)")
            return True
        else:
            xbmc.sleep(1000)
            plugin.notify(msg='Added movie strm-files', title='Starting library scan', delay=3000, image=get_icon_path("movies"))
            scan_library(type="video")
            return True
    elif xbmcvfs.exists(plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH)): xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/tv/batch_add_to_library)")
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:35,代码来源:movies.py


示例2: movies_genre

def movies_genre(id, page):
    """ Movies by genre id """
    import_tmdb()
    result = tmdb.Genres(id).movies(id=id, language=LANG, page=page)
    items = list_tmdb_movies(result)
    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,代码行数:7,代码来源:movies.py


示例3: movies_add_to_library

def movies_add_to_library(src, id):
    """ Add movie to library """
    library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))
    date = None
    if src == "tmdb":
        import_tmdb()
        movie = tmdb.Movies(id).info()
        date = date_to_timestamp(movie.get('release_date'))
        imdb_id = movie.get('imdb_id')
        if imdb_id:
            src = "imdb"
            id = imdb_id
    players = active_players("movies")
    if plugin.get_setting(SETTING_MOVIES_DEFAULT_AUTO_ADD, bool) == True:
        player = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_LIBRARY, unicode)
    else:
        players.insert(0, ADDON_SELECTOR)
        players.insert(0, ADDON_DEFAULT)
        selection = dialogs.select(_("Play with..."), [p.title for p in players])
        if selection == -1:
            return
        player = players[selection]
    # setup library folder
    library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))
    # add to library
    if plugin.get_setting(SETTING_MOVIES_DEFAULT_AUTO_ADD, bool) == True:
        add_movie_to_library(library_folder, src, id, play_plugin=plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_LIBRARY, unicode))
    else:
        add_movie_to_library(library_folder, src, id, play_plugin=ADDON_DEFAULT.id)
    scan_library(type="video")
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:30,代码来源:movies.py


示例4: tmdb_movies_search_term

def tmdb_movies_search_term(term, page):
    """ Perform search of a specified <term>"""
    import_tmdb()
    result = tmdb.Search().movie(query=term, language = LANG, page = page)
    items = list_tmdb_movies(result)
    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,代码行数:7,代码来源:movies.py


示例5: tmdb_movies_most_popular

def tmdb_movies_most_popular(page):
    """ Most popular movies """
    import_tmdb()    
    result = tmdb.Movies().popular(language=LANG, page=page)
    items = list_tmdb_movies(result)
    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,代码行数:7,代码来源:movies.py


示例6: get_episode_parameters

def get_episode_parameters(show, season, episode):
    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['urlname'] = urllib.quote(to_utf8(parameters['clearname']))
    articles = ['a ', 'A ', 'An ', 'an ', 'The ', 'the ']
    parameters['sortname'] = parameters['clearname']
    for article in articles:
        if to_utf8(parameters['clearname']).startswith(article): parameters['sortname'] = to_utf8(parameters['clearname']).replace(article,'')
    parameters['shortname'] = 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['firstaired'] = episode_obj.get('firstaired')
    parameters['year'] = show.get('year', 0)
    parameters['imdb'] = show.get('imdb_id', '')
    parameters['epid'] = episode_obj.get('id')
#    parameters['score'] = show['rating']
#    parameters['vote_count'] = show['ratingcount']
#    parameters['runtime'] = show['runtime']
#    parameters['duration'] = int(show['runtime']) * 60
#    parameters['plot'] = show['overview']
#    parameters['banner'] = "http://thetvdb.com/banners/graphical/" + str(show['id']) + "-g2.jpg"
    parameters['poster'] = "http://thetvdb.com/banners/posters/" + str(show['id']) + "-2.jpg"
    parameters['fanart'] = "http://thetvdb.com/banners/fanart/original/" + str(show['id']) + "-2.jpg"
    parameters['thumbnail'] = "http://thetvdb.com/banners/episodes/" + str(show['id']) + "/" + str(parameters['epid']) + ".jpg"
#    parameters['trailer'] = "plugin://script.extendedinfo/?info=playtvtrailer&tvdb_id=" + str(show['id'])
    try:
        genre = [x for x in show['genre'].split('|') if not x == '']
    except:
        genre = []
    parameters['genre'] = " / ".join(genre)
    is_anime = False
    if parameters['absolute_number'] and parameters['absolute_number'] != '0' and "animation" in parameters['genre'].lower():
        tmdb_results = tmdb.Find(show['id']).info(external_source="tvdb_id") or {}
        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)
    return parameters
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:60,代码来源:tvshows.py


示例7: movies_related

def movies_related(id, page):
    import_tmdb()
    movie = tmdb.Movies(id).info()
    imdb_id = movie.get('imdb_id')
    from trakt import trakt
    results, pages = trakt.trakt_get_related_movies_paginated(imdb_id, page)
    return list_trakt_items(results, pages, page)
开发者ID:vphuc81,项目名称:MyRepository,代码行数:7,代码来源:movies.py


示例8: tmdb_tv_genres

def tmdb_tv_genres():
    import_tmdb()
    result = tmdb.Genres().list_tv(language=LANG)
    genres= dict([(i['id'], i['name']) for i in result['genres'] \
            if i['name'] is not None])
    if genres:
        return genres
    return None
开发者ID:OpenELEQ,项目名称:testing.meta,代码行数:8,代码来源:base.py


示例9: movies_related

def movies_related(id):
    import_tmdb()
    movie = tmdb.Movies(id).info()
    imdb_id = movie.get('imdb_id')
    from trakt import trakt
    results = trakt.trakt_get_related_movies_paginated(imdb_id)
    items = list_trakt_movies_related(results)
    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,代码行数:9,代码来源:movies.py


示例10: guide_movies_play

def guide_movies_play(src, id, mode="external"):
    import_tmdb()
    tmdb_id = None
    if src == "tmdb": tmdb_id = id
    elif src == "imdb":
        info = tmdb.Find(id).info(external_source="imdb_id")
        try: tmdb_id = info["movie_results"][0]["id"]
        except (KeyError, TypeError): pass
    if tmdb_id: play_movie_from_guide(tmdb_id, mode)
    else: plugin.set_resolved_url()
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:10,代码来源:movies.py


示例11: play_movie

def play_movie(tmdb_id, mode):
    import_tmdb()
    # Get players to use
    if mode == 'select':
        play_plugin = ADDON_SELECTOR.id
    elif mode == 'context':
        play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_CONTEXT, unicode)
    elif mode == 'library':
        play_plugin = get_movie_player_plugin_from_library(tmdb_id)
        if not play_plugin or play_plugin == "default":
            play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_LIBRARY, unicode)
    elif mode == 'default':
        play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER, unicode)
    else:
        play_plugin = mode
    if mode == 'default' or mode == 'select': players = active_players("movies")
    else: players = get_players("movies")
    players = [p for p in players if p.id == play_plugin] or players
    if not players:
        xbmc.executebuiltin( "Action(Info)")
        action_cancel()
        return
    # Get movie data from TMDB
    movie = tmdb.Movies(tmdb_id).info(language=LANG, append_to_response="external_ids,videos")
    movie_info = get_movie_metadata(movie)
    # Get movie ids from Trakt
    trakt_ids = get_trakt_ids("tmdb", tmdb_id, movie['original_title'],
                    "movie", parse_year(movie['release_date']))
    # Get parameters
    params = {}
    for lang in get_needed_langs(players):
        if lang == LANG:
            tmdb_data = movie
        else:
            tmdb_data = tmdb.Movies(tmdb_id).info(language=lang)
        params[lang] = get_movie_parameters(tmdb_data)
        if trakt_ids != None:
            params[lang].update(trakt_ids)
        params[lang]['info'] = movie_info
        params[lang] = to_unicode(params[lang])
    # Go for it
    link = on_play_video(mode, players, params, trakt_ids)
    if link:
        movie = tmdb.Movies(tmdb_id).info(language=LANG)
        action_play({
            'label': movie_info['title'],
            'path': link,
            'info': movie_info,
            'is_playable': True,
            'info_type': 'video',
            'thumbnail': movie_info['poster'],
            'poster': movie_info['poster'],
            'properties' : {'fanart_image' : movie_info['fanart']},
        })
开发者ID:vphuc81,项目名称:MyRepository,代码行数:54,代码来源:movies.py


示例12: get_episode_parameters

def get_episode_parameters(show, season, episode):
    import_tmdb()
    
    if season in show and episode in show[season]:
        episode_obj = show[season][episode]
    else:
        dialogs.ok(_("Episode info not found"), "No tvdb information found for {0} - S{1}E{2}".format(
            show['seriesname'], season, episode))
        return
    
    # Get parameters
    parameters = {'id': show['id'], 'season': season, 'episode': episode}
    
    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'], _ = xbmc.getCleanMovieTitle(parameters['showname'])
    parameters['clearname'] = re.sub("(\(.*?\))", "", show['seriesname']).strip()

    parameters['absolute_number'] = episode_obj.get('absolute_number')
    parameters['title'] = episode_obj.get('episodename', str(episode))
    parameters['firstaired'] = episode_obj.get('firstaired')
    parameters['year'] = show.get('year', 0)
    parameters['imdb'] = show.get('imdb_id', '')    

    try:
        genre = [x for x in show['genre'].split('|') if not x == '']
    except:
        genre = []
    parameters['genre'] = " / ".join(genre)

    is_anime = False
    if parameters['absolute_number'] and \
     parameters['absolute_number'] != '0' and \
     "animation" in parameters['genre'].lower():
        tmdb_results = tmdb.Find(show['id']).info(external_source="tvdb_id") or {}
        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)

    return parameters
开发者ID:OpenELEQ,项目名称:meta4kodi,代码行数:52,代码来源:tvshows.py


示例13: get_episode_parameters

def get_episode_parameters(show, season, episode):
    import_tmdb()
    
    episode_obj = show[season][episode]
    
    # Get parameters
    parameters = {'id': show['id'], 'season': season, 'episode': episode}
    
    network = show.get('network', '')
    
    parameters['network'] = network
    parameters['network_clean'] = re.sub("(\(.*?\))", "", network).strip()
    
    parameters['showname'] = show['seriesname']
    #parameters['clearname'], _ = xbmc.getCleanMovieTitle(parameters['showname'])
    parameters['clearname'] = re.sub("(\(.*?\))", "", network).strip()

    parameters['absolute_number'] = episode_obj.get('absolute_number')
    parameters['title'] = episode_obj.get('episodename', str(episode))
    parameters['firstaired'] = episode_obj.get('firstaired')
    parameters['year'] = show.get('year', 0)
    parameters['imdb'] = show.get('imdb_id', '')    

    try:
        genre = [x for x in show['genre'].split('|') if not x == '']
    except:
        genre = []
    parameters['genre'] = " / ".join(genre)

    is_anime = False
    if parameters['absolute_number'] and \
     parameters['absolute_number'] != '0' and \
     "animation" in parameters['genre'].lower():
        tmdb_results = tmdb.Find(show['id']).info(external_source="tvdb_id") or {}
        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)

    for key, value in parameters.items():
        if isinstance(value, basestring):
            parameters[key + "_+"] = value.replace(" ", "+")
            # Hack for really bad addons
            parameters[key + "_escaped"] = value.replace(" ", "%2520")

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


示例14: movies_add_to_library_parsed

def movies_add_to_library_parsed(src, id, player):
    library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER, unicode))
    date = None
    if src == "tmdb":
        import_tmdb()
        movie = tmdb.Movies(id).info()
        date = date_to_timestamp(movie.get('release_date'))
        imdb_id = movie.get('imdb_id')
        if imdb_id:
            if imdb_id != None and imdb_id != "":
                src = "imdb"
                id = imdb_id
    add_movie_to_library(library_folder, src, id, player)
    scan_library(type="video")
开发者ID:vphuc81,项目名称:MyRepository,代码行数:14,代码来源:movies.py


示例15: guide_movies_play_by_name

def guide_movies_play_by_name(name, lang = "en"):
    import_tmdb()
    from meta.utils.text import parse_year
    items = tmdb.Search().movie(query=name, language=lang, page=1)["results"]
    if not items: return dialogs.ok(_("Movie not found"), "{0} {1}".format(_("No movie information found on TMDB for"), name))
    if len(items) > 1:
        selection = dialogs.select(_("Choose Movie"), ["{0} ({1})".format(
            to_utf8(s["title"]),
            parse_year(s["release_date"])) for s in items])
    else: selection = 0
    if selection != -1:
        id = items[selection]["id"]
        guide_movies_play("tmdb", id, "default")
        if plugin.get_setting(SETTING_MOVIES_PLAYED_BY_ADD, converter=bool) == True: movies_add_to_library("tmdb", id)
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:14,代码来源:movies.py


示例16: movies_play_by_name

def movies_play_by_name(name, lang = "en"):
    """ Activate tv search """
    import_tmdb()
    from meta.utils.text import parse_year
    items = tmdb.Search().movie(query=name, language=lang, page=1)["results"]
    if not items: return dialogs.ok(_("%s not found") % _("Movie"), "{0} {1}".format(_("No movie information found on TMDB for"), name))
    if len(items) > 1:
        selection = dialogs.select("{0}".format(_("Choose thumbnail").replace(_("Thumbnail").lower(),_("Movie").lower())), ["{0} ({1})".format(
            to_utf8(s["title"]),
            parse_year(s["release_date"])) for s in items])
    else: selection = 0
    if selection != -1:
        id = items[selection]["id"]
        movies_play("tmdb", id, "context")
        if plugin.get_setting(SETTING_MOVIES_PLAYED_BY_ADD, bool) == True: movies_add_to_library("tmdb", id)
开发者ID:vphuc81,项目名称:MyRepository,代码行数:15,代码来源:movies.py


示例17: movies_play_by_name

def movies_play_by_name(name, lang = "en"):
    """ Activate tv search """
    import_tmdb()
    from meta.utils.text import parse_year

    items = tmdb.Search().movie(query=name, language=LANG, page=1)["results"]

    if len(items) > 1:
        selection = dialogs.select(_("Choose Movie"),
                                   [to_utf8(s["title"]) + " (" + parse_year(s["release_date"]) + ")" for s in items])
    else:
        selection = 0
    if selection != -1:
        id = items[selection]["id"]
        movies_play("tmdb", id, "default")
开发者ID:OpenELEQ,项目名称:testing.meta.more,代码行数:15,代码来源:movies.py


示例18: movies_add_to_library

def movies_add_to_library(id):
    """ Add movie to library """
    library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))

    # TODO: we actually prefer tmdb...
    
    import_tmdb()
    movie = tmdb.Movies(id).info()
    imdb_id = movie.get('imdb_id')
    date = date_to_timestamp(movie.get('release_date'))
    if imdb_id:
        add_movie_to_library(library_folder, "imdb", imdb_id, date)
    else:
        add_movie_to_library(library_folder, "tmdb", id, date)
    
    scan_library()
开发者ID:itzikg,项目名称:meta4kodi,代码行数:16,代码来源:movies.py


示例19: movies_add_to_library

def movies_add_to_library(src, id):
    """ Add movie to library """
    library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))

    date = None
    if src == "tmdb":
        import_tmdb()

        movie = tmdb.Movies(id).info()
        date = date_to_timestamp(movie.get('release_date'))
        imdb_id = movie.get('imdb_id')
        if imdb_id:
            src = "imdb"
            id = imdb_id
    
    add_movie_to_library(library_folder, src, id, date)   
    scan_library()
开发者ID:OpenELEQ,项目名称:meta4kodi,代码行数:17,代码来源:movies.py


示例20: get_movie_player_plugin_from_library

def get_movie_player_plugin_from_library(id):
    # Specified by user
    try:
        if not str(id).startswith("tt"):
            import_tmdb()
            movie = tmdb.Movies(id).info()
            imdb_id = movie.get('imdb_id')
        else: imdb_id = id
        if imdb_id:
            src = "imdb"
            id = imdb_id
            library_folder = plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER, unicode)
            player_file = xbmcvfs.File(os.path.join(library_folder, str(id), "player.info"))
            content = player_file.read()
            player_file.close()
        if content: return content
    except: pass
    return None
开发者ID:vphuc81,项目名称:MyRepository,代码行数:18,代码来源:movies.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python meta.mapper函数代码示例发布时间:2022-05-27
下一篇:
Python messytables.type_guess函数代码示例发布时间: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