{
def llenguaOriginal = {try{info.OriginalLanguage} catch(e){null}}()
def prodCountries= {try{info.ProductionCountries} catch(e){[]}}()
def numPaises = prodCountries.size()
def certifications={try{info.Certifications} catch(e){[]}}()
def llengu = {try {def langs=[]; for (lan in languages) langs.add(lan.toString()); return langs } catch(err) {[]}}()

def catalana = llenguaOriginal=='ca' || llengu.contains('cat')
def espanyola = llenguaOriginal=='gl' || llenguaOriginal=='eu'

if (!espanyola && !catalana && llenguaOriginal=="es") {
	latina = {try{info.ProductionCompanies.any{it=~/Corazón Films/}} catch(e){false} }()
			|| {try{["Kenya Marquez"].any{director==it}}catch(err){false}}()

	if (latina) return false

	if (numPaises>0 ? prodCountries.contains("ES") : true) {
		espanyola =
				(numPaises==1 || (numPaises==2 && prodCountries.contains("ES") && prodCountries.any{ it=~/AR|PT/ }))
			||	{ try { info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b|\bAntena 3\b/ } catch (e) { false } }()
			||	({ try { info.ProductionCompanies.any{it =~ /.?TVE|ESDIP|Canal Sur|Canal\+|Telecinco/}}catch(e){false}}() && llengu.contains("spa") && (llengu.size()==1?llengu[0]=="spa":true))
			||	(certifications.size()==1 && certifications.ES!=null) 
			||	((llengu.size()==1 && llengu[0]=="spa") || (llengu.size()==2 && llengu.contains("spa")))
			||	{try{ movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null} catch(e){false}}()
			||	(pais=~/ES|esp/ && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]=="spa" : true))
	}
}

return espanyola
}