Last active
July 3, 2023 01:45
-
-
Save rlaphoenix/66307b2cc222a71ac3944759da438b80 to your computer and use it in GitHub Desktop.
Common style P2P Movies and TV filebot template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Requirements: MediaInfo and libmediainfo v19.09 or newer. | |
// Examples: | |
// "The.IT.Crowd.S01E01.Yesterdays.Jam.1080p.AMZN.WEB-DL.DDP.5.1.H.264-PHOENiX" | |
// "Luca.2021.Repack.2160p.DSNP.WEB-DL.DV.DDP.5.1.Atmos.H.265-PHOENiX" | |
def Movie = false; | |
def Group = "PHOENiX"; // Only used if no Group Tag is detected in the original filenames | |
def Source = "AMZN WEB-DL"; // e.g. "DVD REMUX", "BluRay REMUX", "BRRip", and so on | |
def Edition = ""; // If empty or not set, it will be detected from the original filename | |
def Tags = ""; // placed before -GROUP. Newer P2P formats put the "REMUX" etc. here instead of in Source | |
// =========================== // | |
if ((m = fn =~ /-(\w+)$/)) { | |
Group = m.group(1) | |
} | |
if (!Edition) { | |
Edition = [] | |
if ((m = fn.space(".") =~ /(?i)\b(open\.matte|unrated|extended)\b/)) { | |
Edition.add(m.group(1).tokenize(".")*.toLowerCase()*.capitalize().join(" ")) | |
} | |
if ((m = fn.space(".") =~ /(?i)\b(repack|proper)\b/)) { | |
Edition.add(m.group(1).tokenize(".")*.toLowerCase()*.capitalize().join(" ")) | |
} | |
Edition = Edition.join(" ") | |
} | |
def Ac = audio[0].format_commercial | |
def Ach = (any{ audio.ChannelLayout*.replaceAll(/Object Based/)*.split()*.collect{ it.replace(/LFE/, '0.1').replaceFirst(/(\b(?:L|R|C)(?:b+|s+|w+)?\b)/, '1').toDouble() }*.sum().collect{ it == null ? audio.findAll{ it.ChannelLayout == /Object Based/ }.Channels*.replace(/8/,'7.1')*.replace(/6/,'5.1')[0] + ' (Objs)' : it }[0] }{ audio.Channels[0].toDouble() }).toString() | |
switch (Ac) { | |
case "Dolby TrueHD with Dolby Atmos": Ac = "[email protected]"; break | |
case "Dolby TrueHD": Ac = "TrueHD"; break | |
case "DTS-HD Master Audio": Ac = "DTS-HD MA"; break | |
case "DTS-ES Matrix": Ac = "DTS-ES"; break | |
case "Dolby Digital": Ac = "DD"; break | |
case "Dolby Digital Plus": Ac = "DDP"; break | |
case "HE-AAC": Ac = "AAC"; break | |
} | |
if (any{audio[0].format_additionalfeatures}{false}) { | |
switch (audio[0].format_additionalfeatures) { | |
case "XLL X": Ac = audio[0].format + "-X"; break | |
} | |
} | |
def fnf = fn.lower().space("."); | |
def Fn = [ | |
// Title | |
n.replace(" - ", " "), | |
// Year or S00E00 and Episode Name | |
Movie ? y : (S00E00 + " " + t), | |
// Edition, e.g. Repack, Proper, Open Matte, Unrated, Extended, etc. | |
Edition, | |
// Resolution and Scan, e.g. 480i, 576p, 1080i, 1080p, etc. | |
vf.replaceAll(/[^0-9]/)+(any{hpi}{vf}.replace("m", "i").replaceAll(/[^a-z]/)), | |
// Source, e.g. AMZN WEB-DL, DVD REMUX, BluRay REMUX, BRRip, and so on | |
Source, | |
// Video Range, e.g. HDR, DV | |
any{hdr}{" "}, | |
// Audio Codec and Channels, e.g. AAC 2.0, DDP 5.1, TrueHD 7.1 Atmos, etc. | |
Ac.contains("@") ? Ac.replace('@', Ach) : (Ac + " " + Ach), | |
// Video Codec | |
video.Format[0].replace("AVC", "H.264").replace("HEVC", "H.265"), | |
// Tags | |
Tags | |
].join(" ") + "-" + Group | |
// Condense spaces, replace spaces with dots | |
Fn = Fn.replaceAll(/[ ]{2,}/, " ").space(".") | |
// Remove special characters that may not be usable on some file systems | |
Fn = Fn.replaceAll(/([<>:"\/\\!|?*,'()_]|\s|[\x00-\x1F\x7F]|(?:(?!\p{IsLatin})\p{L})|\.$)/).ascii() | |
return Fn | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generic Base Style: https://gist.github.com/rlaphoenix/06b374c87f27c431c1cd3ae25e5247a9
Common P2P Style: https://gist.github.com/rlaphoenix/66307b2cc222a71ac3944759da438b80
FraMeSToR Style: https://gist.github.com/rlaphoenix/22c482980f0f7d2d683c6df6153dc575
RPG Style: https://gist.github.com/rlaphoenix/f4bb99fbe7b7b23bbeba34de1648037c