force lrc file to utf-8

This commit is contained in:
logykk 2023-08-10 01:01:00 +12:00
parent ff527fe834
commit 8cfd27407e
3 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,10 @@
# Changelog
## 0.6.12
- Dockerfile works again
- Fixed lrc file extension replacement
- Fixed lrc file writes breaking on non-utf8 systems
## 0.6.11
- Add new scope for reading followed artists
- Print API errors by default

View File

@ -1,6 +1,6 @@
[metadata]
name = zotify
version = 0.6.11
version = 0.6.12
author = Zotify Contributors
description = A highly customizable music and podcast downloader
long_description = file: README.md

View File

@ -113,12 +113,12 @@ def get_song_lyrics(song_id: str, file_save: str) -> None:
except KeyError:
raise ValueError(f'Failed to fetch lyrics: {song_id}')
if(lyrics['lyrics']['syncType'] == "UNSYNCED"):
with open(file_save, 'w') as file:
with open(file_save, 'w+', encoding='utf-8') as file:
for line in formatted_lyrics:
file.writelines(line['words'] + '\n')
return
elif(lyrics['lyrics']['syncType'] == "LINE_SYNCED"):
with open(file_save, 'w') as file:
with open(file_save, 'w+', encoding='utf-8') as file:
for line in formatted_lyrics:
timestamp = int(line['startTimeMs'])
ts_minutes = str(math.floor(timestamp / 60000)).zfill(2)
@ -332,4 +332,4 @@ def convert_audio_format(filename) -> None:
Path(temp_filename).unlink()
except ffmpy.FFExecutableNotFoundError:
Printer.print(PrintChannel.WARNINGS, f'### SKIPPING {file_codec.upper()} CONVERSION - FFMPEG NOT FOUND ###')
Printer.print(PrintChannel.WARNINGS, f'### SKIPPING {file_codec.upper()} CONVERSION - FFMPEG NOT FOUND ###')