glomatico / spotify-web-downloader

A Python CLI app for downloading songs and music videos directly from Spotify.
441 stars 55 forks source link

lrc file lyrics timestamp issue #17

Closed RustedShader closed 8 months ago

RustedShader commented 8 months ago

Issue

The timestamp in lrc file are getting stored according to local timezone and not using UTC time so i am getting different results in lrc files.

Problem

At line 188 in get_lyrics_synced_timestamp_lrc function its not using UTC timezone and using my local timezone by default thus output is

Screenshot 2024-01-19 at 4 16 43 PM Screenshot 2024-01-19 at 4 15 08 PM

Fix

Instead of using

lrc_timestamp = datetime.datetime.fromtimestamp(time / 1000.0)

Output

1970-01-01 05:30:02.380000

Full Output

30:02.38

You can use

lrc_timestamp = datetime.datetime.fromtimestamp(time / 1000.0,tz=datetime.timezone.utc)

Output

1970-01-01 00:00:02.380000+00:00

Full Output

00:02.38

glomatico commented 8 months ago

I will be adding this on the next release.