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 #!/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"]: if "LYRICS_SYNC_JSON" in trackAPI_gw["LYRICS"]:
self.lyrics['sync'] = "" self.lyrics['sync'] = ""
self.lyrics['syncID3'] = [] self.lyrics['syncID3'] = []
lastTimestamp = "" timestamp = ""
lastMilliseconds = 0 milliseconds = 0
for i in range(len(trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"])): for i in range(len(trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"])):
if "lrc_timestamp" in trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]: if trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["line"] != "":
self.lyrics['sync'] += trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["lrc_timestamp"] timestamp = trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["lrc_timestamp"]
lastTimestamp = trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["lrc_timestamp"] milliseconds = int(trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["milliseconds"])
else: else:
self.lyrics['sync'] += lastTimestamp j=i+1
if "milliseconds" in trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]: while trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][j]["line"] == "":
lastMilliseconds = int(trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["milliseconds"]) j=j+1
self.lyrics['sync'] += trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["line"] + "\r\n" timestamp = trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][j]["lrc_timestamp"]
self.lyrics['syncID3'].append((trackAPI_gw["LYRICS"]["LYRICS_SYNC_JSON"][i]["line"], lastMilliseconds)) 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 = { self.mainArtist = {
'id': trackAPI_gw['ART_ID'], 'id': trackAPI_gw['ART_ID'],

View File

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