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


Python TVDB.search方法代码示例

本文整理汇总了Python中pytvdbapi.api.TVDB.search方法的典型用法代码示例。如果您正苦于以下问题:Python TVDB.search方法的具体用法?Python TVDB.search怎么用?Python TVDB.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pytvdbapi.api.TVDB的用法示例。


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

示例1: test_unicode_search

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_unicode_search(self):
        """
        It should be possible to search for shows containing non ascii chars
        """

        api = TVDB("B43FF87DE395DF56")

        search = api.search("Alarm für cobra 11", "de")
        show = search[0]
        self.assertEqual(show[1][2].EpisodeName, "Rote Rosen, schwarzer Tod")

        search = api.search('3年B組金八先生', "zh")
        show = search[0]
        self.assertEqual(show[1][1].EpisodeName, "3年B組金八先生")
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:16,代码来源:test_api.py

示例2: test_search

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_search(self):
        """It should be possible to search for shows"""
        api = TVDB("B43FF87DE395DF56")
        search = api.search("dexter", "en")

        self.assertEqual(len(search), 1)

        search = api.search("scrubs", "en")
        self.assertEqual(len(search), 2)

        search = api.search("dexter", "en")

        self.assertEqual(len(search), 1)
        self.assertEqual(search.search, "dexter")
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:16,代码来源:test_api.py

示例3: test_iterate_search

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_iterate_search(self):
        """It should be possible to iterate over a search result"""
        api = TVDB("B43FF87DE395DF56")
        search = api.search("house", "en")

        for s in search:
            self.assertEqual(type(s), pytvdbapi.api.Show)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:9,代码来源:test_api.py

示例4: test_force_language

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_force_language(self):
        """
        It should be possible to use the "force_lang" keyword when
        creating the TVDB instance
        """

        api = TVDB("B43FF87DE395DF56", force_lang=True)
        search = api.search("dexter", "it")

        self.assertEqual(len(search), 2)
开发者ID:toroettg,项目名称:pytvdbapi,代码行数:12,代码来源:test_api.py

示例5: test_invalid_search_index

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_invalid_search_index(self):
        """Search should raise TVDBIndexError when trying to access an
        invalid index
        """
        api = TVDB("B43FF87DE395DF56")
        search = api.search("dexter", "en")

        self.assertRaises(error.TVDBIndexError, search.__getitem__, 2)
        self.assertRaises(error.TVDBIndexError, search.__getitem__, 5)
        self.assertRaises(error.TVDBIndexError, search.__getitem__, 100)
        self.assertRaises(error.TVDBIndexError, search.__getitem__, "foo")
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:13,代码来源:test_api.py

示例6: test_attribute_case

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_attribute_case(self):
        """
        When ignore_case is False, all attributes should be case sensitive
        """
        api = TVDB("B43FF87DE395DF56", ignore_case=False)
        search = api.search("friends", 'en')

        # Load and update the show
        show = search[0]
        show.update()

        self.assertRaises(error.TVDBAttributeError, show.__getattr__, "ImDB_id")
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:14,代码来源:test_api.py

示例7: test_ignore_case

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_ignore_case(self):
        """
        It should be possible to pass the ignore_case keyword to the api
        and access all show/season/episode attributes in a case insensitive
        way.
        """
        api = TVDB("B43FF87DE395DF56", ignore_case=True)
        search = api.search("friends", 'en')

        # Load and update the show
        show = search[0]
        show.update()

        self.assertEqual(show.IMDB_ID, show.imdb_id)
        self.assertEqual(show.ImDB_id, show.imDb_Id)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:17,代码来源:test_api.py

示例8: test_names_with_spaces

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_names_with_spaces(self):
        """It should be possible to search for shows with spaces in the name"""
        api = TVDB("B43FF87DE395DF56")
        search = api.search("How I Met Your Mother", "en")

        self.assertEqual(len(search), 1)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:8,代码来源:test_api.py

示例9: test_case_insensitive

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
    def test_case_insensitive(self):
        """The test should be case insensitive"""
        api = TVDB("B43FF87DE395DF56")
        search = api.search("DeXtEr", "en")

        self.assertEqual(len(search), 1)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:8,代码来源:test_api.py

示例10: _load_show

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def _load_show(show):
    """Helper function to load a show show from server"""
    api = TVDB("B43FF87DE395DF56")

    search = api.search(show, "en")
    return search[0]
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:8,代码来源:test_api.py

示例11: get

# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
 def get(self, language, name):
     db = TVDB(tvdb_api_key)
     shows = db.search(name, language)
     shows = [show_to_dict(show) for show in shows]
     data = {"status": "success", "data": shows}
     self.write(data)
开发者ID:notsure,项目名称:stream-mania,代码行数:8,代码来源:shows.py


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