
Useful Links
Code: Select all
{n} - {s00e00} - {t}
Code: Select all
X:/TV Shows/{n}/Season {s.pad(2)}/{n} - {s00e00} - {t}{'.'+lang}
Code: Select all
{n.replaceTrailingBrackets()} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Code: Select all
{n.space('_')}_-_{sxe}_[{resolution}_{vc}_{ac}][{crc32}]
Code: Select all
{n} [{airdate.format("yyyy.MM.dd, EEEE", Locale.getDefault())}] {t}
Code: Select all
{n.space('.')}.S{(episode.season ? s : 1).pad(2)}E{e.pad(2)}.{t.space('.')}
Code: Select all
X:/TV Shows/{n}/{episode.special ? 'Special' : 'Season '+s}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t}
Code: Select all
{n} ({y}){' CD'+pi}{'.'+lang}
Code: Select all
X:/Movies/{n} ({y})/{n} ({y}){' CD'+pi}
Code: Select all
{n} ({y}){' CD'+pi}{if (ext == 'nfo' && folder.list().find{it =~ /(?i:CD\d+)/}) '.CD1'}
Code: Select all
X:/Movies/{n} ({y})/{fn}
Code: Select all
{file.path[0]}:/Movies/{n} ({y})/{n} ({y}){' CD'+pi}
Code: Select all
{n} ({y}) {genres} - {actors.take(3).join(', ')}
Code: Select all
X:/Movies/{collection+'/'}{n} ({y}){'['+source+']'}/{n} ({y}) [{fn.match(/3D/)+', '}{vf}, {ac}, {af}]
Code: Select all
{fn =~ /3D/ ? '3D Movies' : 'Movies'}/{n} ({y}){fn =~ /3D/ ? ' [3D] [H-SBS]' : ''}/{n} ({y}) ({vf}){fn =~ /3D/ ? ' H-SBS' : ''}{' CD'+pi}
Code: Select all
{['C:', 'D:', 'E:'].collect{ (it+'/TV/'+n) as File }.sort{ a, b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode}
Code: Select all
{n =~ /^(?i)[0-9a-f]/ ? 'X' : n =~ /^(?i)[g-t]/ ? 'Y' : 'Z'}:/TV/{n}/{episode}
Code: Select all
TV Shows/{n}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
Code: Select all
Anime/{primaryTitle}/{primaryTitle} - {sxe} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, /'/).replacePart(', Part $1')}
Code: Select all
Movies/{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}
Code: Select all
Music/{n}/{album+'/'}{pi.pad(2)+'. '}{artist} - {t}
Code: Select all
Unsorted/{file.structurePathTail}
Code: Select all
F:/{n}{"/Season $s"}/{n} - {s}{e.pad(2)} - {t}{" [$airdate.year]"}{" [$vf]"}{" [$source]"}{" [$vc]"}{" [$ac]"}{" [$group]"}
from the FAQ if you are having trouble.Q: Why does MediaInfo not work? I'm running on 64-bit Windows and installed FileBot x64?
A: If you're on 64-bit Windows but are actually running a 32-bit Java runtime, the whole java process will be in 32-bit compability mode, so the mediainfo native library also has to be the 32-bit version. Just install FileBot x86 instead, or replace mediainfo.dll with the 32-bit version.
Code: Select all
{n.upperInitial().space('.').replaceAll(/[,]+/)}.{s00e00}.{t.upperInitial().space('.').replaceAll(/[,]+/)}{'.'+vf.match(/720[pP]|1080[pP]/)}{".$source"}{".$vc"}{'-'+fn.match(/(?:(?<=[-])\w+$)|(?:^\w+(?=[-]))/)}
Code: Select all
filebot -rename -r "F:\Downloads" --db thetvdb -non-strict --format "F:\British TV\{folder.path.match(/Arts and Culture|Comedy|Documentary|Drama|Game Show|Horror|Kids|Motoring|Music|Mystery|Planes and Trains|Property|Radio|Reality|Sci-Fi|Soaps|Special Events|Talkshow|Travel/)}\{n.replaceAll(':|\\?',' -').replaceAll('(?i)\\s-\\s\\(uk\\)|(?i)\\s\\(uk\\)')}\Series {s}\{n.replaceAll(':|\\?',' -').replaceAll('(?i)\\s-\\s\\(uk\\)|(?i)\\s\\(uk\\)')} - {S00E00}"
Which creates :Expression wrote:E:/Video/Séries/{n}/{"Saison ${s.pad(2)}"}/{n} - {s.pad(2)}x{e.pad(2)} - {t}
Output wrote:E:\Video\Séries\Firefly\Saison 01\Firefly - 01x01 - Serenity.avi
Which creates :Expression wrote:E:/Video/Films/{"$collection/"}{n} ({y}){ [{"${fn.match(/3D/)}, "}{"${cf}, "}{"${hpi}, "}{"${vc}, "}{"${ac}"}]}
Output wrote:E:\Video\Films\Avatar Collection\Avatar (2009) [3D, mkv, 720p, x264, ac3].mkv
Which creates :Expression wrote:E:/Musique/{n}/{"$album/"}{"${album}."}{"${pi.pad(2)} - "} {t}
Output wrote:E:\Musique\Les Fatals Picards\Coming Out\Coming Out.02 - Dans mon verre.mp3
\\mynas\media\Movies\Twilight Saga, The\Twilight Saga - Eclipse, The (2010 PG-13)\Twilight Saga - Eclipse, The [720p x264 DTS 6ch].mkv
\\mynas\media\Movies\Rurôni Kenshin - Ishin Shishi E No Requiem (Samurai X - The Motion Picture) (1997 PG-15)\Rurôni Kenshin - Ishin Shishi E No Requiem [480p DivX MP3 2ch].avi
\\mynas\media\Movies\Alien Collection\Aliens (1986 R)\Aliens (Special Edition) Part 1 [360p XviD AC3 6ch].avi
\\mynas\media\Movies\Alien Collection\Aliens (1986 R)\Aliens (Special Edition) Part 2 [360p XviD AC3 6ch].avi
\\mynas\media\Movies\Sanctum 3D (2011 R)\Sanctum 3D [720p x264 AAC 6ch].mp4
Code: Select all
//mynas/media/Movies/{collection.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/).replaceFirst(/^(?i)(Collection of the)\s(.+)/, /$2 Collection/).replaceAll(/Saga Collection/, "Saga").replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ")}\{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() }).replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/^\d+$/, 'PG-$0')})/{norm(n)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'}{" Part $pi"}{" [$vf $vc $ac $af]"}
\\mynas\media\TV Shows\Pushing Daisies (2007 TV-PG)\Season 01\Pushing Daisies S01E01 Pie-Lette [360p XviD MP3 2ch].avi
\\mynas\media\TV Shows\Slap, The (2011 TV-MA)\Season 01\Slap, The S01E01 Hector [360p XviD MP3 2ch].avi
\\mynas\media\TV Shows\Straits, The (2012)\Season 01\Straits, The S01E01-E02 Proposition & The Trouble With Raskols, The [360p XviD MP3 2ch]
\\mynas\media\TV Shows\Looney Tunes (1930)\Season 1943\Looney Tunes S1943E01 Coal Black And De Sebben Dwarfs [240p MPEG MPEG Audio 2ch].mpeg
Code: Select all
//mynas/media/TV Shows/{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() }).replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/^\d+$/, 'PG-$0')})/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{norm(n)} {episode.special ? 'S00E'+special.pad(2) : s00e00} {norm(t)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'}{" Part $pi"}{" [$vf $vc $ac $af]"}
\\mynas\media\Anime\Blade Of The Immortal (Mugen No Juunin) (2008)\Blade Of The Immortal - 01 - Criminal [576p x264 AAC 2ch].mp4
\\mynas\media\Anime\Freezing (2011 N A)\Freezing - 01 - Untouchable Queen (Uncensored) [720p x264 AAC 2ch].mkv
\\mynas\media\Anime\One Piece (1999 TV-PG)\One Piece - 001 - I'm Luffy! The Man Who's Gonna Be King Of The Pirates! [480p XviD MP3 2ch].avi
\\mynas\media\Anime\Eternal Aseria, The [Eien No Aseria] (2005)\Eternal Aseria, The - 01 - Voice Of Motome [480p XviD MP3 2ch].avi
Code: Select all
//mynas/media/Anime/{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() }).replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/^\d+$/, 'PG-$0')})/{norm(n)} - {absolute.pad(episodelist.size() < 99 ? 2 : 3)}{'Special '+special.pad(episodelist.size() < 99 ? 2 : 3)} - {norm(t)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'}{" Part $pi"}{" [$vf $vc $ac $af]"}
Code: Select all
{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.,]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};isLatin = {java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD).replaceAll(/\p{InCombiningDiacriticalMarks}+/, '') ==~ /^\p{InBasicLatin}+$/}; isLatin(info.OriginalName) ? norm(info.OriginalName) : norm(primaryTitle) }.({y}){if(isLatin(info.OriginalName) && info.OriginalName != primaryTitle && !(info.SpokenLanguages[0] ==~ /(sv|da|no)/)) '.'+ norm(primaryTitle) }{'.'+vf}{'.'+source}{fn.contains('3D') || fn.contains('3-D') ? '.3D':''}{'.'+fn.replace(/(?i)\.DC\./, '.directors.cut.').replaceAll(/director\'?s|theatrical|ultimate/,'$0.Cut').matchAll(/UNCENSORED|UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTOR\'?S.CUT|THEATRICAL.CUT|ULTIMATE.CUT|FINAL.CUT|SPECIAL.EDITION/)*.upperInitial()*.lowerTrail().sort().join('.')}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g==null && m!=null) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null && m!=null && m.lower()!=g.lower()) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null) return '-'+g;}
I would have loved to figure out how to keep the transliterated names, but using {transliterate(info.OriginalTitle)}did not work perfectly, which meant a bunch of titles missed when doing searched.Kôkaku.Kidôtai.2.0.(2008).Ghost.In.The.Shell.2.0.720p.REPACK.x264.DTS.5.1-timeshift.mkv // Latin characters but added english name
Jagten.(2012).1080p.BluRay.x264.DTS-HD.MA-GRYM.mkv // Original name only, primary language is Danish
My.Sassy.Girl.(2001).720p.BluRay.x264.AC3.5.1-EbP.mkv // Actual name is 엽기적인 그녀, or transliterated to Yeopgijeogin Geunyeo
Code: Select all
{n}/{episode.special ? 'Specials' : 'Season '+s}/{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};norm(n) }.{episode.special ? 'S00E'+special.pad(2) : s00e00}.{norm(t)}{'.'+vf}{'.'+source}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g==null && m!=null) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null && m!=null && m.lower()!=g.lower()) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null) return '-'+g;}
Coupling\Season 1\Coupling.S01E01.Flushed.360p.DVDRip.x264.AAC.mkv
Doctor Horrible's Sing-Along Blog\Season 1\Doctor.Horrible's.Sing-Along.Blog.S01E01.Act.I.1080p.BluRay.x264.DTS-DIMENSION.mkv
Code: Select all
filebot -script fn:amc "x:/downloads" --log-file d:\amc-run.log --output "//nas/" --action move --conflict skip -non-strict --def clean=y --def "movieFormat=Movies/{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.,]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};isLatin = {java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD).replaceAll(/\p{InCombiningDiacriticalMarks}+/, '') ==~ /^\p{InBasicLatin}+$/}; isLatin(info.OriginalName) ? norm(info.OriginalName) : norm(primaryTitle) }.({y}){if(isLatin(info.OriginalName) && info.OriginalName != primaryTitle && !(info.SpokenLanguages[0] ==~ /(sv|da|no)/)) '.'+ norm(primaryTitle) }{'.'+vf}{'.'+source}{fn.contains('3D') || fn.contains('3-D') ? '.3D':''}{'.'+fn.replace(/(?i)\.DC\./, '.directors.cut.').replaceAll(/director\'?s|theatrical|ultimate/,'$0.Cut').matchAll(/UNCENSORED|UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTOR\'?S.CUT|THEATRICAL.CUT|ULTIMATE.CUT|FINAL.CUT|SPECIAL.EDITION/)*.upperInitial()*.lowerTrail().sort().join('.')}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g==null && m!=null) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null && m!=null && m.lower()!=g.lower()) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null) return '-'+g;}" --def "seriesFormat=TV Shows/{n}/{episode.special ? 'Specials' : 'Season '+s}/{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};norm(n) }.{episode.special ? 'S00E'+special.pad(2) : s00e00}.{norm(t)}{'.'+vf}{'.'+source}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g==null && m!=null) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null && m!=null && m.lower()!=g.lower()) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null) return '-'+g;}"
Code: Select all
{'H:/Live Action/[Naming]/'}{if (s3d) '3D/'}{model.episodes.flatten().containsAll(episodelist.findAll{it.season == s && it.episode && it.title}) ? '[Finished]/' : '[Current Seasons]/'}{if (episode.special) '[Finished]/'}{csv('C:/FileBot Settings/TV/TVGenreFolderBasedOnSeriesName.csv').get(n) ?: genre +'/'}{norm = {it.upperInitial().lowerTrail().replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/.web./, "web-dl").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b[IiVvXx]+\b/, { it.upper()}).replaceAll(/\b[0-9](?i:th|nd|rd)\b/, {it.lower()})}; norm(n).replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/).replaceTrailingBrackets()}{' '+n.match(/\([A-Z]+\)$/)}{if (norm(n) != norm (primaryTitle)) ' ('+norm(primaryTitle)+')'}{s3d ? ' '+'3D':""}{if (y) {' ['+y +']'}}{' '+any{"[$certification]"}{"["+$imdb.certification+"]" }.replaceAll('N A','').replaceAll(/^ \d+$/, 'PG-$0')}{" [$rating" + "★]"} [{csv('C:/FileBot Settings/TV/TVNetwork.csv').get(info.network) ?: info.network }]/{[episodelist.findAll{ it.season == s }.airdate.year.min()]}{episode.special ? '[Specials]' : ' - Season '+s.pad(2)}{' '}{' (' + file.path.matchAll(/extended|uncensored|remastered|unrated|uncut|unedited|directors.cut|special.edition|unsold.pilot|broadcast.version|alternate.ending|with.original.commercials|reconstructed|with.commercials|unaired.pilot|unaired.episode/).unique()*.upperInitial()*.lowerTrail().sort().join(') (').replaceAll(/ [._]/, " ") +') '}{episode.special ? '': {def sources = model.findAll{ it.n == n && it.s == s }.source.minus(null).unique(); sources.size() >= 1 ? sources.size() == 1 ? sources : '[Mixed]' : (fn.upper() =~ /.WEB.|WEBDL|WEB.DL/ ? /[WEB-DL]/ : '[No Source]')}}{model.episodes.flatten().containsAll(episodelist.findAll{it.season == s && it.episode && it.title}) ? '' : ' [Incomplete]'}/{csv('C:/FileBot Settings/TV/TVFileShowNames.csv').get(n) ?: norm(n).replaceTrailingBrackets()}{' '+n.match(/\([A-Z]+\)$/)}{' '+n.match(/\([0-9]+\)$/)} {'- '+S00E00+' -'} {norm(t.replaceAll("\\s*[(]([^)]*)[)]\$", { group, match -> ' (Part '+match.pad(2)+')' }))}{if (episode.special) ' [Special]'}{s3d ? ' '+'3D':""}{' (' + file.path.matchAll(/extended|uncensored|remastered|unrated|uncut|unedited|directors.cut|special.edition|unsold.pilot|broadcast.version|alternate.ending|with.original.commercials|reconstructed|with.commercials|unaired.pilot|unaired.episode/).unique()*.upperInitial()*.lowerTrail().sort().join(') (').replaceAll(/ [._]/, " ") + ')'}{" Part $pi"}{" [$minutes Min]"}{airdate.format(" [MM.dd.yyyy]")}{fn.upper() =~ /.WEB.|WEBDL|WEB.DL/ ? / [WEB-DL]/ :" ["+any{source}{'No Source'}+"]"}{" [$vf $ac $af]"}
Code: Select all
{any{if (file.path.lower().matchAll(/(3d|half|full|h?sbs|f?sbs|(?i)(?<=^|[^a-z])hou(?=$|[^a-z])|(?i)(?<=^|[^a-z])fou(?=$|[^a-z])|f.ou|anaglyth)(?:.sbs|(?i)(?<=^|[^a-z])cat(?=$|[^a-z]))?/)){'C:/[3D Movies]/'}}{'C:/Movies/'}}{any{def map=['erinbrown':'[Actors]/Erin Brown','stephenking':'[Stephen King]']; actors.join(', ').lower().replaceAll(/[\W]/, "").matchAll(/erinbrown|stephenking/).findResults{ map[it] }.join(',')+'/'}{def map=[/rifftrax/:'RiffTrax','miniseries':'Mini-Series','monstervision':'MonsterVision','fanedit':'FanEdits','usaupallnight':'USA Up All Night',/elvirasmoviemacabre/:'Elvira\'s Movie Macabre']; '['+file.path.lower().replaceAll(/[\W]/, "").matchAll(/monstervision|rifftrax|fanedit|usaupallnight|elvirasmoviemacabre/).findResults{ map[it].replaceAll("\\[|\\]", "") }.sort{ map.values().indexOf(it)}.join(',')+']/'}{(info.SpokenLanguages.displayLanguage.contains(/English/)) ? '' : '[Foreign Films]/'}}{any{if (genres.join(', ').matchAll(/^(?=.*drama)(?=.*history|biography)/))('Docudrama')}{if (genres.join(', ').matchAll(/animation/))('Animation/')}{any{if (genres.join(', ').matchAll(/musical/))('Musicials/')}{if (omdb.genres.join(', ').matchAll(/musical/))('Musicials/')}}{(csv('C:/FileBot Settings/Movies/MovieGenres.csv').get(n))}{genre}{'[No Genre]'}}/{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:th| nd|rd)\b/, { it.lower() }).replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{" (Part ${pi.pad(2)})"}{" ["+file.path.lower().replace(/dc/, 'director\'s cut').replaceAll('limited','limited release').replaceAll('directors','director\'s').replaceAll('-','').replaceAll(/director.s|theatrical/,'$0 Cut').matchAll(/(uncensored|uncut|unrated|remastered|ultimate|extended|director?s|theatrical|ultimate|final|bootleg|special|fan?edit?|limited|rifftrax|monstervision|youtube|hulu|netflix|vimeo|edited|edit|censored+)(?:.edition|.cut|.version|.edit|.release|.extended|.rip)?/)*.upperInitial()*.lowerTrail().sort().join('] [')+']'}{def map=['3d':'3D','hsbs':'Half-SBS','halfsbs':'Half-SBS','fsbs':'Full-SBS','fullsbs':'Full-SBS','sbs':'SBS','halfou':'Half-OU','fullou':'Full-OU','overunder':'OU','anaglyth':'Anaglyth']; " ("+ ((file.path.lower().contains(/3d/)) ? '' : '3D ')+ file.path.lower().replaceAll(/(?i)(?<=^|[^a-z])hou(?=$|[^a-z])/,'halfou').replaceAll(/(?i)(?<=^|[^a-z])fou(?=$|[^a-z])/,'fullou').replaceAll(/(?i)(?<=^|[^a-z])ou(?=$|[^a-z])/,'overunder').replaceAll(/[\W]/, "").matchAll(/3d(?!.*?3d)|hsbs(?!.*?hsbs)|halfsbs(?!.*?halfsbs)|fsbs(?!.*?fsbs)|fullsbs(?!.*?fullsbs)|sbs(?!.*?sbs)|halfou(?!.*?halfou)|fullou(?!.*?fullou)|overunder(?!.*?overunder)|anaglyth(?!.*?anaglyth)/).findResults{ map[it]}.sort().join(' ')+')'}{any{" ["+d.format("yyyy")+"]"}{y}}{info.SpokenLanguages.displayLanguage.contains(/English/) ? '' : " ["+any{(audios.language[1]) ? (csv('C:/FileBot Settings/All/Locales.csv').get(audios.language[0]))+", "+(csv('C:/FileBot Settings/All/Locales.csv').get(audios.language[1])) : (csv('C:/FileBot Settings/All/Locales.csv').get(audios.language[0]))}{(info.SpokenLanguages.displayLanguage.join(', '))}+"]"}{' ['+any{certification} {omdb.certification}.replaceAll(/^\d+$/, 'PG-$0').replaceAll('N A','No Certification')+']'}{" [$minutes Min]"}{" ["+(rating)+"★]"}{" ["+any{(csv('C:/FileBot Settings/Movies/MovieSource.csv').get(source))}{(source)}{'No Source'}+"]"}{" [$vf] [$ac "+af.replace('8ch', '7.1ch').replace('7ch', '6.1ch').replace('6ch', '5.1ch').replace('3ch', '2.1ch').replace('2ch','2.0ch')+"]"}{" ("+actors.take(3).join(', ')+")"}{any{" ("+omdb.genres.take(3).join(', ')+")"}{" ("+genres.take(3).join(', ')+")"}}
Code: Select all
F:/Filme{fn =~ /3D/ ? ' 3D' : ''}{fn =~ /3d/ ? ' 3D' : ''}/{collection+'/'}{n} ({y}) {genres}/{n} ({y}) ({vf}) ({af}){fn =~ /3dhsbs/ ? '.3D.H-SBS' : ''}{fn =~ /H-SBS/ ? '.3D.H-SBS' : ''}{fn =~ /3dhou/ ? '.3D.H-OU' : ''}{fn =~ /H-OU/ ? '.3D.H-OU' : ''}{' - CD'+pi}
Code: Select all
G:\TV\{n.replace(':','-').replaceAll(/[\/:*?"<>|]/,' - ')}/{n.replace(':','-').replaceAll(/[\/:*?"<>|]/,' - ')}
({any{self.d}{'0000-00-00'}})
[{info.network}]
{episode.special ? 'S00E'+special.pad(2) : s00e00}
{t.after(/^[.]+/).replace(':','-').replaceAll(/[\/:*?"<>|]/,' - ')}
{self.vf ? self.vf + "" : self.hpi}
{"${self.source ?: 'NA'}"}
{ac}
{audio[0].channels.replaceAll(/2/, "2ch").replaceAll(/6/, "5.1ch")} {vc}_{any{"$group"}{fn.match(/(?<=[_-])[^\s_-]+?$/)}{'NA'}.replaceAll(/[-_\[\]]\s*|\.\w{3}$/, "")}{any{'.'+lang}{lang}}{any{fn.match(/(?i)sdh.+?/)('')}{fn.match(/(?i).*sdh.*/)('_SDH')}}{any{fn.match(/(?i)\(foreignpartsonly\)/)}{''}}{"."+ext}
Code: Select all
{
def space = call{' '};
// Root Directory
def dir_root = 'Z:/Movies & TV/'+
call{hd.matches(/(?i)SD/) ? '480p-720p/' : ' '}+
call{hd.matches(/(?i)HD/) ? '720p-1080p/' : ' '}+
call{hd.matches(/(?i)UHD/) ? '4k/' : ' '};
// Main Title e.g.
// 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS
// 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR
// Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR
// Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON
def main_title = call{n}+
space + '(' + call{y} + ')'+
space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+
space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+
space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+
space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+
space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+
space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+
space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+
space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+
space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+
space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+
space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+
space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+
space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+
space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+
space + call{self.vf ? self.vf : self.hpi}+
space + call{hd}+
space + call{source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}+
space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+
space + call{self.hdr ? self.hdr + bitdepth + 'bit' : 'non-HDR'}+
space + call{vc}+
space +
// Call audio
// Thread here where I got the base code: https://www.filebot.net/forums/viewtopic.php?f=5&t=5285
call {
def mCFP =
[
'AAC LC SBR' : 'AAC',
'AAC LC' : 'AAC',
'AC 3 Dep' : 'E-AC3',
'AC 3' : 'AC3',
'DTS 96 24' : 'DTS 96-24',
'DTS ES XBR' : 'DTS-HD HRA',
'DTS ES XLL' : 'DTS-HD MA',
'DTS ES XXCH XBR' : 'DTS-HD HRA',
'DTS ES XXCH XLL' : 'DTS-HD MA',
'DTS ES XXCH' : 'DTS-ES',
'DTS ES' : 'DTS-ES',
'DTS XBR' : 'DTS-HD HRA',
'DTS XLL X' : 'DTS X',
'DTS XLL' : 'DTS-HD MA',
'DTS' : 'DTS',
'E AC 3 JOC' : 'EAC3 Atmos',
'E AC 3' : 'EAC3',
'MLP FBA 16 ch' : 'TrueHD Atmos',
'MLP FBA' : 'TrueHD',
'MP3' : 'MP3',
'PCM' : 'PCM'
];
def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };
def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };
def audioCollection = audio.collect
{ au ->
def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };
def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};
def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -> a + b }).findAll { it > 0 }.max().toString() + 'ch';
def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });
def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };
def combined = allOf{codec}{format_profile}.join(' ');
def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };
};
return audioCollection[0].join( ' ' )
} +
'_'+
// Group
call{any{"$group"}{fn.match(/(?<=[_-])[^\s_-]+?$/)}{'NA'}.replaceAll(/[-_\[\]]\s*|\.\w{3}$/, '')};
// Language
def lang = call{any{'.'+lang}{lang}}+{fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''}{any{fn.match(/(?i)\(foreignpartsonly\)/)}{''}};
// Extension
def ext = call{'.'+ext};
// Call all the bindings to create the result
(call(main_title).replace(':', ';') + call(lang)).replaceAll(/null/,'')
}
Code: Select all
{n.replaceAll(/[:*?"<>|?]/).replaceAll(/[`´‘’?]/, "'")} ({y})/{n.replaceAll(/[:*?"<>|?]/).replaceAll(/[`´‘’?]/, "'")} ({y}){' - '+vf.replaceAll("360p","SD").replaceAll("240p","LD")}{'.'+lang}
Code: Select all
{n.replaceAll(/[:*?"<>|?]/).replaceAll(/[`´‘’?]/, "'")}/{n.replaceAll(/[:*?"<>|?]/).replaceAll(/[`´‘’?]/, "'")} - S{(episode.special ? 0 : episode.season ? s : 1).pad(2)}E{episode.special ? special.pad(2) : e.pad(2)} - {t.replaceAll(/[:*?"<>|?]/).replaceAll(/[`´‘’?]/, "'")}{' - '+vf.replaceAll("360p","SD").replaceAll("240p","LD")}{'.'+lang}
Code: Select all
{n.replaceAll(/[:*?"<>|?]/).replaceAll(/[`´‘’?]/, "'")}\{album.replaceAll(/[:*?"<>|?]/).replaceAll(/[`´‘’?]/, "'")}\{pi.pad(2)} - {t.replaceAll(/[:*?"<>|?]/).replaceAll(/[`´‘’?]/, "'")}
Code: Select all
.replaceAll(/&/,"and").replaceAll(/#/,"number").replaceAll("[^a-zA-Z0-9_-]", "")
Code: Select all
.replaceAll("[^a-zA-ZÀ-ÿ0-9_-]", "")
Code: Select all
{".$source"}
Code: Select all
{n.space('_').replaceAll(/&/,"and").replaceAll(/#/,"number").replaceAll("[^a-zA-Z0-9_-]", "")}.{s00e00.lower()}.{t.space('_').replaceAll(/&/,"and").replaceAll(/#/,"number").replaceAll("[^a-zA-Z0-9_-]", "").lowerTrail().replacePart('Part_$1')}{".$airdate.month"}{"-$airdate.day"}{"-$airdate.year"}{".$resolution"}{".$source"}{".$af"}{".$ac"}{".$vf"}{".$vc".replace('AVC','x264').replace('HEVC','x265')}
Code: Select all
{artist}.{album}.{pi.pad(2)}_-_{t.space('_').replaceAll(/&/,"and").replaceAll(/#/,"number").replaceAll("[^a-zA-Z0-9_-]", "")}{".[$media.OverallBitrateString]".replaceAll(/null/, "variable")}
Code: Select all
{n.space('_').replaceAll(/&/,"and").replaceAll(/#/,"number").replaceAll("[^a-zA-Z0-9_-]", "").lowerTrail().replacePart('Part_$1')}.{y}{".$resolution"}{".$vc"}{".$vf"}{".$source"}{".$ac"}{".$af"}
Code: Select all
{['F:', 'G:'].collect{ (it+'/'+n) as File }.sort{ a, b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/Season {s}/{n} {s00e00} {episode.title}
Code: Select all
F:\Chicago P.D\Season 2\Chicago P.D. S02E09 Called In Dead (1).avi
Code: Select all
{if (media.'Album/Performer'!=null && (media.'Album/Performer'!=media.'Performer')) return (media.'Performer'!=n?n+'/':media.'Album/Performer'+'/') else n+'/'}
{if (media.'Original/Released_Date'!=null||media.'Original/Released_Date'!=Y) return (media.'Original/Released_Date'!=null?media.'Original/Released_Date'.truncate(4):Y)+' - ' else (Y!=null?Y+' - ':date.truncate(4)+' - ')}
{album.replace(/:/,/,/).replaceAll(/"|`/,/'/)}
{if (media.'musicbrainz.album.type'!=null&&media.'musicbrainz.album.type'=~"/") return (album=~/Live|LIVE|live|oundtrack|Best Of|best of|reatest|Remix|remix|ollection/?'':' - '+(media.'musicbrainz.album.type'.upperInitial().split("/")[1])) else (album=~/ EP/||media.'musicbrainz.album.type'=="album"||"other"?'':' - '+media.'musicbrainz.album.type'.upper())}
{media.'Part/Position_Total'<'2' ? "" : ' ('+media.'Part/Position_Total'+'CD)'}
{ext=='mp3'?"":" "+[EXT.upper()]}
{media.'part/position'==null||media.'Part/Position_Total'<'2' ? "" : '/CD'+media.'part/position'}/
{pi.pad(2)+' - '}
{media.'Album/Performer'==media.'Performer' ? "" : (media.'Performer').replaceAll('/',', ')+' - '}
{t.replace(/:/,/,/).replaceAll(/"|`/,/'/)}
Code: Select all
/Users/Guest/Public/TV/{def n00 = any{collection}{n}.sortName().charAt(0); n00.isDigit() ? '0-9' : n00}/{collection+'/'}{n}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')} [{airdate}]{' _'+certification+'_'} {hd}
Code: Select all
/Volumes/Multimedia/TV/{def n00 = any{collection}{n}.sortName().charAt(0); n00.isDigit() ? '0-9' : n00}/{collection+'/'}{n}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')} [{airdate}]{' _'+certification+'_'} {hd}
Code: Select all
/Users/Guest/Public/Cinema/{def n00 = any{collection}{n}.sortName().charAt(0); n00.isDigit() ? '0-9' : n00}/{collection+'/'}{n}/{n} ({y}){" ["+pi+'of'+pn+']'} _{certification}_ star-{rating} -- {'t-'+minutes} {hd} {'hpi-'+hpi} {'af-'+af} {'vc-'+vc} {'ac-'+ac}
Code: Select all
/Volumes/Multimedia/Cinema/{def n00 = any{collection}{n}.sortName().charAt(0); n00.isDigit() ? '0-9' : n00}/{collection+'/'}{n}/{n} ({y}){" ["+pi+'of'+pn+']'} _{certification}_ star-{rating} -- {'t-'+minutes} {hd} {'hpi-'+hpi} {'af-'+af} {'vc-'+vc} {'ac-'+ac}
Code: Select all
/Volumes/Multimedia/Cinema/{def n00 = any{collection}{n}.sortName().charAt(0); n00.isDigit() ? '0-9' : n00}/{collection+'/'}{n}/{n} ({y}){" ["+pi+'of'+pn+']'} _{certification}_ star-{rating+'★'} -- {'t-'+minutes} {hd} {'hpi-'+hpi} {'af-'+af} {'vc-'+vc} {'ac-'+ac}
Code: Select all
filebot -script fn:amc --action test --output "/<disk>/Media" --conflict --def clean=y unsorted=y subtitles=en artwork=y excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" exec="chmod 664 '{file}'" --def @/<disk>/scripts/pushover.txt --def [email protected]/<disk>/scripts/movies.groovy [email protected]/<disk>/scripts/tvshows.groovy
Code: Select all
{ norm = { it.upperInitial()
.lowerTrail()
.replaceTrailingBrackets()
.replaceAll(/[`´‘’ʻ""“”]/, "'")
.replaceAll(/[:|]/, " - ")
.replaceAll(/[?]/, "!")
.replaceAll(/[*\s]+/, " ")
.replaceAll(/\b[IiVvXx]+\b/, { it.upper() })
.replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() })
.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/) } }
{ transl = { it.transliterate("Any-Latin; NFD; NFC; Title") }
isLatin = { java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD)
.replaceAll(/\p{InCombiningDiacriticalMarks}+/, "") ==~ /^\p{InBasicLatin}+$/ } }
{ allOf
{"Movies"}
// Movies directory
{n.colon(" - ") + " ($y, $director)"}
// File name
{ allOf
{ isLatin(primaryTitle) ? primaryTitle : transl(primaryTitle) }
{" ($y)"}
// tags + a few more variants
{ specials = { allOf
{tags}
{ fn.findAll(/(?i:alternate[ ._-]cut|limited|proper|repack)/)*.upperInitial()*.lowerTrail()*.replaceAll(/[._-]/, " ") }
.flatten().sort() }
specials().size() > 0 ? specials().join(", ").replaceAll(/^/, " - ") : "" }
{" PT $pi"}
{" ["}
{ allOf
// Video stream
{[vf,vc].join(" ")}
{ allOf
// Audio stream and language
{[channels,ac].join(" ")}
{ def a = audioLanguages
a.size() > 1 ? a.ISO3.join(", ").upperInitial() : a.name.first() }
.join(" ") }
{source}
.join(" - ") }
{"]"}
{"-" + group}
{subt}
.join("") }
.join("/") }
Code: Select all
{ norm = { it.upperInitial()
.lowerTrail()
.replaceTrailingBrackets()
.replaceAll(/[`´‘’ʻ""“”]/, "'")
.replaceAll(/[:|]/, " - ")
.replaceAll(/[?]/, "!")
.replaceAll(/[*\s]+/, " ")
.replaceAll(/\b[IiVvXx]+\b/, { it.upper() })
.replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() })
.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/) } }
{ allOf
{"TV Shows"}
{ allOf
{ (norm(n) == norm(primaryTitle)) ? norm(n) : norm(n) + ' [' + norm(primaryTitle) + ']' }
{ "($y)" }
.join(" ") }
{ episode.special ? 'Specials' : 'Season ' + s.pad(2) }
{ allOf
{ norm(n) }
{ episode.special ? 'S00E' + special.pad(2) : s00e00 }
{ allOf
{ norm(t) }
{"PT $pi"}
{ allOf
{ allOf
{"["}
{ allOf
{[vf,vc].join(" ")}
{[channels,ac].join(" ")}
{source}
.join(" - ") }
{"]"}
.join("") }
{"-$group"}
{subt}
.join("") }
.join(" ") }
.join(" - ") }
.join("/") }
Code: Select all
{vf == /2160p/ ? 'N:/Movies 4K' : vf =~ /1080p|720p/ ? 'M:/Movies HD' : 'M:/Movies'}/{n.upperInitial().colon(' - ').replace('?', '!')} {' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|redux/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'} {any{' Part '+pi}{null}} ({y}) {fn.match(/3D/)}/{n.upperInitial().colon(' - ').replace('?', '!')} {' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|redux/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'} {any{' Part '+pi}{null}} [{y}, {any{csv('M:/replacecert1.csv').get(certification)}{certification}{"NR"} }, {runtime} Min] {[actors.take(3).join(', ')]} {[genres.take(3).join(', ')]} [{fn.match(/3D/)+', '}{"$vf, [email protected]$af"}]{subt}
Code: Select all
O:/TV Series/{n.upperInitial().colon(' - ').replace('?', '!') }/{ any{"Season $s"}{'Specials'} }/{n.upperInitial().colon(' - ').replace('?', '!') } {[genres.take(2).join(', ')]} - {s00e00} - {any{[airdate]}{null}} ({"$vf, [email protected]$af"}) - {t.colon(" - ").replace('?', '!')}{subt}
Code: Select all
$set(title,$replace(%title%,...,…))
$set(album,$replace(%album%,...,…))
$set(artist,$replace(%artist%,...,…))
$set(albumartist,$replace(%albumartist%,...,…))
$if(%originaldate%,$set(date,%originaldate%))
$set(filename,%_filename%)
$set(foldername,%_dirname%)
$if($in(%title%,Live),$set(_misctype,Live))
$if($in(%title%,Demo),$set(_misctype,Demos))
$if($in(%title%,Acoustic),$set(_misctype,Acoustic))
$if($in(%title%,Unplugged),$set(_misctype,Acoustic))
$if($in(%title%,Remix),$set(_misctype,Remixes))
$if($in($lower(%_dirname%),album),$if($not(%discsubtitle%),$set(disctitle,Album)))
$if($in(%_dirname%,Bonus),$if($not(%discsubtitle%),$set(disctitle,Bonus Disc)))
$if($gte($matchedtracks(),$div(%totaltracks%,2)),$set(_miscorincomplete,Incomplete),$set(_miscorincomplete,Misc))
$if($gte($matchedtracks(),%totaltracks%),$unset(_miscorincomplete) $unset(_misctype))
$if($lte($sub(%totaltracks%,$matchedtracks()),1),$set(_numberofmissingtracks,$sub(%totaltracks%,$matchedtracks())$unset(_pluaralmissingtracks)))
$if($gt($sub(%totaltracks%,$matchedtracks()),1),$set(_numberofmissingtracks,$sub(%totaltracks%,$matchedtracks())$set(_pluaralmissingtracks,s)))
$if($in(%album%,Tribute),$set(_tribute,Tributes))
$if($in(%album%,tribute),$set(_tribute,Tributes))
$if($eq(%releasetype%,compilation),$set(releasetype,[Compilation Albums]))
$if($eq(%releasetype%,remix),$set(releasetype,[Remixes]) $set(tributetype,[Remixes]))
$if($eq(%releasetype%,soundtrack),$set(releasetype,[Soundtracks]))
$if($eq(%releasetype%,album),$set(releasetype,[Studio Albums]))
$if($eq(%releasetype%,live),$set(releasetype,[Live Albums]))
$if($eq(%releasetype%,single),$set(releasetype,[Singles]))
$if($eq(%releasetype%,ep),$set(releasetype,[EPs]))
$if(%_releasecomment%, $set(_releasecomment,\(%_releasecomment%\)),$noop())
$if($and($eq(%releasecountry%,JP),$not($in(%_releasecomment%,Japan))),$set(_releasecomment,%_releasecomment% \(Japan Import\)))
$if($and($eq(%releasecountry%,RU),$not($in(%_releasecomment%,Russia))),$set(_releasecomment,%_releasecomment% \(Russian Import\)))
$if($and($eq(%releasecountry%,XE),$not($in(%_releasecomment%,Europe))),$set(_releasecomment,%_releasecomment% \(European Import\)))
$if($and($eq(%releasecountry%,AU),$not($in(%_releasecomment%,Australia))),$set(_releasecomment,%_releasecomment% \(Australian Import\)))
$if($and($eq(%releasecountry%,DE),$not($in(%_releasecomment%,German))),$set(_releasecomment,%_releasecomment% \(German Import\)))
$if($and($eq(%releasecountry%,FI),$not($in(%_releasecomment%,Finland))),$set(_releasecomment,%_releasecomment% \(Finland Import\)))
$if($and($eq(%releasecountry%,FR),$not($in(%_releasecomment%,France))),$set(_releasecomment,%_releasecomment% \(France Import\)))
$if($in(%album%, Punk ),$set(tributetype,Punk))
$if($in(%album%, Rock ),$set(tributetype,Rock))
$if($in(%album%, Metal ),$set(tributetype,Metal))
$if($in(%album%, Bluegrass ),$set(tributetype,Bluegrass))
$if($in(%album%, Acoustic ),$set(tributetype,[Acoustic]))
$if($in(%album%,Gothic Acoustic),$set(tributetype,[Gothic Acoustic Series]))
$if($in(%album%,Pickin' On ),$set(tributetype,[Pickin' On Series]))
$if($in(%album%, Industrial ),$set(tributetype,Industrial))
$if($in(%album%, Techno ),$set(tributetype,Techno))
$if($in(%album%,Tribute),$set(_tribute,Tributes))
$if($in(%album%, Quartet ),$set(tributetype,[String Quartet Series]))
$if($in(%album%,Remix),$set(tributetype,[Remixes]))
$if($in(%album%,Symphonic),$set(_tribute,Tributes))
$if($in(%album%,Symphonic),$set(tributetype,[Symphonic]))
$if($in(%album%, Lullaby Renditions),$set(_tribute,Tributes))
$if($in(%album%, Lullaby Renditions),$set(tributetype,[Lullaby Renditions]))
$if($in(%album%, Piano ),$set(_tribute,Tributes))
$if($in(%album%, Piano ),$set(tributetype,[Piano Series]))
$if($not(%tributetype%),$set(tributetype,[Various Artists]))
$if($in(%releasetype%,[Soundtracks]),$set(_tribute,Soundtracks)$unset(tributetype))
$replace($replace($replace($replace($replace($replace($replace($replace($replace(
$if($eq(%compilation%,1),
$if(%_tribute%,[%_tribute%]/
$if(%tributetype%,%tributetype%)/
$if(%date%, [$left(%date%,4)]) - %album%
$if(%_releasecomment%, %_releasecomment%)
$if($and($ne(%totaldiscs%,1),$not($in(%totaldiscs%,1))),\(%totaldiscs% Disc Set\),$noop())
$if($gt(%totaldiscs%,1),/Disc $num(%discnumber%,2)
$if(%discsubtitle%, - \(%discsubtitle%\)))/
$num(%tracknumber%,2) - %artist% - %title%
$if(%discsubtitle%,\(%discsubtitle%\)))
$if($eq(%albumartist%,Various Artists),
$if($not(%_tribute%),Various Artists/%releasetype%/
$if(%date%, [$left(%date%,4)]) - %album%
$if(%_releasecomment%, %_releasecomment%)
$if($and($ne(%totaldiscs%,1),$not($in(%totaldiscs%,1))),\(%totaldiscs% Disc Set\),$noop())
$if($gt(%totaldiscs%,1),/Disc $num(%discnumber%,2)
$if(%discsubtitle%, - \(%discsubtitle%\)))/
$num(%tracknumber%,2) - %artist% - %title%
$if(%discsubtitle%,\(%discsubtitle%\))))
$if($not($eq(%albumartist%,Various Artists)),
$if($not(%_tribute%),Various Artists/%releasetype%/
$if(%date%, [$left(%date%,4)]) - %album%
$if(%_releasecomment%, %_releasecomment%)
$if($and($ne(%totaldiscs%,1),$not($in(%totaldiscs%,1))),\(%totaldiscs% Disc Set\),$noop())
$if($gt(%totaldiscs%,1),/Disc $num(%discnumber%,2)
$if(%discsubtitle%, - \(%discsubtitle%\)))/
$num(%tracknumber%,2) - %artist% - %title%
$if(%discsubtitle%,\(%discsubtitle%\)))))
,*,[x]),?,),:, -),",'),_, ),|, ),<,[),>,]), , )
$replace($replace($replace($replace($replace($replace($replace($replace($replace(
$if($not($eq(%compilation%,1)),
$if(%_tribute%,[%_tribute%]/
$if(%tributetype%,%tributetype%)/
$if(%date%, [$left(%date%,4)]) - %album%$if($ne(%originalyear%,$left(%date%,4)),
$if(%originalyear%, \(%originalyear% Reissue\)))
$if(%_releasecomment%, %_releasecomment%)
$if($and($ne(%totaldiscs%,1),$not($in(%totaldiscs%,1))),\(%totaldiscs% Discs\),$noop())
$if($gt(%totaldiscs%,1),/Disc $num(%discnumber%,2)
$if(%discsubtitle%, - \(%discsubtitle%\)))/
%artist% - $num(%tracknumber%,2) - %title%
$if(%discsubtitle%,\(%discsubtitle%\)))
$if($not(%_tribute%),
$if(%_miscorincomplete%,
$if($eq(%_miscorincomplete%,Misc),
$if2(%grouping%,Unknown)/$if2(%genre%,Unknown)/
$if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%)/
$if(%_misctype%,[%_misctype%]/,[Misc]/)
%artist% -$if(%album%, %album% -) $num(%tracknumber%,2) - %title%)
$if($eq(%_miscorincomplete%,Incomplete),
$if2(%grouping%,Unknown)/$if2(%genre%,Unknown)/
$if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%)/
$if(%_miscorincomplete%, [Incomplete Albums]/)
$if(%date%, [$left(%date%,4)]) - %album% $if(%_numberofmissingtracks%, \($num(%_numberofmissingtracks%,2) Track$if(%_pluaralmissingtracks%,%_pluaralmissingtracks%) Missing\))
$if($ne(%originalyear%,$left(%date%,4)),
$if(%originalyear%, \(%originalyear% Reissue\)))
$if(%_releasecomment%, %_releasecomment%)
$if($and($ne(%totaldiscs%,1),$not($in(%totaldiscs%,1))),\(%totaldiscs% Discs\),$noop())
$if($gt(%totaldiscs%,1),/Disc $num(%discnumber%,2)
$if(%discsubtitle%, - \(%discsubtitle%\)))/
%artist% - $num(%tracknumber%,2) - %title%
$if(%discsubtitle%,\(%discsubtitle%\)))))
$if($not(%_miscorincomplete%),
$if2(%grouping%,Unknown)/$if2(%genre%,Unknown)/
$if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%)/
$if(%releasetype%, %releasetype%/)
$if(%date%, [$left(%date%,4)]) - %album%
$if($ne(%originalyear%,$left(%date%,4)),
$if(%originalyear%, \(%originalyear% Reissue\)))
$if(%_releasecomment%, %_releasecomment%)
$if($and($ne(%totaldiscs%,1),$not($in(%totaldiscs%,1))),\(%totaldiscs% Discs\),$noop())
$if($gt(%totaldiscs%,1),/Disc $num(%discnumber%,2) $if(%disctitle%, - \(%disctitle%\))
$if(%discsubtitle%, - \(%discsubtitle%\)))/
%artist% - $num(%tracknumber%,2) - %title%
$if(%discsubtitle%,\(%discsubtitle%\))))
,*,[x]),?,),:, -),",'),_, ),|, ),<,[),>,]), , )
Code: Select all
{y}/{primaryTitle}{if (n != primaryTitle) {primaryTitle.isLatin() ? " (${n})" : " (${primaryTitle.ascii()}) (${n})"}}/{fn}
Code: Select all
I:/TV/{n}{' '+any{"[$certification]"}{"["+$imdb.certification+"]" }.replaceAll('N A','').replaceAll(/^ \d+$/, 'PG-$0')}{" [$rating" + "★]"}/{regular ? 'Season ' + s.pad(1) : 'Specials'}/
{
def space = call{' '};
def dir_root = 'I/TV/'+
call{hd.matches(/(?i)SD/) ? '480p-720p/' : ' '}+
call{hd.matches(/(?i)HD/) ? '720p-1080p/' : ' '}+
call{hd.matches(/(?i)UHD/) ? '4k/' : ' '};
// Main Title e.g.
// 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS
// 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR
// Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR
// Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON
def main_title = call{n}+
space + call{s00e00}+
space + '-'+
space + call{t}+
space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+
space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+
space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+
space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+
space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+
space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+
space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+
space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+
space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+
space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+
space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+
space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+
space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+
space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+
space + '['+ call{self.vf ? self.vf : self.hpi}+
space + call{hd}+
space + call{source.matches(/(?i)blu.*ray/) ? 'BluRay' : {source} ?: 'WEB-DL'}+
space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+
space + call{fn.matches(/(?i).+\bwebrip\b.+/) ? 'WEBRip' : ' '}+
space + call{fn.matches(/(?i).+\bhevc.+?\b.+/) ? '(x265)' : ' '}+
space + call{fn.matches(/(?i).+\bx265\b.+/) ? '(x265)' : ' '}+
space + call{fn.matches(/(?i).+\b264\b.+/) ? '(x264)' : ' '}+
// Only calls {hdr} if it's not SD else non-HDR
space + call{if (hd =~ 'HD') {any{hdr + bitdepth + 'bit'}{'non-HDR'}}}+
space + call{vc}+
space +
// Call audio
// Thread here where I got the base code: https://www.filebot.net/forums/viewtopic.php?f=5&t=5285
call {
def mCFP =
[
'AAC LC SBR PS' : 'AAC',
'AAC LC SBR' : 'AAC',
'AAC LC' : 'AAC',
'AC 3 Dep' : 'E-AC3',
'AC 3' : 'AC3',
'DTS 96 24' : 'DTS 96-24',
'DTS ES XBR' : 'DTS-HD HRA',
'DTS ES XLL' : 'DTS-HD MA',
'DTS ES XXCH XBR' : 'DTS-HD HRA',
'DTS ES XXCH XLL' : 'DTS-HD MA',
'DTS ES XXCH' : 'DTS-ES',
'DTS ES' : 'DTS-ES',
'DTS XBR' : 'DTS-HD HRA',
'DTS XLL X' : 'DTS X',
'DTS XLL' : 'DTS-HD MA',
'DTS' : 'DTS',
'E AC 3 JOC' : 'EAC3 Atmos',
'E AC 3' : 'EAC3',
'MLP FBA 16 ch' : 'TrueHD Atmos',
'MLP FBA' : 'TrueHD',
'MP3' : 'MP3',
'MPEG Audio' : 'MP2',
'PCM' : 'PCM'
];
def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };
def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };
def audioCollection = audio.collect
{ au ->
def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };
def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};
def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -> a + b }).findAll { it > 0 }.max().toString() + 'ch';
def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });
def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };
def combined = allOf{codec}{format_profile}.join(' ');
def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };
};
return audioCollection[0].join( ' ' )
} +
'_'+
// Group
call{any{"$group"}{fn.match(/(?<=[_-])[^\s_-]+?$/)}{'NA'}.replaceAll(/[-_\[\]]\s*|\.\w{3}$/, '')};
// Language
def lang = call{any{'.'+lang}{lang}}+{fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''}{any{fn.match(/(?i)\(foreignpartsonly\)/)}{''}};
// Extension
def ext = call{'.'+ext};
// Call all the bindings to create the result
(call(main_title).replace(':', ';') + call(lang)).replaceAll(/null/,'')
}[{runtime} Min]
Code: Select all
I:/Movies/{n}{' '+any{"[$certification]"}{"["+$imdb.certification+"]" }.replaceAll('N A','').replaceAll(/^ \d+$/, 'PG-$0')}{" [$rating" + "★]"}/
{
def space = call{' '};
def dir_root = 'I/Movies/'+
call{hd.matches(/(?i)SD/) ? '480p-720p/' : ' '}+
call{hd.matches(/(?i)HD/) ? '720p-1080p/' : ' '}+
call{hd.matches(/(?i)UHD/) ? '4k/' : ' '};
// Main Title e.g.
// 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS
// 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR
// Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR
// Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON
def main_title = call{n}+
space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+
space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+
space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+
space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+
space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+
space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+
space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+
space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+
space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+
space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+
space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+
space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+
space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+
space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+
space + '['+ call{self.vf ? self.vf : self.hpi}+
space + call{hd}+
space + call{source.matches(/(?i)blu.*ray/) ? 'BluRay' : {source} ?: 'WEB-DL'}+
space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+
space + call{fn.matches(/(?i).+\bwebrip\b.+/) ? 'WEBRip' : ' '}+
space + call{fn.matches(/(?i).+\bhevc.+?\b.+/) ? '(x265)' : ' '}+
space + call{fn.matches(/(?i).+\bx265\b.+/) ? '(x265)' : ' '}+
space + call{fn.matches(/(?i).+\b264\b.+/) ? '(x264)' : ' '}+
// Only calls {hdr} if it's not SD else non-HDR
space + call{if (hd =~ 'HD') {any{hdr + bitdepth + 'bit'}{'non-HDR'}}}+
space + call{vc}+
space +
// Call audio
// Thread here where I got the base code: https://www.filebot.net/forums/viewtopic.php?f=5&t=5285
call {
def mCFP =
[
'AAC LC SBR PS' : 'AAC',
'AAC LC SBR' : 'AAC',
'AAC LC' : 'AAC',
'AC 3 Dep' : 'E-AC3',
'AC 3' : 'AC3',
'DTS 96 24' : 'DTS 96-24',
'DTS ES XBR' : 'DTS-HD HRA',
'DTS ES XLL' : 'DTS-HD MA',
'DTS ES XXCH XBR' : 'DTS-HD HRA',
'DTS ES XXCH XLL' : 'DTS-HD MA',
'DTS ES XXCH' : 'DTS-ES',
'DTS ES' : 'DTS-ES',
'DTS XBR' : 'DTS-HD HRA',
'DTS XLL X' : 'DTS X',
'DTS XLL' : 'DTS-HD MA',
'DTS' : 'DTS',
'E AC 3 JOC' : 'EAC3 Atmos',
'E AC 3' : 'EAC3',
'MLP FBA 16 ch' : 'TrueHD Atmos',
'MLP FBA' : 'TrueHD',
'MP3' : 'MP3',
'MPEG Audio' : 'MP2',
'PCM' : 'PCM'
];
def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };
def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };
def audioCollection = audio.collect
{ au ->
def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };
def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};
def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -> a + b }).findAll { it > 0 }.max().toString() + 'ch';
def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });
def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };
def combined = allOf{codec}{format_profile}.join(' ');
def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };
};
return audioCollection[0].join( ' ' )
} +
'_'+
space+
// Group
call{any{"$group"}{fn.match(/(?<=[_-])[^\s_-]+?$/)}{'NA'}.replaceAll(/[-_\[\]]\s*|\.\w{3}$/, '')};
// Language
def lang = call{any{'.'+lang}{lang}}+{fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''}{any{fn.match(/(?i)\(foreignpartsonly\)/)}{''}};
// Extension
def ext = call{'.'+ext};
// Call all the bindings to create the result
(call(main_title).replace(':', ';') + call(lang)).replaceAll(/null/,'')
}[{runtime} Min]
Before:
D:/MakeMkv/The.Handmaids.Tale.S03E07.Under.His.Eye.1080p.HULU.WEBRip.AAC2.0.H264/The.Handmaids.Tale.S03E07.Under.His.Eye.1080p.HULU.WEB-DL.AAC2.0.H.264-NTb
After
I:/TV/The Handmaid's Tale [TV-MA] [8.9★]/Season 3/The Handmaid's Tale S03E07 - Under His Eye [1080p HD WEB-DL non-HDR AVC AAC 2.0ch_NTb[55 Min]
Before:
D:/MakeMkv/Rick and Morty S01 Season 1 1080p TrueHD [MAX Quality]/S01E02.Lawnmower.Dog.mkv
After:
I:/TV/Rick and Morty [TV-MA] [9.3★]/Season 1/Rick and Morty S01E02 - Lawnmower Dog [1080p HD non-HDR Microsoft TrueHD 5.1ch_NA[25 Min]
Before:
D:/MakeMkv/Stranger.Things.S01.2160p.BluRay.REMUX.HEVC.DD5.1-FGT/Stranger.Things.S01E01.Chapter.One.The.Vanishing.Of.Will.Byers.2160p.BluRay.REMUX.HEVC.DD5.1-FGT
After:
I:/TV/Stranger Things [TV-14] [9.2★]/Season 1/Stranger Things S01E01 - Chapter One; The Vanishing of Will Byers [2160p UHD BluRay REMUX (x265) non-HDR ATEME AC3 5.1ch_FGT[50 Min]
please set user varsformat expression wrote: /path/to/media/tv/or/movies/{plex.derive{' ['}{allOf{vf}{vs}{vc}{ac}{hdr}.join(' ').lower()}{' '+fn.matchAll(/proper|repack|rerip/).join('.').lower()}{']-'}{group}.tail}
deluge-postprocess.sh wrote: #!/bin/sh -xu
# plex compatiable filebot rename script w/ extra quality info
# TV: /path/to/media/tv/Firefly/Season 01/Firefly - S01E01 - Serenity [1080p web-dl avc eac3 repack]-NTG.mkv
# MOVIES: /path/to/media/movies/Avatar (2009)/Avatar (2009) [1080p bluray x264 dts]-EVO.mkv
# Input Parameters
ARG_PATH="$3/$2"
ARG_NAME="$2"
ARG_LABEL="N/A"
ARG_SAVE_PATH="$3"
# user vars
movie_dl_dir="flexget-mv" # where deluge downloads movies to (must be different from tv_dl_dir)
tv_dl_dir="flexget-tv" # where deluge downloads tv to (must be different from movie_dl_dir)
exclude_list="/home/ivagsjw/logs/amc.excludes" # this is required or u will get banned. it stores previously processed file list
log_file="/home/ivagsjw/logs/amc.log"
files_out_movies="/data/ivagsjw/f/media/movies"
files_out_tv="/data/ivagsjw/f/media/tv"
files_out_base="/data/ivagsjw/f/media" # base of your media folder with tv and movies dest folder (for fixing chmod permissions)
#### end user vars ###
# check movie or tv
what_label=Series
if [ $(basename "$ARG_SAVE_PATH") = "$movie_dl_dir" ]
then
what_label=Movie
fi
if [ $(basename "$ARG_SAVE_PATH") = "$tv_dl_dir" ] || [ $(basename "$ARG_SAVE_PATH") = "$movie_dl_dir" ]
then
/usr/bin/filebot -script fn:amc --conflict skip --action hardlink -non-strict --log-file "$log_file" --def clean=y ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$what_label" "exec=chmod -R a+rwX,o-w $files_out_base" deleteAfterExtract=n excludeList="$exclude_list" movieFormat="$files_out_movies/{plex.derive{' ['}{allOf{vf}{vs}{vc}{ac}{hdr}.join(' ').lower()}{' '+fn.matchAll(/proper|repack|rerip/).join('.').lower()}{']-'}{group}.tail}" seriesFormat="$files_out_tv/{plex.derive{' ['}{allOf{vf}{vs}{vc}{ac}{hdr}.join(' ').lower()}{' '+fn.matchAll(/proper|repack|rerip/).join('.').lower()}{']-'}{group}.tail}"
fi