Remove redundant code

This commit is contained in:
Keith Edmunds 2022-09-10 21:59:14 +01:00
parent c0c90595fd
commit c907736436
2 changed files with 1 additions and 42 deletions

View File

@ -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"""

View File

@ -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)