mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-04-01 00:35:30 +02:00
T357: Added an ID3v1 fallback and added more information to the classification script.
This commit is contained in:
parent
cd113e4d4b
commit
c0e619aacd
2 changed files with 19 additions and 6 deletions
|
@ -88,18 +88,18 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ 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 = [];
|
||||||
|
|
||||||
|
@ -183,6 +183,10 @@ class ClassifyMLPMA extends Command {
|
||||||
$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 ');
|
||||||
|
|
|
@ -391,7 +391,16 @@ class ImportMLPMA extends Command {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
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…
Add table
Reference in a new issue