Moving Files to 3 different folders

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
Snowrisk
Posts: 2
Joined: 06 Aug 2021, 14:47

Moving Files to 3 different folders

Post by Snowrisk »

Hello,

I am using FileBot on a Synology and would like to put my movies in different folders.

My Sysinfo:

Code: Select all

FileBot 4.9.4 (r8736)
JNA Native: 6.1.0
MediaInfo: 20.08
Tools: fpcalc/1.5.0 p7zip/9.20 unrar/5.21 ffprobe/3.3.7
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2021-08-02 (r761)
Groovy: 3.0.8
JRE: OpenJDK Runtime Environment 16.0.2
JVM: 64-bit OpenJDK 64-Bit Server VM
CPU/MEM: 4 Core / 1.0 GB Max Memory / 27 MB Used Memory
OS: Linux (amd64)
HW: Linux Daedalus 3.10.105 #25556 SMP Thu Mar 18 12:51:35 CST 2021 x86_64 GNU/Linux synology_cedarview_713+
CPU/MEM: Intel(R) Atom(TM) CPU D2701   @ 2.13GHz [MemTotal: 4.1 GB | MemFree: 136 MB | SwapCached: 174 MB | SwapTotal: 2.1 GB | SwapFree: 678 MB]
STORAGE: ext4 [/] @ 1.1 GB | ext4 [/volume1] @ 677 GB | ext4 [/volumeUSB1/usbshare] @ 2.4 TB | ext4 [/volumeUSB2/usbshare] @ 864 GB
USER: root
DATA: /volume1/@appstore/filebot/data/0
Package: SPK
License: FileBot License PX6086830 (Valid-Until: 2068-11-03)
Done ヾ(@⌒ー⌒@)ノ
My Script :

Code: Select all

export JAVA_OPTS=`free | awk -vm=512 -vp=0.7 '/Mem:/ {printf "-Xmx%dm", ($2*p)/m; exit}'`    # set -Xmx to 0.7 of physical memory
LOG="/volume1/amc.log"
EXC="/volume1/amc.txt"
SERIEN="/volumeUSB1/usbshare/Series/{n}/{n} - {s00e00} - {t}"
UNSORTIERT="/volumeUSB1/usbshare/Unsorted/{file.structurePathTail}"

/var/packages/filebot/target/filebot.sh -script fn:amc --lang de --log-file $LOG \
--output /volumeUSB1/usbshare/OrphanedMedia/ \
--action move "$1" \
--conflict=auto \
--def "seriesFormat=$SERIEN" \
--def "movieFormat={fn =~ /2160p|4K|4k|UHD|uhd/ ? '/volumeUSB1/usbshare/Movies4K/': fn =~ /DOKU|doku/ ? '/volumeUSB1/usbshare/MoviesDoku/' : '/volume1/video/Movies'}/{n}/{n} {y} {imdbid}" \
--def "unsortedFormat=$UNSORTIERT" \
--def unsorted=y "artwork=y" \
--def clean=y \
--def 'kodi=10.10.10.7:8080' \


/var/packages/filebot/target/filebot.sh -script fn:cleaner '/volumeUSB1/usbshare/Download/JDownloader' --def minsize=314572800  --def maxsize=314572800
Movies should be sorted as follows:

HD movies in "Movies".
4k movies in "Movies4k
Documentaries in "MoviesDoku"

Normally this works, but documentations in 4k are also moved to the folder "Movies4k" and not to "MoviesDoku". Is it possible to control the order in which the processing of the parameters (fn =~) happens?

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

Re: Moving Files to 3 different folders

Post by rednoah »

This bit of code (that presumably is written by you, no?) is responsible for how the destination file paths starts:

Code: Select all

fn =~ /2160p|4K|4k|UHD|uhd/ ? '/volumeUSB1/usbshare/Movies4K/' : fn =~ /DOKU|doku/ ? '/volumeUSB1/usbshare/MoviesDoku/' : '/volume1/video/Movies'

You could turn things around if you wanna do the /DOKU|doku/ check first:

Code: Select all

fn =~ /DOKU|doku/ ? '/volumeUSB1/usbshare/MoviesDoku/' : fn =~ /2160p|4K|4k|UHD|uhd/ ? '/volumeUSB1/usbshare/Movies4K/' : '/volume1/video/Movies'
:idea: Please read the FAQ and How to Request Help.
User avatar
Snowrisk
Posts: 2
Joined: 06 Aug 2021, 14:47

Re: Moving Files to 3 different folders

Post by Snowrisk »

Thanks rednoah!
rednoah wrote: 06 Aug 2021, 15:25 (that presumably is written by you, no?)
I found the code here and adapted it for me ;)
You could turn things around if you wanna do the /DOKU|doku/ check first:

Code: Select all

fn =~ /DOKU|doku/ ? '/volumeUSB1/usbshare/MoviesDoku/' : fn =~ /2160p|4K|4k|UHD|uhd/ ? '/volumeUSB1/usbshare/Movies4K/' : '/volume1/video/Movies'
Thanks for the tip, I will rearrange the line in the code.

Regards,
Jens
Post Reply