[FIX] [BUG] Impossible d'ajouter un morceau #4
This commit is contained in:
@@ -47,15 +47,40 @@ class ScoreScanner {
|
||||
}
|
||||
|
||||
$ini = @parse_ini_file($iniFile, true);
|
||||
|
||||
// If parse fails, try to extract info manually
|
||||
if ($ini === false) {
|
||||
$content = file_get_contents($iniFile);
|
||||
|
||||
$name = '';
|
||||
$compositor = '';
|
||||
|
||||
if (preg_match('/name\s*=\s*(.+)/i', $content, $matches)) {
|
||||
$name = trim($matches[1]);
|
||||
}
|
||||
if (preg_match('/compositor\s*=\s*(.+)/i', $content, $matches)) {
|
||||
$compositor = trim($matches[1]);
|
||||
}
|
||||
|
||||
if ($name || $compositor) {
|
||||
return [
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
'compositor' => $compositor,
|
||||
'ressource' => null
|
||||
];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$info = $ini['info'] ?? [];
|
||||
|
||||
return [
|
||||
'id' => $id,
|
||||
'name' => $ini['info']['name'] ?? 'Inconnu',
|
||||
'compositor' => $ini['info']['compositor'] ?? 'Inconnu',
|
||||
'ressource' => $ini['info']['ressource'] ?? null
|
||||
'name' => $info['name'] ?? '',
|
||||
'compositor' => $info['compositor'] ?? '',
|
||||
'ressource' => $info['ressource'] ?? null
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user