AMC script leaves off attributes when renaming some media files

Any questions? Need some help?
Post Reply
korzynski
Posts: 9
Joined: 17 Jun 2020, 06:13

AMC script leaves off attributes when renaming some media files

Post by korzynski » 30 Jun 2020, 01:48

I am using the AMC script to move and rename my video files and to append media properties, such as video and audio attributes, for example: Movies/Kill Bill - Vol. 2 (2004)/Kill Bill - Vol. 2 (2004) [BluRay-480p][AC3][5.1][x264].mkv.

I specified --def 'movieFormat={plex.derive{" [$vs-$vf][$ac][$channels][$vc]"}}', and it worked great for some files, but many others the script left off the attributes.

Out of 1,944 movie files that were successfully processed, 819 were renamed as expected, but 1,125 were renamed with just the movie name and release date without the audio and video attributes.

The log shows that the files were identified, renamed and moved, but doesn't include any errors or other information about why it named these files differently. I checked the embedded metadata in several files from each group and didn't find anything significantly different between the ones that were named correctly and the ones that weren't.

The log is about 4MB in size, but you can view it at https://www.dropbox.com/s/5vef578m2bcd4 ... t.log?dl=0

Below is an excerpt from the log showing several examples:

Code: Select all

[2020-06-21 21:30:56.372] [MOVE] from [/volume1/Media/Library/CouchPotato/Transporter, The (2002)/The TransporterDVD-Rip.m4v] to [/volume1/Media/Library/Movies/The Transporter (2002)/The Transporter (2002).m4v]
[2020-06-21 21:30:56.393] [MOVE] from [/volume1/Media/Library/CouchPotato/Spiderwick Chronicles, The (2008)/The Spiderwick ChroniclesDVD-Rip.m4v] to [/volume1/Media/Library/Movies/The Spiderwick Chronicles (2008)/The Spiderwick Chronicles (2008).m4v]
[2020-06-21 21:30:56.396] [MOVE] from [/volume1/Media/Library/CouchPotato/Finding Nemo 2003 HDTV 720p x264 DTS PRoDJi/Finding.Nemo.2003.HDTV.720p.x264.DTS.PRoDJi.mkv] to [/volume1/Media/Library/Movies/Finding Nemo (2003)/Finding Nemo (2003) [HDTV-720p][DTS][5.1][x264].mkv]
[2020-06-21 21:30:56.399] [MOVE] from [/volume1/Media/Library/CouchPotato/Forrest Gump (1994) [tt0109830]/Forrest Gump (1994) - HD BR-Rip avc1 ch.mp4] to [/volume1/Media/Library/Movies/Forrest Gump (1994)/Forrest Gump (1994) [BluRay-720p][AAC][2.0][x264].mp4]
[2020-06-21 21:30:56.411] [MOVE] from [/volume1/Media/Library/CouchPotato/Forrest Gump (1994) [tt0109830]/Forrest Gump (1994) - HD BR-Rip avc1 ch.srt] to [/volume1/Media/Library/Movies/Forrest Gump (1994)/Forrest Gump (1994) [BluRay-720p][AAC][2.0][x264].eng.srt]
[2020-06-21 21:30:56.412] [MOVE] from [/volume1/Media/Library/CouchPotato/American Beauty (1999)/American Beauty.1999.720p.2.h264.mkv] to [/volume1/Media/Library/Movies/American Beauty (1999)/American Beauty (1999) [BluRay-720p][AAC][2.0][x264].mkv]
[2020-06-21 21:30:56.429] [MOVE] from [/volume1/Media/Library/CouchPotato/Citizen Kane.1941.HD(tt0033467)/Citizen Kane.1941.1080p.DTS.H264.mkv] to [/volume1/Media/Library/Movies/Citizen Kane (1941)/Citizen Kane (1941).mkv]
[2020-06-21 21:30:56.431] [MOVE] from [/volume1/Media/Library/CouchPotato/Circle, The (2017) [tt4287320]/Circle, The (2017) - HD BR-Rip H264 AC3 6ch.mkv] to [/volume1/Media/Library/Movies/The Circle (2017)/The Circle (2017) [BluRay-720p][AC3][5.1][x264].mkv]
[2020-06-21 21:30:56.439] [MOVE] from [/volume1/Media/Library/CouchPotato/Circle, The (2017) [tt4287320]/Circle, The (2017) - HD BR-Rip H264 AC3 6ch.srt] to [/volume1/Media/Library/Movies/The Circle (2017)/The Circle (2017) [BluRay-720p][AC3][5.1][x264].eng.srt]
[2020-06-21 21:30:56.440] [MOVE] from [/volume1/Media/Library/CouchPotato/Fifth Element, The (1997) [tt0119116]/Fifth Element, The (1997) - HD BR-Rip H264 AC3 6ch.mkv] to [/volume1/Media/Library/Movies/The Fifth Element (1997)/The Fifth Element (1997) [BluRay-720p][AC3][5.1][x264].mkv]
[2020-06-21 21:30:56.443] [MOVE] from [/volume1/Media/Library/CouchPotato/Fifth Element, The (1997) [tt0119116]/Fifth Element, The (1997) - HD BR-Rip H264 AC3 6ch.srt] to [/volume1/Media/Library/Movies/The Fifth Element (1997)/The Fifth Element (1997) [BluRay-720p][AC3][5.1][x264].eng.srt]
[2020-06-21 21:30:56.445] [MOVE] from [/volume1/Media/Library/CouchPotato/Metropolis (1927)/Metropolis.1927.720p.6.H264.mkv] to [/volume1/Media/Library/Movies/Metropolis (1927)/Metropolis (1927).mkv]
[2020-06-21 21:30:56.447] [MOVE] from [/volume1/Media/Library/CouchPotato/Little Women (2018) [tt6495094]/Little Women (2018) - HD 1080p H264 AC3 6ch.mkv] to [/volume1/Media/Library/Movies/Little Women (2018)/Little Women (2018).mkv]
[2020-06-21 21:30:56.449] [MOVE] from [/volume1/Media/Library/CouchPotato/Little Women (2018) [tt6495094]/Little Women (2018) - HD 1080p H264 AC3 6ch.srt] to [/volume1/Media/Library/Movies/Little Women (2018)/Little Women (2018).eng.srt]
[2020-06-21 21:30:56.451] [MOVE] from [/volume1/Media/Library/CouchPotato/Pirates of the Caribbean The Curse of the Black Pearl.2003.HD(tt0325980)/Pirates of the Caribbean The Curse of the Black Pearl.2003.1080p.AAC6.H264.mkv] to [/volume1/Media/Library/Movies/Pirates of the Caribbean - The Curse of the Black Pearl (2003)/Pirates of the Caribbean - The Curse of the Black Pearl (2003).mkv]
[2020-06-21 21:30:56.453] [MOVE] from [/volume1/Media/Library/CouchPotato/Meet the Feebles (1989)/Meet the FeeblesDVD-Rip.m4v] to [/volume1/Media/Library/Movies/Meet the Feebles (1989)/Meet the Feebles (1989).m4v]
[2020-06-21 21:30:56.456] [MOVE] from [/volume1/Media/Library/CouchPotato/Kill Bill Vol. 1 (2003)/Kill Bill Vol. 1.2003.BR-Rip.avc1.mp4] to [/volume1/Media/Library/Movies/Kill Bill - Vol. 1 (2003)/Kill Bill - Vol. 1 (2003) [BluRay-1080p][AAC][2.0][x264].mp4]
CLI command used:

Code: Select all

filebot -script 'fn:amc' '/volume1/Media/Library/CouchPotato' --output '/volume1/Media/Library' --action move --conflict auto --lang en --def 'ut_label=Movie' 'artwork=y' 'skipExtract=y' 'clean=n' 'unsorted=y' 'movieFormat={plex.derive{" [$vs-$vf][$ac][$channels][$vc]"}}' excludeList='/volume1/Media/filebot/excludes.txt' --apply refresh --log all --log-file '/volume1/Media/filebot/filebot.log'
Sysinfo

Code: Select all

$ filebot -script fn:sysinfo
FileBot 4.9.1 (r7372)
JNA Native: 6.1.0
MediaInfo: 19.09
7-Zip-JBinding: 9.20
Chromaprint: java.io.IOException: Cannot run program "fpcalc": error=2, No such file or directory
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2020-06-18 (r655)
Groovy: 3.0.3
JRE: OpenJDK Runtime Environment 14.0.1
JVM: 64-bit OpenJDK 64-Bit Server VM
CPU/MEM: 4 Core / 788 MB Max Memory / 28 MB Used Memory
OS: Linux (amd64)
HW: Linux Pike 3.10.105 #24922 SMP Fri May 10 02:51:01 CST 2019 x86_64 GNU/Linux synology_cedarview_1812+
STORAGE: ext4 [/] @ 1.3 GB | btrfs [/volume1] @ 5 TB | btrfs [/volume1/@docker] @ 5 TB | btrfs [/volume1/@docker/btrfs] @ 5 TB
DATA: /volume1/@appstore/filebot/data/andrew
Package: SPK
License: FileBot License P15380663 (Valid-Until: 2021-06-22)
[2020-06-29 18:07:47.769] Done ヾ(@⌒ー⌒@)ノ

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

Re: AMC script leaves off attributes when renaming some media files

Post by rednoah » 30 Jun 2020, 04:20

Keep in mind that each individual binding may fail, and thus unwind the entire expression or closure:
viewtopic.php?f=5&t=1895


e.g. if vs is undefined, which it may very well be depending on the original file name, then you will get no value for any binding since the expression fails right away:

Code: Select all

plex.derive{" [$vs-$vf][$ac][$channels][$vc]"}
:arrow: You'll want to use the GUI to rapidly prototype your format to make sure it works for all your files, and not just some of them.


e.g. if you separate each binding into it's own closure, then you'll get all the defined bindings at least:

Code: Select all

plex.derive{[vs]}{[vf]}{[ac]}{[channels]}{[vc]}
:idea: Please read the FAQ and How to Request Help.

korzynski
Posts: 9
Joined: 17 Jun 2020, 06:13

Re: AMC script leaves off attributes when renaming some media files

Post by korzynski » 30 Jun 2020, 07:15

Thank you! I'll try that.

korzynski
Posts: 9
Joined: 17 Jun 2020, 06:13

Re: AMC script leaves off attributes when renaming some media files

Post by korzynski » 06 Jul 2020, 03:02

rednoah wrote:
30 Jun 2020, 04:20
e.g. if you separate each binding into it's own closure, then you'll get all the defined bindings at least:

Code: Select all

plex.derive{[vs]}{[vf]}{[ac]}{[channels]}{[vc]}
Thank you for the suggestion! I found a format that appears to work on my test folder

Code: Select all

{plex.derive
	{[tags]}
	{[allOf{vs}{vf}.join("-")]}
	{[allOf{ac}{channels}.join(" ")]}
	{[vc]}
	{-rg}
}
The only problem is that when both properties in the allOf statement are missing, I end up with empty brackets, so a bunch of my files end with "[][]". I couldn't figure out any good way to only include the brackets when the list contains elements. I was hoping to do something like

Code: Select all

{s=allOf{vs}{vf}.join("-")
s?[s]:""}
But that always returns empty. Is there a better way?

But what did you mean about using the GUI to rapidly prototype? It doesn't seem like the Windows app offers any helpful formatting features that aren't in the CLI, and it takes just as long to do a full test run through my library - about 2 hours. Is there a trick I'm missing that would help test more quickly?

Finally, how can I rename all of the existing files in place now that I've already processed them once? They are all in the correct folders, I just need to fix the naming format of the media files. But if I try to specify the same directory for output and input, I get an error message like the following:

Code: Select all

Invalid usage: output folder [/volume1/Media/Library/FBTest] must be separate from input arguments [/volume1/Media/Library/FBTest]
When I do process the files for the second time, will filebot use the information that it previously created in the .xattr folders on the first run or will it just use the current filename to identify the files?

korzynski
Posts: 9
Joined: 17 Jun 2020, 06:13

Re: AMC script leaves off attributes when renaming some media files

Post by korzynski » 06 Jul 2020, 05:21

I think I found a fix for the orphaned brackets, thanks to a comment of yours on another thread (viewtopic.php?t=11817). This seems to work:

Code: Select all

{plex.derive
	{[tags]}
	{allOf{vs}{vf}.joining('-','[',']')}
	{allOf{ac}{channels}.joining(' ','[',']')}
	{[vc]}
	{-rg}
}
But I'm still unable to make the script rename the files in place since they were already moved to the destination folder during the first run. Is there a way to rename them without moving them?

Post Reply