mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04:00
Fixed timestamp parsing for Spotify import, GH-104
This commit is contained in:
parent
2a1f188e37
commit
8ed3923851
@ -35,6 +35,7 @@ def import_scrobbles(inputf):
|
|||||||
|
|
||||||
print(f"Parsing {col['yellow'](inputf)} as {col['cyan'](type)} export")
|
print(f"Parsing {col['yellow'](inputf)} as {col['cyan'](type)} export")
|
||||||
|
|
||||||
|
|
||||||
if os.path.exists(outputf):
|
if os.path.exists(outputf):
|
||||||
while True:
|
while True:
|
||||||
action = prompt(f"Already imported {type} data. [O]verwrite, [A]ppend or [C]ancel?",default='c').lower()[0]
|
action = prompt(f"Already imported {type} data. [O]verwrite, [A]ppend or [C]ancel?",default='c').lower()[0]
|
||||||
@ -48,7 +49,10 @@ def import_scrobbles(inputf):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("Could not understand response.")
|
print("Could not understand response.")
|
||||||
|
else:
|
||||||
|
mode = 'w'
|
||||||
|
|
||||||
|
|
||||||
with open(outputf,mode) as outputfd:
|
with open(outputf,mode) as outputfd:
|
||||||
success = 0
|
success = 0
|
||||||
failed = 0
|
failed = 0
|
||||||
@ -114,7 +118,7 @@ def parse_spotify(inputf):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
sec = int(entry['ms_played'] / 1000)
|
sec = int(entry['ms_played'] / 1000)
|
||||||
timestamp = entry['offline_timestamp']
|
timestamp = int(entry['offline_timestamp'] / 1000)
|
||||||
artist = entry['master_metadata_album_artist_name']
|
artist = entry['master_metadata_album_artist_name']
|
||||||
title = entry['master_metadata_track_name']
|
title = entry['master_metadata_track_name']
|
||||||
album = entry['master_metadata_album_album_name']
|
album = entry['master_metadata_album_album_name']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user