You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
I think that there are cases where update_music can skip over music files that it doesn't know about yet due to them having mtimes and ctimes that precede the timestamp in last_update_time.json.
This is the relevant code from scanForUpdatedSongs in cmd/update_music/scan.go:
The songs in the second album won't be picked up by the second update_music run:
last_update_time.json will contain t3.
The artist dir's mtime and ctime will be t4.
The second album's mtime will be t1 and its ctime will be t4.
The songs in the second album will have an mtime and ctime of t1.
I should read more about how this is usually handled. Should scanForUpdatedSongs also process all the files in a directory if the directory's ctime is after the last update time? Do I need to walk multiple levels up the tree to handle the case where an entire artist directory gets moved (rather than just an album directory)?
The text was updated successfully, but these errors were encountered:
Update check_music to support checking that all music files
under the music dir have been imported. This can be used to
detect the problem described in #22.
Also avoid checking for unused cover files if the song dump
doesn't contain cover filenames.
I think that I can prevent this by tracking the directories that contained songs during the last update and then additionally processing songs in newly-seen directories.
I believe that I don't need to track each directory's mtime, since moving a file into an existing directory should update the file's ctime (which will make us process it).
Some implementations mark for update the st_ctime field of renamed files and some do not. Applications which make use of the st_ctime field may behave differently with respect to renamed files unless they are designed to allow for either behavior.
It looks like Linux (ext4?) updates it, fortunately.
I also noticed that the ctime may not get updated (from Go's perspective, at least) if the rename happens very quickly after the file is created. I only saw this in unit tests, though, and I suspect it won't be a concern in real-world usage.
I think that there are cases where
update_music
can skip over music files that it doesn't know about yet due to them having mtimes and ctimes that precede the timestamp inlast_update_time.json
.This is the relevant code from
scanForUpdatedSongs
incmd/update_music/scan.go
:The problem is easy to trigger:
update_music
.update_music
again.The songs in the second album won't be picked up by the second
update_music
run:last_update_time.json
will containt3
.t4
.t1
and its ctime will bet4
.t1
.I should read more about how this is usually handled. Should
scanForUpdatedSongs
also process all the files in a directory if the directory's ctime is after the last update time? Do I need to walk multiple levels up the tree to handle the case where an entire artist directory gets moved (rather than just an album directory)?The text was updated successfully, but these errors were encountered: