diff --git a/app/models.py b/app/models.py index a6395f0..23d9498 100644 --- a/app/models.py +++ b/app/models.py @@ -373,6 +373,15 @@ class PlaylistRows(Base): session.add(self) session.flush() + def append_note(self, extra_note: str) -> None: + """Append passed note to any existing note""" + + current_note = self.note + if current_note: + self.note = current_note + '\n' + extra_note + else: + self.note = extra_note + @staticmethod def copy_playlist(session: scoped_session, src_id: int, diff --git a/app/playlists.py b/app/playlists.py index 899843c..b70847a 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -696,7 +696,11 @@ class PlaylistTab(QTableWidget): if existing_plr and ask_yes_no("Duplicate row", "Track already in playlist. " "Move to new location?"): - # Yes it is and we shoudl reuse it + # Yes it is and we should reuse it + # If we've been passed a note, we need to add that to the + # existing track + if note: + existing_plr.append_note(note) return self._move_row(session, existing_plr, row_number) # Build playlist_row object @@ -1356,7 +1360,8 @@ class PlaylistTab(QTableWidget): return playlistrow_id - def _get_playlistrow_object(self, session: scoped_session, row: int) -> int: + def _get_playlistrow_object(self, session: scoped_session, + row: int) -> int: """Return the playlistrow object associated with this row""" playlistrow_id = (self.item(row, USERDATA).data(self.PLAYLISTROW_ID))