Hello,
I would like to write a script to scan the content of a folder (and sub-folder), and update gallery data according to this.
I no almost nothing about Gallery 2 code, but I've done my share of PHP, ASP, C#, Java, C++ programming.
I assume you have objects to represent an item, a way to create them, and put them in the database. I also assume that there is some function to call to add an item to the database, remove and item, and maybe even update an item.
I would like to know where is this code, and what should I look for and pay attention to.
I don't know if this could would make it into a module. I don't really care for integration with gallery, I just want something I can run (or setup a cron to run) to update Gallery data according to the content of a folder.
Thanks in advance for your help.
Posts: 27300
No need to reinvent the wheel:
http://gallery.menalto.com/node/81010
I have never used it so can't comment on it.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 3
Hello,
This script doesn't seem to do what I want.
It adds files you send in an upload/ directory to a specified album, then deletes the file from the upload/ directory.
What I want is to add the complete directory structure to the gallery, without touching the directory.
Suppose I have a folder called ~/Pictures/, and there are the folders 2007/ and 2008/ in it. The script should add 2007 and 2008 as albums in the gallery, then add the pictures in the folders to the gallery.
Moreover, I want to periodically scan the structure (which will never be changed by the script, but only by the user), and the gallery should reflect this. This mean that I must do one of the following
- Delete everything from the gallery and then importing the complete structure once again (I guess this will be a lengthy process)
- Scanning for updates and update the items.
My guess is that there must be some thing in the database to indicate the date of last modification. If so, my plan would be to look for the date of last modification in the folder and compare it to that of the items in the database. If that of files in the folder is latter than that of the item in the database, then delete the item from the database and add it back.