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

Python lostfilm.LostFilmTVTracker类代码示例

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

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



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

示例1: test_login_failed_unknown_2

    def test_login_failed_unknown_2(self):
        mock_tracker = LostFilmTVTracker()
        login_mock = Mock(side_effect=Exception)
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({'username': 'monitorrent', 'password': 'monitorrent'})
        self.assertEqual(self.plugin.login(), LoginResult.Unknown)

        login_mock.assert_called_with('monitorrent', 'monitorrent')
开发者ID:werwolfby,项目名称:monitorrent,代码行数:9,代码来源:test_lostfilmtrackerplugin.py


示例2: test_login_failed_incorrect_login_password

    def test_login_failed_incorrect_login_password(self):
        mock_tracker = LostFilmTVTracker()
        mock_tracker.tracker_settings = self.tracker_settings
        login_mock = Mock(side_effect=LostFilmTVLoginFailedException(6, 'incorrect login/password', ''))
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({'username': 'monitorrent', 'password': 'monitorrent'})
        self.assertEqual(self.plugin.login(), LoginResult.IncorrentLoginPassword)

        login_mock.assert_called_with('monitorrent', 'monitorrent')
开发者ID:werwolfby,项目名称:monitorrent,代码行数:10,代码来源:test_lostfilmtrackerplugin.py


示例3: test_login_failed_unknown_1

    def test_login_failed_unknown_1(self):
        mock_tracker = LostFilmTVTracker()
        mock_tracker.tracker_settings = self.tracker_settings
        login_mock = Mock(side_effect=LostFilmTVLoginFailedException(1, 'temp_code', 'temp_message'))
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({'username': 'monitorrent', 'password': 'monitorrent'})
        self.assertEqual(self.plugin.login(), LoginResult.Unknown)

        login_mock.assert_called_with('monitorrent', 'monitorrent')
开发者ID:werwolfby,项目名称:monitorrent,代码行数:10,代码来源:test_lostfilmtrackerplugin.py


示例4: test_download_info

    def test_download_info(self):
        url = 'http://www.lostfilm.tv/browse.php?cat=160'
        tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
        tracker.tracker_settings = self.tracker_settings
        downloads = tracker.get_download_info(url, 4, 22)

        self.assertEqual(3, len(downloads))
        if PY3:
            # Python 3.4+
            self.assertCountEqual(['SD', '720p', '1080p'], [d['quality'] for d in downloads])
        else:
            # Python 2.7
            self.assertItemsEqual(['SD', '720p', '1080p'], [d['quality'] for d in downloads])
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:13,代码来源:test_lostfilmtracker.py


示例5: test_download_info_2

    def test_download_info_2(self):
        url = 'http://www.lostfilm.tv/browse.php?cat=37'
        tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
        tracker.tracker_settings = self.tracker_settings
        downloads_4_9 = tracker.get_download_info(url, 4, 9)

        self.assertEqual(1, len(downloads_4_9))
        self.assertEqual('SD', downloads_4_9[0]['quality'])

        downloads_4_10 = tracker.get_download_info(url, 4, 10)

        self.assertEqual(2, len(downloads_4_10))
        if PY3:
            self.assertCountEqual(['SD', '720p'], [d['quality'] for d in downloads_4_10])
        else:
            self.assertItemsEqual(['SD', '720p'], [d['quality'] for d in downloads_4_10])
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:16,代码来源:test_lostfilmtracker.py


示例6: test_parse_special_rss_title4

 def test_parse_special_rss_title4(self):
     t1 = u'Люди (Humans). Эпизод 8 [WEBRip]. (S01E08)'
     parsed = LostFilmTVTracker.parse_rss_title(t1)
     self.assertEqual(u'Люди', parsed['name'])
     self.assertEqual(u'Humans', parsed['original_name'])
     self.assertEqual(u'Эпизод 8', parsed['title'])
     self.assertIsNone(parsed['original_title'])
     self.assertEqual(u'unknown', parsed['quality'])
     self.assertEqual(u'S01E08', parsed['episode_info'])
     self.assertEqual(1, parsed['season'])
     self.assertEqual(8, parsed['episode'])
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:11,代码来源:test_lostfilmtracker.py


示例7: test_parse_special_rss_title

 def test_parse_special_rss_title(self):
     t1 = u'Под куполом (Under the Dome). Идите дальше/А я останусь (Move On/But I\'m Not) [1080p]. (S03E01E02)'
     parsed = LostFilmTVTracker.parse_rss_title(t1)
     self.assertEqual(u'Под куполом', parsed['name'])
     self.assertEqual(u'Under the Dome', parsed['original_name'])
     self.assertEqual(u'Идите дальше/А я останусь', parsed['title'])
     self.assertEqual(u'Move On/But I\'m Not', parsed['original_title'])
     self.assertEqual(u'1080p', parsed['quality'])
     self.assertEqual(u'S03E01E02', parsed['episode_info'])
     self.assertEqual(3, parsed['season'])
     self.assertEqual(2, parsed['episode'])
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:11,代码来源:test_lostfilmtracker.py


示例8: test_parse_corrent_rss_title1

 def test_parse_corrent_rss_title1(self):
     t1 = u'Мистер Робот (Mr. Robot). уя3вим0сти.wmv (3xpl0its.wmv). (S01E05)'
     parsed = LostFilmTVTracker.parse_rss_title(t1)
     self.assertEqual(u'Мистер Робот', parsed['name'])
     self.assertEqual(u'Mr. Robot', parsed['original_name'])
     self.assertEqual(u'уя3вим0сти.wmv', parsed['title'])
     self.assertEqual(u'3xpl0its.wmv', parsed['original_title'])
     self.assertEqual(u'SD', parsed['quality'])
     self.assertEqual(u'S01E05', parsed['episode_info'])
     self.assertEqual(1, parsed['season'])
     self.assertEqual(5, parsed['episode'])
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:11,代码来源:test_lostfilmtracker.py


示例9: test_login_success

    def test_login_success(self):
        mock_tracker = LostFilmTVTracker()
        mock_tracker.tracker_settings = self.tracker_settings
        mock_tracker.c_uid = '123456'
        mock_tracker.c_pass = 'c3cdf2d2784e81097cda167b8f0674bd'
        mock_tracker.c_uid = 'e9853fcd82cd46a5294349151700643e'
        login_mock = Mock()
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({'username': 'monitorrent', 'password': 'monitorrent'})
        self.assertEqual(self.plugin.login(), LoginResult.Ok)

        login_mock.assert_called_with('monitorrent', 'monitorrent')
开发者ID:werwolfby,项目名称:monitorrent,代码行数:13,代码来源:test_lostfilmtrackerplugin.py


示例10: test_parse_correct_title_strange

 def test_parse_correct_title_strange(self):
     title = LostFilmTVTracker._parse_title(u'Род человеческий')
     self.assertEqual(u'Род человеческий', title['original_name'])
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:3,代码来源:test_lostfilmtracker.py


示例11: test_verify_fail

 def test_verify_fail(self):
     tracker = LostFilmTVTracker("457686", '1'*32, '2'*32)
     tracker.tracker_settings = self.tracker_settings
     self.assertFalse(tracker.verify())
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:4,代码来源:test_lostfilmtracker.py


示例12: test_verify

 def test_verify(self):
     tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
     tracker.tracker_settings = self.tracker_settings
     self.assertTrue(tracker.verify())
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:4,代码来源:test_lostfilmtracker.py


示例13: test_parse_incorrent_rss_title1

 def test_parse_incorrent_rss_title1(self, title):
     self.assertIsNone(LostFilmTVTracker.parse_rss_title(title))
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:2,代码来源:test_lostfilmtracker.py


示例14: setUp

 def setUp(self):
     self.tracker_settings = TrackerSettings(10)
     self.tracker = LostFilmTVTracker()
     self.tracker.tracker_settings = self.tracker_settings
     super(LostFilmTrackerTest, self).setUp()
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:5,代码来源:test_lostfilmtracker.py


示例15: test_download_info_3

 def test_download_info_3(self):
     url = 'http://www.lostfilm.tv/browse_wrong.php?cat=2'
     tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
     tracker.tracker_settings = self.tracker_settings
     self.assertIsNone(tracker.get_download_info(url, 4, 9))
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:5,代码来源:test_lostfilmtracker.py


示例16: LostFilmTrackerTest

class LostFilmTrackerTest(ReadContentMixin, TestCase):
    def setUp(self):
        self.tracker_settings = TrackerSettings(10)
        self.tracker = LostFilmTVTracker()
        self.tracker.tracker_settings = self.tracker_settings
        super(LostFilmTrackerTest, self).setUp()

    @helper.use_vcr()
    def test_login(self):
        self.tracker.login(helper.real_login, helper.real_password)
        self.assertTrue((self.tracker.c_uid == helper.real_uid) or (self.tracker.c_uid == helper.fake_uid))
        self.assertTrue((self.tracker.c_pass == helper.real_pass) or (self.tracker.c_pass == helper.fake_pass))
        self.assertTrue((self.tracker.c_usess == helper.real_usess) or (self.tracker.c_usess == helper.fake_usess))

    @use_vcr()
    def test_fail_login(self):
        with self.assertRaises(LostFilmTVLoginFailedException) as cm:
            self.tracker.login("admin", "FAKE_PASSWORD")
        self.assertEqual(cm.exception.code, 6)
        self.assertEqual(cm.exception.text, u'incorrect login/password')
        self.assertEqual(cm.exception.message, u'Не удалось войти. Возможно не правильный логин/пароль')

    @helper.use_vcr()
    def test_verify(self):
        tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
        tracker.tracker_settings = self.tracker_settings
        self.assertTrue(tracker.verify())

    def test_verify_false(self):
        self.assertFalse(self.tracker.verify())

    @use_vcr()
    def test_verify_fail(self):
        tracker = LostFilmTVTracker("457686", '1'*32, '2'*32)
        tracker.tracker_settings = self.tracker_settings
        self.assertFalse(tracker.verify())

    def test_parse_correct_title(self):
        title = LostFilmTVTracker._parse_title(u'Род человеческий (Extant)')
        self.assertEqual(u'Род человеческий', title['name'])
        self.assertEqual(u'Extant', title['original_name'])

    def test_parse_correct_title_strange(self):
        title = LostFilmTVTracker._parse_title(u'Род человеческий')
        self.assertEqual(u'Род человеческий', title['original_name'])

    @data(('http://www.lostfilm.tv/browse.php?cat=236', True),
          ('http://www.lostfilm.tv/my.php', False))
    @unpack
    def test_can_parse_url(self, url, value):
        self.assertEqual(value, self.tracker.can_parse_url(url))

    @use_vcr()
    def test_parse_correct_url(self):
        title = self.tracker.parse_url('http://www.lostfilm.tv/browse.php?cat=236')
        self.assertEqual(u'12 обезьян', title['name'])
        self.assertEqual(u'12 Monkeys', title['original_name'])

    @use_vcr()
    def test_parse_correct_url_issue_22_1(self):
        title = self.tracker.parse_url('http://www.lostfilm.tv/browse.php?cat=114')
        self.assertEqual(u'Дневники вампира', title['name'])
        self.assertEqual(u'The Vampire Diaries', title['original_name'])

    @use_vcr()
    def test_parse_correct_url_issue_22_2(self):
        title = self.tracker.parse_url('http://www.lostfilm.tv/browse.php?cat=160')
        self.assertEqual(u'Гримм', title['name'])
        self.assertEqual(u'Grimm', title['original_name'])

    @use_vcr()
    def test_parse_incorrect_url_1(self):
        url = 'http://www.lostfilm.tv/browse_wrong.php?cat=236'
        self.assertIsNone(self.tracker.parse_url(url))

    @use_vcr()
    def test_parse_incorrect_url_2(self):
        url = 'http://www.lostfilm.tv/browse.php?cat=2'
        resp = self.tracker.parse_url(url)
        self.assertIsNotNone(resp)
        self.assertNotEqual(resp.status_code, 200)

    @use_vcr()
    def test_parse_series(self):
        url = 'http://www.lostfilm.tv/browse.php?cat=160'
        parsed_url = self.tracker.parse_url(url, True)
        self.assertEqual(160, parsed_url['cat'])
        self.assertEqual(u'Гримм', parsed_url['name'])
        self.assertEqual(u'Grimm', parsed_url['original_name'])
        self.assertEqual(88, len(parsed_url['episodes']))
        self.assertEqual(4, len(parsed_url['complete_seasons']))

    @use_vcr()
    def test_parse_series_without_original_name(self):
        url = 'http://www.lostfilm.tv/browse.php?cat=129'
        parsed_url = self.tracker.parse_url(url, True)
        self.assertEqual(129, parsed_url['cat'])
        self.assertEqual(u'Касл', parsed_url['name'])
        self.assertEqual(u'Castle', parsed_url['original_name'])
        self.assertEqual(119, len(parsed_url['episodes']))
#.........这里部分代码省略.........
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:101,代码来源:test_lostfilmtracker.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python monitors.Monitor类代码示例发布时间:2022-05-27
下一篇:
Python monitoring.stop函数代码示例发布时间: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