From 72b74eb27effbf824d31f7ea145399a60063066b Mon Sep 17 00:00:00 2001 From: krateng Date: Mon, 4 Apr 2022 16:25:21 +0200 Subject: [PATCH] Renamed import module to match v3 --- maloja/proccontrol/tasks/__init__.py | 2 +- .../proccontrol/tasks/{importer.py => import_scrobbles.py} | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) rename maloja/proccontrol/tasks/{importer.py => import_scrobbles.py} (97%) diff --git a/maloja/proccontrol/tasks/__init__.py b/maloja/proccontrol/tasks/__init__.py index b86008f..cd5be4c 100644 --- a/maloja/proccontrol/tasks/__init__.py +++ b/maloja/proccontrol/tasks/__init__.py @@ -11,7 +11,7 @@ def loadexternal(filename): print("File could not be found.") return - from .importer import import_scrobbles + from .import_scrobbles import import_scrobbles result = import_scrobbles(filename) msg = f"Successfully imported {result['CONFIDENT_IMPORT'] + result['UNCERTAIN_IMPORT']} scrobbles" diff --git a/maloja/proccontrol/tasks/importer.py b/maloja/proccontrol/tasks/import_scrobbles.py similarity index 97% rename from maloja/proccontrol/tasks/importer.py rename to maloja/proccontrol/tasks/import_scrobbles.py index 0290fdf..0d22df0 100644 --- a/maloja/proccontrol/tasks/importer.py +++ b/maloja/proccontrol/tasks/import_scrobbles.py @@ -12,7 +12,8 @@ c = CleanerAgent() outputs = { "CONFIDENT_IMPORT": lambda msg: None, "UNCERTAIN_IMPORT": lambda msg: print(col['orange'](msg)), - "CONFIDENT_SKIP": lambda msg: print(col['ffcba4'](msg)), + #"CONFIDENT_SKIP": lambda msg: print(col['ffcba4'](msg)), + "CONFIDENT_SKIP": lambda msg: None, "UNCERTAIN_SKIP": lambda msg: print(col['orange'](msg)), "FAIL": lambda msg: print(col['red'](msg)), } @@ -145,6 +146,8 @@ def parse_spotify_lite(inputf): yield ('FAIL',None,f"{entry} could not be parsed. Scrobble not imported. ({repr(e)})") continue + print() + def parse_spotify_full(inputf): @@ -212,7 +215,7 @@ def parse_spotify_full(inputf): ts_group = int(timestamp/10) - relevant_ts_groups = [ts_group-2,ts_group-1,ts_group,ts_group+1,ts_group+2] + relevant_ts_groups = [ts_group-3,ts_group-2,ts_group-1,ts_group,ts_group+1,ts_group+2,ts_group+3] similar_scrobbles = [scrob for tsg in relevant_ts_groups for scrob in inaccurate_timestamps.get(tsg,[])] scrobble_describe = (timestamp,entry['spotify_track_uri'],entry['ms_played'])