jpg renaming

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
filebotfan
Posts: 4
Joined: 14 Jun 2015, 16:00

jpg renaming

Post 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.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: jpg renaming

Post 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.
:idea: Please read the FAQ and How to Request Help.
filebotfan
Posts: 4
Joined: 14 Jun 2015, 16:00

Re: jpg renaming

Post 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.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: jpg renaming

Post 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
:idea: Please read the FAQ and How to Request Help.
filebotfan
Posts: 4
Joined: 14 Jun 2015, 16:00

Re: jpg renaming

Post by filebotfan »

For the script, how do I get fn:replace to use the existing folder name as part of the jpg rename?

Thanks.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: jpg renaming

Post 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.
:idea: Please read the FAQ and How to Request Help.
Post Reply