paolobenve/myphotoshare

Re-scan an album content when album.ini content has changed.

Closed this issue · 11 comments

Currently, when the content of the album.ini file containing extra-metadata is modified but the photos/videos in the album are not, the changes are not detected and the scanner does not process the album content.

How to detect when album.ini file has been modified?

Can we compare the modification date of album.ini with a file for that album in the cache directory?

my last commit solved this issue, didn't it?

Sorry, I did not see you message when I created this issue. I'll test it tonight.

closing, seems ok, reopen it if not ok

A check is missing on album.ini removed.

I think the way is adding a boolean key to the album json file, so that the code can see that it was there and has disappeared

Instead of a boolean in the JSON file, the timestamp of the file can be used to manage all the cases. If the album.ini file timestamp is different from the one in JSON, either because of change or because inexistant, the scanner should process all the files in the directory.

you mean that instead of a boolean, a timestamp has to be added to album json file?

Yes.

well, a remotion of album.ini should make the dir modification date change, and that should make invalid the json file. It I'm right, nothing has to be added to the json file

Usually, it's correct. But there are trends in the linux world to mount filesystems with noatime and nodiratime flags set to have performance gain or when using a FLASH storage to reduce writes. This would break your proposal. You can select the safe path (change in JSON) or the mostly safe one (check directory atime) depending on how you want the users to manage it. If it's well documented, the mostly safe can do because album.ini files are rarely deleted.

First Google results on the subject:

atime is the access time, it's hasn't anything to do with it, the scanner checks mtime, which I think is always set on all filesystem.

https://stackoverflow.com/questions/3620684/directory-last-modified-date: "The mtime (modification time) on the directory itself changes when a file or a subdirectory is added, removed or renamed".

It does not seem that there is need to add anything to json file

OK. Great!