Esempio n. 1
0
 def _load_with_config(self, values, should_raise):
     if should_raise:
         for v in values:
             config['fetchart']['enforce_ratio'] = v
             with self.assertRaises(confuse.ConfigValueError):
                 fetchart.FetchArtPlugin()
     else:
         for v in values:
             config['fetchart']['enforce_ratio'] = v
             fetchart.FetchArtPlugin()
Esempio n. 2
0
    def setUp(self):
        super(CombinedTest, self).setUp()
        self.dpath = os.path.join(self.temp_dir, 'arttest')
        os.mkdir(self.dpath)

        # Set up configuration.
        fetchart.FetchArtPlugin()
Esempio n. 3
0
    def setUp(self):
        super(CombinedTest, self).setUp()

        self.dpath = os.path.join(self.temp_dir, 'arttest')
        os.mkdir(self.dpath)
        self.old_urlopen = fetchart.urllib.urlopen
        fetchart.urllib.urlopen = self._urlopen
        self.page_text = ""
        self.urlopen_called = False

        # Set up configuration.
        fetchart.FetchArtPlugin()
Esempio n. 4
0
    def setUp(self):
        super(ArtImporterTest, self).setUp()

        # Mock the album art fetcher to always return our test file.
        self.art_file = os.path.join(self.temp_dir, 'tmpcover.jpg')
        _common.touch(self.art_file)
        self.old_afa = fetchart.art_for_album
        self.afa_response = self.art_file

        def art_for_album(i, p, maxwidth=None, local_only=False):
            return self.afa_response

        fetchart.art_for_album = art_for_album

        # Test library.
        self.libpath = os.path.join(self.temp_dir, 'tmplib.blb')
        self.libdir = os.path.join(self.temp_dir, 'tmplib')
        os.mkdir(self.libdir)
        os.mkdir(os.path.join(self.libdir, 'album'))
        itempath = os.path.join(self.libdir, 'album', 'test.mp3')
        shutil.copyfile(os.path.join(_common.RSRC, 'full.mp3'), itempath)
        self.lib = library.Library(self.libpath)
        self.i = _common.item()
        self.i.path = itempath
        self.album = self.lib.add_album([self.i])
        self.lib._connection().commit()

        # The plugin and import configuration.
        self.plugin = fetchart.FetchArtPlugin()
        self.session = _common.import_session(self.lib)

        # Import task for the coroutine.
        self.task = importer.ImportTask(None, None, [self.i])
        self.task.is_album = True
        self.task.album = self.album
        info = AlbumInfo(
            album='some album',
            album_id='albumid',
            artist='some artist',
            artist_id='artistid',
            tracks=[],
        )
        self.task.set_choice(AlbumMatch(0, info, {}, set(), set()))
Esempio n. 5
0
 def setUp(self):
     super(DeprecatedConfigTest, self).setUp()
     config['fetchart']['remote_priority'] = True
     self.plugin = fetchart.FetchArtPlugin()
Esempio n. 6
0
 def setUp(self):
     super(UseThePlugin, self).setUp()
     self.plugin = fetchart.FetchArtPlugin()
Esempio n. 7
0
 def setUp(self):
     super().setUp()
     config['fetchart']['remote_priority'] = True
     self.plugin = fetchart.FetchArtPlugin()
Esempio n. 8
0
 def setUp(self):
     super().setUp()
     self.plugin = fetchart.FetchArtPlugin()