Created
October 20, 2015 21:43
-
-
Save fidelix/3d530dba7f4865c4d9fe to your computer and use it in GitHub Desktop.
This file contains 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
if ($row->field_info_adicionais) { | |
$row->field_info_adicionais = current($row->field_info_adicionais); | |
$words = array( | |
'Blu-ray', | |
'Bluray', | |
'Blueray', | |
'Blue-ray', | |
'BD ', | |
'BD-', | |
'BDdisc', | |
'BD-disc', | |
); | |
foreach ($words as $word) { | |
if (stripos($row->field_info_adicionais, $word) !== FALSE) { | |
$row->qualidade = 'Blu-Ray'; | |
$sem_censura = 1; | |
$row->title = $row->title . ' - Blu-Ray'; | |
break; | |
} | |
} | |
if (!isset($row->sem_censura) || is_null($row->sem_censura)) { | |
$words = array( | |
'Sem-censura', | |
'Sem censura', | |
'Sem-sensura', | |
'Sem sensura', | |
'Sem-cortes', | |
'Sem cortes', | |
'peitos', | |
'unrated', | |
); | |
foreach ($words as $word) { | |
if (stripos($row->field_info_adicionais, $word) !== FALSE) { | |
$sem_censura = 1; | |
break; | |
} | |
} | |
} | |
} | |
// Calcula a qualidade pelo número de pixels. | |
if (empty($row->qualidade)) { | |
$row->qualidade = 'TV'; | |
$dimensoes = explode('x', $row->resolucao); | |
if ($dimensoes[0] * $dimensoes[1] > 548860) { | |
$row->qualidade = 'HDTV'; | |
} | |
// Um pouco acima de 640x480 | |
elseif ($dimensoes[0] * $dimensoes[1] > 310000) { | |
$row->qualidade = 'DVD'; | |
} | |
} | |
if (!empty($sem_censura)) { | |
$row->atributos[] = 'Sem censura'; | |
} | |
if (!empty($row->field_softsub)) { | |
$softsub = current($row->field_softsub); | |
if (!empty($softsub)) { | |
$row->atributos[] = 'Softsub'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment