1
0
Fork 0
filebot-presets/common/video.groovy

84 lines
2.8 KiB
Groovy
Executable File

/** Codec Vídeo: en nombre fichero **/
def codecVideo = (any{vc}{0} =~ /HEVC|265|ATEME/ ) ? 'HEVC' :
(any{vc}{0} =~ /264/) ? 'AVC' : vc
/**************/
/******* Calidad ******/
def calidad =
(vf =~ '2160.') ? //4K
(peso > 30 && numericBps >= 26000000)
? "UHDRemux"
: (peso > 15)
? "UHDRip"
: "microUHD"
: es1080 ? //1080
es1080Remux
? vf+" BDRemux"
: (numericBps > 8000000)
? vf
: "microHD"
: vf
def fuente = {try{ source } catch(err){null}}()
if (fuente!=null) {
calidad = calidad.startsWith("micro") ? calidad : vf
if (fuente.contains("WEB-DL")) fuente = "WEB-DL"
}
/***************************/
/** Formato distribución **/
def formato_distribucion = fuente!=null ? fuente : relocation ? '' :
fn=~/(?i)\bblu.?ray\b|\bbdrip\b/ ? (calidad=~/(?i).+rip/ ? '' : 'BDRip') :
fn=~/(?i)remux/ ? (calidad=~/(?i).+remux/ ? '' : 'BDRemux') :
fn=~/(?i)\bWEB.?(DL|RIP)\b/ ? 'WEB-DL' :
''
if (formato_distribucion=='WEB-DL') {
def plataforma = fn.find( //coge el contenido que encaja
/(?i)\bAMZN?\b|\bNF\b|\bHBO\b|\bHBO.?MAX\b|\bHMAX\b|\bHULU\b|\bA3P\b|\bDPLY\b|\bSTARZ\b|\bFILMIN\b|\bFLMN\b|\bNETFLIX\b|\bDSN.?\b|\bDSP+?\b|\bRTVE\b|\bFLIXOL.\b|(?<!\w)M\+(?!\w)|\bSKYSHO\b/ )
if (plataforma!=null) {
plataforma = plataforma.toUpperCase()
.replace("MVPLUS","MV+").replace("DSNY","DSN+")
}
formato_distribucion = formato_distribucion+(plataforma!=null?(' '+plataforma):'')
}
if (formato_distribucion!='') formato_distribucion=' '+formato_distribucion
/**********************************/
/**** HDR ********/
def hdr_info=''
try{
def mHDRCol = ["BT.709" : "NO", "BT.2020" : "YES"]
def _HDRMap = ["HDR10": "HDR10", "SMPTE ST 2086": "HDR10", "SMPTE ST 2094 App 4": "HDR10+", "Dolby Vision / SMPTE ST 2086": "Dolby Vision", "Dolby Vision / HDR10": "Dolby Vision",]
def vid = video.first()
String _HDR
switch (bitdepth) {
case { it > 8 }:
_HDR = any
{ vid["HDR_Format_Commercial"] }
{ vid["HDR_Format"] }
{ hdr }
{ null }
break
default:
"$bitdepth-bit"
break
}
hdr_info = _HDRMap.find { k, v -> k =~ _HDR }?.value
if (hdr_info!=null) hdr_info=' '+hdr_info
else hdr_info=''
} catch (err) {}
/*****************/
/**** Profundidad vídeo ****/
def myBitrate = 'noBRdef'
try{ myBitrate = mbps.replace(/.0/,'').replace(' Mbps','M') }catch(err){}
def myFps = ' FRvar'
try { myFps = ' '+fps.replace(/.0/,'').replace(' fps','f') }catch(err){}
/***************************/
/* BLOQUE VIDEO */
def bloqueCalidadVideo = calidad + formato_distribucion
def bloqueDescVideo = myBitrate + myFps + hdr_info
def bloqueVideo = ' ['+codecVideo+' '+bloqueCalidadVideo+' '+bloqueDescVideo+']'
/**********************************************************************************************************/