lyrics: add support for lyricsfly.com database

This commit is contained in:
Andrzej Rybczak
2010-08-08 19:12:51 +02:00
parent 74d177feae
commit 8b109d0736
3 changed files with 19 additions and 4 deletions

View File

@@ -389,6 +389,7 @@
## supported lyrics databases: ## supported lyrics databases:
## ##
## - 1 - lyrc.com.ar ## - 1 - lyrc.com.ar
## - 2 - lyricsfly.com
## ##
# #
#lyrics_database = "1" #lyrics_database = "1"

View File

@@ -261,6 +261,8 @@ void *Lyrics::Get(void *screen_void_ptr)
pthread_exit(0); pthread_exit(0);
} }
if (my_lyrics == &Lyricsfly)
Replace(result, "[br]", "");
Replace(result, "&lt;", "<"); Replace(result, "&lt;", "<");
Replace(result, "&gt;", ">"); Replace(result, "&gt;", ">");
@@ -337,12 +339,13 @@ void Lyrics::Take()
} }
#endif // HAVE_PTHREAD_H #endif // HAVE_PTHREAD_H
const unsigned Lyrics::DBs = 1; // number of currently supported lyrics databases const unsigned Lyrics::DBs = 2; // number of currently supported lyrics databases
const char *Lyrics::PluginsList[] = const char *Lyrics::PluginsList[] =
{ {
//"lyricsplugin.com", //"lyricsplugin.com",
"lyrc.com.ar", "lyrc.com.ar",
"lyricsfly.com",
0 0
}; };
@@ -369,7 +372,7 @@ const Lyrics::Plugin Lyrics::LyricsPlugin =
LyricsPlugin_NotFound LyricsPlugin_NotFound
};*/ };*/
bool Lyrics::LyrcComAr_NotFound(const std::string &s) bool Lyrics::Generic_NotFound(const std::string &s)
{ {
// it should never fail as open_tag and close_tag // it should never fail as open_tag and close_tag
// are not present if lyrics are not found // are not present if lyrics are not found
@@ -381,7 +384,15 @@ const Lyrics::Plugin Lyrics::LyrcComAr =
"http://lyrc.com.ar/tema1es.php?artist=%artist%&songname=%title%", "http://lyrc.com.ar/tema1es.php?artist=%artist%&songname=%title%",
"</table>", "</table>",
"<p>", "<p>",
LyrcComAr_NotFound Generic_NotFound
};
const Lyrics::Plugin Lyrics::Lyricsfly =
{
"http://api.lyricsfly.com/api/api.php?i=30002e18b71fbe4f0-temporary.API.access&a=%artist%&t=%title%",
"<tx>",
"</tx>",
Generic_NotFound
}; };
const Lyrics::Plugin *Lyrics::ChoosePlugin(int i) const Lyrics::Plugin *Lyrics::ChoosePlugin(int i)
@@ -391,6 +402,8 @@ const Lyrics::Plugin *Lyrics::ChoosePlugin(int i)
case 0: case 0:
//return &LyricsPlugin; //return &LyricsPlugin;
return &LyrcComAr; return &LyrcComAr;
case 1:
return &Lyricsfly;
default: default:
return &LyrcComAr; return &LyrcComAr;
} }

View File

@@ -85,7 +85,7 @@ class Lyrics : public Screen<Scrollpad>
static const Plugin *ChoosePlugin(int); static const Plugin *ChoosePlugin(int);
//static bool LyricsPlugin_NotFound(const std::string &); //static bool LyricsPlugin_NotFound(const std::string &);
static bool LyrcComAr_NotFound(const std::string &); static bool Generic_NotFound(const std::string &);
static bool Ready; static bool Ready;
@@ -96,6 +96,7 @@ class Lyrics : public Screen<Scrollpad>
static const char *PluginsList[]; static const char *PluginsList[];
//static const Plugin LyricsPlugin; //static const Plugin LyricsPlugin;
static const Plugin LyrcComAr; static const Plugin LyrcComAr;
static const Plugin Lyricsfly;
# endif // HAVE_CURL_CURL_H # endif // HAVE_CURL_CURL_H
size_t itsScrollBegin; size_t itsScrollBegin;