JeffreyGaydos / music-database-generator

An idea to help organize your music with extra metadata using a SQL Server Database. This repository searches through a folder and gathers metadata already in mp3 files to add to a database
2 stars 1 forks source link

Allow for Adding/Updating/Deleting (Rather than Complete Regeneration) #13

Closed JeffreyGaydos closed 1 year ago

JeffreyGaydos commented 1 year ago

It would be nice if the user did not have to completely regenerate the music database every time they acquired new music they wanted to add to the database.

Devise a system that records which files the database generator has used.

INSERT: That way when new music is added, it skips all the files it already knows about. DELETE: Also, every time we re-generate, check to see if the file still exists in that spot and if it does not, delete the track and all related data from the database. UPDATE: Depending on how we keep track of these things, the user may be able to update some file or whatever we are using to make the generator re-ingest the data for that track.

Keep in mind that the intent of this is to speed up generation for when a user needs to add or delete only a few songs to the database.

JeffreyGaydos commented 1 year ago

Create a delete sproc that takes 1 track and attempts to delete as much as it can. This will be used for the DELETE and UPDATE operations.

Also, use the LastModifiedDate in conjunction with the LastGeneratedDate to determine which files need deleted and regenerated

JeffreyGaydos commented 1 year ago

This is all a little over-complex. As long as the performance is acceptable, we shouldn't need any database-external files to "mass skip" records (skipping should be pretty fast, even with large scale databases). Additionally, the LastModifiedDate/LastGeneratedDate comparisons are not needed and were replaced by PK comparisons.

EDIT: Tested Main "Sync" with 2276 music files. Took appx. 1 minute, which is acceptable