Page 1 of 1

jpg renaming

Posted: 14 Jun 2015, 16:06
by filebotfan
Hello,

I'm trying to automate the naming of the folder, fanart and poster jpg files so they match the naming convention I require.

I ultimately need it along the lines of movietitle.blurayrip.fanart.jpg.

I'm using fn:renall with --db TheMovieDB which names my movie and nfo file correctly.

Is there a way to then name fanart to moviename.blurayrip.fanart.jpg?

I've tried if then and match statements with no luck.

Thanks. Great tool.

Re: jpg renaming

Posted: 14 Jun 2015, 17:00
by rednoah
Assuming the additional files match the movie file (kinda like subtitles) then FileBot will match the additional files to the same metadata and the rest is ultimately up to what you do in your --format.

This should work:
* movie.mp4
* movie.something.jpg

By default it'll probably rename that to movie.mp4 and movie.jpg but you can retain tokens from the original filename via your --format expression. Probably something like fn.match(/something/) like all the other formats that retain information from the original filename.

Re: jpg renaming

Posted: 14 Jun 2015, 17:43
by filebotfan
So the artwork pull brings down the files as fanart.jpg, folder.jpg and poster.jpg.

Would that mean I would need to rename them first as movie.fanart.jpg, movie.folder.jpg etc, then I could run fn:renall?

Would that be the correct approach?

Thanks.

Re: jpg renaming

Posted: 14 Jun 2015, 17:59
by rednoah
In that case you shouldn't use fn:renall at all. Why would you call it on files that have already been perfectly organised?

You really just want folder/name.jpg => folder/folder.name.jpg so that's simple enough. I'm sure there's plenty of tools that can do that. Including FileBot GUIs generic renaming features or the fn:replace script of you need a script.

@see viewtopic.php?f=3&t=2072
@see viewtopic.php?f=4&t=5#p2100

Re: jpg renaming

Posted: 14 Jun 2015, 18:49
by filebotfan
For the script, how do I get fn:replace to use the existing folder name as part of the jpg rename?

Thanks.

Re: jpg renaming

Posted: 14 Jun 2015, 19:19
by rednoah
Regular Expression. Match folder & filename and then replace as required.

Here's the regular expression you'll need:
http://regexr.com/3b6tp

I'm sure you can come up with the replacement yourself. ;)

@see http://www.regular-expressions.info/brackets.html

Hint: something like /$1/$1.$2 should do.