{plex} with additional information

All about user-defined episode / movie / file name format expressions
Post Reply
gvr4qRQv1FlWakfzI2rV
Posts: 2
Joined: 02 Jan 2017, 21:28

{plex} with additional information

Post by gvr4qRQv1FlWakfzI2rV »

I have a question: is there a documentation what and how the Plex Naming Scheme works?
I'd love to use it, but I want to add (by movies and TV Shows, not the subtitles) the encoding for video and audio if available - h.264, ac3 and so. Is there a way to add this if the file used there is a videofile?
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {plex} with additional information

Post by rednoah »

1.
Plex Naming Schemes wrote:e.g. Movies/Avatar (2009)/Avatar (2009) by James Cameron [720p, x264, AC3]

Code: Select all

{plex.derive{" by $director"}{" [$vf, $vc, $ac]"}}
@see viewtopic.php?f=5&t=4116

This example from the documentation seems to do what you're asking for.


2.
Alternatively, if you don't want to abide by the {plex} standard, you can just define your own format:

Code: Select all

{ny} [{vf}]/{n}.{y}.{vf}.{vc}
:idea: Please read the FAQ and How to Request Help.
gvr4qRQv1FlWakfzI2rV
Posts: 2
Joined: 02 Jan 2017, 21:28

Re: {plex} with additional information

Post by gvr4qRQv1FlWakfzI2rV »

my problem is with plex and it's subtitles. If I have external subtitles (.srt-files), then I have to name them Moviename.subt.srt. {plex} prepares everything, including the .subt-part for the srt-file - but when I add {vf} then the subt is not the last part of the filename before the suffix .srt. That's why I wanted to expansion of the {plex}-macro; to have my "specials" as part _before_ the subt.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {plex} with additional information

Post by rednoah »

Yes, the solutions outlined above do take the subtitle suffix into account.

1.
{plex} with additional information before the subtitle suffix:

Code: Select all

{plex.derive{" [$vf, $vc, $ac]"}}
2.
Custom format with subtitle suffix:

Code: Select all

{ny} [{vf}]/{n}.{y}.{vf}.{vc}{subt}
:idea: Please read the FAQ and How to Request Help.
mikejandreau
Posts: 42
Joined: 07 Jun 2017, 16:50

Re: {plex} with additional information

Post by mikejandreau »

I've started using Radarr and thus need the file's quality in the filename so this stupid program knows it's downloaded something already.

I'm trying:

Code: Select all

{plex.derive{" [$vf, $vc, $ac]"}}
But my .workflow (I'm using this as a service) gets an error:

Code: Select all

The action “Run Shell Script” encountered an error: “Illegal Argument: java.nio.file.NoSuchFileException: /Users/Alfred/[, ([,)
Illegal Argument: java.nio.file.NoSuchFileException: /Users/Alfred/, (,)
Illegal Argument: java.nio.file.NoSuchFileException: /Users/Alfred/]}} (]}})
SyntaxError: missing token: }
javax.script.ScriptException: SyntaxError: missing token: }
	at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:112)
	at net.filebot.format.ExpressionFormat.<init>(ExpressionFormat.java:43)
	at net.filebot.format.ExpressionFileFormat.<init>(ExpressionFileFormat.java:13)
	at net.filebot.cli.ArgumentBean.getExpressionFileFormat(ArgumentBean.java:255)
	at net.filebot.cli.ArgumentProcessor.runCommand(ArgumentProcessor.java:124)
	at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:33)
	at net.filebot.Main.main(Main.java:132)
”
It works fine with

Code: Select all

{plex}
and

Code: Select all

{plex.tail}
But the additional parameters throw an error about a missing token. I don't see a token missing though.

Edit: If I use that same format within the GUI, it works. I checked to make sure my CLI is up to date and it wasn't (I was on 4.8.5). Now I'm running v. 4.9.0

When I run that same command in 4.9.0, I get a different error:

Code: Select all

The action “Run Shell Script” encountered an error: “File does not exist: []}}
args[1] = -rename
args[2] = -r
args[3] = /Volumes/Super Storage/Video/Bloodshot (2020) [1080p] [WEBRip] [5.1] [YTS.MX]/Movies/Bloodshot (2020)/Bloodshot (2020).mp4
args[4] = --format
args[5] = {plex.derive{
args[6] = []}}
args[7] = -non-strict
args[8] = --log-file
args[9] = context-menu.log”
The file exists, though: https://take.ms/Jkjlo
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {plex} with additional information

Post by rednoah »

You must quote your arguments correctly. Please read Cmdline and Argument Passing for details.


GOOD:

Code: Select all

filebot -script fn:sysenv --format '{plex.derive{" [$vf, $vc, $ac]"}}'
...
args[0] = -script
args[1] = fn:sysenv
args[2] = --format
args[3] = {plex.derive{" [$vf, $vc, $ac]"}}

BAD:

Code: Select all

filebot -script fn:sysenv --format "{plex.derive{" [$vf, $vc, $ac]"}}"
...
args[0] = -script
args[1] = fn:sysenv
args[2] = --format
args[3] = {plex.derive{
args[4] = [,
args[5] = ,
args[6] = ]}}

:idea: Use the @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.
mikejandreau
Posts: 42
Joined: 07 Jun 2017, 16:50

Re: {plex} with additional information

Post by mikejandreau »

Got it. I didn't realize I needed single tickets around the format.

I've always had quotes around it and now see the error in my ways.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {plex} with additional information

Post by rednoah »

mikejandreau wrote: 28 Mar 2020, 13:33 I've always had quotes around it and now see the error in my ways.
FileBot 4.9.0 tries to give you better error messages by mirroring the argument array is something is off, though it's somewhat difficult FileBot to give you better error messages because it can't even guess what you're trying to do if the argument array is gibberish. :lol:


:idea: Use the @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.
Post Reply