コード例 #1
0
    def test_end_to_end_tvdb_flow(self):
        no_op = NoOpFanartProvider()
        tvdb = TvdbFanartProvider(self.platform)
        fileCache = FileCache(os.path.join(self.sandbox, 'http'),
                              HttpResolver())
        http = HttpCachingFanartProvider(fileCache, tvdb)
        superfast = SuperFastFanartProvider(self.platform,
                                            http,
                                            filename='tvdb')
        strike = OneStrikeAndYoureOutFanartProvider(self.platform,
                                                    superfast,
                                                    no_op,
                                                    filename='tvdb')

        fields = {
            'title': u'The Real World',
            'subtitle': u'',
            'starttime': socketDateTime(2008, 11, 4, 22, 45, 00),
            'endtime': socketDateTime(2008, 11, 4, 23, 50, 00),
            'airdate': u'2010-07-14'
        }
        #self.assertSeasonAndEpisode(RecordedProgram(data=pdata(fields), **self.deps), u'24', u'3')

        program = RecordedProgram(data=pdata(fields), **self.deps)
        season, episode = strike.getSeasonAndEpisode(program)

        log.info(season)
        log.info(episode)

        self.assertEqual(('24', '3'), (season, episode))

        method = 'getSeasonAndEpisode'

        # verify strikeout provider
        strikeKey = strike.createKey(method, program)
        self.assertFalse(strike.hasStruckOut(strikeKey))

        # verify superfast provider
        superfastKey = superfast.createEpisodeKey(method, program)
        self.assertEqual(superfast.pcache[superfastKey], ('24', '3'))

        strike.close()
コード例 #2
0
ファイル: test_fanart.py プロジェクト: Jajcus/mythbox
    def test_end_to_end_tvdb_flow(self):
        no_op = NoOpFanartProvider()
        tvdb = TvdbFanartProvider(self.platform)
        fileCache = FileCache(os.path.join(self.sandbox, 'http'), HttpResolver())
        http = HttpCachingFanartProvider(fileCache, tvdb)
        superfast = SuperFastFanartProvider(self.platform, http, filename='tvdb')
        strike = OneStrikeAndYoureOutFanartProvider(self.platform, superfast, no_op, filename='tvdb')

        fields = {
            'title'     : u'The Real World',
            'subtitle'  : u'',
            'starttime' : socketDateTime(2008, 11, 4, 22, 45, 00),
            'endtime'   : socketDateTime(2008, 11, 4, 23, 50, 00),
            'airdate'   : u'2010-07-14'
        }
        #self.assertSeasonAndEpisode(RecordedProgram(data=pdata(fields), **self.deps), u'24', u'3')
        
        program = RecordedProgram(data=pdata(fields), **self.deps)
        season, episode = strike.getSeasonAndEpisode(program)
        
        log.info(season)
        log.info(episode)

        self.assertEqual(('24','3'), (season, episode))
        
        method = 'getSeasonAndEpisode'
        
        # verify strikeout provider
        strikeKey = strike.createKey(method, program)
        self.assertFalse(strike.hasStruckOut(strikeKey))
        
        # verify superfast provider
        superfastKey = superfast.createEpisodeKey(method, program)
        self.assertEqual(superfast.pcache[superfastKey], ('24','3'))
        
        strike.close()