scrub: Use syspath in beet scrub (#1297)

This commit is contained in:
Adrian Sampson 2015-02-02 10:42:31 -08:00
parent 465719a208
commit 313c3807aa
2 changed files with 6 additions and 4 deletions

View file

@ -71,10 +71,11 @@ class ScrubPlugin(BeetsPlugin):
# Get album art if we need to restore it.
if opts.write:
try:
mf = mediafile.MediaFile(item.path,
mf = mediafile.MediaFile(util.syspath(item.path),
config['id3v23'].get(bool))
except IOError as exc:
self._log.error(u'scrubbing failed: {0}', exc)
self._log.error(u'could not open file to scrub: {0}',
exc)
art = mf.art
# Remove all tags.
@ -86,7 +87,7 @@ class ScrubPlugin(BeetsPlugin):
item.try_write()
if art:
self._log.info(u'restoring art')
mf = mediafile.MediaFile(item.path)
mf = mediafile.MediaFile(util.syspath(item.path))
mf.art = art
mf.save()

View file

@ -94,7 +94,8 @@ Fixes:
* :doc:`/plugins/embedart`: Fix a crash that occured when used together
with the *check* plugin. :bug:`1241`
* :doc:`/plugins/scrub`: Log an error instead of stopping when the ``beet
scrub`` command cannot write a file. :bug:`1297`
scrub`` command cannot write a file. Also, avoid problems on Windows with
Unicode filenames. :bug:`1297`
For developers: