From 0e05385182756e6ed0990c711769d59b46f3f640 Mon Sep 17 00:00:00 2001 From: Nigel Pearson Date: Sun, 23 Oct 2011 19:07:54 +1100 Subject: [PATCH] Deal (badly) with multiple results from CDDB lookup. Just uses first result. Should pop up a GUI for the user to choose, but that can wait 'till this code is moved into base class. --- .../mythmusic/mythmusic/cddecoder-darwin.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mythplugins/mythmusic/mythmusic/cddecoder-darwin.cpp b/mythplugins/mythmusic/mythmusic/cddecoder-darwin.cpp index a08ba5c94b1..82374f14bc4 100644 --- a/mythplugins/mythmusic/mythmusic/cddecoder-darwin.cpp +++ b/mythplugins/mythmusic/mythmusic/cddecoder-darwin.cpp @@ -221,7 +221,7 @@ void CdDecoder::lookupCDDB(const QString &hexID, uint totalTracks) QString cddb = HttpComms::getHttp(URL2); #if 0 - LOG(VB_MEDIA, LOG_INFO, "CDDB lookup: " + URL); + LOG(VB_MEDIA, LOG_INFO, "CDDB lookup: " + URL2); LOG(VB_MEDIA, LOG_INFO, "...returned: " + cddb); #endif // @@ -234,12 +234,24 @@ void CdDecoder::lookupCDDB(const QString &hexID, uint totalTracks) // We should check for errors here, and possibly do a CDDB lookup // (telnet 8880) if it failed, but Nigel is feeling lazy. - if (stat == 211) // Multiple matches + if (stat == 210 || stat == 211) // Multiple matches { + // e.g. 210 Found exact matches, list follows (until terminating `.') + // folk 9c09590b Michael W Smith / Stand + // misc 9c09590b Michael W. Smith / Stand + // rock 9c09590b Michael W. Smith / Stand + // classical 9c09590b Michael W. Smith / Stand + // . // TODO // Parse disks, put up dialog box, select disk, prune cddb to selected LOG(VB_MEDIA, LOG_INFO, "Multiple CDDB matches. Please implement this code"); + + // For now, we just choose the first match. + //int EOL = cddb.indexOf('\n'); + cddb.remove(0, cddb.indexOf('\n')); + LOG(VB_MEDIA, LOG_INFO, "String now: " + cddb); + stat = 200; } if (stat == 200) // One unique match