rename artwork after fetching

Support for Ubuntu and other Desktop Linux distributions
Post Reply
svenilee
Posts: 4
Joined: 19 Oct 2022, 09:57

rename artwork after fetching

Post by svenilee »

Hi,

I use filbot as follow to rename and sort my video files.

Code: Select all

#!/bin/sh
LOG="/home/svenilee/amc.log"
EXC="/home/svenilee/amc.txt"
SERIEN="/home/svenilee/TEST/Serien/{n}/Season {s.pad(2)}/{n}.{s00e00}.{t}"
FILME="/home/svenilee/TEST/Filme/{n}/{n}.{y}"
OUTPUT="/home/svenilee/TEST"
UNSORTIERT="/home/svenlee/TEST/{file.structurePathTail}" 
##FileBot ausführen
filebot -script fn:amc --output "$OUTPUT" --lang de --log-file $LOG --action move "$1" --def "seriesFormat=$SERIEN" "movieFormat=$FILME" "animeFormat=$ANIME" "unsortedFormat=$UNSORTIERT" -non-strict --def unsorted=y "artwork=y" --def clean=n
## Aufräumen, --def root löscht den Unterordner mit
filebot -script fn:cleaner "$1" --def root=n
Now I would like to add fetch the artwork too. With '''atwork=y''' it works so far. But I would like to rename the artwork.
e.g. folder.jpg to {n}.{y}-folder.jpg

how could I get it work?

sveni_lee
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rename artwork after fetching

Post by rednoah »

The amc script does not rename artwork, and does not have any configuration options that would allow you to change how artwork downloaded by the amc script is stored and named on the local file system.


:idea: You could use Plain File Mode to do additional custom renaming with a dedicated filebot call at the end of your script.


:arrow: The Rename subtitle files to match the name of a nearby video file example seems to be somewhat close to what you're trying to do, and can easily be modified to do what you want to do:

Code: Select all

$ filebot -rename -r /path/to/input --db file --file-filter "f.name ==~ /folder.jpg/" --format "{ folder.files.max{ it.length() }.nameWithoutExtension }-{ fn }" --action TEST --log INFO
[TEST] from [Avatar/folder.jpg] to [Avatar/Avatar-folder.jpg]
:idea: Please read the FAQ and How to Request Help.
svenilee
Posts: 4
Joined: 19 Oct 2022, 09:57

Re: rename artwork after fetching

Post by svenilee »

thanks for the hint.

is there a way to pass the arguments from amc script? Otherwise I did not know the path to artwok within my script because amc script will define the path and the file name.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rename artwork after fetching

Post by rednoah »

e.g.

Code: Select all

filebot -rename -r "$OUTPUT" --db file --file-filter "f.name ==~ /folder.jpg/" --format "{ folder.files.max{ it.length() }.nameWithoutExtension }-{ fn }"
:idea: --file-filter "f.name ==~ /folder.jpg/" takes care of selecting only files named folder.jpg for processing even though we pass the entire output file structure as input via -r "$OUTPUT"
:idea: Please read the FAQ and How to Request Help.
svenilee
Posts: 4
Joined: 19 Oct 2022, 09:57

Re: rename artwork after fetching

Post by svenilee »

thanks for your help...
everythink works like aspected.

is it possible to fetch the artwork only for movies but not for series?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rename artwork after fetching

Post by rednoah »

Sorry, the amc script is not configurable on that level of detail. You can (and should if possible) have separate calls for Movies and TV Shows though, so that you can do --def ut_label=TV artwork=n for TV Shows and --def ut_label=Movie artwork=y for Movies respectively depending on the use case at hand.
:idea: Please read the FAQ and How to Request Help.
svenilee
Posts: 4
Joined: 19 Oct 2022, 09:57

Re: rename artwork after fetching

Post by svenilee »

so could/should work in this way.

Code: Select all

filebot -script fn:amc --output "$OUTPUT" --lang de --log-file $LOG --action move "$1" --def "seriesFormat=$SERIEN" "movieFormat=$FILME" "animeFormat=$ANIME" "unsortedFormat=$UNSORTIERT" -non-strict --def unsorted=y  --def ut_label=TV "artwork=n" --def ut_label=Movie "artwork=y" --def clean=n
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rename artwork after fetching

Post by rednoah »

No. --def ut_label=TV artwork=n will force TV mode for all input files and disable artwork.


Process Movie files with this command:

Code: Select all

filebot -script fn:amc ... --def ut_label=Movie artwork=y
Process Episode files with this command:

Code: Select all

filebot -script fn:amc ... --def ut_label=TV artwork=n
:arrow: 2 different commands for 2 different use cases. Each optimised for a specific use case.

You can use this technique if you can somehow tell in advance if your input file is a movie or an episode. This may be easy for some users, e.g. if downloads are somehow automatically tagged / labelled / separated into folders depending on the source, i.e. movies and episodes are downloaded into different folders.

You cannot use this technique if your downloads are not tagged / labelled / all mixed together, i.e. movies and episodes are downloaded into the same folder.
:idea: Please read the FAQ and How to Request Help.
Post Reply