Page 1 of 1

Saving fetched assets to shared folder (for Kometa)

Posted: 14 Sep 2024, 04:31
by thedigitalhobo
Used Filebot to rename and reorganize years of manually named files and folders. Wish I dove in much, much sooner.

Renaming is working like a charm....

Format: Select all

//myNAS/4Kvideo/4kMovies/{ n.sortName('$2, $1')} ({y}) {" {tmdb-$tmdbid} "} {" {edition-$edition}"}/{ n.sortName('$2, $1')} ({y}) {" {tmdb-$tmdbid} "} {" {edition-$edition}"} - [{vf}.{vc}{if (hdr == '') '' else({'.'+hdr}){vcf}}.{acf}]
I keep my 4k libraries separate from my HD/1080p libraries. So I have two versions of the same movie in two different libraries. I recently started playing with Kometa and bumped into a hurdle. Kometa allows for an "asset folder" that can be used across libraries, so I wouldn't need to keep two sets of artwork, subtitles, etc.

I can't figure out how to set the post-processing to save the poster, art, subtitles, etc, to a different folder. So instead of renaming /myNAS/4Kmovies/Jaws (1974) to /myNAS/4kmovies/Jaws (1975) {tmdb-578}/Jaws (1975) {tmdb-578} - [2160p.x265.HDR10.DTHDDA7.1] and saving the art an assets to the movie folder, I'd like to save or move the posters and subtitles to /myNAS/Assets/Jaws (1975) {tmdb-578}/

Re: Saving fetched assets to shared folder (for Kometa)

Posted: 14 Sep 2024, 04:58
by rednoah
:!: [{vf}.{vc}{if (hdr == '') '' else({'.'+hdr}){vcf}}.{acf}] is wrong and works at best somewhat by accident. {vcf} is notably not actually used, due to strange code doing strange things by accident. See Learn how {expressions} work and useful Helper Functions › The Unwind-on-Undefined Behaviour for details.


:arrow: Here's what you mean to express:

Format: Select all

[{ allOf{ vf }{ vc }{ hdr }{ vcf }{ acf }.join('.') }]

:arrow: The 4K rule could be expressed in code as well: Separate 4K Movies and non-4K Movies

Format: Select all

{ hd == /UHD/ ? '4kMovies' : 'Movies' }



thedigitalhobo wrote: 14 Sep 2024, 04:31 I can't figure out how to set the post-processing to save the poster, art, subtitles, etc, to a different folder.
You can't. The standard Custom Post-Processing Scripts are not customizable and will always save files relative to where media files were moved / copied.


:arrow: You could do this after the fact with Plain File Mode:

:arrow: You could (at great difficulty for non-programmers) use Custom Post-Processing Scripts and write your own code, e.g. simply move / copy artwork from where it is by default to where you want it to be.



:arrow: You could (at great difficulty for non-programmers) use the filebot command-line tool and your own standalone modified artwork script to fetch artwork and put it where you want it to be.

Re: Saving fetched assets to shared folder (for Kometa)

Posted: 14 Sep 2024, 20:59
by thedigitalhobo
I had been creating new folders after renaming the originals....

Code: Select all

$: find -type d -exec mkdir -p "$HOME/NewFolder/{}" \;
then creating an mp4 file based on the folder names...

Code: Select all

find . -type d | while IFS= read -r d; do      ( cd "$d" && touch "$(basename "$d").mp4" ) ; done
Let filebot work its magic on the new folder / files, and then delete the mp4 after I had the new assets.

Code: Select all

find . -type f -name "*.mp4" -delete
Its a little tedious, but it works, and may just keep doing that if I can't bend filebot to my will.

Thanks for the tips on my "happy accidents." I'll update to avoid strange things from happening down the road!

Re: Saving fetched assets to shared folder (for Kometa)

Posted: 15 Sep 2024, 05:17
by rednoah
I do believe that the post above already has a better solution, so let me add a copy & paste example here:

Shell: Select all

filebot -rename -r /path/to/4kmovies --db file --format '{ f.path.replace("4kmovies" : "Assets") }'  --file-filter 'f.image || f.subtitle'


Step 1: Process files as usual generating artwork at the usual file paths:

Console Output: Select all

$ filebot -rename Avatar.2009.mp4 --db TheMovieDB --output 4kmovies --format "{plex.id}" --apply artwork --log INFO
[MOVE] from [Avatar.2009.mp4] to [4kmovies/Movies/Avatar (2009) {tmdb-19995}/Avatar (2009).mp4]
[ARTWORK] https://image.tmdb.org/t/p/original/6EiRUJpuoeQPghrs3YNktfnqOVh.jpg (4kmovies/Movies/Avatar (2009) {tmdb-19995}/poster.jpg)
[ARTWORK] https://image.tmdb.org/t/p/original/vL5LR6WdxWPjLPFRLe133jXWsh5.jpg (4kmovies/Movies/Avatar (2009) {tmdb-19995}/backdrop.jpg)
[ARTWORK] https://assets.fanart.tv/fanart/movies/19995/hdmovieclearart/avatar-51a3a817f375b.png (4kmovies/Movies/Avatar (2009) {tmdb-19995}/clearart.png)
[ARTWORK] https://assets.fanart.tv/fanart/movies/19995/hdmovielogo/avatar-51290d0678d4e.png (4kmovies/Movies/Avatar (2009) {tmdb-19995}/logo.png)
[ARTWORK] https://assets.fanart.tv/fanart/movies/19995/moviedisc/avatar-520968c2dde7b.png (4kmovies/Movies/Avatar (2009) {tmdb-19995}/disc.png)


Step 2: Rewrite file paths of image / subtitle files:

Console Output: Select all

$ filebot -rename -r 4kmovies --db file --format '{ f.path.replace("4kmovies" : "Assets") }'  --file-filter 'f.image || f.subtitle' --log INFO
[MOVE] from [4kmovies/Movies/Avatar (2009) {tmdb-19995}/backdrop.jpg] to [Assets/Movies/Avatar (2009) {tmdb-19995}/backdrop.jpg]
[MOVE] from [4kmovies/Movies/Avatar (2009) {tmdb-19995}/clearart.png] to [Assets/Movies/Avatar (2009) {tmdb-19995}/clearart.png]
[MOVE] from [4kmovies/Movies/Avatar (2009) {tmdb-19995}/disc.png] to [Assets/Movies/Avatar (2009) {tmdb-19995}/disc.png]
[MOVE] from [4kmovies/Movies/Avatar (2009) {tmdb-19995}/logo.png] to [Assets/Movies/Avatar (2009) {tmdb-19995}/logo.png]
[MOVE] from [4kmovies/Movies/Avatar (2009) {tmdb-19995}/poster.jpg] to [Assets/Movies/Avatar (2009) {tmdb-19995}/poster.jpg]

Re: Saving fetched assets to shared folder (for Kometa)

Posted: 18 Sep 2024, 20:11
by thedigitalhobo
MARVELOUS.

Learning how to read, understand, and modify the expressions is pretty key. Had my "ah-ha" moment and it is all working now. Thanks!

Re: Saving fetched assets to shared folder (for Kometa)

Posted: 19 Sep 2024, 04:05
by rednoah
thedigitalhobo wrote: 18 Sep 2024, 20:11 Learning how to read, understand, and modify the expressions is pretty key.
You will of course want to learn and prototype in the Format Editor GUI, possibly create Preset for easy access in the GUI, and if you need a command-line call then that would be the last step, copy & pasting code that has already been thoroughly tested in the GUI.

ScreenshotScreenshot