use urllib to un-escape quotes

This commit is contained in:
2022-05-07 20:13:05 +02:00
parent 74dc385a49
commit 4d617a956c

View File

@@ -8,6 +8,7 @@ import mutagen.id3
from mutagen.id3 import ID3, TIT2, TIT3, TALB, TRCK, TYER from mutagen.id3 import ID3, TIT2, TIT3, TALB, TRCK, TYER
import os import os
from shutil import copyfile from shutil import copyfile
from urllib import unquote
import xml.etree.cElementTree as xml import xml.etree.cElementTree as xml
@@ -39,10 +40,10 @@ def copy_file(track: Track, targetFolder) -> str:
""" """
Copies a track from its source to the destination folder Copies a track from its source to the destination folder
""" """
path = track.Location[7:] path = unquote(track.Location[7:])
dst = os.path.join(targetFolder, os.path.basename(path)) dst = os.path.join(targetFolder, os.path.basename(path))
if (os.path.exists(path)): if (os.path.exists(path)):
print('Copying file {0}'.capitalizeformat(path)) print('Copying file {0}'.format(path))
copyfile(path, dst) copyfile(path, dst)
else: else:
print('File {0} not found.'.format(path)) print('File {0} not found.'.format(path))