Example #1
0
class TestScraperChain(unittest.TestCase):
    bootstrapper.bootstrap()

    def setUp(self):
        self.chain = RequiredFeature('scraper-chain').request()

    def testReturnType(self):
        game_name = 'Half-Life 2'
        game = self.chain.query_game_information(game_name)
        self.assertEqual(isinstance(game, Game), True)

    def testImageDump(self):
        game_name = 'Half-Life 2'
        game = self.chain.query_game_information(game_name)

        for img_id in game.fanarts:
            art = game.fanarts.get(img_id)
            self.assertEqual(os.path.isfile(art.get_thumb()), True)
            if art != game.get_selected_fanart():
                self.assertEqual(os.path.isfile(art.get_original()), False)
            else:
                self.assertEqual(os.path.isfile(art.get_original()), True)

        for img_path in game.posters:
            self.assertEqual(os.path.isfile(img_path), True)

        self.assertEqual(os.path.isfile(game.get_selected_fanart().get_original()), True)

    def tearDown(self):
        self.chain.reset_cache()
Example #2
0
def reset_cache():
    core = RequiredFeature('core').request()
    confirmed = xbmcgui.Dialog().yesno(core.string('name'),
                                       core.string('reset_cache_warning'))

    if confirmed:
        scraper_chain = RequiredFeature('scraper-chain').request()
        scraper_chain.reset_cache()
        del scraper_chain

    del core
Example #3
0
def reset_cache():
    import xbmcgui
    core = RequiredFeature('core').request()
    confirmed = xbmcgui.Dialog().yesno(
            core.string('name'),
            core.string('reset_cache_warning')
    )

    if confirmed:
        scraper_chain = RequiredFeature('scraper-chain').request()
        scraper_chain.reset_cache()
        del scraper_chain

    del core
Example #4
0
def reset_cache():
    import xbmcgui
    if plugin.get_setting('last_run', str):
        plugin.set_setting('last_run', '')
    core = RequiredFeature('core').request()
    confirmed = xbmcgui.Dialog().yesno(core.string('name'),
                                       core.string('reset_cache_warning'))

    if confirmed:
        scraper_chain = RequiredFeature('scraper-chain').request()
        scraper_chain.reset_cache()
        del scraper_chain

    del core