pedazo refactor
This commit is contained in:
parent
95cb29d287
commit
f815a32a06
|
@ -1,4 +1,8 @@
|
||||||
//by @xeviff
|
//by @xeviff
|
||||||
|
/* HARDCODED */
|
||||||
|
def skipAudioCheck = true
|
||||||
|
def relocation = false
|
||||||
|
/*************/
|
||||||
/** RUTAS **/
|
/** RUTAS **/
|
||||||
def ubuntu_desktop=false
|
def ubuntu_desktop=false
|
||||||
|
|
||||||
|
@ -19,11 +23,6 @@ def ruta_asiaticas = root+"Pelis_asiaticas/"
|
||||||
def rutaKO = root+"error/"
|
def rutaKO = root+"error/"
|
||||||
/**********/
|
/**********/
|
||||||
|
|
||||||
/* HARDCODED */
|
|
||||||
def skipAudioCheck = true
|
|
||||||
def relocation = true
|
|
||||||
/*************/
|
|
||||||
|
|
||||||
/** Audio (definición) **/
|
/** Audio (definición) **/
|
||||||
def hayEAC3=false
|
def hayEAC3=false
|
||||||
|
|
||||||
|
@ -76,7 +75,7 @@ def printAudio (audio2Print) {
|
||||||
else if (idiomaOrigin =~ /(?i)\bcast\b|\bspa\b/)
|
else if (idiomaOrigin =~ /(?i)\bcast\b|\bspa\b/)
|
||||||
idioma = "Es"
|
idioma = "Es"
|
||||||
} else {
|
} else {
|
||||||
idioma = idiomaOrigin.replace("Catalan","Cat").replace("Espanol / Espanol", "Es").replaceFirst(/(?i)(spanish|espa.ol)/,"Es")
|
idioma = idiomaOrigin.replace("Catalan","Cat").replace("Espanol / Espanol", "Es").replaceFirst(/(?i)(spanish|espa.ol)/,"Es").replace("(ES)","")
|
||||||
}
|
}
|
||||||
def formato_audio = audio2Print.Format_Commercial.replace("Dolby Digital":"Dolby").replace(" Plus","+")
|
def formato_audio = audio2Print.Format_Commercial.replace("Dolby Digital":"Dolby").replace(" Plus","+")
|
||||||
.replace("DTS-HD Master Audio","DTS-MA").replace("DTS-HD High Resolution Audio","DTS-HD-H")
|
.replace("DTS-HD Master Audio","DTS-MA").replace("DTS-HD High Resolution Audio","DTS-HD-H")
|
||||||
|
@ -85,6 +84,20 @@ def printAudio (audio2Print) {
|
||||||
def canales = audio2Print.Channels.replace(2:'2.0', 6:'5.1', 8:'7.1')
|
def canales = audio2Print.Channels.replace(2:'2.0', 6:'5.1', 8:'7.1')
|
||||||
return idioma + ' ' + formato_audio + ' ' + canales
|
return idioma + ' ' + formato_audio + ' ' + canales
|
||||||
}
|
}
|
||||||
|
def bloqueSubs
|
||||||
|
def handleSub(sub, capturedSubs) {
|
||||||
|
def lang = sub.Language_String != null ? sub.Language_String : sub.title
|
||||||
|
def lang3 = sub.Language_String3 != null ? sub.Language_String3 : sub.title
|
||||||
|
def forced = sub.title!=null ? sub.title.toLowerCase().contains("forzado") : false
|
||||||
|
if (!capturedSubs.containsKey(lang)) {
|
||||||
|
capturedSubs[lang] = lang3+(forced?'+F':'')
|
||||||
|
} else {
|
||||||
|
def existing=capturedSubs[lang]
|
||||||
|
if (!existing.contains('+F') && !existing.contains('+'))
|
||||||
|
capturedSubs[lang] = lang3+(forced?'+F':'+')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***********/
|
/***********/
|
||||||
/* otras funciones */
|
/* otras funciones */
|
||||||
def getInicial () {
|
def getInicial () {
|
||||||
|
@ -100,8 +113,8 @@ def normalLang(langs) {
|
||||||
return !langs.isEmpty() ? {try { for (lan in languages) langs.add(lan.toString()) } catch(err) {langs}}() : langs
|
return !langs.isEmpty() ? {try { for (lan in languages) langs.add(lan.toString()) } catch(err) {langs}}() : langs
|
||||||
}
|
}
|
||||||
def sanityCheck(newId) {
|
def sanityCheck(newId) {
|
||||||
def oldId = fn.find(/\{tmdb-\d+\}/).find(/\d+/)
|
def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/)
|
||||||
return oldId == newId.toString()
|
return oldId!=null ? oldId == newId.toString() : true
|
||||||
}
|
}
|
||||||
/***********/
|
/***********/
|
||||||
|
|
||||||
|
@ -137,31 +150,84 @@ try { //empieza el script
|
||||||
def peso = bytes.toString().before(' ').toDouble()
|
def peso = bytes.toString().before(' ').toDouble()
|
||||||
def numericBps = (mbps.toString().before(' ').toDouble()*1000000).round()
|
def numericBps = (mbps.toString().before(' ').toDouble()*1000000).round()
|
||||||
def calidad =
|
def calidad =
|
||||||
['480p', '576p', '360p', '240p'].contains(vf) ? 'SD' //SD
|
(vf == '2160p') ? //4K
|
||||||
: (vf == '2160p') ? //4K
|
|
||||||
(peso > 30 && numericBps >= 26000000)
|
(peso > 30 && numericBps >= 26000000)
|
||||||
? "4K-UHDRemux"
|
? "UHDRemux"
|
||||||
: (peso > 15)
|
: (peso > 15)
|
||||||
? "4K-UHDRip"
|
? "UHDRip"
|
||||||
: "4K-MicroUHD"
|
: "microUHD"
|
||||||
: (vf == '1080p') ? //1080
|
: (vf == '1080p') ? //1080
|
||||||
(peso > 15 && numericBps >= 18000000)
|
(peso > 15 && numericBps >= 18000000)
|
||||||
? "1080-BDRemux"
|
? "1080-BDRemux"
|
||||||
: (numericBps > 8000000)
|
: (numericBps > 8000000)
|
||||||
? "1080-HD"
|
? "1080"
|
||||||
: "1080-MicroHD"
|
: "microHD"
|
||||||
: vf //720
|
: vf
|
||||||
|
|
||||||
def calidadF = calidad=="4K-UHDRemux" ? "4K"
|
|
||||||
: calidad=="4K-UHDRip" ? "4K"
|
|
||||||
: calidad=="4K-MicroUHD" ? "micro4K"
|
|
||||||
: calidad=="1080-BDRemux" ? "HD"
|
|
||||||
: calidad=="1080-HD" ? "HD"
|
|
||||||
: calidad=="1080-MicroHD" ? "microHD"
|
|
||||||
: calidad=="SD" ? vf // Los SD vamos a poner su resolución
|
|
||||||
: calidad //tal cual
|
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|
||||||
|
|
||||||
|
/** Formato distribución **/
|
||||||
|
formato_distribucion =
|
||||||
|
fn=~/(?i)\bblu.?ray\b|\bbdrip\b/ ? (calidad==~"rip" ? '' : 'BDRip') :
|
||||||
|
fn=~/(?i)remux/ ? (calidad==~"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|\bM\+\b/ )
|
||||||
|
if (plataforma!=null) plataforma = plataforma.replace("MVPLUS","MV+")
|
||||||
|
formato_distribucion = formato_distribucion+(plataforma!=null?(' '+plataforma.toUpperCase()):'')
|
||||||
|
} else if (hayEAC3) //por el audio también se determina que es web-dl
|
||||||
|
formato_distribucion = 'WEB-DL'
|
||||||
|
|
||||||
|
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
|
||||||
|
} catch (err) {}
|
||||||
|
/*****************/
|
||||||
|
|
||||||
|
/**** Profundidad de color */
|
||||||
|
def profundidadColor=''
|
||||||
|
try{profundidadColor = ' '+bitdepth+"bits" } catch(err){}
|
||||||
|
/**************************/
|
||||||
|
|
||||||
|
/**** Profundidad vídeo ****/
|
||||||
|
def myBitrate = 'noBRdef'
|
||||||
|
try{ myBitrate = mbps.replace(/.0/,'').replace(' ','') }catch(err){}
|
||||||
|
def myFps = ' FRvar'
|
||||||
|
try { myFps = ' '+fps.replace(/.0/,'').replace(' ','') }catch(err){}
|
||||||
|
/***************************/
|
||||||
|
|
||||||
|
/* RESULTADO MEDIAINFO */
|
||||||
|
def bloqueCalidadVideo = calidad + formato_distribucion
|
||||||
|
def bloqueDescVideo = myBitrate + profundidadColor + myFps + hdr_info
|
||||||
|
|
||||||
|
def bloqueVideo = ' ['+codecVideo+' '+bloqueCalidadVideo+'] ['+bloqueDescVideo+']'
|
||||||
|
|
||||||
|
|
||||||
/** Audio (ejecución) **/
|
/** Audio (ejecución) **/
|
||||||
def catalanAudios=[]
|
def catalanAudios=[]
|
||||||
def spanishAudios=[]
|
def spanishAudios=[]
|
||||||
|
@ -221,118 +287,20 @@ try { //empieza el script
|
||||||
} else {
|
} else {
|
||||||
if (!skipAudioCheck) throw new Exception("[idioma_audio_no_encontrado]")
|
if (!skipAudioCheck) throw new Exception("[idioma_audio_no_encontrado]")
|
||||||
}
|
}
|
||||||
if (bloqueAudio==null) bloqueAudio = "audio_no_def"
|
if (bloqueAudio==null) bloqueAudio = "[audio_no_def]"
|
||||||
|
else bloqueAudio = ' ['+bloqueAudio+']'
|
||||||
/***********/
|
/***********/
|
||||||
|
|
||||||
/** Formato distribución **/
|
|
||||||
formato_distribucion =
|
|
||||||
fn=~/(?i)\bblu.?ray\b/ ? 'BDRip' :
|
|
||||||
fn=~/(?i)\bdrip\b/ ? 'BDRip' :
|
|
||||||
fn=~/(?i)\bDVD.?RIP\b/ ? 'DVDRip' :
|
|
||||||
fn=~/(?i)\bHDiTunes\b/ ? 'HDiTunes' :
|
|
||||||
fn=~/(?i)\bTV.?RIP\b/ ? 'TVRip' :
|
|
||||||
fn=~/(?i)\bWEB.?Screener\b/ ? 'WEB-SRC' :
|
|
||||||
'no_encontrado'
|
|
||||||
def plataforma
|
|
||||||
def esWEB_DL=false
|
|
||||||
if (formato_distribucion=='no_encontrado') {
|
|
||||||
esWEB_DL = fn=~/(?i)\bWEB.??(DL|RIP)\b/ //WEB-DL o WEB-RIP (todo junto o con punto/guión/etc)
|
|
||||||
|
|
||||||
if (esWEB_DL) {
|
/***** subtitulos *******/
|
||||||
def web_x = fn=~/(?i)\bWEB.?DL\b/ ? 'WEB-DL' : 'WEB-RIP' //guardar el que es
|
|
||||||
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|\bM\+\b/ )
|
|
||||||
if (plataforma!=null) plataforma = plataforma.replace("MVPLUS","MV+")
|
|
||||||
formato_distribucion = web_x+(plataforma!=null?(' '+plataforma.toUpperCase()):'') //web-dl/rip + plataforma(si hay)
|
|
||||||
} else {
|
|
||||||
if (hayEAC3) //por el audio también se determina que es web-dl
|
|
||||||
formato_distribucion = 'WEB-DL'
|
|
||||||
else {
|
|
||||||
def otrosFD = fn.find( /(?i)\bMTL\b |\bMUBI\b/ )
|
|
||||||
if (otrosFD!= null && !otrosFD.isEmpty())
|
|
||||||
formato_distribucion = otrosFD.toUpperCase() //si son estos, se setea
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**********/
|
|
||||||
|
|
||||||
/** Formato distribución 2ª ronda**/
|
|
||||||
//formato_distribucion = formato_distribucion=='no_encontrado'? '' : ' '+formato_distribucion
|
|
||||||
if (formato_distribucion=='no_encontrado') {
|
|
||||||
formato_distribucion =
|
|
||||||
calidad=="4K-UHDRemux" ? "UHDRemux" :
|
|
||||||
calidad=="4K-UHDRip" ? "UHDRip" :
|
|
||||||
calidad=="4K-MicroUHD" ? "UHDRip" :
|
|
||||||
calidad=="1080-BDRemux" ? "BDRemux" :
|
|
||||||
calidad=="1080-HD" ? "DBRip" :
|
|
||||||
calidad=="1080-MicroHD" ? "BDRip" :
|
|
||||||
'' //no_encontrado -> ''
|
|
||||||
} else {
|
|
||||||
if (calidad=~/(?i)\remux\b/) {
|
|
||||||
formato_distribucion =
|
|
||||||
calidad=="4K-UHDRemux" ? "UHDRemux" :
|
|
||||||
calidad=="1080-BDRemux" ? "BDRemux" :
|
|
||||||
'' //no_encontrado -> ''
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (formato_distribucion!='') formato_distribucion=' '+formato_distribucion
|
|
||||||
/**********************************/
|
|
||||||
|
|
||||||
/**** HDR ********/
|
|
||||||
def hdr_info=''
|
|
||||||
try {
|
try {
|
||||||
def mHDRCol = ["BT.709" : "NO", "BT.2020" : "YES"]
|
def capturedSubs = [:]
|
||||||
def hdr_info_old = (bitdepth >= 10 && mHDRCol.get(self.video[0].colourprimaries) == "YES" ) ? ' HDR' : ''
|
bloqueSubs = ' [sub '
|
||||||
|
for (sub in text) handleSub(sub, capturedSubs)
|
||||||
def _HDRMap = [
|
for (entry in capturedSubs) bloqueSubs += entry.value+', '
|
||||||
"HDR10": "HDR10",
|
bloqueSubs = bloqueSubs.substring(0,bloqueSubs.size()-2)+']'
|
||||||
"SMPTE ST 2086": "HDR10",
|
}catch(err){bloqueSubs=' [no sub]'}
|
||||||
"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
|
|
||||||
}
|
|
||||||
def hdr_info_ = _HDRMap.find { k, v ->
|
|
||||||
k =~ _HDR
|
|
||||||
}?.value
|
|
||||||
|
|
||||||
if (hdr_info_!=null) hdr_info=' '+hdr_info_
|
|
||||||
} catch (err) {}
|
|
||||||
/*****************/
|
|
||||||
|
|
||||||
/**** Profundidad de color */
|
|
||||||
def profundidadColor=''
|
|
||||||
try{profundidadColor = bitdepth+"bits" } catch(err){}
|
|
||||||
/**************************/
|
|
||||||
|
|
||||||
/**** Profundidad vídeo ****/
|
|
||||||
def myBitrate = 'noBRdef'
|
|
||||||
try{ myBitrate = mbps.replace(/.0/,'').replace(' ','') }catch(err){}
|
|
||||||
def myFps = ' FRvar'
|
|
||||||
try { myFps = ' '+fps.replace(/.0/,'').replace(' ','') }catch(err){}
|
|
||||||
/***************************/
|
|
||||||
|
|
||||||
/* RESULTADO MEDIAINFO */
|
|
||||||
def bloqueCalidadVideo = calidadF+formato_distribucion+hdr_info
|
|
||||||
def bloqueProfundidad = myBitrate+myFps
|
|
||||||
if (bloqueProfundidad!='' && profundidadColor!='') bloqueProfundidad=' '+bloqueProfundidad
|
|
||||||
|
|
||||||
def bloqueMediainfo = ' ['+codecVideo+' '+bloqueCalidadVideo+']['+profundidadColor+bloqueProfundidad+']'+' ['+bloqueAudio+']'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************/
|
/**************************************/
|
||||||
|
@ -434,20 +402,17 @@ try { //empieza el script
|
||||||
else if (y<2000) ruta = ruta_retro
|
else if (y<2000) ruta = ruta_retro
|
||||||
if (ruta==rutaOK && y>=2021) ruta = ruta_estrenos
|
if (ruta==rutaOK && y>=2021) ruta = ruta_estrenos
|
||||||
/********************************************/
|
/********************************************/
|
||||||
/**************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/**** Nombre pelicula ****/
|
/**** Nombre pelicula ****/
|
||||||
def nombrePelicula_formatoPlex = {try { primaryTitle!=localize.Catalan.n ? localize.Catalan.plex.name : localize.Spanish.plex.name } catch (err) {localize.Spanish.plex.name} }()
|
def nombrePelicula_formatoPlex = {try { primaryTitle!=localize.Catalan.n ? localize.Catalan.plex.name : localize.Spanish.plex.name } catch (err) {localize.Spanish.plex.name} }()
|
||||||
/*************************/
|
/*************************/
|
||||||
|
|
||||||
|
|
||||||
/*** RESULTADO FINAL ***/
|
/*** RESULTADO FINAL ***/
|
||||||
def inicial = (ruta==rutaOK || ruta==ruta_retro) ? getInicial() : ''
|
def inicial = (ruta==rutaOK || ruta==ruta_retro) ? getInicial() : ''
|
||||||
def tmdb = " {tmdb-"+tmdbid+"}"
|
def tmdb = " {tmdb-"+tmdbid+"}"
|
||||||
def carpetaPeli = localize.Spanish.plex.name + tmdb + '/'
|
def carpetaPeli = localize.Spanish.plex.name + tmdb + '/'
|
||||||
def nomPrincipal = nombrePelicula_formatoPlex + bloqueMediainfo
|
def nomPrincipal = nombrePelicula_formatoPlex + bloqueVideo + bloqueAudio + bloqueSubs
|
||||||
def tracker = fn.find(/(?i)\bHDO(limpo)?\b/)
|
def tracker = fn.find(/(?i)\bHDO(limpo)?\b|\bRedBits\b/)
|
||||||
def extras = tracker != null ? ' ['+tracker.replace("HDOlimpo", "HDO")+']' : ''
|
def extras = tracker != null ? ' ['+tracker.replace("HDOlimpo", "HDO")+']' : ''
|
||||||
|
|
||||||
return ruta + inicial + carpetaPeli + nomPrincipal + extras + tmdb
|
return ruta + inicial + carpetaPeli + nomPrincipal + extras + tmdb
|
||||||
|
|
|
@ -38,8 +38,8 @@ def normalLang(langs) {
|
||||||
return !langs.isEmpty() ? {try { for (lan in languages) langs.add(lan.toString()) } catch(err) {langs}}() : langs
|
return !langs.isEmpty() ? {try { for (lan in languages) langs.add(lan.toString()) } catch(err) {langs}}() : langs
|
||||||
}
|
}
|
||||||
def sanityCheck(newId) {
|
def sanityCheck(newId) {
|
||||||
def oldId = fn.find(/\{tmdb-\d+\}/).find(/\d+/)
|
def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/)
|
||||||
return oldId == newId.toString()
|
oldId!=null ? oldId == newId.toString() : true
|
||||||
}
|
}
|
||||||
//*****************************************************************************************/
|
//*****************************************************************************************/
|
||||||
//*****************************************************************************************/
|
//*****************************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue