[Solved]How to add format to script via input file (amc script)

Any questions? Need some help?
Post Reply
craigjl77
Posts: 4
Joined: 05 Jan 2024, 23:54

[Solved]How to add format to script via input file (amc script)

Post by craigjl77 »

System Info

Code: Select all

 11:22:28$ filebot -script fn:sysinfo
FileBot 5.1.1 (r9982)
JNA Native: 6.1.4
MediaInfo: 23.07
Tools: NONE
Extended Attributes: OK
Unicode Filesystem: OK
GVFS: PlatformGVFS [/run/user/1000/gvfs]
Script Bundle: 2023-11-06 (r952)
Groovy: 4.0.14
JRE: OpenJDK Runtime Environment 17.0.7
JVM: OpenJDK 64-Bit Server VM
CPU/MEM: 8 Core / 4.2 GB Max Memory / 46 MB Used Memory
OS: Linux (amd64)
HW: Linux flake-nixos 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux
CPU/MEM: : AMD Ryzen 9 3950X 16-Core Processor / MemTotal: 16 GB / MemFree: 274 MB / MemAvailable: 9 GB / SwapTotal: 8 GB / SwapFree: 8 GB
STORAGE: ext4 [/] @ 452 GB | ext4 [/nix/store] @ 452 GB | nfs4 [/home/craigl/Desktop] @ 2.6 TB | nfs4 [/home/craigl/Documents] @ 2.6 TB | nfs4 [/home/craigl/Music] @ 2.6 TB | nfs4 [/mnt/unraid/imagefiles] @ 2.6 TB | nfs4 [/data] @ 9 TB | nfs4 [/mnt/unraid/workdata] @ 2.6 TB | nfs4 [/home/craigl/Pictures] @ 2.6 TB | nfs4 [/home/craigl/MoviesOnUnraid] @ 2.6 TB | nfs4 [/mnt/unraid/isos] @ 2.6 TB | nfs4 [/mnt/unraid/MacPhotos] @ 484 GB | nfs4 [/home/craigl/Downloads] @ 2.6 TB
UID/GID: uid=1000(craigl) gid=100(users) groups=100(users),1(wheel),57(networkmanager),59(scanner)
DATA: /home/craigl/.local/share/filebot/data
Package: TAR
License: FileBot License P56836855 (Valid-Until: 2025-01-12)

------------------- UPDATE AVAILABLE: FileBot 5.1.2 (r10125) -------------------

Done ヾ(@⌒ー⌒@)ノ
cr
Script that I'm trying to setup in Transmission

Code: Select all

#/bin/sh -xu
#!/usr/bin/env bash -xu

RDATE=`date`
echo "$RDATE =============================================== Begin run ====================================" >> $HOME/Videos/tpprun.log
# Input Parameters

ARG_PATH="/home/craigl/Public/Reacher.S02E06.1080p.HEVC.x265-MeGusta[EZTVx.to].mkv"
ARG_NAME="Reacher.S02E06.1080p.HEVC.x265-MeGusta[EZTVx.to].mkv"
ARG_LABEL="" 


#ARG_PATH="$TR_TORRENT_DIR/$TR_TORRENT_NAME"
#ARG_NAME="$TR_TORRENT_NAME"
#ARG_LABEL="$TR_TORRENT_LABELS"
echo "ARG_PATH: $ARG_PATH" >> $HOME/Videos/tpprun.log
echo "ARG_NAME: $ARG_NAME" >> $HOME/Videos/tpprun.log
echo "ARG_LABEL: $ARG_LABEL" >> $HOME/Videos/tpprun.log


# Configuration
CONFIG_OUTPUT="$HOME/Videos"
echo "CONFIG_OUTPUT: $CONFIG_OUTPUT" >> $HOME/Videos/tpprun.log
echo ' '

## Running this works
#####################
filebot -script fn:amc --output "$CONFIG_OUTPUT" --action duplicate --conflict skip -non-strict --log-file amc.log --def unsorted=y music=y artwork=n excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" 2>&1 >> $HOME/Videos/tpprun.log

#Running this does not - nothing in log - just brings up GUI panel
######################
#filebot --format "\{ allOf\{n\}\{y\}\{s00e00\}\{t\}.join\('\-'\).upperInitial\(\).space\('_'\).replace('\&'\:'And'\).removeAll\(/\[\(\)\"',\]/\) \}" --output "$CONFIG_OUTPUT" --action duplicate --conflict skip -non-strict --def unsorted=y music=n artwork=n excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" 2>&1 >> $HOME/Videos/tpprun.log

RDATE=`date`
echo "$RDATE =============================================== End run ====================================" >> $HOME/Videos/tpprun.log
This works

Code: Select all

filebot -script fn:amc --output "$CONFIG_OUTPUT" --action duplicate --conflict skip -non-strict --log-file amc.log --def unsorted=y music=y artwork=n excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" 2>&1 >> $HOME/Videos/tpprun.log
This does not

Code: Select all

filebot --format "\{ allOf\{n\}\{y\}\{s00e00\}\{t\}.join\('\-'\).upperInitial\(\).space\('_'\).replace('\&'\:'And'\).removeAll\(/\[\(\)\"',\]/\) \}" --output "$CONFIG_OUTPUT" --action duplicate --conflict skip -non-strict --def unsorted=y music=n artwork=n excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" 2>&1 >> 
Would like to use this format, via an input file in the above script example

Code: Select all

{ allOf{n}{y}{s00e00}{t}.join('-').upperInitial().space('_').replace('&':'And').removeAll(/[()"',]/) }
Any help would be extremely appreciated, many thanks in advance :-)
Last edited by craigjl77 on 06 Jan 2024, 23:07, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to add format to script via input file

Post by rednoah »

:!: If you remove -script fn:amc then filebot will launch the GUI. If you're using the amc script then you must not remove the -script fn:amc bit. You'll also want to read the amc script manual since the --format option is not relevant in your case. If you're using the amc script then different formats are used for different files, hence you need to pass in multiple custom formats for series / movie / etc.


e.g. GUI usage:

Shell: Select all

filebot ...
e.g. CLI usage:

Shell: Select all

filebot -rename ...

Shell: Select all

filebot -script fn:amc ...



:idea: Use the @file syntax for reading command-line arguments from external text files.


:idea: You'll want to read Automated Media Center › Change how files will be organized and renamed and @file syntax for reading cmdline args from text files › Script Parameter Value to learn how to pass in custom formats for each content type from external files:

Shell: Select all

--def movieFormat="@/path/to/MovieFormat.groovy" seriesFormat="@/path/to/SeriesFormat.groovy" animeFormat="@/path/to/AnimeFormat.groovy"
:idea: Please read the FAQ and How to Request Help.
craigjl77
Posts: 4
Joined: 05 Jan 2024, 23:54

[Solved]Re: How to add format to script via input file

Post by craigjl77 »

Thanks @rednoah, I have sorted it out, example below

Code: Select all

--format
{jellyfin.id}
/home/craigl/Public
-rename
-non-strict
-no-xattr
--output
/home/craigl/Videos
--action
symlink
not the final product, just where I'm up to in the dev cycle :-)

BTW - I love your dedication to this site over the years, an absolute stellar effort !!
rednoah wrote: 06 Jan 2024, 07:52 :!: If you remove -script fn:amc then filebot will launch the GUI. If you're using the amc script then you must not remove the -script fn:amc bit. You'll also want to read the amc script manual since the --format option is not relevant in your case. If you're using the amc script then different formats are used for different files, hence you need to pass in multiple custom formats for series / movie / etc.


e.g. GUI usage:

Shell: Select all

filebot ...
e.g. CLI usage:

Shell: Select all

filebot -rename ...

Shell: Select all

filebot -script fn:amc ...



:idea: Use the @file syntax for reading command-line arguments from external text files.


:idea: You'll want to read Automated Media Center › Change how files will be organized and renamed and @file syntax for reading cmdline args from text files › Script Parameter Value to learn how to pass in custom formats for each content type from external files:

Shell: Select all

--def movieFormat="@/path/to/MovieFormat.groovy" seriesFormat="@/path/to/SeriesFormat.groovy" animeFormat="@/path/to/AnimeFormat.groovy"
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Solved]Re: How to add format to script via input file

Post by rednoah »

craigjl77 wrote: 06 Jan 2024, 23:06 BTW - I love your dedication to this site over the years, an absolute stellar effort !!
Very important. Rarely appreciated. The forums and discussions with users is half the secret sauce. I rarely see and miss that in other products. Cheers! :)
:idea: Please read the FAQ and How to Request Help.
IAmBroom
Posts: 16
Joined: 18 Jan 2016, 18:44

Re: [Solved]How to add format to script via input file (amc script)

Post by IAmBroom »

Seconded, wholeheartedly!
Post Reply