Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Next song fails with "FAILED TO QUERY METADATA" when previous downloaded track has unicode chars in name or author ("incomplete escape \U at position 3") #211

Open
mkorning opened this issue Nov 13, 2024 · 1 comment

Comments

@mkorning
Copy link

mkorning commented Nov 13, 2024

Description:
Given a playlist with at least 1 song with foreign unicode chars in song title and/or album name and/or author, when the playlist is downloaded via zotify, the physical song with unicode chars will download, however the metadata wil fail to download and this will cause the next song to fail to download and return
## SKIPPING SONG - FAILED TO QUERY METADATA ###

...Followed by
incomplete escape \U at position 3

Note that with some song names with unicode chars, the next 3 songs (which do not have unicode) will fail for download, but for some others it's only the next single song (also without unicode) - (possibly due to variable byte-length of specific chars). Then after these 1-3 track failures, download recovers and succeeds on the next track(s) - unless other songs in the playlist also have unicode. I have repeated this with many playlists (with 1 or more unicode chars in track names) and I get the same result.

e.g.:
This playlist: https://open.spotify.com/playlist/3cMXTkP11GBDoNitE7jtJk?si=963050a5ecf946b3
Containing this artist/song at track #4: "Myrkur - Två Konungabarn (Single)"


###   SKIPPING: Myrkur - Två Konungabarn (Single) (SONG ALREADY EXISTS)   ###


###   SKIPPING SONG - FAILED TO QUERY METADATA   ###
Track_ID: 5ErGc51SWCg6C6pvSJxzNg
playlist: D&D-Lyric (Ctrl+Shift+L)
playlist_num: 05


incomplete escape \U at position 3

Traceback (most recent call last):
  File "C:\Users\xymok\pipx\venvs\zotify\Lib\site-packages\zotify\track.py", line 190, in download_track
    c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}_', str(file))]) + 1
                                                         ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\__init__.py", line 177, in search
    return _compile(pattern, flags).search(string)
           ~~~~~~~~^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\__init__.py", line 350, in _compile
    p = _compiler.compile(pattern, flags)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 459, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                       not nested and not items))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 543, in _parse
    code = _escape(source, this, state)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 397, in _escape
    raise source.error("incomplete escape %s" % escape, len(escape))
re.PatternError: incomplete escape \U at position 3



###   SKIPPING SONG - FAILED TO QUERY METADATA   ###
Track_ID: 01pGPwb1OkC5JflWmcqeYQ
playlist: D&D-Lyric (Ctrl+Shift+L)
playlist_num: 06


incomplete escape \U at position 3

Traceback (most recent call last):
  File "C:\Users\xymok\pipx\venvs\zotify\Lib\site-packages\zotify\track.py", line 190, in download_track
    c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}_', str(file))]) + 1
                                                         ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\__init__.py", line 177, in search
    return _compile(pattern, flags).search(string)
           ~~~~~~~~^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\__init__.py", line 350, in _compile
    p = _compiler.compile(pattern, flags)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 459, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                       not nested and not items))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 543, in _parse
    code = _escape(source, this, state)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 397, in _escape
    raise source.error("incomplete escape %s" % escape, len(escape))
re.PatternError: incomplete escape \U at position 3



###   SKIPPING SONG - FAILED TO QUERY METADATA   ###
Track_ID: 667Zhsq8Zcs9iPhb5jJVeo
playlist: D&D-Lyric (Ctrl+Shift+L)
playlist_num: 07


incomplete escape \U at position 3

Traceback (most recent call last):
  File "C:\Users\xymok\pipx\venvs\zotify\Lib\site-packages\zotify\track.py", line 190, in download_track
    c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}_', str(file))]) + 1
                                                         ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\__init__.py", line 177, in search
    return _compile(pattern, flags).search(string)
           ~~~~~~~~^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\__init__.py", line 350, in _compile
    p = _compiler.compile(pattern, flags)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 459, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                       not nested and not items))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 543, in _parse
    code = _escape(source, this, state)
  File "C:\Users\xymok\scoop\apps\python\current\Lib\re\_parser.py", line 397, in _escape
    raise source.error("incomplete escape %s" % escape, len(escape))
re.PatternError: incomplete escape \U at position 3



###   Downloaded "Heilung - Fylgija Ear" to "D&D-Lyric (Ctrl+Shift+L)\Heilung - Fylgija Ear.mp3" in 08:34 (plus 11s converting)   ###

Fylgija Ear: 100%|████████████████████████████████████████████████████████████████| 8.00/8.00 [08:53<00:00, 66.7s/song]                                                                                          
**All playlists have been downloaded**

Originally posted by @mkorning in #210

@mkorning mkorning changed the title [Bug] Next 3 songs fail with "FAILED TO QUERY METADATA" when previous downloaded track has unicode chars in name or author ("incomplete escape \U at position 3") [Bug] Next song fails with "FAILED TO QUERY METADATA" when previous downloaded track has unicode chars in name or author ("incomplete escape \U at position 3") Nov 14, 2024
@tschogger
Copy link

same over here - not only with playlists, also with albums, what seems to work fine are podcasts

SKIPPING SONG - FAILED TO QUERY METADATA

Track_ID: 5OqwQz0LcsDDK0oPrS9z4Z
playlist_song_name: Lullaby For You
playlist: Peaceful Sleep
playlist_num: 8
playlist_id: 0GssTF0HL6S0pnExTIJT3V
playlist_track_id: 5OqwQz0LcsDDK0oPrS9z4Z

incomplete escape \U at position 3

Traceback (most recent call last):
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\site-packages\zotify\track.py", line 190, in download_track
c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}', str(file))]) + 1
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\site-packages\zotify\track.py", line 190, in
c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}
', str(file))]) + 1
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\re.py", line 201, in search
return _compile(pattern, flags).search(string)
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\sre_parse.py", line 525, in _parse
code = _escape(source, this, state)
File "C:\Users\tscho\AppData\Local\Programs\Python\Python39\lib\sre_parse.py", line 381, in _escape
raise source.error("incomplete escape %s" % escape, len(escape))
re.error: incomplete escape \U at position 3`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants