mirror of
https://github.com/beetbox/beets.git
synced 2025-12-09 01:54:08 +01:00
decode ipfs item paths to satisy python -bb
This commit is contained in:
parent
8c1e9e0dd4
commit
b9cd889ef4
2 changed files with 9 additions and 5 deletions
|
|
@ -272,9 +272,11 @@ class IPFSPlugin(BeetsPlugin):
|
||||||
break
|
break
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
item_path = os.path.basename(item.path).decode(
|
||||||
|
util._fsencoding(), 'ignore'
|
||||||
|
)
|
||||||
# Clear current path from item
|
# Clear current path from item
|
||||||
item.path = '/ipfs/{0}/{1}'.format(album.ipfs,
|
item.path = '/ipfs/{0}/{1}'.format(album.ipfs, item_path)
|
||||||
os.path.basename(item.path))
|
|
||||||
|
|
||||||
item.id = None
|
item.id = None
|
||||||
items.append(item)
|
items.append(item)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ from __future__ import division, absolute_import, print_function
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
|
||||||
from beets import library
|
from beets import library
|
||||||
from beets.util import bytestring_path
|
from beets.util import bytestring_path, _fsencoding
|
||||||
from beetsplug.ipfs import IPFSPlugin
|
from beetsplug.ipfs import IPFSPlugin
|
||||||
|
|
||||||
from test import _common
|
from test import _common
|
||||||
|
|
@ -51,9 +51,11 @@ class IPFSPluginTest(unittest.TestCase, TestHelper):
|
||||||
for check_item in added_album.items():
|
for check_item in added_album.items():
|
||||||
try:
|
try:
|
||||||
if check_item.ipfs:
|
if check_item.ipfs:
|
||||||
|
ipfs_item = os.path.basename(want_item.path).decode(
|
||||||
|
_fsencoding(),
|
||||||
|
)
|
||||||
want_path = '/ipfs/{0}/{1}'.format(test_album.ipfs,
|
want_path = '/ipfs/{0}/{1}'.format(test_album.ipfs,
|
||||||
os.path.basename(
|
ipfs_item)
|
||||||
want_item.path))
|
|
||||||
want_path = bytestring_path(want_path)
|
want_path = bytestring_path(want_path)
|
||||||
self.assertEqual(check_item.path, want_path)
|
self.assertEqual(check_item.path, want_path)
|
||||||
self.assertEqual(check_item.ipfs, want_item.ipfs)
|
self.assertEqual(check_item.ipfs, want_item.ipfs)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue