mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added alternative to loading bar, fixes GH-54
This commit is contained in:
parent
218313f80c
commit
5fe4c5cd22
@ -88,3 +88,6 @@ NAME = None
|
||||
SKIP_SETUP = no
|
||||
LOGGING = true
|
||||
DEV_MODE = false
|
||||
|
||||
# set this to true if your console output will be processed and should never change existing lines
|
||||
CLEAN_OUTPUT = false
|
||||
|
@ -777,7 +777,12 @@ def build_db():
|
||||
db = tsv.parse_all(datadir("scrobbles"),"int","string","string",comments=False)
|
||||
scrobblenum = len(db)
|
||||
log(f"Found {scrobblenum} scrobbles...")
|
||||
pbar = ProgressBar(max=scrobblenum,prefix="Loading scrobbles")
|
||||
|
||||
usebar = not settings.get_settings("CLEAN_OUTPUT")
|
||||
if usebar: pbar = ProgressBar(max=scrobblenum,prefix="Loading scrobbles")
|
||||
else:
|
||||
n = 0
|
||||
m = max(int(scrobblenum / 25),20)
|
||||
#db = parseAllTSV("scrobbles","int","string","string",escape=False)
|
||||
for sc in db:
|
||||
artists = sc[1].split("␟")
|
||||
@ -785,9 +790,12 @@ def build_db():
|
||||
time = sc[0]
|
||||
|
||||
readScrobble(artists,title,time)
|
||||
pbar.progress()
|
||||
if usebar: pbar.progress()
|
||||
else:
|
||||
n += 1
|
||||
if n % m == 0: log(f"Loaded {n}/{scrobblenum}...")
|
||||
|
||||
pbar.done()
|
||||
if usebar: pbar.done()
|
||||
log("Database loaded, optimizing...")
|
||||
|
||||
# optimize database
|
||||
|
Loading…
Reference in New Issue
Block a user