~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to src/songinfo/ultimatelyricsprovider.cpp

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "songinfotextview.h"
19
19
#include "ultimatelyricsprovider.h"
 
20
#include "core/logging.h"
20
21
#include "core/network.h"
21
22
 
22
23
#include <QNetworkReply>
38
39
  // Get the text codec
39
40
  const QTextCodec* codec = QTextCodec::codecForName(charset_.toAscii().constData());
40
41
  if (!codec) {
41
 
    qWarning() << "Invalid codec" << charset_;
 
42
    qLog(Warning) << "Invalid codec" << charset_;
42
43
    emit Finished(id);
43
44
    return;
44
45
  }
55
56
  DoUrlReplace("{a}",      FirstChar(metadata.artist()), &url_text);
56
57
 
57
58
  QUrl url(url_text);
 
59
  qLog(Debug) << "Fetching lyrics from" << url;
58
60
 
59
61
  // Fetch the URL, follow redirects
60
62
  redirect_count_ = 0;
105
107
  // Check for invalid indicators
106
108
  foreach (const QString& indicator, invalid_indicators_) {
107
109
    if (original_content.contains(indicator)) {
 
110
      qLog(Debug) << "Found invalid indicator" << indicator;
108
111
      emit Finished(id);
109
112
      return;
110
113
    }
115
118
    QString content = original_content;
116
119
    ApplyExtractRule(rule, &content);
117
120
 
 
121
    qLog(Debug) << "Extract rule" << rule << "matched" << content.length();
 
122
 
118
123
    if (!content.isEmpty())
119
124
      lyrics = content;
120
125
  }