|
@@ -272,7 +272,7 @@ def get_file_md5_hash(file_path: str) -> str:
|
|
|
return file_hash.hexdigest()
|
|
|
|
|
|
|
|
|
-def deduplicate_tracks():
|
|
|
+def deduplicate_tracks(commit=False):
|
|
|
from music.models import Track
|
|
|
|
|
|
# TODO This whole thing should iterate over users
|
|
@@ -287,9 +287,10 @@ def deduplicate_tracks():
|
|
|
first = tracks.first()
|
|
|
for other in tracks.exclude(id=first.id):
|
|
|
print("moving scrobbles for ", other.id, " to ", first.id)
|
|
|
- other.scrobble_set.update(track=first)
|
|
|
- print("deleting ", other.id, " - ", other)
|
|
|
- other.delete()
|
|
|
+ if commit:
|
|
|
+ other.scrobble_set.update(track=first)
|
|
|
+ print("deleting ", other.id, " - ", other)
|
|
|
+ other.delete()
|
|
|
|
|
|
|
|
|
def send_notifications_for_scrobble(scrobble_id):
|