From 8cfd27407e8bacc50d43c8983a97443b29a2b7cf Mon Sep 17 00:00:00 2001 From: logykk Date: Thu, 10 Aug 2023 01:01:00 +1200 Subject: [PATCH] force lrc file to utf-8 --- CHANGELOG.md | 5 +++++ setup.cfg | 2 +- zotify/track.py | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b5aedb..95e6ff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/setup.cfg b/setup.cfg index 32946e0..af73781 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/zotify/track.py b/zotify/track.py index 3f6d35c..bb2af89 100644 --- a/zotify/track.py +++ b/zotify/track.py @@ -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 ###') \ No newline at end of file + Printer.print(PrintChannel.WARNINGS, f'### SKIPPING {file_codec.upper()} CONVERSION - FFMPEG NOT FOUND ###')