mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added ability to import multiple files, GH-104
This commit is contained in:
parent
5d582d39aa
commit
27cacbf658
@ -3,7 +3,7 @@ import os, datetime, re
|
|||||||
import json, csv
|
import json, csv
|
||||||
|
|
||||||
from ...cleanup import *
|
from ...cleanup import *
|
||||||
from doreah.io import col, ask
|
from doreah.io import col, ask, prompt
|
||||||
from ...globalconf import data_dir
|
from ...globalconf import data_dir
|
||||||
|
|
||||||
|
|
||||||
@ -35,10 +35,20 @@ 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):
|
||||||
overwrite = ask("Already imported data. Overwrite?",default=False)
|
while True:
|
||||||
if not overwrite: return
|
action = prompt("Already imported data. Overwrite (o), append (a) or cancel (c)?",default='c')
|
||||||
|
if action == 'c':
|
||||||
|
return 0,0,0
|
||||||
|
elif action == 'a':
|
||||||
|
mode = 'a'
|
||||||
|
break
|
||||||
|
elif action == 'o':
|
||||||
|
mode = 'w'
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print("Could not understand response.")
|
||||||
|
|
||||||
with open(outputf,"w") as outputfd:
|
with open(outputf,mode) as outputfd:
|
||||||
success = 0
|
success = 0
|
||||||
failed = 0
|
failed = 0
|
||||||
warning = 0
|
warning = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user