Skip to content

Commit

Permalink
force lrc file to utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
logykk committed Aug 9, 2023
1 parent ff527fe commit 8cfd274
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions zotify/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 ###')

0 comments on commit 8cfd274

Please sign in to comment.