fix: rating no longer reset to -1 during mount/sync from iPod Play Counts
The Play Counts parser uses rating=-1 as sentinel for 'no change', but the merge logic used which treats -1 as truthy, overwriting real ratings with -1 in all three paths: mount-time sync (worker.py), DB regeneration (_merge_play_stats), and track listing (get_all_tracks).
This commit is contained in:
parent
a36312c9d7
commit
309ba994a5
@ -485,7 +485,8 @@ class Nano7Database:
|
|||||||
dd = delta_stats.get(location, {})
|
dd = delta_stats.get(location, {})
|
||||||
pc = bs.get("play_count", 0) + dd.get("play_count", 0)
|
pc = bs.get("play_count", 0) + dd.get("play_count", 0)
|
||||||
sc = bs.get("skip_count", 0) + dd.get("skip_count", 0)
|
sc = bs.get("skip_count", 0) + dd.get("skip_count", 0)
|
||||||
rating = dd.get("rating", 0) or bs.get("rating", 0)
|
dd_rt = dd.get("rating", 0)
|
||||||
|
rating = dd_rt if dd_rt >= 0 else bs.get("rating", 0)
|
||||||
tracks.append({
|
tracks.append({
|
||||||
"pid": s["pid"],
|
"pid": s["pid"],
|
||||||
"title": s.get("title") or os.path.splitext(s["file_name"])[0],
|
"title": s.get("title") or os.path.splitext(s["file_name"])[0],
|
||||||
@ -660,7 +661,8 @@ class Nano7Database:
|
|||||||
bs.get("skip_count", 0), local_pc.get("skip_count", 0),
|
bs.get("skip_count", 0), local_pc.get("skip_count", 0),
|
||||||
) + dd.get("skip_count", 0)
|
) + dd.get("skip_count", 0)
|
||||||
|
|
||||||
s["rating"] = dd.get("rating", 0) or bs.get("rating", 0) or local_pc.get("rating", 0)
|
dd_rating = dd.get("rating", 0)
|
||||||
|
s["rating"] = dd_rating if dd_rating >= 0 else bs.get("rating", 0) or local_pc.get("rating", 0)
|
||||||
|
|
||||||
s["last_played"] = max(
|
s["last_played"] = max(
|
||||||
bs.get("last_played", 0), local_pc.get("last_played", 0),
|
bs.get("last_played", 0), local_pc.get("last_played", 0),
|
||||||
|
|||||||
@ -240,7 +240,8 @@ class WorkerThread(QThread):
|
|||||||
entry.get("skip_count", 0), bs.get("skip_count", 0),
|
entry.get("skip_count", 0), bs.get("skip_count", 0),
|
||||||
) + dd.get("skip_count", 0)
|
) + dd.get("skip_count", 0)
|
||||||
|
|
||||||
entry["rating"] = dd.get("rating", 0) or bs.get("rating", 0) or entry.get("rating", 0)
|
dd_rating = dd.get("rating", 0)
|
||||||
|
entry["rating"] = dd_rating if dd_rating >= 0 else bs.get("rating", 0) or entry.get("rating", 0)
|
||||||
|
|
||||||
entry["last_played"] = max(
|
entry["last_played"] = max(
|
||||||
entry.get("last_played", 0), bs.get("last_played", 0),
|
entry.get("last_played", 0), bs.get("last_played", 0),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user