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.
This commit is contained in:
Adrian Sampson 2013-05-19 10:18:41 -07:00
parent 71666c7ac2
commit c56ef31da0
3 changed files with 4 additions and 8 deletions

View file

@ -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)

View file

@ -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(),
)

View file

@ -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):