diff --git a/vrobbler/apps/scrobbles/models.py b/vrobbler/apps/scrobbles/models.py index 3608913..300e023 100644 --- a/vrobbler/apps/scrobbles/models.py +++ b/vrobbler/apps/scrobbles/models.py @@ -56,10 +56,12 @@ class AudioScrobblerTSVImport(TimeStampedModel): self.tsv_file.path, user_tz=tz ) if scrobbles: - self.process_log = f"Created {len(scrobbles)} scrobbles" - for scrobble in scrobbles: + for count, scrobble in enumerate(scrobbles): scrobble_str = f"{scrobble.id}\t{scrobble.timestamp}\t{scrobble.track.title}" - self.process_log += f"\n{scrobble_str}" + log_line = f"{scrobble_str}" + if count > 0: + log_line = "\n" + log_line + self.process_log += log_line self.process_count = len(scrobbles) else: self.process_log = f"Created no new scrobbles" diff --git a/vrobbler/apps/scrobbles/tsv.py b/vrobbler/apps/scrobbles/tsv.py index c998d65..eaf4c70 100644 --- a/vrobbler/apps/scrobbles/tsv.py +++ b/vrobbler/apps/scrobbles/tsv.py @@ -124,9 +124,7 @@ def undo_audioscrobbler_tsv_import(process_log, dryrun=True): logger.warning("No lines in process log found to undo") return - for line_num, line in enumerate(process_log.split('\n')): - if line_num == 0: - continue + for line in process_log.split('\n'): scrobble_id = line.split("\t")[0] scrobble = Scrobble.objects.filter(id=scrobble_id).first() if not scrobble: