/* descriptor fields specification: - url - parameters: {artist},{title},{album},{Artist},{Title},{Album},{a} - urlFormat - specify character replacements for url parameters - title - use {artist} - {title} lyrics for extracting artist and title from returned html - charset - extract - short rule(s) for extracting reply from returned html - exclude - similar as extract but inverse - invalidIndicator - string(s) that identify returned page as invalid if page contains the invalidIndicator(s) - getReply - javascript function that manually extract reply from a html page extract, exclude and invalidIndicator fields are alternative to getReply extract, exclude and invalidIndicator fields can be catenated in an array extract, exclude fields specification (2 formats): - string - an html tag - 2 lenght array - specify starting and ending string that surround data alternative (fallback) rules for extract are named extract2,extract3,extract4 (useful when a site use multiple templates) */ /* var reply = "13. Payback" var start = reply.search(new RegExp("\\d+. Payback<\\/b>","i")); Amarok.alert(start); */ const siteDescriptors = { "lyrics.wikia.com": { title: "{artist}:{title} Lyrics - ", charset: "utf-8", extract: [["
","','']], exclude: ['',['[',']'],['[',']']], url: "http://www.azlyrics.com/lyrics/{artist}/{title}.html", urlFormat : [ {rep: "", punct: " ._@,;&\\/'\"-" }, ] }, "metrolyrics.com": { title: "{artist} - {title} LYRICS", charset: "utf-8", invalidIndicator: "These lyrics are missing", extract: '', extract2: '
', exclude: '
', url: "http://www.metrolyrics.com/{title}-lyrics-{artist}.html", urlFormat : [ {rep: "-", punct: " _@,;&\\/\"" }, {rep: "", punct: "'." }, ] }, "jamendo.com": { charset: "utf-8", getReply: function(reply){ if(reply.indexOf('0) reply = reply.extractXmlTag('
'); else reply = reply.replace(/\n/g,"
") return reply; }, url: "http://www.jamendo.com/en/get/track/list/track-artist/lyricstext/plain/?searchterm={Title}&artist_searchterm={Artist}", // url: "http://www.jamendo.com/en/get/track/list/track-artist-album/lyricstext/plain/?searchterm={title}&artist_searchterm={artist}", urlFormat : [] }, "mp3lyrics.org": { title: "{artist} "{title}" Lyrics", charset: "utf-8", invalidIndicator: "Something went wrong", extract: "", extract2: '
', exclude: ["",["",":"],["Lyrics",""]], url: "http://www.mp3lyrics.org/{a}/{artist}/{title}/", urlFormat : [ {rep: "-", punct: " _@,;&\\/\"" }, {rep: "", punct: "'." }, ] }, "songlyrics.com": { title: "{title} LYRICS - {artist}", charset: "utf-8", invalidIndicator: ["Sorry, we have no", "This is an upcoming album and we do not have the"], extract: '

', exclude: [['\n[','] ']], url: "http://www.songlyrics.com/{artist}/{title}-lyrics/", urlFormat : [ {rep: "-", punct: " ._@,;&\\/\"" }, {rep: "_", punct: "'" }, ] }, "darklyrics.com": { title: "{artist} LYRICS - {title}", charset: "utf-8", getReply: function(reply, info){ // var start = reply.search(new RegExp(("\d+. " + info.arrange(info.title,this.urlFormat,false) + "").escapeRegExp(),"i")); var start = reply.search(new RegExp("\\d+. " + info.arrange(info.title,SearchInfo.prototype.defaultReplaces,false) + "[^<]*<\\/b>","i")); // var start = reply.search(new RegExp("","i")); if (start<0) return ""; // Amarok.alert(start); reply = reply.substring(start); var end = reply.search(new RegExp("")+4); reply = reply.replace(/<\/font>/ig,""); reply = reply.replace(//ig,""); return reply; }, /* matchInfo:function(reply,info,info2){ if (info2){ info.matchedTitle = info2.title; info.matchedArtist = info2.artist; // Amarok.alert(info.matchedTitle + " | " + info.matchedArtist); }else{ LyricsClass.prototype.matchInfo.call(this,reply,info); if (!info.arrange) return; var title = reply.match(new RegExp("\\d+. (" + info.arrange(info.title,SearchInfo.prototype.defaultReplaces,false) + "[^<]*)<\\/b>","i")); if (title) info.matchedTitle = title[1]; } Amarok.alert(info.matchedTitle + " | " + info.matchedArtist); }, */ invalidIndicator: "Not Found", url: "http://www.darklyrics.com/lyrics/{artist}/{album}.html", urlFormat : [ {rep: "", punct: " _@,;&\\/\"'." }, ] }, "lyricsmode.com": { title: "{artist} - {title} lyrics", charset: "iso-8859-1", invalidIndicator: "Sorry, we have no", // extract: '

', // extract2: '', extract: "
", url: "http://www.lyricsmode.com/lyrics/{a}/{artist}/{title}.html", urlFormat : [ {rep: "_", punct: " ._@,;&\\/\"" }, ] }, "elyrics.net": { title: "{title} Lyrics - {artist}", charset: "iso-8859-1", invalidIndicator: "Page not Found", extract : "
", exclude : ["",""], url: "http://www.elyrics.net/read/{a}/{artist}-lyrics/{title}-lyrics.html", urlFormat : [ {rep: "-", punct: " _@;&\\/\"" }, // removed , {rep: "_", punct: "'" }, ] }, "lyricsdownload.com": { title: "{artist} - {title} LYRICS", charset: "utf-8", invalidIndicator: "We haven't lyrics of this song", extract : '
', url: "http://www.lyricsdownload.com/{artist}-{title}-lyrics.html", urlFormat : [ {rep: "-", punct: " _@,;&\\/\"" }, {rep: "", punct: "." }, ] }, "lyrics.com": { title: "{artist} - {title} Lyrics", charset: "utf-8", invalidIndicator: "we do not have the lyric for this song", extract: '
', // extract: '
', url: "http://www.lyrics.com/lyrics/{artist}/{title}.html", urlFormat : [ {rep: "-", punct: " _@,;&\\/\"" }, {rep: "", punct: "'." }, ] }, "lyriki.com": { charset: "utf-8", extract: [['','
'],'

'], url: "http://www.lyriki.com/{artist}:{title}", urlFormat : [ {rep: "_", punct: " _@,;&\\/\"" }, {rep: "", punct: "." }, ] }, "lyricsbay.com": { title: "{title} lyrics {artist}", charset: "iso-8859-1", extract: "

", exclude: '