mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Fixed error for Lastfm import and added feedback, fix GH-118
This commit is contained in:
parent
61526fdc89
commit
32a900cf37
|
@ -268,11 +268,17 @@ def parse_lastfm(inputf):
|
||||||
with open(inputf,'r',newline='') as inputfd:
|
with open(inputf,'r',newline='') as inputfd:
|
||||||
reader = csv.reader(inputfd)
|
reader = csv.reader(inputfd)
|
||||||
|
|
||||||
|
line = 0
|
||||||
for row in reader:
|
for row in reader:
|
||||||
|
line += 1
|
||||||
try:
|
try:
|
||||||
artist,album,title,time = row
|
artist,album,title,time = row
|
||||||
except ValueError:
|
except ValueError:
|
||||||
yield ('FAIL',None,f"{row} does not look like a valid entry. Scrobble not imported.")
|
yield ('FAIL',None,f"{row} (Line {line}) does not look like a valid entry. Scrobble not imported.")
|
||||||
|
continue
|
||||||
|
|
||||||
|
if time == '':
|
||||||
|
yield ('FAIL',None,f"{row} (Line {line}) is missing a timestamp.")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -287,7 +293,7 @@ def parse_lastfm(inputf):
|
||||||
'scrobble_duration':None
|
'scrobble_duration':None
|
||||||
},'')
|
},'')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
yield ('FAIL',None,f"{entry} could not be parsed. Scrobble not imported. ({repr(e)})")
|
yield ('FAIL',None,f"{row} (Line {line}) could not be parsed. Scrobble not imported. ({repr(e)})")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user