mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 09:33:46 +01:00
fetchart: Fix path types on Windows
This commit is contained in:
parent
27bd4c5570
commit
f400a2431e
4 changed files with 11 additions and 6 deletions
|
|
@ -31,6 +31,7 @@ from beets import util
|
|||
from beets import config
|
||||
from beets.util.artresizer import ArtResizer
|
||||
from beets.util import confit
|
||||
from beets.util import syspath, bytestring_path
|
||||
|
||||
try:
|
||||
import itunes
|
||||
|
|
@ -599,15 +600,16 @@ class FileSystem(LocalArtSource):
|
|||
cautious = extra['cautious']
|
||||
|
||||
for path in paths:
|
||||
if not os.path.isdir(path):
|
||||
if not os.path.isdir(syspath(path)):
|
||||
continue
|
||||
|
||||
# Find all files that look like images in the directory.
|
||||
images = []
|
||||
for fn in os.listdir(path):
|
||||
for fn in os.listdir(syspath(path)):
|
||||
fn = bytestring_path(fn)
|
||||
for ext in IMAGE_EXTENSIONS:
|
||||
if fn.lower().endswith(b'.' + ext.encode('utf8')) and \
|
||||
os.path.isfile(os.path.join(path, fn)):
|
||||
os.path.isfile(syspath(os.path.join(path, fn))):
|
||||
images.append(fn)
|
||||
|
||||
# Look for "preferred" filenames.
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ Some fixes for Windows:
|
|||
addition to forward slashes). This only applies on Windows.
|
||||
* :doc:`/plugins/embedart`: Image similarity comparison with ImageMagick
|
||||
should now work on Windows.
|
||||
* :doc:`/plugins/fetchart`: The plugin should work more reliably with
|
||||
non-ASCII paths.
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
|||
|
|
@ -454,9 +454,9 @@ class TestHelper(object):
|
|||
|
||||
parent = os.path.dirname(path)
|
||||
if not os.path.isdir(parent):
|
||||
os.makedirs(parent)
|
||||
os.makedirs(util.syspath(parent))
|
||||
|
||||
with open(path, 'a+') as f:
|
||||
with open(util.syspath(path), 'a+') as f:
|
||||
f.write(content)
|
||||
return path
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ from __future__ import division, absolute_import, print_function
|
|||
import os
|
||||
from test._common import unittest
|
||||
from test.helper import TestHelper
|
||||
from beets import util
|
||||
|
||||
|
||||
class FetchartCliTest(unittest.TestCase, TestHelper):
|
||||
|
|
@ -41,7 +42,7 @@ class FetchartCliTest(unittest.TestCase, TestHelper):
|
|||
|
||||
self.album.load()
|
||||
self.assertEqual(self.album['artpath'], cover_path)
|
||||
with open(cover_path, 'r') as f:
|
||||
with open(util.syspath(cover_path), 'r') as f:
|
||||
self.assertEqual(f.read(), 'IMAGE')
|
||||
|
||||
def test_filesystem_does_not_pick_up_folder(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue