From c56ef31da04ff9a847a1eb07a2583769b7e89f88 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 19 May 2013 10:18:41 -0700 Subject: [PATCH] remove art_filename Library field This is the first of a handful of refactorings that take advantage of the new confit system to simplify parameter passing boilerplate. --- beets/library.py | 8 ++------ beets/ui/__init__.py | 1 - test/test_db.py | 3 ++- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/beets/library.py b/beets/library.py index a8fe0be73..18c0afb06 100644 --- a/beets/library.py +++ b/beets/library.py @@ -1113,7 +1113,6 @@ class Library(BaseLibrary): directory='~/Music', path_formats=((PF_KEY_DEFAULT, '$artist/$album/$track $title'),), - art_filename='cover', timeout=5.0, replacements=None, item_fields=ITEM_FIELDS, @@ -1124,7 +1123,6 @@ class Library(BaseLibrary): self.path = bytestring_path(normpath(path)) self.directory = bytestring_path(normpath(directory)) self.path_formats = path_formats - self.art_filename = art_filename self.replacements = replacements self._memotable = {} # Used for template substitution performance. @@ -1703,11 +1701,9 @@ class Album(BaseAlbum): image = bytestring_path(image) item_dir = item_dir or self.item_dir() - if not isinstance(self._library.art_filename,Template): - self._library.art_filename = Template(self._library.art_filename) - + filename_tmpl = Template(beets.config['art_filename'].get(unicode)) subpath = util.sanitize_path(format_for_path( - self.evaluate_template(self._library.art_filename) + self.evaluate_template(filename_tmpl) )) subpath = bytestring_path(subpath) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 099ea4cc3..e5b78e521 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -729,7 +729,6 @@ def _raw_main(args): dbpath, config['directory'].as_filename(), get_path_formats(), - Template(config['art_filename'].get(unicode)), config['timeout'].as_number(), get_replacements(), ) diff --git a/test/test_db.py b/test/test_db.py index 6dc822e63..f3c3004ed 100644 --- a/test/test_db.py +++ b/test/test_db.py @@ -29,6 +29,7 @@ from _common import item import beets.library from beets import util from beets import plugins +from beets import config TEMP_LIB = os.path.join(_common.RSRC, 'test_copy.blb') @@ -835,10 +836,10 @@ class BaseAlbumTest(_common.TestCase): class ArtDestinationTest(_common.TestCase): def setUp(self): super(ArtDestinationTest, self).setUp() + config['art_filename'] = u'artimage' self.lib = beets.library.Library(':memory:') self.i = item() self.i.path = self.lib.destination(self.i) - self.lib.art_filename = 'artimage' self.ai = self.lib.add_album((self.i,)) def test_art_filename_respects_setting(self):