Remove superflous code

This commit is contained in:
Keith Edmunds 2022-08-15 16:01:16 +01:00
parent 61311f67fe
commit 6ddb40d146
2 changed files with 0 additions and 79 deletions

View File

@ -1107,11 +1107,6 @@ if __name__ == "__main__":
group.add_argument('-c', '--check-database',
action="store_true", dest="check_db",
default=False, help="Check and report on database")
# group.add_argument('-f', '--full-update',
# action="store_true", dest="full_update",
# default=False, help="Update database")
# group.add_argument('-i', '--import', dest="fname", help="Input
# file")
args = p.parse_args()
# Run as required
@ -1119,10 +1114,6 @@ if __name__ == "__main__":
log.debug("Updating database")
with Session() as session:
check_db(session)
# elif args.full_update:
# log.debug("Full update of database")
# with Session() as session:
# full_update_db(session)
else:
# Normal run
try:

View File

@ -95,76 +95,6 @@ def create_track_from_file(session, path, normalise=None, tags=None):
return track
# def full_update_db(session):
# """Rescan all entries in database"""
#
# def log(msg):
# log.info(f"full_update_db(): {msg}")
#
# def check_change(track_id, title, attribute, old, new):
# if new > (old * 1.1) or new < (old * 0.9):
# log(
# "\n"
# f"track[{track_id}] ({title}) "
# f"{attribute} updated from {old} to {new}"
# )
#
# # Start with normal update to add new tracks and remove any missing
# # files
# log("update_db()")
# update_db(session)
#
# # Now update track length, silence and fade for every track in
# # database
#
# tracks = Tracks.get_all_tracks(session)
# total_tracks = len(tracks)
# log(f"Processing {total_tracks} tracks")
# track_count = 0
# for track in tracks:
# track_count += 1
# print(f"\rTrack {track_count} of {total_tracks}", end='')
#
# # Sanity check
# tag = get_music_info(track.path)
# if not tag['title']:
# log(f"track[{track.id}] {track.title=}: No tag title")
# continue
# if not tag['artist']:
# log(f"track[{track.id}] {track.artist=}: No tag artist")
# continue
#
# # Update title and artist
# if track.title != tag['title']:
# track.title = tag['title']
# if track.artist != tag['artist']:
# track.artist = tag['artist']
#
# # Update numbers; log if more than 10% different
# duration = int(round(
# tag['duration'], Config.MILLISECOND_SIGFIGS) * 1000)
# check_change(track.id, track.title, "duration", track.duration,
# duration)
# track.duration = duration
#
# audio = get_audio_segment(track.path)
#
# start_gap = leading_silence(audio)
# check_change(track.id, track.title, "start_gap", track.start_gap,
# start_gap)
# track.start_gap = start_gap
#
# fade_at = fade_point(audio)
# check_change(track.id, track.title, "fade_at", track.fade_at,
# fade_at)
# track.fade_at = fade_at
#
# silence_at = trailing_silence(audio)
# check_change(track.id, track.title, "silence_at", track.silence_at,
# silence_at)
# track.silence_at = silence_at
# session.commit()
def check_db(session):
"""