lyrics fetcher: fix shadow warnings
This commit is contained in:
@@ -53,7 +53,7 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist, const std:
|
|||||||
Result result;
|
Result result;
|
||||||
result.first = false;
|
result.first = false;
|
||||||
|
|
||||||
std::string url = this->url();
|
std::string url = urlTemplate();
|
||||||
boost::replace_all(url, "%artist%", artist.c_str());
|
boost::replace_all(url, "%artist%", artist.c_str());
|
||||||
boost::replace_all(url, "%title%", title.c_str());
|
boost::replace_all(url, "%title%", title.c_str());
|
||||||
|
|
||||||
@@ -91,10 +91,10 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist, const std:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> LyricsFetcher::getContent(const char *regex, const std::string &data)
|
std::vector<std::string> LyricsFetcher::getContent(const char *regex_, const std::string &data)
|
||||||
{
|
{
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
boost::regex rx(regex);
|
boost::regex rx(regex_);
|
||||||
auto first = boost::sregex_iterator(data.begin(), data.end(), rx);
|
auto first = boost::sregex_iterator(data.begin(), data.end(), rx);
|
||||||
auto last = boost::sregex_iterator();
|
auto last = boost::sregex_iterator();
|
||||||
for (; first != last; ++first)
|
for (; first != last; ++first)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ struct LyricsFetcher
|
|||||||
virtual Result fetch(const std::string &artist, const std::string &title);
|
virtual Result fetch(const std::string &artist, const std::string &title);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char *url() = 0;
|
virtual const char *urlTemplate() = 0;
|
||||||
virtual const char *regex() = 0;
|
virtual const char *regex() = 0;
|
||||||
|
|
||||||
virtual bool notLyrics(const std::string &) { return false; }
|
virtual bool notLyrics(const std::string &) { return false; }
|
||||||
@@ -52,7 +52,7 @@ struct LyricwikiFetcher : public LyricsFetcher
|
|||||||
virtual Result fetch(const std::string &artist, const std::string &title);
|
virtual Result fetch(const std::string &artist, const std::string &title);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char *url() { return "http://lyrics.wikia.com/api.php?action=lyrics&fmt=xml&func=getSong&artist=%artist%&song=%title%"; }
|
virtual const char *urlTemplate() { return "http://lyrics.wikia.com/api.php?action=lyrics&fmt=xml&func=getSong&artist=%artist%&song=%title%"; }
|
||||||
virtual const char *regex() { return "<url>(.*?)</url>"; }
|
virtual const char *regex() { return "<url>(.*?)</url>"; }
|
||||||
|
|
||||||
virtual bool notLyrics(const std::string &data);
|
virtual bool notLyrics(const std::string &data);
|
||||||
@@ -65,7 +65,7 @@ struct GoogleLyricsFetcher : public LyricsFetcher
|
|||||||
virtual Result fetch(const std::string &artist, const std::string &title);
|
virtual Result fetch(const std::string &artist, const std::string &title);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char *url() { return URL; }
|
virtual const char *urlTemplate() { return URL; }
|
||||||
virtual const char *siteKeyword() { return name(); }
|
virtual const char *siteKeyword() { return name(); }
|
||||||
|
|
||||||
virtual bool isURLOk(const std::string &url);
|
virtual bool isURLOk(const std::string &url);
|
||||||
|
|||||||
Reference in New Issue
Block a user