Skip to content

add encoding for create m3u file.#235

Open
halepham wants to merge 2 commits intovitiko98:masterfrom
halepham:fix-encode-when-create-m3u-file
Open

add encoding for create m3u file.#235
halepham wants to merge 2 commits intovitiko98:masterfrom
halepham:fix-encode-when-create-m3u-file

Conversation

@halepham
Copy link

If an album or playlist has a song containing special characters, qobuz-dl cannot create m3u file.

Signed-off-by: Hale Pham <phamanhtu19297@gmail.com>
@ozdennis
Copy link

ozdennis commented Jan 3, 2024

Hi. I want to ask I got this error

Traceback (most recent call last):
File "C:\Users\OZ\miniconda3\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\OZ\miniconda3\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\OZ\miniconda3\Scripts\qobuz-dl.exe_main
.py", line 7, in
File "C:\Users\OZ\AppData\Roaming\Python\Python39\site-packages\qobuz_dl\cli.py", line 176, in main
_handle_commands(qobuz, arguments)
File "C:\Users\OZ\AppData\Roaming\Python\Python39\site-packages\qobuz_dl\cli.py", line 83, in _handle_commands
qobuz.download_list_of_urls(arguments.SOURCE)
File "C:\Users\OZ\AppData\Roaming\Python\Python39\site-packages\qobuz_dl\core.py", line 180, in download_list_of_urls
self.handle_url(url)
File "C:\Users\OZ\AppData\Roaming\Python\Python39\site-packages\qobuz_dl\core.py", line 166, in handle_url
make_m3u(new_path)
File "C:\Users\OZ\AppData\Roaming\Python\Python39\site-packages\qobuz_dl\utils.py", line 73, in make_m3u
pl.write("\n\n".join(track_list))
File "C:\Users\OZ\miniconda3\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 3589-3590: character maps to

I don't have python knowledge and I try your add encoding. Added that one line but still not working. Is it different problem?

@ReubenUKGB
Copy link

ReubenUKGB commented Jan 20, 2024

If an album or playlist has a song containing special characters, qobuz-dl cannot create m3u file.

Your implementation of this fix doesn't work because of a typo.

Change qobuz_dl/utils.py, line 72 from:
encoding="uf-8"

To:
encoding="utf-8"

Then it works.

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

Successfully merging this pull request may close these issues.

3 participants