mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
Merge rPFc0e619aacd75: T357: Added an ID3v1 fallback and added more information to the…
This commit is contained in:
parent
e4ae56885f
commit
a8d7bd1935
2 changed files with 42 additions and 19 deletions
|
@ -90,18 +90,23 @@ class ClassifyMLPMA extends Command
|
||||||
if (Str::contains(Str::lower($track->filename), 'ingram')) {
|
if (Str::contains(Str::lower($track->filename), 'ingram')) {
|
||||||
$this->info('This is an official song remix!');
|
$this->info('This is an official song remix!');
|
||||||
|
|
||||||
list($trackType, $linkedSongIds) = $this->classifyTrack($track->filename, $officialSongs, true);
|
list($trackType, $linkedSongIds) = $this->classifyTrack($track->filename, $officialSongs, true,
|
||||||
|
$parsedTags);
|
||||||
|
|
||||||
|
|
||||||
// If it has "remix" in the name, it's definitely a remix.
|
// If it has "remix" in the name, it's definitely a remix.
|
||||||
} else if (Str::contains(Str::lower($sanitizedTrackTitle), 'remix')) {
|
} else {
|
||||||
|
if (Str::contains(Str::lower($sanitizedTrackTitle), 'remix')) {
|
||||||
$this->info('This is some kind of remix!');
|
$this->info('This is some kind of remix!');
|
||||||
|
|
||||||
list($trackType, $linkedSongIds) = $this->classifyTrack($track->filename, $officialSongs);
|
list($trackType, $linkedSongIds) = $this->classifyTrack($track->filename, $officialSongs, false,
|
||||||
|
$parsedTags);
|
||||||
|
|
||||||
// No idea what this is. Have the pony at the terminal figure it out!
|
// No idea what this is. Have the pony at the terminal figure it out!
|
||||||
} else {
|
} else {
|
||||||
list($trackType, $linkedSongIds) = $this->classifyTrack($track->filename, $officialSongs);
|
list($trackType, $linkedSongIds) = $this->classifyTrack($track->filename, $officialSongs, false,
|
||||||
|
$parsedTags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,7 +138,8 @@ class ClassifyMLPMA extends Command
|
||||||
* @param bool|false $isRemixOfOfficialTrack
|
* @param bool|false $isRemixOfOfficialTrack
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function classifyTrack($filename, $officialSongs, $isRemixOfOfficialTrack = false) {
|
protected function classifyTrack($filename, $officialSongs, $isRemixOfOfficialTrack = false, $tags)
|
||||||
|
{
|
||||||
$trackTypeId = null;
|
$trackTypeId = null;
|
||||||
$linkedSongIds = [];
|
$linkedSongIds = [];
|
||||||
|
|
||||||
|
@ -150,7 +156,8 @@ class ClassifyMLPMA extends Command
|
||||||
if ($isRemixOfOfficialTrack && sizeof($officialSongs) > 1) {
|
if ($isRemixOfOfficialTrack && sizeof($officialSongs) > 1) {
|
||||||
$this->question('Multiple official songs matched! Please enter the ID of the correct one.');
|
$this->question('Multiple official songs matched! Please enter the ID of the correct one.');
|
||||||
|
|
||||||
} else if (sizeof($officialSongs) > 0) {
|
} else {
|
||||||
|
if (sizeof($officialSongs) > 0) {
|
||||||
$this->question('This looks like a remix of an official song!');
|
$this->question('This looks like a remix of an official song!');
|
||||||
$this->question('Press "r" if the match above is right!');
|
$this->question('Press "r" if the match above is right!');
|
||||||
|
|
||||||
|
@ -158,10 +165,15 @@ class ClassifyMLPMA extends Command
|
||||||
$this->question('Exactly what kind of track is this?');
|
$this->question('Exactly what kind of track is this?');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->question('If this is a medley, multiple song ID\'s can be separated by commas. ');
|
$this->question('If this is a medley, multiple song ID\'s can be separated by commas. ');
|
||||||
$this->question(' ');
|
$this->question(' ');
|
||||||
$this->question(' ' . $filename . ' ');
|
$this->question(' ' . $filename . ' ');
|
||||||
$this->question(' ');
|
$this->question(' ');
|
||||||
|
$this->question(' Title: ' . $tags['title'] . ' ');
|
||||||
|
$this->question(' Album: ' . $tags['album'] . ' ');
|
||||||
|
$this->question(' Artist: ' . $tags['artist'] . ' ');
|
||||||
|
$this->question(' ');
|
||||||
$this->question(' r = official song remix (accept all "guessed" matches) ');
|
$this->question(' r = official song remix (accept all "guessed" matches) ');
|
||||||
$this->question(' # = official song remix (enter the ID(s) of the show song(s)) ');
|
$this->question(' # = official song remix (enter the ID(s) of the show song(s)) ');
|
||||||
$this->question(' a = show audio remix ');
|
$this->question(' a = show audio remix ');
|
||||||
|
|
|
@ -383,7 +383,18 @@ class ImportMLPMA extends Command
|
||||||
*/
|
*/
|
||||||
protected function getId3Tags($rawTags)
|
protected function getId3Tags($rawTags)
|
||||||
{
|
{
|
||||||
|
if (array_key_exists('id3v2', $rawTags['tags'])) {
|
||||||
$tags = $rawTags['tags']['id3v2'];
|
$tags = $rawTags['tags']['id3v2'];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (array_key_exists('id3v1', $rawTags['tags'])) {
|
||||||
|
$tags = $rawTags['tags']['id3v1'];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$tags = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$comment = null;
|
$comment = null;
|
||||||
|
|
||||||
if (isset($tags['comment'])) {
|
if (isset($tags['comment'])) {
|
||||||
|
|
Loading…
Reference in a new issue