Changed the path format from unicode to bytes.

This commit is contained in:
mried 2015-02-18 19:06:58 +01:00
parent b3fc489305
commit 53cefa328e

View file

@ -26,7 +26,7 @@ from beets.plugins import BeetsPlugin
from beets import mediafile
from beets import ui
from beets.ui import decargs
from beets.util import syspath, normpath, displayable_path
from beets.util import syspath, normpath, displayable_path, bytestring_path
from beets.util.artresizer import ArtResizer
from beets import config
@ -101,14 +101,14 @@ class EmbedCoverArtPlugin(BeetsPlugin):
self.extract_first(normpath(opts.outpath),
lib.items(decargs(args)))
else:
filename = opts.filename or config['art_filename'].get()
filename = bytestring_path(opts.filename or
config['art_filename'].get())
if os.path.dirname(filename) != '':
self._log.error(u"Only specify a name rather than a path "
u"for -n")
return
for album in lib.albums(decargs(args)):
albumpath = album.path.decode('utf-8')
artpath = normpath(os.path.join(albumpath, filename))
artpath = normpath(os.path.join(album.path, filename))
artpath = self.extract_first(artpath, album.items())
if artpath and opts.associate:
album.set_art(artpath)
@ -266,7 +266,7 @@ class EmbedCoverArtPlugin(BeetsPlugin):
self._log.warning(u'Unknown image type in {0}.',
displayable_path(item.path))
return
outpath = outpath.decode('utf-8') + '.' + ext
outpath = outpath + b'.' + ext
self._log.info(u'Extracting album art from: {0} to: {1}',
item, displayable_path(outpath))