Setting Album date from photo info?

rlobrecht

Joined: 2003-01-20
Posts: 92
Posted: Thu, 2005-09-15 19:21

I've just installed Gallery 2, and am in the process of migrating all of my Gallery 1 data. At some point, my gallery 1 album order went really wacky. Well, gallery 2 has this really fantastic feature of being able to sort the main album by the album date. This has helped a bunch, but of course my album dates are all after the date I would really like for them to be. I wonder if there is an easy way to set the album date based on the information from one of the images in the gallery (say the oldest image, youngest image, or even hightlight image)?

Any ideas?

Thanks,
Rick

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-15 21:16

nope, there isn't. that would be feature request 510 or so. :)
you could write a maintenance task that does that for you, but still, you'd have to code...

 
rlobrecht

Joined: 2003-01-20
Posts: 92
Posted: Thu, 2005-09-15 21:35

I'm not afraid of coding something (I know how to do backups) but figuring out the API may be a little tough. I'll dig into the API docs and try to decide if it will be faster to code something or date them all by hand.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-15 22:36

take a look at the other maintenance tasks.
e.g. modules/core/classes/SetOriginationTimestampTask.class
which sets the origination timestamp of all items (not albums) according to the exif date.

so you could hack this file to also set the timestamp also for albums.

or you create your own module:

your module needs 2 files
modules/modulename/module.inc
and
modules/modulename/classes/SetAlbumOriginationTimestampTask.class
(you want to set the originationTimestamp, so i thought that may be a good name)

in module.inc you need a constructor and a performFactoryRegistrations function.

this code is needed in performFactoryRegistration. i assumed your module name is setalbumdate.

$ret = GalleryCoreApi::registerFactoryImplementation(
		'MaintenanceTask', 'SetAlbumOriginationTimestampTask',
		'SetAlbumOriginationTimestampTask',
		dirname(__FILE__) . '/classes/SetAlbumOriginationTimestampTask.class',
		'setalbumdate', null, 4);

etc.
see the developers link at the top of the this page and take a look at codex.gallery2.org.

 
rlobrecht

Joined: 2003-01-20
Posts: 92
Posted: Thu, 2005-09-15 23:42

Thanks for the pointers.

Rick

 
anohman

Joined: 2005-09-17
Posts: 2
Posted: Sat, 2005-09-17 16:40

Hi

I'm also very interested in this kind of functionality for my G2 installation, so just I'm wondering if there has been any progress made?

Andreas

 
rlobrecht

Joined: 2003-01-20
Posts: 92
Posted: Sun, 2005-09-18 18:51

Not much from my point. I spent a few hours on it, and managed to get a module that won't activate. I'll spend some more time this week.

Rick