Unpack "Artist - Title" from icycast metadata. Fixes issue #425

This commit is contained in:
David Sansome 2010-07-10 19:51:34 +00:00
parent fca4fb8264
commit 91f801639a
1 changed files with 11 additions and 1 deletions

View File

@ -344,8 +344,18 @@ void Player::EngineMetadataReceived(const Engine::SimpleMetaBundle& bundle) {
if (item == NULL)
return;
Engine::SimpleMetaBundle bundle_copy = bundle;
// Maybe the metadata is from icycast and has "Artist - Title" shoved
// together in the title field.
int dash_pos = bundle_copy.title.indexOf('-');
if (dash_pos != -1 && bundle_copy.artist.isEmpty()) {
bundle_copy.artist = bundle_copy.title.mid(dash_pos + 1).trimmed();
bundle_copy.title = bundle_copy.title.left(dash_pos).trimmed();
}
Song song = item->Metadata();
song.MergeFromSimpleMetaBundle(bundle);
song.MergeFromSimpleMetaBundle(bundle_copy);
// Ignore useless metadata
if (song.title().isEmpty() && song.artist().isEmpty())