Fixed: Display title and artist name from ogg files in music player

This commit is contained in:
kervala 2015-11-15 13:13:44 +01:00
parent 80d4f69973
commit fb8eb7db70
2 changed files with 22 additions and 13 deletions

View file

@ -2690,21 +2690,30 @@ bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &res
{
std::string artist;
std::string title;
if (_SoundDriver->getMusicInfo(filename, artist, title))
if (!_SoundDriver->getMusicInfo(filename, artist, title))
{
if (!title.empty())
{
if (!artist.empty()) result = artist + " - " + title;
else result = title;
}
else if (!artist.empty())
{
result = artist + " - " + CFile::getFilename(filename);
}
else result = CFile::getFilename(filename);
return true;
// use 3rd party libraries supported formats
IAudioDecoder::getInfo(filename, artist, title);
}
if (!title.empty())
{
if (!artist.empty()) result = artist + " - " + title;
else result = title;
}
else if (!artist.empty())
{
result = artist + " - " + CFile::getFilename(filename);
}
else
{
result = CFile::getFilename(filename);
}
return true;
}
result = "???";
return false;
}

View file

@ -83,7 +83,7 @@ void CMusicPlayer::play ()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:mp3_player:screen:text"));
if (pVT)
pVT->setText (_Songs[_CurrentSong].Title);
pVT->setText (ucstring::makeFromUtf8(_Songs[_CurrentSong].Title));
}
}