Add {edition-4K UHD} to UHD movies

All about user-defined episode / movie / file name format expressions
Post Reply
adamd
Posts: 5
Joined: 17 Dec 2022, 12:49

Add {edition-4K UHD} to UHD movies

Post by adamd »

Thank you for your reply

I'm facing another issue now, with the script itself. I'm trying to add the Plex editions tag for UHD movies but am not getting the results I want.

This is my movieFormat expression.

Code: Select all

--def movieFormat="/mnt/Synology/Library/Plex Media/{vf =~ /2160p/ ? '4K UHD Movies'/{n} ({y})/{n} ({y}) { 'edition-4K UHD' } : 'Movies'}/{n} ({y})/{n} ({y})" \
I ran a test and this is the Filebot console output,

Code: Select all

admin@RaspberryPi:~ $ bash /mnt/Synology/Misc/Filebot/filebot-test.sh
Run script [fn:amc] at [Tue Dec 20 11:29:33 GMT 2022]
Parameter: music = n
Parameter: unsorted = y
Parameter: clean = y
Parameter: skipExtract = y
Parameter: ignore = .srt|.exe|.txt
Parameter: seriesFormat = /mnt/Synology/Library/Plex Media/TV Shows\{n} ({y})/{'Season '+s}/{n.space('.')}.{s00e00}
Parameter: movieFormat = /mnt/Synology/Library/Plex Media/{vf =~ /2160p/ ? '4K UHD Movies'/{n} ({y})/{n} ({y}) { 'edition-4K UHD' } : 'Movies'}/{n} ({y})/{n} ({y})
Parameter: movieDB = TheMovieDB
Parameter: seriesDB = TheTVDB
Parameter: excludeList = .excludes
Parameter: gmail = *****
Argument[0]: /mnt/Synology/Completed
[TEST] --def clean is incompatible with --action TEST and has been disabled
[TEST] --def unsorted is incompatible with --action TEST and has been disabled
Use excludes: /mnt/Synology/.excludes (0)
Ignore pattern: /mnt/Synology/Completed/Diary.of.a.Wimpy.Kid.Rodrick.Rules.2022.1080p.WEB.H264-NAISU[rarbg]/RARBG.txt
Ignore pattern: /mnt/Synology/Completed/Diary.of.a.Wimpy.Kid.Rodrick.Rules.2022.1080p.WEB.H264-NAISU[rarbg]/RARBG_DO_NOT_MIRROR.exe
Ignore pattern: /mnt/Synology/Completed/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/RARBG.txt
Ignore pattern: /mnt/Synology/Completed/Harry.Potter.and.the.Sorcerers.Stone.2001.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/RARBG.txt
Disk Folder: /mnt/Synology/Completed/TRON.Legacy.2010.1080p.BluRay.AVC.DTS-HD.MA.7.1-FGT
Disk Folder: /mnt/Synology/Completed/TRON.Legacy.2010.1080p.BluRay.AVC.DTS-HD.MA.7.1-FGT
Input: /mnt/Synology/Completed/Diary.of.a.Wimpy.Kid.Rodrick.Rules.2022.1080p.WEB.H264-NAISU[rarbg]/diary.of.a.wimpy.kid.rodrick.rules.2022.1080p.web.h264-naisu.mkv
Input: /mnt/Synology/Completed/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv
Input: /mnt/Synology/Completed/Harry.Potter.and.the.Sorcerers.Stone.2001.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/Harry.Potter.and.the.Sorcerers.Stone.2001.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv
Input: /mnt/Synology/Completed/TRON.Legacy.2010.1080p.BluRay.AVC.DTS-HD.MA.7.1-FGT
Group: {Movie=Diary of a Wimpy Kid: Rodrick Rules (2022)} => [diary.of.a.wimpy.kid.rodrick.rules.2022.1080p.web.h264-naisu.mkv]
Group: {Movie=Harry Potter and the Goblet of Fire (2005)} => [Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv]
Group: {Movie=Harry Potter and the Philosopher's Stone (2001)} => [Harry.Potter.and.the.Sorcerers.Stone.2001.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv]
Group: {Movie=TRON: Legacy (2010)} => [TRON.Legacy.2010.1080p.BluRay.AVC.DTS-HD.MA.7.1-FGT]
Rename movies using [TheMovieDB]
Auto-detect movie from context [/mnt/Synology/Completed/Diary.of.a.Wimpy.Kid.Rodrick.Rules.2022.1080p.WEB.H264-NAISU[rarbg]/diary.of.a.wimpy.kid.rodrick.rules.2022.1080p.web.h264-naisu.mkv]
Stripping invalid characters from the output file path: /mnt/Synology/Library/Plex Media/Movies/Diary of a Wimpy Kid: Rodrick Rules (2022)/Diary of a Wimpy Kid: Rodrick Rules (2022).mkv
[TEST] from [/mnt/Synology/Completed/Diary.of.a.Wimpy.Kid.Rodrick.Rules.2022.1080p.WEB.H264-NAISU[rarbg]/diary.of.a.wimpy.kid.rodrick.rules.2022.1080p.web.h264-naisu.mkv] to [/mnt/Synology/Library/Plex Media/Movies/Diary of a Wimpy Kid Rodrick Rules (2022)/Diary of a Wimpy Kid Rodrick Rules (2022).mkv]
Processed 1 file
Rename movies using [TheMovieDB]
Auto-detect movie from context [/mnt/Synology/Completed/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv]
[TEST] from [/mnt/Synology/Completed/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv] to [/mnt/Synology/Library/Plex Media/Harry Potter and the Goblet of Fire (2005)/Harry Potter and the Goblet of Fire (2005).mkv]
Processed 1 file
Rename movies using [TheMovieDB]
Auto-detect movie from context [/mnt/Synology/Completed/Harry.Potter.and.the.Sorcerers.Stone.2001.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/Harry.Potter.and.the.Sorcerers.Stone.2001.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv]
[TEST] from [/mnt/Synology/Completed/Harry.Potter.and.the.Sorcerers.Stone.2001.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/Harry.Potter.and.the.Sorcerers.Stone.2001.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv] to [/mnt/Synology/Library/Plex Media/Harry Potter and the Philosopher's Stone (2001)/Harry Potter and the Philosopher's Stone (2001).mkv]
Processed 1 file
Rename movies using [TheMovieDB]
Auto-detect movie from context [/mnt/Synology/Completed/TRON.Legacy.2010.1080p.BluRay.AVC.DTS-HD.MA.7.1-FGT]
Stripping invalid characters from the output file path: /mnt/Synology/Library/Plex Media/Movies/TRON: Legacy (2010)/TRON: Legacy (2010)
[TEST] from [/mnt/Synology/Completed/TRON.Legacy.2010.1080p.BluRay.AVC.DTS-HD.MA.7.1-FGT] to [/mnt/Synology/Library/Plex Media/Movies/TRON Legacy (2010)/TRON Legacy (2010)]
Processed 1 file
Finished without processing any files
Done ¯\_(ツ)_/¯
admin@RaspberryPi:~ $
I essentially want the format for UHD movies to be /mnt/Synology/Library/Plex Media/4K UHD Movies/{n} ({y})/{n} ({y}) {edition-4K UHD} and as you can tell from the output, 2160p rips are being renamed like this:

Code: Select all

[TEST] from [/mnt/Synology/Completed/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT/Harry.Potter.And.The.Goblet.Of.Fire.2005.PROPER.2160p.BluRay.REMUX.HEVC.DTS-X.7.1-FGT.mkv] to [/mnt/Synology/Library/Plex Media/Harry Potter and the Goblet of Fire (2005)/Harry Potter and the Goblet of Fire (2005).mkv]
I tried testing an if-else statement to specify two expressions for movieFormat, see below:

Code: Select all

{ 
	if ( vf == /2160p/ ) {
		return '/mnt/Synology/Library/Plex Media/4K UHD Movies/'{n} ({y})/{n} ({y}) { "{edition-4K UHD}" }
	} else if ( vf == /1080p/ ) {
		return '/mnt/Synology/Library/Plex Media/Movies/'{n} ({y})/{n} ({y})
	}
}
However this resulted in this error:

Code: Select all

Script Error: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl./mnt/Synology/Library/Plex Media/Movies/() is applicable for argument types: (Script4$_run_closure6) values: [Script4$_run_closure6@15c4f17]
Thanks for your help in advance
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help running Filebot AMC script from qBittorrent

Post by rednoah »

You misunderstand how {...} works. The outermost {...} delimits Groovy code, and everything inside is Groovy code, which may or may not contain any {} code blocks or {} closures, but semantically completely different:
viewtopic.php?t=1895

tl;dr {n} is format code and n is groovy code, and although format code contains groovy code, groovy code cannot contain format code.



:arrow: Here's how I'd write it:

Code: Select all

/mnt/Synology/Library/Plex Media/
{ vf == /2160p/ ? '4K UHD Movies/' : null }
{ ~plex % { vf == /2160p/ ? ' {edition-4K UHD}' : null } }
:idea: Please read the FAQ and How to Request Help.
adamd
Posts: 5
Joined: 17 Dec 2022, 12:49

Re: Add {edition-4K UHD} to UHD movies

Post by adamd »

Thank you for your prompt reply and your simple explanation. Your code put me on the right track. I had to adjust it slightly to make sure that lower resolution files were being put in the correct folder.

Below is the final movieFormat expression:

Code: Select all

--def movieFormat="/mnt/Synology/Library/Plex Media/{ vf == /2160p/ ? '4K UHD Movies/' : 'Movies/' } {n} ({y})/{n} ({y}) { vf == /2160p/ ? ' {edition-4K UHD}' : null }"
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Add {edition-4K UHD} to UHD movies

Post by rednoah »

OK. Here's the final code for the next guy:

Code: Select all

/mnt/Synology/Library/Plex Media
/{ vf == /2160p/ ? '4K UHD Movies' : 'Movies' }
/{n} ({y})
/{n} ({y}) { vf == /2160p/ ? ' {edition-4K UHD}' : null }"


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

Code: Select all

--def movieFormat=@/path/to/MovieFormat.groovy
:idea: Please read the FAQ and How to Request Help.
Post Reply