Automatically change filenames of downloaded art

Hello,
I’ve managed to set up Picard to download art from the cover art archive and save it to the predefined types. However, to use it with Kodi I would prefer some types to be saved with different names, namely

medium.jpg => discart.jpg
front.jpg => folder.jpg

and types with multiple numbers with 2-digit numbers in brackets, i.e.

booklet (1).jpg => booklet (01).jpg

Is this possible? Thank you in advance!

The easiest way is to enable the option " Always use the primary image type as the file name for non-front images".

You could also use the file naming pattern for the cover art files. It supports scripting, and you can use the variable %coverart_maintype% to get the primary type of the image. E.g. to save front as cover, medium as discart and all other as primary type you could use:

$if($eq(%coverart_maintype%,front),front,$if($eq(%coverart_maintype%,medium),discart,%coverart_maintype%))

See also Location — MusicBrainz Picard v2.8 documentation

5 Likes

Thanks, that is already very helpful! I am by no means a programmer but are all the brackets correct? It also seems that the first condition is missing the rename. How about

$if($eq(%coverart_maintype%,front),folder),$if($eq(%coverart_maintype%,medium),discart),%coverart_maintype%

Just to understand the script, it sets the match to coverart_maintype in condition 1, defines the specific type in condition 2 and gives it another name in condition 3? No command to substitute the name like $replace is necessary?

Ok, through trial and error I found that this would work:

$if($eq(%coverart_maintype%,front),folder,%coverart_maintype%)
$if($eq(%coverart_maintype%,medium),discart,%coverart_maintype%)

However, it only takes effect when entered into the field under cover art “Use the following file name for images”. It has no effect when used under “File naming” as that only seems to affect music tracks.

Unfortunately, in that field under cover art no line breaks are possible. So when I enter 2 replacement conditions, the separator between the two ifs (i.e. ,) becomes part of the new filename. The pipe character | also doesn’t seem to work.

Any ideas?

You need to enter each followup $if process to only happen if the current $if fails. For example, something like:

$if($eq(%coverart_maintype%,front),folder,$if($eq(%coverart_maintype%,medium),discart,%coverart_maintype%))

That allows everything to be on one line.

1 Like