From c907736436de369d2ec72c83095c6eaca5e03899 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Sat, 10 Sep 2022 21:59:14 +0100 Subject: [PATCH] Remove redundant code --- app/models.py | 15 +-------------- app/utilities.py | 28 ---------------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/app/models.py b/app/models.py index 863ddf1..ffdfcf0 100644 --- a/app/models.py +++ b/app/models.py @@ -41,6 +41,7 @@ from config import Config from helpers import ( fade_point, get_audio_segment, + get_tags, leading_silence, trailing_silence, ) @@ -598,20 +599,6 @@ class Tracks(Base): session.add(self) session.commit() - # @staticmethod - # def remove_by_path(session: Session, path: str) -> None: - # """Remove track with passed path from database""" - # - # log.debug(f"Tracks.remove_path({path=})") - # - # try: - # session.query(Tracks).filter(Tracks.path == - # path).delete() - # session.flush() - # except IntegrityError as exception: - # log.error(f"Can't remove track with {path=} - # ({exception=})") - @classmethod def search_artists(cls, session: Session, text: str) -> List["Tracks"]: """Search case-insenstively for artists containing str""" diff --git a/app/utilities.py b/app/utilities.py index 4a54700..db6c594 100755 --- a/app/utilities.py +++ b/app/utilities.py @@ -174,31 +174,3 @@ def update_bitrates(session): track.bitrate = t["bitrate"] except FileNotFoundError: continue - - -# # Spike -# # -# # # Manage tracks listed in database but where path is invalid -# # log.debug(f"Invalid {path=} in database") -# # track = Tracks.get_by_path(session, path) -# # messages.append(f"Remove from database: {path=} {track=}") -# # -# # # Remove references from Playdates -# # Playdates.remove_track(session, track.id) -# # -# # # Replace playlist entries with a note -# # note_txt = ( -# # f"File removed: {track.title=}, {track.artist=}, " -# # f"{track.path=}" -# # ) -# # for playlist_track in track.playlists: -# # row = playlist_track.row -# # # Remove playlist entry -# # log.debug(f"Remove {row=} from {playlist_track.playlist_id}") -# # playlist_track.playlist.remove_track(session, row) -# # # Create note -# # log.debug(f"Add note at {row=} to {playlist_track.playlist_id=}") -# # Notes(session, playlist_track.playlist_id, row, note_txt) -# # -# # # Remove Track entry pointing to invalid path -# # Tracks.remove_by_path(session, path)