X-Git-Url: https://git.llucax.com/personal/documentos.git/blobdiff_plain/3c03126534969bb7641fce37d699ae1158096061..258a0ebd5a4a526950083bf3a0d1ef0ebe239de9:/glabels/mp3.php?ds=inline diff --git a/glabels/mp3.php b/glabels/mp3.php index fcafc05..e09b00c 100755 --- a/glabels/mp3.php +++ b/glabels/mp3.php @@ -72,10 +72,10 @@ if ($datos) { 'X' => $x, 'TEXTO_Y' => $y, 'LINEA_Y' => $y + PUNTOS + 2.5, - 'LINEA_ANCHO' => strlen($artista) * 2.5 + 25 / strlen($artista), + 'LINEA_ANCHO' => strlen($artista) * 2.8 + 25 / strlen($artista), 'ARTISTA' => translate($artista), )); - sort($albums); + usort($albums, 'cmp'); for ($i = 0; $i < count($albums); $i++) { // assign data $tpl->setVariable('ALBUM', translate($albums[$i])); @@ -92,6 +92,20 @@ if ($datos) { fclose($fo); } +function cmp($a, $b) { + if (preg_match('/.*\[(\d{4})\]/', $a, $ma) + and preg_match('/.*\[(\d{4})\]/', $b, $mb)) + { + if ($ma[1] == $mb[1]) return 0; + elseif ($ma[1] < $mb[1]) return -1; + else return 1; + } + else + { + strcmp($a, $b); + } +} + function translate($str) { static $tabla = array(); if (!@$tabla) {