Help to simplify my script.
Posted: 04 Nov 2019, 18:19
Hi i have a so complex script, that in fact is so big that i reached the MAX CHARS limit, and sometimes is not working properly, can you help me to simplify it? I did it getting parts from forums here and there, is a strange collage.
Bests.
# I NEED HELP al these is to get bitrate....so often fails...
# I NEED HELP If there are more than 5 subs to just use "multisub" word.
Bests.
# I NEED HELP al these is to get bitrate....so often fails...
Code: Select all
{def V1=video.bitrate.toString(); def V=V1.substring(1,V1.indexOf("]"));def audbit=audio.bitrate.toString().minus("Unknown /").minus(" Unknown /").minus("[").minus("]").replaceAll("null","0"); def audnum=audio.streamcount.toString().substring(1,2).toInteger();def posaud1=audbit.indexOf(',',0);def posaud2=audbit.indexOf(',',posaud1+1); def posaud3=audbit.indexOf(',',posaud2+1);def posaud4=audbit.indexOf(',',posaud3+1);def posaud5=audbit.indexOf(',',posaud4+1);def posaud6=audbit.indexOf(',',posaud5+1); if ( V != "null") {(V.toFloat()/1e6d).round(1)} else{ ((bitrate-(audnum >= 1 ?( posaud1 == -1 ? audbit : audbit.substring(0,posaud1)) :0 ).toInteger() -(audnum >= 2 ?(posaud2 == -1 ? audbit.substring(posaud1+1):audbit.substring(posaud1+1,posaud2)):0).toInteger() -(audnum >= 3 ?(posaud3 == -1 ? audbit.substring(posaud2+1):audbit.substring(posaud2+1,posaud3)):0).toInteger() -(audnum >= 4 ?(posaud4 == -1 ? audbit.substring(posaud3+1):audbit.substring(posaud3+1,posaud4)):0).toInteger() -(audnum >= 5 ?(posaud5 == -1 ? audbit.substring(posaud4+1):audbit.substring(posaud4+1,posaud5)):0).toInteger() -(audnum >= 6 ?(posaud6 == -1 ? audbit.substring(posaud5+1):audbit.substring(posaud5+1,posaud6)):0).toInteger())/1e6d).round(1)}}Mbps{" "}
# I NEED HELP If there are more than 5 subs to just use "multisub" word.
Code: Select all
{def x = text.language.findResults{ it.toLocale().ISO3Language.upper().replaceAll("SPA","ESP") }.unique().sort().join(' '); if (x) "SUB $x"}