~ubuntu-branches/ubuntu/karmic/kid3/karmic

« back to all changes in this revision

Viewing changes to kid3/discogsdialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Matthäi
  • Date: 2009-05-20 16:12:30 UTC
  • mfrom: (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20090520161230-qetp532r8ydujkz2
Tags: upstream-1.2
Import upstream version 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * \author Urs Fleisch
7
7
 * \date 13 Oct 2006
8
8
 *
9
 
 * Copyright (C) 2006-2007  Urs Fleisch
 
9
 * Copyright (C) 2006-2009  Urs Fleisch
10
10
 *
11
11
 * This file is part of Kid3.
12
12
 *
70
70
        // releases have the format:
71
71
        // <li><a href="/release/761529"><span style="font-size: 11pt;"><em>Amon</em> <em>Amarth</em> - The <em>Avenger</em></span></a><br>
72
72
        QString str = QString::fromUtf8(searchStr);
73
 
        QRegExp idTitleRe("<a href=\"/release/([0-9]+)\">(.+)</a>");
 
73
        QRegExp idTitleRe("<a href=\"/([^/]*/?release)/([0-9]+)\">(.+)</a>");
74
74
        QStringList lines = QCM_split("<p/>", str.remove('\n').remove('\r'));
75
75
        m_albumListBox->clear();
76
76
        for (QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it) {
77
77
                if (idTitleRe.QCM_indexIn(*it) != -1) {
78
 
                        QString title(idTitleRe.cap(2));
 
78
                        QString title(idTitleRe.cap(3));
79
79
                        title.replace(QRegExp("<[^>]+>"), "");
80
80
                        new AlbumListItem(
81
81
                                m_albumListBox,
82
82
                                title,
83
 
                                "release",
84
 
                                idTitleRe.cap(1));
 
83
                                idTitleRe.cap(1),
 
84
                                idTitleRe.cap(2));
85
85
                }
86
86
        }
87
87
        m_albumListBox->setFocus();
388
388
                }
389
389
        }
390
390
 
 
391
        m_trackDataVector.setCoverArtUrl(QString::null);
 
392
        if (getCoverArt()) {
 
393
                /*
 
394
                 * cover art can be found in image source
 
395
                 */
 
396
                start = str.QCM_indexOf("<img src=\"http://www.discogs.com/image/");
 
397
                if (start >= 0) {
 
398
                        start += 10; // skip <img src="
 
399
                        end = str.QCM_indexOf("\"", start);
 
400
                        if (end > start) {
 
401
                                m_trackDataVector.setCoverArtUrl(str.mid(start, end - start));
 
402
                        }
 
403
                }
 
404
        }
 
405
 
391
406
        /*
392
407
         * album tracks have the format (lines with only whitespace in between):
393
408
<b>Tracklisting:</b><br>