Compare commits

...

2 Commits

Author SHA1 Message Date
Keith Edmunds
fc9a10ad52 Tidy up playlist.remove_track 2022-05-02 17:32:29 +01:00
Keith Edmunds
8b644ee236 Clarify comment 2022-05-02 16:09:29 +01:00
2 changed files with 2 additions and 4 deletions

View File

@ -342,12 +342,10 @@ class Playlists(Base):
DEBUG(f"Playlist.remove_track({self.id=}, {row=})") DEBUG(f"Playlist.remove_track({self.id=}, {row=})")
# Get tracks collection for this playlist # Get tracks collection for this playlist
tracks_collections = self.tracks
# Tracks are a dictionary of tracks keyed on row # Tracks are a dictionary of tracks keyed on row
# number. Remove the relevant row. # number. Remove the relevant row.
del tracks_collections[row] del self.tracks[row]
# Save the new tracks collection # Save the new tracks collection
self.tracks = tracks_collections
session.flush() session.flush()

View File

@ -224,7 +224,7 @@ def update_db(session):
for path in list(os_paths - db_paths): for path in list(os_paths - db_paths):
DEBUG(f"utilities.update_db: {path=} not in database") DEBUG(f"utilities.update_db: {path=} not in database")
# is filename in database? # is filename in database with a different path?
track = Tracks.get_by_filename(session, os.path.basename(path)) track = Tracks.get_by_filename(session, os.path.basename(path))
if not track: if not track:
messages.append(f"{path} missing from database: {path}") messages.append(f"{path} missing from database: {path}")