GUI - Format Expression output broken

Any questions? Need some help?
Post Reply
omg
Posts: 2
Joined: 05 Apr 2018, 23:44

GUI - Format Expression output broken

Post by omg » 23 Apr 2019, 04:16

Hello Rednoah,

To begin, I want to say I am a huge fan and have been using Filebot for years. I can usually help myself with the forums but not this time it seems.

OS: Windows 10
Package: Windows 10 App store

My sysenv: https://gist.github.com/The-OMG/56e210d758d643a3b4667f597274eb38
My Screenshots:
Image
Image

I have tried to "repair" and "reset" the app, but it doesn't help.

My issue is that the format expression I am using is rendering a weird string. I get the correct string using the exe windows installer and the linux package but not for the windows app store version.

My expression:

Code: Select all

H:/Team Drives/OMG TV/TV Shows/Processed/TV Shows/Processed/{genres =~ /Children|Family/ ? 'TV.Cartoons_and_Kids' : genres =~ /Animation/ ? 'Anime' : 'TV'}{hd =~ /UHD/ ? '.4K' : ''}{f.isDirectory() ? '.Disc' : ''}/{plex[1].replaceTrailingBrackets()}{" ($y)"}/{any{fn.match(/(.*\.S\d\dE\d\d\..*?\d{3,}p.*)/)}{plex[1].replaceTrailingBrackets()+{" ($y)"}+{" $s00e00"}+{" - $t"}+' - ['+{"$SOURCE-"}+{"$vf "}+{"$HDR "}+{"$ac "}+{"$vc"}+{" $channels"}+{"-$GROUP"}+']'}{fn.replace('-xpost','')}}
Output: Windows 10 exe output:

Code: Select all

TV Shows/Processed/Anime/ID-0 (2017)/ID-0 (2017) S01E01 - Mind Trance - [HDTV-1080p EAC3 x264 2.0]
My linux script runs this just fine as well.
Script:

Code: Select all

#!/usr/bin/env bash
#set -x
#set -v

MEDIA_FOLDER="$1"
MEDIA_GENRE="$2"
FIND_MODE="d"

mapfile -t -d '' INPUT_ARRAY < <(find "${MEDIA_FOLDER}" -depth -maxdepth 1 -type "${FIND_MODE}" -print0)

filebotFunction() {
    filebot -script fn:amc \
        --output "/home6/omg/cloud" \
        --action move \
        --conflict auto \
        -non-strict \
        "$1" \
        --def @/home6/omg/scripts/filebot/args.txt "ut_label=$2"\
        excludelist=amc.txt -no-xattr > $HOME/logs/amcOperations.txt 2>&1
}

export -f filebotFunction
find "${MEDIA_FOLDER}" -depth -type "${FIND_MODE}" -print0 |
    parallel \
        --joblog ~/logs/amc.log \
        --use-cores-instead-of-threads \
        --retries 10 \
        --progress \
        --nice 19 \
        -0 \
        --jobs 5 \
        --load 10% filebotFunction ::: "${INPUT_ARRAY[@]}" ::: "$MEDIA_GENRE"
Args.txt:

Code: Select all

seriesFormat="TV Shows/Processed/{genres =~ /Children|Family/ ? 'TV.Cartoons_and_Kids' : genres =~ /Animation/ ? 'Anime' : 'TV'}{hd =~ /UHD/ ? '.4K' : ''}{f.isDirectory() ? '.Disc' : ''}/{plex[1].replaceTrailingBrackets()}{" ($y)"}/{any{fn.match(/(.*\.S\d\dE\d\d\..*?\d{3,}p.*)/)}{plex[1].replaceTrailingBrackets()+{" ($y)"}+{" $s00e00"}+{" $t"}+' ['+{"$SOURCE-"}+{"$vf "}+{"$HDR "}+{"$ac "}+{"$vc"}+{" $channels"}+{"-$GROUP"}+']'}{fn.replace('-xpost','')}}"
movieFormat="Movies/{y < 1979 ? '/OLD/' : ''}{(audio.language) =~ /en/ ? '' : {genres =~ /Animation/ ? 'Anime.' : 'Foreign.'}}Movies{genres =~ /Children|Family/ ? '.Kids' : {hd =~ /UHD/ ? '.4K' : '.HD'}}{f.isDirectory() ? '.Disc' : ''}/{plex[1].replaceTrailingBrackets()}{" ($y)"}/{any{fn.match(/(.*\.\d\d\d\d\..*?\d{3,}p.*)/)}{plex[1].replaceTrailingBrackets()+{" ($y)"}+' ['+{"$SOURCE-"}+{"$vf "}+{"$HDR "}+{"$ac "}+{"$vc"}+{" $channels"}+{"-$GROUP"}+']'}{fn.replace('-xpost','')}}"
animeFormat="TV Shows/Processed/Anime{hd =~ /UHD/ ? '.4K' : ''}{f.isDirectory() ? '.Disc' : ''}/{plex[1].replaceTrailingBrackets()}{" ($y)"}/{any{fn.match(/(.*\.S\d\dE\d\d\..*?\d{3,}p.*)/)}{plex[1].replaceTrailingBrackets()+{" ($y)"}+{" $s00e00"}+{" $t"}+' ['+{"$SOURCE-"}+{"$vf "}+{"$HDR "}+{"$ac "}+{"$vc"}+{" $channels"}+{"-$GROUP"}+']'}{fn.replace('-xpost','')}}"
unsorted=n
music=n
artwork=n
clean=y
extras=n
deleteAfterExtract=y
minFileSize=0
minLengthMS=0
skipExtract=y

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

Re: GUI - Format Expression output broken

Post by rednoah » 23 Apr 2019, 04:39

1.
Looks like your format is just wrong, and it seems newer versions of FileBot / Groovy are less forgiving for some reason:
https://www.filebot.net/forums/viewtopic.php?f=5&t=1895

GOOD

Code: Select all

{"Season " + s}
GOOD

Code: Select all

{"Season $s"}
BAD

Code: Select all

{"Season " + {s}}

:idea: The outermost {...} delimit a Groovy expression, but everything within the outermost {...} is just Groovy code. Notably, {...} is not a substitution pattern for variables. {...} in Groovy code are simply Groovy closures or code blocks, and are thus semantically completely different from the outermost {...}.


e.g. Compare & Contrast:

Code: Select all

{
	def value = 1 // the value 1
	return value
}

Code: Select all

{
	def function = { 1 } // a function or closure that yields 1 if called
	return function.call()
}

:idea: You'll need to fix your format.


2.
? is not allowed on paths on Windows, so this could be a problem, one completely unrelated to your custom format though:

Code: Select all

net.filebot.xattr.store: .xattr?
:idea: Please read the FAQ and How to Request Help.

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

Re: GUI - Format Expression output broken

Post by rednoah » 23 Apr 2019, 05:00

I've rewritten your format expression in a more correct more readable way:

Code: Select all

H:/Team Drives/OMG TV/TV Shows/Processed/TV Shows/Processed/
{
	genres =~ /Children|Family/ ? 'TV.Cartoons_and_Kids' : 
	genres =~ /Animation/ ? 'Anime' : 'TV'
}
{
	hd =~ /UHD/ ? '.4K' : null
}
{
	f.directory ? '.Disc' : null
}
/{ny}/
{
	any{
		fn.match(/(.*\.S\d\dE\d\d\..*?\d{3,}p.*)/)
	}{
		[ny, s00e00, t, '-', '[' + source, vf, hdr, ac, vc,channels].join(' ') + '-' + group + ']'
	}{
		fn.removeAll(/-xpost/)
	}
}
:!: I'm actually not sure how your code is supposed to behave, in the error case, because it wasn't supposed to work at all in the first place. :lol:

:!: In my example above, if any binding fails, source, channels, group, etc fail for some reason, then that code block is scrapped, and fn.removeAll(/-xpost/) is used instead. I think this is what you meant in the first place, but not sure.




Alternatively, this will do if you want to ignore any individual bindings that aren't working:

Code: Select all

H:/Team Drives/OMG TV/TV Shows/Processed/TV Shows/Processed/
{
	genres =~ /Children|Family/ ? 'TV.Cartoons_and_Kids' : 
	genres =~ /Animation/ ? 'Anime' : 'TV'
}
{
	hd =~ /UHD/ ? '.4K' : null
}
{
	f.directory ? '.Disc' : null
}
/{ny}/
{
	any{
		fn.match(/(.*\.S\d\dE\d\d\..*?\d{3,}p.*)/)
	}{
		ny + ' ' + s00e00 + ' ' + t + 
		' - [' + 
			allOf{source+'-'}{' '+vf}{' '+hdr}{' '+ac}{' '+vc}{' '+channels}{'-'+group}.join() + 
		']'
	}
}
:idea: Please read the FAQ and How to Request Help.

omg
Posts: 2
Joined: 05 Apr 2018, 23:44

Re: GUI - Format Expression output broken

Post by omg » 23 Apr 2019, 21:41

Thank you for your help.

The last format you wrote was what I was going for.

Would you be able to tell me the best method of renaming the folders of the media files? Right now Filebot will process each individual file which is very slow. For example changing "Firefly/" to "Firefly (2002)/" without having Filebot parse each file.


Thanks again.

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

Re: GUI - Format Expression output broken

Post by rednoah » 24 Apr 2019, 07:28

1.
I kinda like what you did there though, where the {closure} works exactly like any{closure}{null} just shorter and more readable:

Code: Select all

"String" + {closure}
I'll see if I can official make this kind of code work for upcoming releases.



2.
omg wrote:
23 Apr 2019, 21:41
Would you be able to tell me the best method of renaming the folders of the media files? Right now Filebot will process each individual file which is very slow. For example changing "Firefly/" to "Firefly (2002)/" without having Filebot parse each file.
Unfortunately, that's not supported. FileBot doesn't really have a way of getting the series year without identifying at least one episode and then taking the series information from that.

If you literally want to just rename a folder called "Firefly" to "Firefly (2002)" without having to figure out the year, then I suppose generic rename tools, i.e. just find -exec bash commands, probably will work best.


3.
Is it slow identifying a file or it slow moving a file? The latter should be instant as long as the source and destination file system is the same.


4.
If you have previously processed the files with FileBot, and if xattr was stored successfully, then you can use --db xattr to instantly process all files without having to spend time on identifying them first:
https://www.filebot.net/forums/viewtopic.php?f=4&t=4788
:idea: Please read the FAQ and How to Request Help.

Post Reply