mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-29 06:02:06 +00:00
fix: UnicodeEncodeError: 'utf-8' codec can't encode character '\udce0' in position 99: surrogates not allowed
This commit is contained in:
parent
34c26416e2
commit
f2e110a564
@ -42,9 +42,15 @@ class SQLiteTrackMethods:
|
|||||||
:date, :disc, :duration, :filepath, :folder, :genre, :last_mod, :title, :track, :trackhash)
|
:date, :disc, :duration, :filepath, :folder, :genre, :last_mod, :title, :track, :trackhash)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
|
||||||
track = OrderedDict(sorted(track.items()))
|
track = OrderedDict(sorted(track.items()))
|
||||||
|
|
||||||
|
def force_surrogatepass(string: str):
|
||||||
|
return string.encode("utf-16", "surrogatepass").decode("utf-16")
|
||||||
|
|
||||||
|
for key, value in track.items():
|
||||||
|
if isinstance(value, str):
|
||||||
|
track[key] = force_surrogatepass(value)
|
||||||
|
|
||||||
track["artist"] = track["artists"]
|
track["artist"] = track["artists"]
|
||||||
track["albumartist"] = track["albumartists"]
|
track["albumartist"] = track["albumartists"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user