Module: MRTFU: Mass rename of titles, filenames, and URLs

jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-05-06 03:57

This module provides a method of mass renaming items in an album. It provides options for the title, filename, and URL renaming.

Once installed, you'll have an option in the album 'options' menu called 'MRTFU album'

Once you 'mrtfu' an album, a task will be created that, once run (from admin->maintenance), will perform the renames

It generates a task to ensure that ALL items in the album can be renamed without timing out in the event of a LOT of child photos

As with any user contributed module:

Disclaimer:

Please ensure that you have a GOOD, FULL BACKUP of your gallery and it's images.
This module does a LOT to your database/files/structures.
I take no liability in its operation or its fit for use.

Download Via: Codex

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-05-06 04:01

Previous discussion that inspired module is here:

http://gallery.menalto.com/node/106274

Thanks to Rockbär for the inspiration!

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Sun, 2012-05-06 14:58

I have to thank YOU. Awesome, really! Unfortunately I don't want to crash my system, if it's still in beta. I'm not THAT expert :-D I hope someone else (maybe other devs) can test it out?

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-05-06 16:00
Rockbär wrote:
I have to thank YOU. Awesome, really! Unfortunately I don't want to crash my system, if it's still in beta. I'm not THAT expert :-D I hope someone else (maybe other devs) can test it out?

I've removed the BETA tag as I've tested on three different Galleries now with no issues noted.

Should be good to go.

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Sun, 2012-05-06 18:30

Okay, I'll give it a shot! :-)

btw: it's RockbÄr, not RockbAr ;-)
Rockbär = Rock-Bear
Rockbar ~ rockable

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Sun, 2012-05-06 19:06

That's an awesome plugin! I'd like to thank your for your great and helpfully work. It lives up to its promise. Thanx a million! :-)

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Sun, 2012-05-06 19:18

I have changed a few times the options to one album. Suddenly in the maintenance the following message appears:

Quote:
ORM Validation has failed for items model

MAYBE (I'm not sure) I have add a space after the prefix like "picture " in 'Rename all album item's URL to'.
But I have no choice any longer - if I change the options again, it will add the tasks to the existing one (e.g. 50 pics in the album, now there are 150 in task list: "Complete the MRTFU task" ---> "150 (100%) items need to be mrtfu'd" So, no way to cancel it.

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Sun, 2012-05-06 19:20

Protocol:

Quote:
exception 'ORM_Validation_Exception' with message 'ORM Validation has failed for items model' in /is/htdocs/XYZ/system/libraries/ORM_Validation_Exception.php:20
Stack trace:
#0 /is/htdocs/XYZ/system/libraries/ORM.php(755): ORM_Validation_Exception_Core::handle_validation('items', Object(Validation))
#1 /is/htdocs/XYZ/modules/gallery/models/item.php(773): ORM_Core->validate(NULL)
#2 /is/htdocs/XYZ/system/libraries/ORM.php(778): Item_Model_Core->validate()
#3 /is/htdocs/XYZ/modules/gallery/libraries/MY_ORM.php(23): ORM_Core->save()
#4 /is/htdocs/XYZ/modules/gallery/libraries/ORM_MPTT.php(79): ORM->save()
#5 /is/htdocs/XYZ/modules/gallery/models/item.php(440): ORM_MPTT_Core->save()
#6 /is/htdocs/XYZ/modules/mrtfu/helpers/mrtfu.php(61): Item_Model_Core->save()
#7 /is/htdocs/XYZ/modules/mrtfu/helpers/mrtfu_task.php(58): Mrtfu_Core::do_the_mrtfu(Object(Mrtfu_item_Model))
#8 /is/htdocs/XYZ/modules/gallery/helpers/task.php(90): Mrtfu_task_Core::do_mrtfu(Object(Task_Model))
#9 /is/htdocs/XYZ/modules/gallery/controllers/admin_maintenance.php(194): task_Core::run('mrtfu_task::do_...', Array)
#10 /is/htdocs/XYZ/modules/gallery/controllers/admin.php(62): Admin_Maintenance_Controller->run('177')
#11 [internal function]: Admin_Controller->__call('177')
#12 /is/htdocs/XYZ/system/core/Kohana.php(331): ReflectionMethod->invokeArgs(Array, Array)
#13 /is/htdocs/XYZ/system/core/Event.php(208): Kohana_Core::instance('maintenance', Array)
#14 /is/htdocs/XYZ/application/Bootstrap.php(67): Event_Core::run(Object(Admin_Controller), Array)
#15 /is/htdocs/XYZ/index.php(102): require('/is/htdocs/wp10...')
#16 {main}

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-05-06 22:05

To fix: You'll need to go into your database (do you have phpmyadmin?) and empty out the table 'mrtfu_items'

I can fix this in the code going forward... (seems like one of the rules for kohana forge forms doesn't take into account trailing spaces... (rule valid_alpha_dash)

(also emptying 'messages' table will clear the yellow 'you have a task' line...)

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-05-06 22:29

fixed with this update v3 in original post above...

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-05-06 22:37
Rockbär wrote:
Okay, I'll give it a shot! :-)

btw: it's RockbÄr, not RockbAr ;-)
Rockbär = Rock-Bear
Rockbar ~ rockable

I know, but the 'ä' doesn't work for a lot of stuff... but I fixed it :-)

Ich lebte in Deutschland für ein paar Jahre.

Aber, ist mein Deutsch nicht so gut.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2012-05-07 23:15

Tried it out finally. Looks cool. Glad you figured out the task stuff as in a large album it might take some time on a slow system, having a task that can start over is great!

Now for a better/different name? or at least a codex page with some explanations.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2012-05-07 23:44

What?!?!? You don't like my name? MRTFU ? I agree it doesn't roll off the tongue, but I'm a geek...

It's ready for a codex if you want to make me a blank.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2012-05-08 02:38
 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Tue, 2012-05-08 08:08

Cool, really cool, love it, great work! :-)

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2012-05-08 15:32
Rockbär wrote:
Cool, really cool, love it, great work! :-)

Got all the kinks worked out then?

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Tue, 2012-05-08 22:09
jnash wrote:
Got all the kinks worked out then?

Yes, it seems so. Maybe one suggestion for "rename all album item's title": if you choose "the item's tags" and there is no tag for this item an additional option would be nice, that renames the item's title also to the ID or a prefix. Otherwise you have to rename all the pictures to the ID (or the the prefix, whatever you want)... going to the admin dashboard, maintenance, starting the task, going back to the gallery, and restarting the menue for the tags. So a dropdown-menue next to "the item's tags" would be cool. Nothing important - the plugin is still awesome and works fantastic!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Wed, 2012-05-09 03:10

It's an interesting idea, unfortunately, it would be an effort to incorporate the logic. It would be better if you tagged the 'untagged' photos, or renamed them manually. Or, do it twice, like you described, if a lot of photos.

Unfortunately, I think it's too much for the module to do.

 
dn3

Joined: 2012-03-31
Posts: 16
Posted: Sun, 2012-05-13 16:06

It'd be amazing if this module could pull selective EXIF fields to use for the renaming of the files/fields. I realize it'd be some work, just an idea for any future versions.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-05-13 20:26

What sort of fields are we thinking of?

 
dn3

Joined: 2012-03-31
Posts: 16
Posted: Mon, 2012-05-14 00:59

Good question. Ideally, I see any being available, but there are far too many possible fields to list on the form. What about relying on the user to know the name of the EXIF tag? So, if they want to use the exposure time, they would enter something like ExposureTime in the field. If they wanted to use two fields, maybe something like ExposureTime, FNumber. It might be possible to feed those right into the query using LIKE to match them. All the EXIF tag names are single word (no spaces) and CamelCase, which should simplify things slightly. If the user entered non-existent fields it could either do nothing, or throw a warning in the result.

I'm just throwing ideas around, there may be better ways of doing it. I'm also not sure how many fields could be appended. If the module looped through whatever the user entered, to discover them, there's probably no reason for a limit, aside from server load issues (if any).

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2012-05-14 02:23

And for what option, the title, the url, the filename? Or all/any?

 
dn3

Joined: 2012-03-31
Posts: 16
Posted: Mon, 2012-05-14 02:31

Any/all would give the most flexibility. Personally, I care about URLs the least, but I could see others wanting them all to match.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2012-05-14 02:45

I'd have to think about this. I think with the exif tag, there are a lot of potentials for duplicate names that could arise during renaming...

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2012-05-14 02:48

I think that using ExposureTime, FNumber, BatteryLevel, MeteringMode.... (or any other common EXIF/IPTC field) to be the title, url or file-name would be a very small edge case.
If this is going into this module I vote for having this some option that has to be turned on and not on by default.
It just makes the UI cluttered and will make the user confused.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
dn3

Joined: 2012-03-31
Posts: 16
Posted: Mon, 2012-05-14 02:57

There would have to be a parameter to keep it unique, too. You're right about that. Maybe the ID, or adding a sequential number, or something along those lines. The same issue is true of using tags though.

floridave, the way I proposed it, how would one additional field in each section clutter the UI? It might not even need a new field. One could use radio buttons to select what the field is used for, be it tags, EXIF, or custom string.

I don't think this is necessarily a "very small edge case", I think that anyone using the script for photography rather than image hosting could see the potential of it.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2012-05-14 02:59

I'm tending to agree. It's already cluttered a bit too much for my liking, and it seems that some of these are very unique requests.

I'll await for other input before tackling this. I thinks it's just too much for a single request. I'm sorry.

However, as with anything I do here, you're welcome to do all the modifications you'd like to!

 
dn3

Joined: 2012-03-31
Posts: 16
Posted: Mon, 2012-05-14 03:34

It's all good, I appreciate the discussion. I was trying to make a case for its use, not pushing you to code it, certainly not right away.

Part of my thinking is that EXIF can hold relevant descriptive info, artist info, that kind of thing, as well as the settings used. Might be good for pulling title data for people that organize their photos using EXIF.

Maybe I'll have a go at it if I can find the time. It shouldn't be that difficult, given that you've hammered out the process for applying the changes.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2012-05-14 03:49
Quote:
EXIF can hold relevant descriptive info, artist info, that kind of thing,

Isn't that what tags are for?
Mass Rename of Titles, Filenames, and URLs

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
dn3

Joined: 2012-03-31
Posts: 16
Posted: Mon, 2012-05-14 04:07

Yeah, it is what tags are for, and it'd be great to pull tag info from EXIF, too - for people who set the info in their photos as part of their workflow. Why set it twice, and lose the data if the photo is used in other places than a Gallery?

Maybe what's needed is a comprehensive module specifically for handling "advanced" uses of EXIF, rather than packing it into this one.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2012-05-14 13:11

dn3: I agree that perhaps there is a better place for this. I too was looking at the exif module/libraries/etc., and seeing what could be done with it. (It's under review in the bug tracker to be extended/modified/updated) I think you're correct that with IPTC and EXIF tags, there are opportunities to use this data in lot's of areas within the gallery.

I'm hopeful this module will be a catalyst for others to do unique and interesting things as well!

I also appreciate the commentary. After all, that's what this community should be about.

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Mon, 2012-05-14 18:15

Similar in the plugin: Is there a way, to store pictures ALWAYS by standard with img-filename to the item's ID (like 12345.jpg) AND the Internet-URL to the item's ID?

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2012-05-14 18:31
 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Mon, 2012-05-14 19:28

lol :-D