mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-29 08:07:59 +01:00
T357: Support OGG Vorbis master files in the MLPMA importer.
This commit is contained in:
parent
f656c3aadf
commit
50bba983e3
2 changed files with 38 additions and 0 deletions
|
@ -154,6 +154,10 @@ class ImportMLPMA extends Command {
|
||||||
|
|
||||||
} else if (Str::lower($file->getExtension()) === 'm4a') {
|
} else if (Str::lower($file->getExtension()) === 'm4a') {
|
||||||
list($parsedTags, $rawTags) = $this->getAtomTags($allTags);
|
list($parsedTags, $rawTags) = $this->getAtomTags($allTags);
|
||||||
|
|
||||||
|
} else if (Str::lower($file->getExtension()) === 'ogg') {
|
||||||
|
list($parsedTags, $rawTags) = $this->getVorbisTags($allTags);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -464,4 +468,35 @@ class ImportMLPMA extends Command {
|
||||||
$tags];
|
$tags];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $rawTags
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getVorbisTags($rawTags) {
|
||||||
|
$tags = $rawTags['tags']['vorbiscomment'];
|
||||||
|
|
||||||
|
$trackNumber = null;
|
||||||
|
if (isset($tags['track_number'])) {
|
||||||
|
$trackNumberComponents = explode('/', $tags['track_number'][0]);
|
||||||
|
$trackNumber = $trackNumberComponents[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
var_dump($tags);
|
||||||
|
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'title' => isset($tags['title']) ? $tags['title'][0] : null,
|
||||||
|
'artist' => isset($tags['artist']) ? $tags['artist'][0] : null,
|
||||||
|
'band' => isset($tags['band']) ? $tags['band'][0] : null,
|
||||||
|
'album_artist' => isset($tags['album_artist']) ? $tags['album_artist'][0] : null,
|
||||||
|
'genre' => isset($tags['genre']) ? $tags['genre'][0] : null,
|
||||||
|
'track_number' => $trackNumber,
|
||||||
|
'album' => isset($tags['album']) ? $tags['album'][0] : null,
|
||||||
|
'year' => isset($tags['year']) ? (int) $tags['year'][0] : null,
|
||||||
|
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
||||||
|
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
||||||
|
],
|
||||||
|
$tags];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,9 @@
|
||||||
} else if (Str::startsWith($audioObject->getAudioCodec(), 'aac')) {
|
} else if (Str::startsWith($audioObject->getAudioCodec(), 'aac')) {
|
||||||
$masterFormat = 'AAC';
|
$masterFormat = 'AAC';
|
||||||
|
|
||||||
|
} else if ($audioObject->getAudioCodec() === 'vorbis') {
|
||||||
|
$masterFormat = 'OGG Vorbis';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$validator->messages()->add('track', 'The track does not contain audio in a known lossy format.');
|
$validator->messages()->add('track', 'The track does not contain audio in a known lossy format.');
|
||||||
return CommandResponse::fail($validator);
|
return CommandResponse::fail($validator);
|
||||||
|
|
Loading…
Reference in a new issue