Fixed sync lyrics timing

This commit is contained in:
RemixDev 2020-09-22 11:32:07 +02:00
parent 09dba218c2
commit 09331516c7
3 changed files with 14 additions and 12 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/env python3
__version__ = "1.4.1"
__version__ = "1.4.2"

View File

@ -164,18 +164,20 @@ class Track:
if "LYRICS_SYNC_JSON" in trackAPI_gw["LYRICS"]:
self.lyrics['sync'] = ""
self.lyrics['syncID3'] = []
lastTimestamp = ""
lastMilliseconds = 0
timestamp = ""
milliseconds = 0
for i in range(len(trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"])):
if "lrc_timestamp" in trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]:
self.lyrics['sync'] += trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["lrc_timestamp"]
lastTimestamp = trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["lrc_timestamp"]
if trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["line"] != "":
timestamp = trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["lrc_timestamp"]
milliseconds = int(trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["milliseconds"])
else:
self.lyrics['sync'] += lastTimestamp
if "milliseconds" in trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]:
lastMilliseconds = int(trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["milliseconds"])
self.lyrics['sync'] += trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["line"] + "\r\n"
self.lyrics['syncID3'].append((trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["line"], lastMilliseconds))
j=i+1
while trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][j]["line"] == "":
j=j+1
timestamp = trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][j]["lrc_timestamp"]
milliseconds = int(trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][j]["milliseconds"])
self.lyrics['sync'] += timestamp + trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["line"] + "\r\n"
self.lyrics['syncID3'].append((trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["line"], milliseconds))
self.mainArtist = {
'id': trackAPI_gw['ART_ID'],

View File

@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
setup(
name="deemix",
version="1.4.1",
version="1.4.2",
description="A barebone deezer downloader library",
long_description=README,
long_description_content_type="text/markdown",