Lyricator v1.1.1 #31 (2010-12-16)

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

GD3771730
Posts: 31
Joined: Mon Dec 21, 2009 5:33 pm
Location: Paris

Re: Lyricator v1.1.1 #31 (2010-12-16)

Post by GD3771730 »

Hello,

I downloaded Lyricator 1.1.1 from here: http://www.happymonkeying.com/get.php?plg=300091
and changed Lyricator.js as recommended. It works perfectly.

Many thanks.

Gil
Peke
Posts: 17457
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: Lyricator v1.1.1 #31 (2010-12-16)

Post by Peke »

FYI if MDominik13 is interested I'll give him rights to change/update script and release new working version.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
ggibby
Posts: 90
Joined: Mon Feb 07, 2005 10:36 pm
Location: Truckee, CA

Re: Lyrics put's "Ad" in the begning of every lyric

Post by ggibby »

The good news is that MMW Beta 4.1.0.1683 seems to have addressed this,
as I've activated auto lyrics and no 'Ad' prefixes have appeared,
though Lyricator seems to be broken..?

However...
nohitter151 wrote: There is already an addon for that, RegExp find & replace.
I've tried using two different presets to cleanup the 'Ad':
Remove specified number of characters from begin of <Into Field>
Remove specified string from the begin of <Into Field>

Both have the same vague result:
"You encountered a problem when replacing the Lyrics field for 1.track:"
and then the entire text of the lyric field.

Seems like the easiest way to fix it is just re-lookup all the lyrics.
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Updated script to include more lyrics sites

Post by thehammer »

I have updated the script to fix the "Ad" issue and added more supported lyrics sites. I haven't been following up on any other changes people may have been making to the script since it was released, but I can tell you that I have been using this for several months without issue... enjoy! (Note: It was discovered that this only works with the installs where MediaMonkey was installed for all users in WIndows and everything lives in Program Files/MediaMonkey directory instead of the Users appData/Roaming/MediaMonkey directory. I will have to do some work to merge my changes into the latest install file posted a couple posts earlier to work for this type of install.)

It now supports the following, and they all have configuration points to turn them on/off in the options:
AZLyrics
LyricWikia
LyrDB
LyricsVIP
LyricsSongs
LyricsMode
Mp3Lyrics
SeekALyric
MetroLyrics

Remember to back up your existing lyricator.js JavaScript file before replacing it with this code in case there are issues with my updated version, you will be able to go back to the version you were on.

Code: Select all

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

var currentTrack = -1;
var foundTracks = 0;
var currentArtist = 0;
var currentTitle = 0;
var currentRequest = 0;
var cachedArtist;
var cachedTitle;
var cachedTrack;
var loading;
var status;
var tracks;
var artistFirstChar;

var tryAZLyrics
var rAZLyrics;
var tryLyricWikia
var rLyricWikia;
var tryLyrDB
var rLyrDB;
var tryLyricsVIP
var rLyricsVIP;
var tryLyricsSong
var rLyricsSongs;
var tryLyricsMode
var rLyricsMode;
var tryMp3Lyrics
var rMp3Lyrics;
var trySeekALyric
var rSeekALyric;
var tryMetroLyrics
var rMetroLyrics;

var aA = new Array();
var aT = new Array();
var aR = new Array();

var bruteForce = false;
var tryCleanupWhitespace = false;
var tryAllArtists = false;
var tryCommaArtists = false;
var tryRejectSingleLine = false;
var trySingleLineSearch = ''; var trySingleLineReplace = '';
var tryParensA = false; var tryParensT = false;
var tryBracketsA = false; var tryBracketsT = false;
var tryBracesA = false; var tryBracesT = false;
var tryQuotesA = false; var tryQuotesT = false;
var tryTheA = false; var tryTheT = false;
var tryFeatA = false; var tryFeatT = false;
var trySplitArrayA = ''; var trySplitArrayT = '';
var tryBlackListA = ''; var tryBlackListT = '';
var artistFirstChar = '';


var bDebug = false;
var paused = false;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var init = function() {
   if(tryAZLyrics) {
      rAZLyrics = new Request({method:'get',onSuccess:rSuccessAZLyrics,onException:rNextAZLyrics,onFailure:rNextAZLyrics,onCancel:rNextAZLyrics});
      rAZLyrics.host = 'http://www.azlyrics.com/lyrics/%artist%/%title%.html'
      rAZLyrics.sendString = '';
      rAZLyrics.timeout = '20000';
      rAZLyrics.name = 'AZ Lyrics';
      rAZLyrics.className = 'AZLyrics';

      aR.include(rAZLyrics);
   }
   if(tryLyricWikia) {
      rLyricWikia = new Request({method:'get',onSuccess:rSuccessLyricWikia,onException:rNextLyricWikia,onFailure:rNextLyricWikia,onCancel:rNextLyricWikia});
      rLyricWikia.host = 'http://lyrics.wikia.com/%artist%:%title%';
      rLyricWikia.sendString = '';
      rLyricWikia.timeout = '20000';
      rLyricWikia.name = 'Lyrics Wiki';
      rLyricWikia.className = 'LyricWikia';

      aR.include(rLyricWikia);
   }
   if(tryLyricsVIP) {
      rLyricsVIP = new Request({method:'get',onSuccess:rSuccessLyricsVIP,onException:rNextLyricsVIP,onFailure:rNextLyricsVIP,onCancel:rNextLyricsVIP});
      rLyricsVIP.host = 'http://www.lyricsvip.com/%artist%/%title%-Lyrics.html'
      rLyricsVIP.sendString = '';
      rLyricsVIP.timeout = '20000';
      rLyricsVIP.name = 'Lyrics VIP';
      rLyricsVIP.className = 'LyricsVIP';

      aR.include(rLyricsVIP);
   }
   if(tryLyricsSong) {
      rLyricsSongs = new Request({method:'get',onSuccess:rSuccessLyricsSongs,onException:rNextLyricsSongs,onFailure:rNextLyricsSongs,onCancel:rNextLyricsSongs});
      rLyricsSongs.host = 'http://letras.terra.com.br/winamp.php?artista=%artist%&musica=%title%';
      rLyricsSongs.sendString = 'artista=%artist%&musica=%title%';
      rLyricsSongs.timeout = '20000';
      rLyricsSongs.name = 'Lyrics Songs';
      rLyricsSongs.className = 'LyricsSongs';

      aR.include(rLyricsSongs);
   }
   if(tryLyricsMode) {
      rLyricsMode = new Request({method:'get',onSuccess:rSuccessLyricsMode,onException:rNextLyricsMode,onFailure:rNextLyricsMode,onCancel:rNextLyricsMode});
      rLyricsMode.host = 'http://www.lyricsmode.com/lyrics/z/%artist%/%title%.html';
      rLyricsMode.sendString = '';
      rLyricsMode.timeout = '20000';
      rLyricsMode.name = 'Lyrics Mode';
      rLyricsMode.className = 'LyricsMode';

      aR.include(rLyricsMode);
   }
   if(tryMp3Lyrics) {
      rMp3Lyrics = new Request({method:'get',onSuccess:rSuccessMp3Lyrics,onException:rNextMp3Lyrics,onFailure:rNextMp3Lyrics,onCancel:rNextMp3Lyrics});
      rMp3Lyrics.host = 'http://www.mp3lyrics.org/%artist%/%title%';
      rMp3Lyrics.sendString = '';
      rMp3Lyrics.timeout = '20000';
      rMp3Lyrics.name = 'Mp3Lyrics';
      rMp3Lyrics.className = 'Mp3Lyrics';

      aR.include(rMp3Lyrics);
   }
   if(trySeekALyric) {
      rSeekALyric = new Request({method:'get',onSuccess:rSuccessSeekALyric,onException:rNextSeekALyric,onFailure:rNextSeekALyric,onCancel:rNextSeekALyric});
      rSeekALyric.host = 'http://www.seekalyric.com/song/%artist%/%title%';
      rSeekALyric.sendString = '';
      rSeekALyric.timeout = '20000';
      rSeekALyric.name = 'Seek A Lyric';
      rSeekALyric.className = 'SeekALyric';

      aR.include(rSeekALyric);
   }
   if(tryMetroLyrics) {
      rMetroLyrics = new Request({method:'get',onSuccess:rSuccessMetroLyrics,onException:rNextMetroLyrics,onFailure:rNextMetroLyrics,onCancel:rNextMetroLyrics});
      rMetroLyrics.host = 'http://www.metrolyrics.com/%title%-lyrics-%artist%.html';
      rMetroLyrics.sendString = '';
      rMetroLyrics.timeout = '20000';
      rMetroLyrics.name = 'Metro Lyrics';
      rMetroLyrics.className = 'MetroLyrics';

      aR.include(rMetroLyrics);
   }
   if(tryLyrDB) {
      rLyrDB = new Request({method:'get',onSuccess:rSuccessLyrDB,onException:rNextLyrDB,onFailure:rNextLyrDB,onCancel:rNextLyrDB});
      rLyrDB.host = 'http://webservices.lyrdb.com/lookup.php?for=match&q=%artist%|%title%&agent=MediaMonkey'
      rLyrDB.sendString = '';
      rLyrDB.timeout = '20000';
      rLyrDB.name = 'Lyr DB';
      rLyrDB.className = 'LyrDB';

      aR.include(rLyrDB);
   }

   bruteForce = tryAllArtists || tryCommaArtists || tryParensA || tryBracketsA || tryBracesA || trySplitArrayA || tryParensT || tryBracketsT || tryBracesT || trySplitArrayT;

   loading = new Asset.image(loadinggif);
   status = $('Status');
   tracks = $$('div[class=track]');
   if(!tracks.length) return;
   tracks.each(
      function(e) {
         e.addEvent('click', trackClick);
         e.addEvent('mouseover', trackOver);
         e.addEvent('mouseout', trackOut);
         e.addEvent('contextmenu', trackContextMenu);
      }
   )
   $$('input[type=checkbox]').each(function(e) { e.addEvent('click', function() {if(!e.checked) e.parentNode.parentNode.addClass('unchecked'); else e.parentNode.parentNode.removeClass('unchecked'); window.event.cancelBubble = true;});});
   $('Header').innerHTML = '<button id="PauseButton" onclick="pause();">Pause</button><span id="GlobalStatus"></span><span id="GlobalStats"></span><span id="GlobalHost"></span><br><br><span id="Legend">Legend: </span>';
   if(tryAZLyrics) {  $('Header').innerHTML += '<span class="textAZLyrics">AZLyrics</span> ' ; }
   if(tryLyricWikia) {  $('Header').innerHTML += '<span class="textLyricWikia">LyricWikia</span> ' ; }
   if(tryLyrDB) {  $('Header').innerHTML += '<span class="textLyrDB">LyrDB</span> ' ; }
   if(tryLyricsVIP) {  $('Header').innerHTML += '<span class="textLyricsVIP">LyricsVIP</span> ' ; }
   if(tryLyricsSong) {  $('Header').innerHTML += '<span class="textLyricsSongs">LyricsSongs</span> ' ; }
   if(tryLyricsMode) {  $('Header').innerHTML += '<span class="textLyricsMode">LyricsMode</span> ' ; }
   if(tryMp3Lyrics) {  $('Header').innerHTML += '<span class="textMp3Lyrics">Mp3Lyrics</span> ' ; }
   if(trySeekALyric) {  $('Header').innerHTML += '<span class="textSeekALyric">SeekALyric</span> ' ; }
   if(tryMetroLyrics) {  $('Header').innerHTML += '<span class="textMetroLyrics">MetroLyrics</span> ' ; }
   $('Popup').innerHTML = '<button onclick="updateLyrics();">Update Lyrics</button><button onclick="closeLyrics();">Cancel changes</button><br /><textarea id="PopupLyrics"></textarea>';

   whatNext(null, null, null, true);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var rNextAZLyrics = function() { whatNext(''); }
var rNextLyricWikia = function() { whatNext(''); }
var rNextLyrDB = function() { whatNext(''); }
var rNextLyricsVIP = function() { whatNext(''); }
var rNextLyricsSongs = function() { whatNext(''); }
var rNextLyricsMode = function() { whatNext(''); }
var rNextMp3Lyrics = function() { whatNext(''); }
var rNextSeekALyric = function() { whatNext(''); }
var rNextMetroLyrics = function() { whatNext(''); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var rSuccessAZLyrics = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<!-- start of lyrics -->')[1].split('<!-- end of lyrics -->')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<title>')[1].split('</title>')[0].trim().split('LYRICS -')[0].trim()
         t = html.split('<title>')[1].split('</title>')[0].trim().split('LYRICS -')[1].trim()
         l += "<br><br><br>Lyrics provided by: AZLyrics.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessLyricWikia = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<div class=\'lyricbox\'>')[1].split('<!--')[0].trim();
      l = cleanupLyrics(l);
      l = l.substr(2,l.length-2);
      if(l) {
         a = html.split('<title>')[1].split('Lyrics - LyricWiki')[0].trim().split(':')[0].trim()
         t = html.split('<title>')[1].split('Lyrics - LyricWiki')[0].trim().split(':')[1].trim()
         l += "<br><br><br>Lyrics provided by: Lyric.Wikia.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessLyrDB = function(html, xml) {
   var l = '';  var a = '';   var t = '';  var id = '';
   try {
      id = html.split('\\')[0].split('\n')[0];
      if(id.length != 0) {
          a = html.split('\\')[2].split('\n')[0];
          t = html.split('\\')[1].split('\n')[0];
          rLyrDB = new Request({method:'get', onSuccess: function(responseText) {l = cleanupLyrics(responseText.replace(/(\r\n|\n)/g, '<br>')) ; if(l) { l+= "<br><br><br>Lyrics provided by: LyrDB.com<br>Artist: " + a + "<br>Track: " + t}; whatNext(l, a, t);}});
          rLyrDB.host = 'http://webservices.lyrdb.com/getlyr.php?q=' + id

          rLyrDB.host = encodeURI(rLyrDB.host);
          rLyrDB.send({url: rLyrDB.host});
     } else {
        whatNext(null);
     }
   } catch(ex) {}
}
var rSuccessLyricsVIP = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<td class="td1">')[1].split('</td>')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h2>')[1].split('</h2>')[0].trim();
         t = html.split('<h1">')[1].split('</h1>')[0].trim();
         l += "<br><br><br>Lyrics provided by: LyricsVIP.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessLyricsSongs = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<h2>')[1].split('<p>')[1].split('</p>')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h2>')[1].split('</h2>')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<h1>')[1].split('</h1>')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: Lyrics-Songs.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessLyricsMode = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split("<div id='songlyrics_h' class='dn'>")[1].split('</div>')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h2 class="h2l">')[1].split('<br>')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<h2 class="h2l">')[1].split('<br>')[1].split('lyrics</h2>')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: lyricsmode.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessMp3Lyrics = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<div id="lyrics_text"')[1].split('">')[1].split('<span id=')[0];
      l += html.split('<span id="findmorespan">Find more similar lyrics on <a href="http://mp3lyrics.com/Lvpi" id="findmorea">http://mp3lyrics.com/Lvpi</a></span>')[1].split('</div>')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('id="ed_artistname">')[1].split('</a>')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<span id="ed_songtitle">')[1].split('</span>')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: mp3lyrics.org<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessSeekALyric = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<div id="contentt" style="FONT-SIZE: 13px;">')[1].split('</div>')[0].split('<span id=')[0];
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h2>')[1].split(' - ')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<h2>')[1].split(' - ')[1].split('Lyrics')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: seekalyric.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessMetroLyrics = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      var lyricLinesLength = html.split("class='line line-s'").length;
      for (var count = 1; count < lyricLinesLength; count++) {
         l += html.split("class='line line-s'")[count].split('</span>')[0].split('>')[1].trim() + "<br>";
      }
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h3 itemprop="name">')[1].split('</h3>')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<h2>')[1].split('Lyrics')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: metrolyrics.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
try {   l = html.replace('Not found', '').replace(/<[^>]*>/g, "").replace(/\n/g, '<br>'); l = cleanupLyrics(l); }   catch(ex) {}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var cleanupLyrics = function(l) {
   if(l.test(/&#93;&#10;/)) l=''; //LyricWikia - Missing due to copyright law.
   if(l.test(/Sorry, but these lyrics are protected by copyright./)) l=''; //LyrDB - Missing due to copyright law.
   if(l.test(/We haven\'t lyrics of this song/)) l=''; //LyrDB - Missing
   
   l = l.replace(/\<br[\s]*[\/]*\>/gi, '<br>'); // Converts all "New Line" to the same
   l = l.replace(/[\s]+/g, ' ');    // Converts all "spaces" to the same
   l = l.replace(/^(<br>|\s)/gi, ''); // Lyrics starts with a "New Line" or Space
   l = l.replace(/\r/g, '');        // End of Line
   l = l.replace(/&nbsp;+/gi, ' '); // HTML Code
   l = l.replace(/&+/gi, 'and'); // HTML Code
   l = l.replace(/(<i>|<\/i>|<b>|<\/b>|<div(.*?)>)+/gi, ''); // HTML Tags
   l = l.replace(/(<img(.*?)>(.*?)>|<a(.*?)>(.*?)<\/a>)+/gi, ''); // Images & Links
   l = l.replace(/<(h1|h2)>(.*?)<\/(h1|h2)> <br>/gi, ''); // For source: AZLyrics
   l = l.replace(/<\/?[^br>]+(>|$)+/gi, ''); // All other HTML tags that isn't <br>

   if(tryCleanupWhitespace) {
      l = l.replace(/\<br\>\<br\>(\<br\>)+/g, '<br><br>');
      l = l.replace(/(\s)*\<br\>/g, '<br>');
      l = l.replace(/\s\s/gi, ' ');
   }
   if(tryRejectSingleLine || trySingleLineSearch) {
      var a = l.split('<br>');
      if(a.length <= 1 || (a.length == 2 && a[1].trim() == '')) {
         if(tryRejectSingleLine) return false;
         if(l.toUpperCase().indexOf(trySingleLineSearch.toUpperCase()) >= 0)
            l = trySingleLineReplace;
      }
   }
   if(l.replace(/<br>/g,'').test(/^[\s]+$/)) l='';
   return l;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var searchSend = function(r, a, t) {
      var s = r.sendString.replace('%artist%', escape(a)).replace('%title%', escape(t));
      var site = r.className
      a = a.replace('&', '%26'); t = t.replace('&', '%26'); // Dirty Dirty hack.....
      var host = r.host.replace('%artist%', a).replace('%title%',t);
      if (site == 'AZLyrics') {
         host = host.replace(/(\s|\&)+/g, '').toLowerCase();
      } else if (site == 'LyricWikia') {
         host = host.replace(/\s+/g, '_');
      } else if (site == 'LyrDB') {
         host = host.replace(/\s+/g, '+');
      } else if (site == 'LyricsVIP' || site == 'MetroLyrics' || site == 'Lyrics') {
         host = host.replace(/\s+/g, '-');
      }
      host = encodeURI(host).replace('%2526', '%26');      
      r.send({url: host, data: s});
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var lyricsPopulate = function(l, a, t) {
   var e = $(tracks[currentTrack]);
   if(l) {
      loading.inject('hidden');
      status.inject('hidden');
      if(currentArtist || currentTitle || currentRequest || aR[currentRequest].name == 'Lyrics Songs') {
         e.addClass(aR[currentRequest].className);
         if(!a) a = aA[currentArtist];
         if(!t) t = aT[currentTitle];
         e.getElement('div[class=artist]').innerHTML += '<br/><i>' + a + '</i>';
         e.getElement('div[class=title]').innerHTML += '<br/><i>' + t + '</i>';
      }
      e.getElement('div[class=lyrics]').innerHTML = l;
      var c = e.getElement('input[type=checkbox]')
      c.checked = true; c.disabled = false;
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var lyricsFailed = function() {
   loading.inject('hidden');
   status.inject('hidden');
   var e = $(tracks[currentTrack]);
   e.getElement('input[type=checkbox]').checked = false;
   e.addClass('disabled');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var reS = new RegExp("[']*", "g");
var reD = new RegExp("[\"]*", "g");
var mapTrim = function(e, i) { return e.trim(); }
var mapQuoteS = function(e, i) { return e.replace(reS, '').trim(); }
var mapQuoteD = function(e, i) { return e.replace(reD, '').trim(); }
var mapParens = function(e, i) { return e.replace(/\(.*?\)/g, '').trim(); }  //  *** TODO ***  What about half?
var mapBrackets = function(e, i) { return e.replace(/\[.*?\]/g, '').trim(); }  //  *** TODO ***  What about half?
var mapBraces = function(e, i) { return e.replace(/\{.*?\}/g, '').trim(); } //  *** TODO ***  What about half?
var mapThe = function(e, i) { return e.replace(/The /gi, '').trim(); } // *** TODO *** What about "and" , / & + - =
var mapFeat = function(e, i) { return e.replace(/ (Ft|Ft.|feat|feat.|featuring) .*/gi, '').trim(); }
var mapDash = function(e, i) { return e.replace(/-(.*?)+/g, '').trim(); }
var mapIncomplete = function(e, i) { return e.replace(/\((.*?)+/g, '').trim(); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var buildBruteForce = function() {
   aA.empty(); aT.empty();

   aA.include(cachedArtist);
   aT.include(cachedTitle);

   var s; var sa;
   if(tryAllArtists) {
      s = cachedArtist.split(';');
      s.each(function(e) { aA.include(e.trim()); });
   }

   if(tryCommaArtists) { aA.include(cachedArtist.replace(/([\w ]+), ([\w ]+)/g, "$2 $1")); } // Code from "datta"

   if(tryTheA) { aA.merge(aA.map(mapThe)); }
   if(tryTheT) { aT.merge(aT.map(mapThe)); }

   if(tryFeatA) { aA.merge(aA.map(mapFeat)); }
   if(tryFeatT) { aT.merge(aT.map(mapFeat)); }

   if(tryFeatT) { aT.merge(aT.map(mapDash)); }
   if(tryFeatT) { aT.merge(aT.map(mapIncomplete)); }

   if(tryParensA) aA.merge(aA.map(mapParens));      if(tryParensT) aT.merge(aT.map(mapParens));
   if(tryBracketsA) aA.merge(aA.map(mapBrackets));  if(tryBracketsT) aT.merge(aT.map(mapBrackets));
   if(tryBracesA) aA.merge(aA.map(mapBraces));      if(tryBracesT) aT.merge(aT.map(mapBraces));

   if(trySplitArrayA) { sa = trySplitArrayA.split(';'); sa.each(function(e) { aA.each(function(e2) { aA.merge(e2.split(e).map(mapTrim)); }); }); }
   if(trySplitArrayT) { sa = trySplitArrayT.split(';'); sa.each(function(e) { aT.each(function(e2) { aT.merge(e2.split(e).map(mapTrim)); }); }); }

   if(tryBlackListA) { sa = tryBlackListA.split(';'); sa.each(function(e) { aA.remove(e); }); }
   if(tryBlackListT) { sa = tryBlackListT.split(';'); sa.each(function(e) { aT.remove(e); }); }

   if(tryAllArtists) {
      aA.include('Various');
   }

   aA = aA.clean();
   aT = aT.clean();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var cache = function() {
   var c = $(tracks[currentTrack]);
   if(c) {
      cachedArtist = c.getElement('div[class=artist]').innerText;
      cachedTitle = c.getElement('div[class=title]').innerText;
      cachedTrack = c;
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var newTrack = function() {
   currentArtist = currentTitle = currentRequest = 0;
   cache();
   if(cachedTrack) loading.inject(cachedTrack.getElement('div[class=lyrics]'));
   if(currentTrack < tracks.length) {
      $('GlobalStatus').innerHTML = 'Processing Track #' + (currentTrack + 1) + '/' + tracks.length;
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var pauseL, pauseA, pauseT;
var whatNext = function(l, foundA, foundT, init) {
   if(paused) {
      pauseL = l;
      pauseA = foundA;
      pauseT = foundT;
      $('PauseButton').disabled = false;
      $('PauseButton').innerHTML = 'Resume';
      return false;
   }
   var a; var t;
   if(init) {
      currentTrack = 0;   newTrack();
      a = cachedArtist; t = cachedTitle;
   } else if (l) {
      lyricsPopulate(l, foundA, foundT);
      currentTrack++;  foundTracks++;  newTrack();
      a = cachedArtist; t = cachedTitle;
      $('GlobalStats').innerHTML = 'Found: ' + (foundTracks) + ' lyrics (' + ((foundTracks / tracks.length) * 100).toFixed(1) +'%)';
   } else {
      var failed = false;
      if(bruteForce) {
         if(!currentArtist && !currentTitle && !currentRequest) {
            buildBruteForce();
            if(cachedTrack) status.inject(cachedTrack.getElement('div[class=lyrics]'));
         }
         if(currentRequest < aR.length - 1) {
            currentRequest++;
         } else {
            currentRequest = 0;
            if(currentTitle < aT.length - 1) {
               currentTitle++;
            } else {
               currentTitle = 0; currentArtist++;
            }
         }
         if(currentArtist >= aA.length) {
            failed = true;
         } else {
            a = aA[currentArtist]; t = aT[currentTitle];
         }
      } else {
         failed = true;
      }
      if(failed) {
         lyricsFailed();
         currentTrack++; newTrack();
         a = cachedArtist; t = cachedTitle;
      } else {
         status.innerHTML = 'Trying ' + a + ' - ' + t;
      }
   }
   if(currentTrack < tracks.length) {
      cachedTrack.scrollIntoView(false);
      (function() {searchSend(aR[currentRequest], a, t)}).delay(10);
      $('GlobalHost').innerHTML = 'Searching: <span class="text' + aR[currentRequest].className + '">' + aR[currentRequest].name +  '</span>';
   } else {
      loading.remove();
      status.remove();
      $('PauseButton').disabled = true;
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var currentPopup = -1;
var closeLyrics = function() {
   currentPopup = -1;
   var p = $('Popup');
   var pl = $('PopupLyrics');
   pl.value = '';
   p.style.visibility = 'hidden';
   return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var updateLyrics = function() {
   var p = $('Popup');
   var pl = $('PopupLyrics');
   var l = pl.value.replace(/\r/g, '<br>');
   $(currentPopup).getElement('div[class=lyrics]').innerHTML = cleanupLyrics(l);
   closeLyrics();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var trackContextMenu = function() {
   currentPopup = this.id;
   var l = this.getElement('div[class=lyrics]');
   var p = $('Popup');
   var pl = $('PopupLyrics');
   pl.value = l.innerHTML.replace(/\<br\>/gi, '\n');
   p.style.visibility = 'visible';
   p.style.top = document.body.scrollTop;
   return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var trackClick = function() {
   var c = this.getElement('input[type=checkbox]');
   if(!c.disabled)   c.checked = !c.checked;
   if(!c.checked) this.addClass('unchecked'); else this.removeClass('unchecked');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var pause = function() {
   var p = $('PauseButton');
   if(p.innerHTML == 'Pause') {
      p.disabled = true;
      p.innerHTML = 'Pausing ...';
      paused = true;
      loading.inject('hidden');
      status.inject('hidden');
   } else {
      paused = false;
      p.innerHTML = 'Pause';
      whatNext(pauseL, pauseA, pauseT);
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var trackOver = function() { this.style.backgroundColor = '#fffff0'; }
var trackOut = function() { this.style.backgroundColor = ''; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
window.addEvent('domready', init);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var test = function() {
   currentTrack = -1;
   whatNext(null, null, null, true);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var debug = function(t) {
   if(bDebug) $('Debug').innerHTML += currentTrack + '|' + t + '<br />';
}
Last edited by thehammer on Sat Jan 04, 2014 12:38 pm, edited 6 times in total.
ImageSpoon!
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Updated script to include more lyrics sites

Post by thehammer »

Nearly forgot to include the lyricator.css changes as well to support the new lyrics site colors.

Code: Select all

body { overflow: hidden; background-color: #fafafa;}
div { font-family: arial; font-size: 8pt; }
.checkbox, .artist, .title, .lyrics, .Saved { height: 32px; float: left; overflow: hidden; white-space: nowrap; padding: 2px; }
.checkbox { width: 24px; border-right: 1px solid silver; }
.trackindex { display: none }
.artist { width: 100px; border-right: 1px solid silver; }
.title { width: 200px; border-right: 1px solid silver; }
.lyrics, .Saved { width: 400px; }
.track {	height: 32px; white-space: nowrap; clear: both; width: 100%; border-top: 1px solid silver; color: #333; cursor: pointer; }
.disabled { color: #666 !important; background-color: #eee !important; }
.unchecked { color: #333 !important; background-color: #fdfdfd !important; }
.AZLyrics { background-color: #facac3; color: #000000; }     /* Light Red */
.textAZLyrics {  color: #facac3; font-weight: bold;  }
.LyricWikia { background-color: #808000; color: #000000; }   /* Olive */
.textLyricWikia { color: #808000; font-weight: bold;  }
.LyrDB { background-color: #af907f; color: #000000; }        /* Light Brown */
.textLyrDB { color: #af907f; font-weight: bold; }
/* .ChartLyrics{ background-color: #6495ED; color: #000000; }  CornflowerBlue
.textChartLyrics { color: #6495ED; font-weight: bold;  } */
.LyricsVIP { background-color: #0000FF; color: #FFFFFF; }    /* Blue */
.textLyricsVIP { color: #0000FF; font-weight: bold; }
.LyricsSongs { background-color: #bfbfd7; color: #000000; }  /* Light Purple */
.textLyricsSongs { color: #bfbfd7; font-weight: bold; }
.LyricsMode { background-color: #bfbf00; color: #000000; }  /* light green */
.textLyricsMode { color: #bfbf00; font-weight: bold; }
.Mp3Lyrics { background-color: #6495ED; color: #000000; }  /* Cornflower Blue */
.textMp3Lyrics { color: #6495ED; font-weight: bold; }
.SeekALyric { background-color: green; color: #000000; }  /* green */
.textSeekALyric { color: green; font-weight: bold; }
.MetroLyrics { background-color: #FFA500; color: #000000; }  /* yellow */
.textMetroLyrics { color: #FFA500; font-weight: bold; }
.Saved { background-color: 	#00FF00; color: #000000; }       /* Green */
#Hidden { display: none; }
#Data { white-space: nowrap; border-bottom: 1px solid silver; border-left: 1px solid silver; background-color: #fff; }
#DataScroll { width: 100%; height: 90%; overflow: hidden; overflow-y: scroll; }
#Status { font-family: arial; font-size: 8pt; }
i { font-weight: bold; }
#Popup { position: absolute; visibility: hidden; margin-top: 10px; z-index: 1000; padding: 0px; background-color: #fff; border: 1px solid silver; text-align: center; }
#Popup button { margin: 4px; width: 120px; }
#Popup textarea { height: 480px; width: 100%; padding: 4px; background-color: #333; color: #ccc; border-width: 0px; }
#Header { height: 40px; }
#PauseButton { width: 100px; height: 22px; float: left; }
#GlobalStatus { font-family: verdana; font-size: 10pt; color: #333; width: 100%; text-align: right; }
#GlobalStats { font-family: arial; font-size: 8pt; width: 135px; height: 22px; float: right; text-align: left; }
#GlobalHost { font-family: arial; font-size: 8pt; width: 135px; height: 22px; float: right; text-align: left; }
#Legend { float:left; font-family: arial; font-size: 8pt; }
#Debug { position: absolute; top: 300px; background-color: white; height: 200px; overflow-y: scroll; }
Last edited by thehammer on Wed Jan 01, 2014 10:02 pm, edited 2 times in total.
ImageSpoon!
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Updated script to include more lyrics sites

Post by thehammer »

Sorry, but i forgot to include the lyricator.vbs file changes to update the options to turn the sites on/off.

Code: Select all

Option Explicit
Dim sVersion : sVersion = "1.1.1.32"
' 1.1.1.32 (2013-03-28)
' - Add: lyricsmode.com, lyrics.com, seekalyric.com, metrolyrics.com as sources
' 1.1.1.31 (2010-12-16)
' - Add: AZLyrics.com and LyrDB.com as sources
' - Add: Option to remove "The" and "Ft,Ft.,feat,feat.,featuring" from artist and/or title.
' - Add: Toolbar icon
' - Add: "Legend" on output window
' - Add: "Lyric sources" to output window
' - Add: "Lyric stats" to output window
' - Add: "Lyrics provided by" to lyrics
' - Add: "Time out" feature
' - Add: "Update" feature (Tools -> Extension -> Find Updates)
' - Add: colour coding of sites in results
' - Fix: LyricWikia.org (now Lyric.wikia.com) & Lyrics-songs.com (now Letras.Terra.com.br)sources
' - Fix: "Duplicate Artist Search" bug
' - Fix: "Percent Sign/Ampersand in ID3" bug
' - Fix: "Source Selection" bug
' - Update: Enabled "multi domain searching" again
' - Update: Move a few things about in options
' - Update: Replaced LyricsPlugin with LyricsVIP.com (Cuts out "the middle man")
' - Update: Tweaked the log file and the internal workings
' - Update: Lyric text cleanup

' 1.1.0.025 (2010-09-13)
' - Fix "No lyrics" issues

' 1.1.0.024 (2010-09-12)
' - Added message about restarting MediaMonkey after installing the plug-in
' - Removed all "<a href>" tags from results

' 1.1.0.023 (2010-08-20)
' - Fix for loading gif

' 1.1.0.022 (2010-08-16)
' - Fix for "lyricsplugin" issue.

' 1.1.0.0 (??)
' - Fixes for duplicate lyrics?
' - Add setting for logging?
' - Need deep level inspect/trace for duplicate lyrics problem.

' 1.1.0.021(2010-05-18)
' - Add test & log for non-library tracks

' 1.0.9.020(2010-04-23)
' - Add log for TEMP amd APP
' - Fix problem when temp and application on different drives
' - Cleanup "New Array()" -> array literals

' 1.0.8.018(2010-04-17) (Released 2010-04-17)
' - Remove all commented out code
' - Major cleanup and JSLint of lyricator.js. Should be no functional change.
' -- This clears all basic JSlint warnings with the exception of implied globals (moo & html passed)
' -- Break multi-statement lines
' -- "if(" -> "if ("
' -- "function(" -> "function ("
' -- ; terminate all statements
' -- Fix multiple regexp "\<br" -> "<br"
' -- "new Array()" -> "[]"
' -- Fix all use before define cases
' -- Comment out unused variable in lyricsPopulate
' - Fix bug chars < 128 not escaped
' - Checkpoint and test to confirm still working

' 1.0.7.15 (2010-04-16)
' - Make .trackindex hidden (lyricator.css)
' - Fix encoding of extended ascii (lyricator.js)

' 1.0.6.14(2010-04-09)
' - Move html file to %TEMP%\Lyricator.htm
' - Consolidate 1.0.5 change register
' - Minor fix to lyricator.css

' 1.0.5.013(2010-04-08)
' - Move log file to temp
' - Add double check of track index on save
' - Remove track index from display but leave in html for double check (lyricator.css)

' 1.0.4.011 (2010-04-05)
' - Fixed bug in build 10
' - Change lyricsPopulate trace to log
' - Add div trackindex in lyricator.vbs and lyricator.css, adjust onSave element index.
' - Add trace to lyricator.js
' - Set trace off by default

' 1.0.3.008(2010-03-31) (Released 2010-04-03)
' - Consolidate 1.0.2 change register
' - Remove unneeded commented out alerts from lyricator.js
' - Add missing ; in js log function
' - Remove context menu action

' 1.0.2.007(2010-03-28)
' - Merge changes for context menu action
' - Fix total number of tracks in saving progress bar
' - Comment out unused code re. other sources in Lyricator.js
' - Add support for Lyricator.log.
' - Add this modification register
' - Handle no tracks selected

' 1.0.1.002(2010-03-24)
' - Rewrite Uft8.encode in Lyricator.js
' - Remove all sources except LyricsPlugin

' 1.0.0.001(2010-03-22)
' - Fix temp.html open mode. Needs format Unicode.
' - Add Utf8.encode to Lyricator.js

Dim sPath : sPath = sdb.ApplicationPath & "Scripts\Auto\lyricator.vbs"
'Dim sHTML : sHTML = sdb.ApplicationPath & "Scripts\Lyricator\temp.html"
Dim sHTML : sHTML = sdb.TemporaryFolder & "Lyricator.htm"
'Dim sAppPath: sAppPath = Replace(Mid(sdb.ApplicationPath,3) & "Scripts\Lyricator\", "\", "\\")
'Dim sAppPath: sAppPath = Mid(sdb.ApplicationPath,3) & "Scripts\Lyricator\"
Dim sAppPath: sAppPath = sdb.ApplicationPath & "Scripts\Lyricator\"
Dim sLyrMOO : sLyrMOO = sAppPath & "moo.js"
Dim sLyrJS : sLyrJS = sAppPath & "lyricator.js"
Dim sLyrCSS : sLyrCSS = sAppPath & "lyricator.css"
Dim sLoad : sLoad = sAppPath & "loading.gif"
Dim sLOG : sLOG = sdb.ApplicationPath & "Scripts\Lyricator\" & "Lyricator.log"

Const mmAnchorRight = 4
Const mmAnchorBottom = 8
Const mmAlignTop = 1
Const mmAlignBottom = 2
Const mmAlignClient = 5
Const mmListDropdown = 2
Const mmFormScreenCenter = 4

' Initialize for fso, html & log
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim fLog
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Destroy
   SDB.Objects("LyricatorForm") = Nothing
   SDB.Objects("LyricatorWB") = Nothing
   SDB.Objects("LyricatorTracks") = Nothing
   SDB.Objects("LyricatorStatus") = Nothing

   If fso.FileExists(sHTML) Then
      fso.DeleteFile(sHTML)
   End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnSave(Btn)
   log("")
   log("Saving")
   Btn.Caption = SDB.Localize("Saving ...")
   Btn.Common.Enabled = False

   Dim ini : Set ini = SDB.IniFile
   Dim TryAutoClose : TryAutoClose = ini.BoolValue("Lyricator", "TryAutoClose")
   Dim ToolbarIcon : ToolbarIcon = ini.BoolValue("Lyricator", "ToolbarIcon")

   Dim doc : Set doc = SDB.Objects("LyricatorWB").Interf.Document
   Dim tracks: Set tracks = SDB.Objects("LyricatorTracks")
   Dim status : Set status = SDB.Objects("LyricatorStatus")

   Dim cnt : cnt = 0

   Dim interval : interval = 1
   If tracks.count > 10000 Then
      interval = 100
   ElseIf tracks.count > 1000 Then
      interval = 25
   ElseIf tracks.count > 100 Then
      interval = 10
   End If

   Dim i
   For i = 0 to tracks.count - 1
      'Keep GUI responsive
       SDB.ProcessMessages

      'Update progress bar
       If (i + 1) Mod interval = 0 Then
          status.Caption = SDB.Localize("Writing " & (i+1) & "/" & (tracks.count) & " ...")
       End If

       Dim t : Set t = doc.getElementById(tracks.Item(i).ID)
       Dim d : Set d = t.getElementsByTagName("div")
       Dim c : Set c = d(0).getElementsByTagName("input")(0)
       Dim ti: ti = d(1).innerHTML

       If clng(ti) = i Then
          If c.checked Then
             cnt = cnt + 1
             Dim l : l = Replace(d(4).innerHTML, "<BR>", vbNewLine)
             l = Replace(l, "<BR/>", vbNewLine)
             l = Replace(l, "<BR />", vbNewLine)
             tracks.Item(i).Lyrics = l
             tracks.Item(i).UpdateDB
             tracks.Item(i).WriteTags
             t.innerHTML = Replace(t.innerHTML, "<DIV class=lyrics>", "<div class=Saved>")
             log("Saved Track[" & i & "] ID[" & tracks.Item(i).ID & "] Lyric[" & Left(l, 60) &"]")
          End If
       Else
          log("Save Aborted Track[" & i & "] ID[" & tracks.Item(i).ID & "] Index[" & ti & "]")
       End If
   Next

   log("Finished")

   status.Caption = cnt & " Lyrics Saved"

   If TryAutoClose Then
      Destroy
   End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnCancel(Btn)
   Destroy
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnAbort(Btn)
   log("")
   log("Abort")
   SDB.Objects("LyricatorWB") = Nothing

   Btn.Caption = SDB.Localize("C&lose")
   Btn.OnClickFunc = "OnCancel"
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub log(sText)
   ' Open log for append, create if needed, unicode
   Set fLog = fso.OpenTextFile(sLOG, 8, true, -1)
   fLog.WriteLine sText
   fLog.Close
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Lyricator()
   If fso.FileExists(sLOG) Then    ' Remove log if needed
      fso.DeleteFile(sLOG)
   End If
   log("Lyricator v" & sVersion & " started")
   log("Log: " & sLOG)
   log("App: " & sAppPath)

   Dim ini : Set ini = SDB.IniFile
   Dim UI : Set UI = SDB.UI

   Dim TryAllArtists : TryAllArtists = ini.BoolValue("Lyricator", "TryAllArtists")
   Dim TryCommaArtists : TryCommaArtists = ini.BoolValue("Lyricator", "TryCommaArtists")
   Dim TryCleanupWhiteSpace : TryCleanupWhiteSpace = ini.BoolValue("Lyricator", "TryCleanupWhiteSpace")
   Dim TryRejectSingleLine : TryRejectSingleLine = ini.BoolValue("Lyricator", "TryRejectSingleLine")

   Dim TrySingleLineSearch : TrySingleLineSearch = ini.StringValue("Lyricator", "TrySingleLineSearch")
   Dim TrySingleLineReplace : TrySingleLineReplace = ini.StringValue("Lyricator", "TrySingleLineReplace")

   Dim TryParensA : TryParensA = ini.BoolValue("Lyricator", "TryParensA")
   Dim TryBracketsA : TryBracketsA = ini.BoolValue("Lyricator", "TryBracketsA")
   Dim TryBracesA : TryBracesA = ini.BoolValue("Lyricator", "TryBracesA")
   Dim TryQuotesA : TryQuotesA = ini.BoolValue("Lyricator", "TryQuotesA")
   Dim TryTheA : TryTheA = ini.BoolValue("Lyricator", "TryTheA")
   Dim TryFeatA : TryFeatA = ini.BoolValue("Lyricator", "TryFeatA")
   Dim TrySplitArrayA : TrySplitArrayA = ini.StringValue("Lyricator", "TrySplitArrayA")
   Dim TryBlackListA : TryBlackListA = ini.StringValue("Lyricator", "TryBlackListA")

   Dim TryParensT : TryParensT = ini.BoolValue("Lyricator", "TryParensT")
   Dim TryBracketsT : TryBracketsT = ini.BoolValue("Lyricator", "TryBracketsT")
   Dim TryBracesT : TryBracesT = ini.BoolValue("Lyricator", "TryBracesT")
   Dim TryQuotesT : TryQuotesT = ini.BoolValue("Lyricator", "TryQuotesT")
   Dim TryTheT : TryTheT = ini.BoolValue("Lyricator", "TryTheT")
   Dim TryFeatT : TryFeatT = ini.BoolValue("Lyricator", "TryFeatT")
   Dim TrySplitArrayT : TrySplitArrayT = ini.StringValue("Lyricator", "TrySplitArrayT")
   Dim TryBlackListT : TryBlackListT = ini.StringValue("Lyricator", "TryBlackListT")

   Dim tryAZLyrics : tryAZLyrics = ini.BoolValue("Lyricator", "tryAZLyrics")
   Dim tryLyricWikia : tryLyricWikia = ini.BoolValue("Lyricator", "tryLyricWikia")
   Dim tryLyrDB : tryLyrDB = ini.BoolValue("Lyricator", "tryLyrDB")
   Dim tryLyricsVIP : tryLyricsVIP = ini.BoolValue("Lyricator", "tryLyricsVIP")
   Dim tryLyricsSong : tryLyricsSong = ini.BoolValue("Lyricator", "tryLyricsSong")
   Dim tryLyricsMode : tryLyricsMode = ini.BoolValue("Lyricator", "tryLyricsMode")
   Dim tryMp3Lyrics : tryMp3Lyrics = ini.BoolValue("Lyricator", "tryMp3Lyrics")
   Dim trySeekALyric : trySeekALyric = ini.BoolValue("Lyricator", "trySeekALyric")
   Dim tryMetroLyrics : tryMetroLyrics = ini.BoolValue("Lyricator", "tryMetroLyrics")
   Dim ToolbarIcon : ToolbarIcon = ini.BoolValue("Lyricator", "ToolbarIcon")

   Dim TryAutoClose : TryAutoClose = ini.BoolValue("Lyricator", "TryAutoClose")

   Dim FormWidth : FormWidth = 800
   Dim FormHeight : FormHeight = 600

   Dim frmMain : Set frmMain = UI.NewForm
   frmMain.Common.SetRect 50, 50, FormWidth, FormHeight
   frmMain.Common.MinWidth = 200
   frmMain.Common.MinHeight = 150
   frmMain.FormPosition = mmFormScreenCenter
   frmMain.Caption = SDB.Localize("Lyricator")
   frmMain.StayOnTop = True
   frmMain.Common.Visible = True

   Dim WB : Set WB = UI.NewActiveX(frmMain, "Shell.Explorer")
   WB.Common.Align = mmAlignClient
   WB.Common.ControlName = "WB"

   WB.Interf.Navigate(sLoad)

   Dim pnlFooter : Set pnlFooter = UI.NewPanel(frmMain)
   pnlFooter.Common.Align = mmAlignBottom
   pnlFooter.Common.Height = 37

   Dim lblStatus : Set lblStatus = UI.NewLabel(pnlFooter)
   lblStatus.Caption = ""
   lblStatus.Common.SetRect FormWidth - 450, 16, 120, 25
   lblStatus.Common.Anchors = mmAnchorRight + mmAnchorBottom

   Dim btnSave : Set btnSave = UI.NewButton(pnlFooter)
   btnSave.Caption = SDB.Localize("&Save")
   btnSave.Common.SetRect FormWidth - 280, 6, 120, 25
   btnSave.Common.Anchors = mmAnchorRight + mmAnchorBottom
   btnSave.UseScript = sPath
   btnSave.OnClickFunc = "OnSave"
   btnSave.Default = true

   Dim btnCancel : Set btnCancel = UI.NewButton(pnlFooter)
   btnCancel.Caption = SDB.Localize("C&lose")
   btnCancel.Common.SetRect FormWidth - 150, 6, 120, 25
   btnCancel.Common.Anchors = mmAnchorRight + mmAnchorBottom
   btnCancel.UseScript = sPath
   btnCancel.OnClickFunc = "OnCancel"
   btnCancel.Cancel = true

   btnSave.Caption = SDB.Localize("Loading ...")
   btnSave.Common.Enabled = False
   btnCancel.Caption = SDB.Localize("Abort")
   btnCancel.OnClickFunc = "OnAbort"

   SDB.Objects("LyricatorStatus") = lblStatus
   SDB.Objects("LyricatorForm") = frmMain
   SDB.Objects("LyricatorWB") = WB

   Dim tracks : Set tracks = SDB.SelectedSongList

   Dim html : html = ""

   html = html & "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"
   html = html & "<html>"
   html = html & "	<head>"
   html = html & "		<script type=""text/javascript"" src=""" & sLyrMOO & """></script>"
   html = html & "		<script type=""text/javascript"" src=""" & sLyrJS & """></script>"
   html = html & "		<link type=""text/css"" rel=""stylesheet"" href=""" & sLyrCSS & """ />"

   html = html & "<script type=""text/javascript"">"
   log("Settings:")
   If TryAllArtists Then
      html = html & "tryAllArtists = true;"
      log("tryAllArtists")
   End If
   If TryCommaArtists Then
      html = html & "tryCommaArtists = true;"
      log("tryCommaArtists")
   End If
   If TryCleanupWhiteSpace Then
      html = html & "tryCleanupWhiteSpace = true;"
      log("tryCleanupWhiteSpace")
   End If
   If TryRejectSingleLine Then
      html = html & "tryRejectSingleLine = true;"
      log("tryRejectSingleLine")
   End If

   If TrySingleLineSearch <> "" Then
      html = html & "trySingleLineSearch = '" & TrySingleLineSearch & "';"
      log("trySingleLineSearch = '" & TrySingleLineSearch & "'")
   End If
   If TrySingleLineReplace <> "" Then
      html = html & "trySingleLineReplace = '" & TrySingleLineReplace & "';"
      log("trySingleLineReplace = '" & TrySingleLineReplace & "'" )
   End If

   If TryParensA Then
      html = html & "tryParensA = true;"
      log("tryParensA")
   End If
   If TryBracketsA Then
      html = html & "tryBracketsA = true;"
      log("tryBracketsA")
   End If
   If TryBracesA Then
      html = html & "tryBracesA = true;"
      log("tryBracesA")
   End If
   If TryQuotesA Then
      html = html & "tryQuotesA = true;"
      log("tryQuotesA")
   End If
   If TryTheA Then
      html = html & "tryTheA = true;"
      log("tryTheA")
   End If
   If TryFeatA Then
      html = html & "tryFeatA = true;"
      log("tryFeatA")
   End If
   If TrySplitArrayA <> "" Then
      html = html & "trySplitArrayA = '" & TrySplitArrayA & "';"
      log("trySplitArrayA = '" & TrySplitArrayA & "'")
   End If
   If TryBlackListA <> "" Then
      html = html & "tryBlackListA = '" & TryBlackListA & "';"
      log("tryBlackListA = '" & TryBlackListA & "'")
   End If

   If TryParensT Then
      html = html & "tryParensT = true;"
      log("tryParensT")
   End If
   If TryBracketsT Then
      html = html & "tryBracketsT = true;"
      log("tryBracketsT")
   End If
   If TryBracesT Then
      html = html & "tryBracesT = true;"
      log("tryBracesT")
   End If
   If TryQuotesT Then
      html = html & "tryQuotesT = true;"
      log("tryQuotesT")
   End If
   If TryTheT Then
      html = html & "tryTheT = true;"
      log("tryTheT")
   End If
   If TryFeatT Then
      html = html & "tryFeatT = true;"
      log("tryFeatT")
   End If
   If TrySplitArrayT <> "" Then
      html = html & "trySplitArrayT = '" & TrySplitArrayT & "';"
      log("trySplitArrayT = '" & TrySplitArrayT & "'")
   End If
   If TryBlackListT <> "" Then
      html = html & "tryBlackListT = '" & TryBlackListT & "';"
      log("tryBlackListT = '" & TryBlackListT & "'")
   End If

   If tryAZLyrics Then
      html = html & "tryAZLyrics = true;"
      log("tryAZLyrics")
   End If
   If tryLyricWikia Then
      html = html & "tryLyricWikia = true;"
      log("tryLyricWikia")
   End If
   If tryLyrDB Then
      html = html & "tryLyrDB = true;"
      log("tryLyrDB")
   End If
   If tryLyricsVIP Then
      html = html & "tryLyricsVIP = true;"
      log("tryLyricsVIP")
   End If
   If tryLyricsSong Then
      html = html & "tryLyricsSong = true;"
      log("tryLyricsSong")
   End If
   If tryLyricsMode Then
      html = html & "tryLyricsMode = true;"
      log("tryLyricsMode")
   End If
   If tryMp3Lyrics Then
      html = html & "tryMp3Lyrics = true;"
      log("tryMp3Lyrics")
   End If
   If trySeekALyric Then
      html = html & "trySeekALyric = true;"
      log("trySeekALyric")
   End If
   If tryMetroLyrics Then
      html = html & "tryMetroLyrics = true;"
      log("tryMetroLyrics")
   End If

   html = html & "lyricatorLog ='" & Replace(sLog,"\","\\") & "';"
   html = html & "loadinggif ='" & Replace(sLoad,"\","\\") & "';"
   log("")

   html = html & "</script>"
   html = html & "	</head>"
   html = html & "	<body>"
   html = html & "	<div id=""Header""><div id=""Legend""></div></div>"
   html = html & "	<div id=""Popup""></div>"
   html = html & "	<div id=""Hidden""></div>"
   html = html & "	<div id=""Status""></div>"
   html = html & " <div id=""DataScroll"">"
   html = html & " <div id=""Data"">"

   Dim abort : abort = false
   Dim interval : interval = 1
   log(tracks.count & " Tracks Selected")
   If tracks.count > 10000 Then
      interval = 100
   ElseIf tracks.count > 1000 Then
      interval = 25
   ElseIf tracks.count > 100 Then
      interval = 10
   ElseIf tracks.count = 0 Then
      Debug "No Tracks selected"
      log("No Tracks selected")
      Destroy
      Exit Sub
   End If

   Dim status : Set status = SDB.Objects("LyricatorStatus")

   Dim i
   Dim i2: i2 = 0
   For i = 0 to tracks.count - 1
      SDB.ProcessMessages
      If SDB.Objects("LyricatorWB") is nothing Then
         abort = true
         Exit For
      End If

      If (i + 1) Mod interval = 0 Then
         status.Caption = SDB.Localize("Loading " & (i+1) & "/" & (tracks.count) & " ...")
      End If

      With tracks.item(i)
         If .ID <> -1 Then
            i2 = i2 + 1
            html = html & "<div id=""" & .ID & """ class=""track"">"
            html = html & "<div class=""checkbox""><input type=""checkbox"" disabled=""true"" /></div>"
            html = html & "<div class=""trackindex"">" & i & "</div>"
            html = html & "<div class=""artist"">" & .ArtistName
            If TryAllArtists Then
               If .Conductor <> "" And .Conductor <> .ArtistName Then html = html & ";" & .Conductor End If
               If .InvolvedPeople <> "" And .InvolvedPeople <> .ArtistName Then html = html & ";" & .InvolvedPeople End If
               If .Lyricist <> ""  And .Lyricist <> .ArtistName Then html = html & ";" & .Lyricist End If
               If .MusicComposer <> "" And .MusicComposer <> .ArtistName Then html = html & ";" & .MusicComposer End If
               If .OriginalArtist <> "" And .OriginalArtist <>.ArtistName Then html = html & ";" & .OriginalArtist End If
               If .OriginalLyricist <> "" And .OriginalLyricist <> .ArtistName Then html = html & ";" & .OriginalLyricist End If
            End If
            html = html & "</div>"
            html = html & "<div class=""title"">" & .Title & "</div>"
            html = html & "<div class=""lyrics""></div>"
            html = html & "</div>"
            log("i[" & i & "] ID[" & .ID & "] A[" & .ArtistName & "] T[" & .Title & "]")
         Else
            log("Error i[" & i & "] ID[" & .ID & "] A[" & .ArtistName & "] T[" & .Title & "]")
         End If
      End With
   Next
   html = html & " </div>"
   html = html & " </div>"
   html = html & "	</body>"
   html = html & "</html>"

   status.Caption = ""
   SDB.ProcessMessages
   SDB.Objects("LyricatorTracks") = tracks

   html = Replace(html, ChrW(-257), "")

   if i2 = 0 Then
      log("No library tracks to process")
      abort = true
   End If

   If abort Then
      log("Lyricator aborted")
      Destroy
   Else
      log("Starting temp.html")

      Dim f : Set f = fso.OpenTextFile(sHTML, 2, true, -1) 'Owyn - Needs to be opened for Unicode
      f.WriteLine html
      f.close
      Set f = Nothing
      Set fLog = Nothing

      btnSave.Caption = SDB.Localize("&Save")
      btnSave.Common.Enabled = True

      btnCancel.Caption = SDB.Localize("C&lose")
      btnCancel.OnClickFunc = "OnCancel"

      WB.Interf.Navigate(sHTML)
   End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function INIDefault(v, d)
   If v = "" Or v = "False" Then
   Debug v
      v = d
   End If
   INIDefault = v
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function Debug(s)
   Call SDB.MessageBox(s, mtInformation, Array(mbOk))
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnStartUp
   Dim i : i = SDB.UI.AddOptionSheet("Lyricator", Script.ScriptPath, "InitSheet", "SaveSheet", -3)
   Dim but : Set but = SDB.Objects("LyricatorIcon")
   If (but Is Nothing) Then
      Set but = SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard,0,0)
      but.Caption = "Lyricator"
      but.IconIndex = SDB.RegisterIcon("Scripts\Lyricator\App.ico",0)
      but.UseScript = Script.ScriptPath
      but.OnClickFunc = "Toolbar"
      Set SDB.Objects("LyricatorIcon") = but
   End If
   Dim ini : Set ini = SDB.IniFile
   but.Visible = ini.BoolValue("Lyricator","ToolbarIcon")
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Toolbar(but)
  Call Lyricator()
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub InitSheet(Sheet)
   Dim UI : Set UI = SDB.UI
   Dim ini : Set ini = SDB.IniFile

   Dim TryAllArtists : TryAllArtists = ini.BoolValue("Lyricator", "TryAllArtists")
   Dim TryCommaArtists : TryCommaArtists = ini.BoolValue("Lyricator", "TryCommaArtists")
   Dim TryCleanupWhiteSpace : TryCleanupWhiteSpace = ini.BoolValue("Lyricator", "TryCleanupWhiteSpace")
   Dim TryRejectSingleLine : TryRejectSingleLine = ini.BoolValue("Lyricator", "TryRejectSingleLine")

   Dim TrySingleLineSearch : TrySingleLineSearch = ini.StringValue("Lyricator", "TrySingleLineSearch")
   Dim TrySingleLineReplace : TrySingleLineReplace = ini.StringValue("Lyricator", "TrySingleLineReplace")

   Dim TryParensA : TryParensA = ini.BoolValue("Lyricator", "TryParensA")
   Dim TryBracketsA : TryBracketsA = ini.BoolValue("Lyricator", "TryBracketsA")
   Dim TryBracesA : TryBracesA = ini.BoolValue("Lyricator", "TryBracesA")
   Dim TryQuotesA : TryQuotesA = ini.BoolValue("Lyricator", "TryQuotesA")
   Dim TryTheA : TryTheA = ini.BoolValue("Lyricator", "TryTheA")
   Dim TryFeatA : TryFeatA = ini.BoolValue("Lyricator", "TryFeatA")
   Dim TrySplitArrayA : TrySplitArrayA = ini.StringValue("Lyricator", "TrySplitArrayA")
   Dim TryBlackListA : TryBlackListA = ini.StringValue("Lyricator", "TryBlackListA")

   Dim TryParensT : TryParensT = ini.BoolValue("Lyricator", "TryParensT")
   Dim TryBracketsT : TryBracketsT = ini.BoolValue("Lyricator", "TryBracketsT")
   Dim TryBracesT : TryBracesT = ini.BoolValue("Lyricator", "TryBracesT")
   Dim TryQuotesT : TryQuotesT = ini.BoolValue("Lyricator", "TryQuotesT")
   Dim TryTheT : TryTheT = ini.BoolValue("Lyricator", "TryTheT")
   Dim TryFeatT : TryFeatT = ini.BoolValue("Lyricator", "TryFeatT")
   Dim TrySplitArrayT : TrySplitArrayT = ini.StringValue("Lyricator", "TrySplitArrayT")
   Dim TryBlackListT : TryBlackListT = ini.StringValue("Lyricator", "TryBlackListT")

   Dim tryAZLyrics : tryAZLyrics = ini.BoolValue("Lyricator", "tryAZLyrics")
   Dim tryLyricWikia : tryLyricWikia = ini.BoolValue("Lyricator", "tryLyricWikia")
   Dim tryLyrDB : tryLyrDB = ini.BoolValue("Lyricator", "tryLyrDB")
   Dim tryLyricsVIP : tryLyricsVIP = ini.BoolValue("Lyricator", "tryLyricsVIP")
   Dim tryLyricsSong : tryLyricsSong = ini.BoolValue("Lyricator", "tryLyricsSong")
   Dim tryLyricsMode : tryLyricsMode = ini.BoolValue("Lyricator", "tryLyricsMode")
   Dim tryMp3Lyrics : tryMp3Lyrics = ini.BoolValue("Lyricator", "tryMp3Lyrics")
   Dim trySeekALyric : trySeekALyric = ini.BoolValue("Lyricator", "trySeekALyric")
   Dim tryMetroLyrics : tryMetroLyrics = ini.BoolValue("Lyricator", "tryMetroLyrics")

   Dim TryAutoClose : TryAutoClose = ini.BoolValue("Lyricator", "TryAutoClose")
   Dim ToolbarIcon : ToolbarIcon = ini.BoolValue("Lyricator", "ToolbarIcon")

   Dim a : Set a = UI.NewGroupBox(Sheet) : a.Caption = "Artist Settings" : a.Common.SetRect 10, 12, 220, 240
   Dim t : Set t = UI.NewGroupBox(Sheet) : t.Caption = "Title Settings"  : t.Common.SetRect 240, 12, 230, 210
   Dim l : Set l = UI.NewGroupBox(Sheet) : l.Caption = "Lyrics" : l.Common.SetRect 10, 257, 220, 170
   Dim s : Set s = UI.NewGroupBox(Sheet) : s.Caption = "Sources"  : s.Common.SetRect 240, 223, 230, 200
   Dim g : Set g = UI.NewGroupBox(Sheet) : g.Caption = "General"  : g.Common.SetRect 240, 430, 230, 55
   Dim ls : Set ls = UI.NewGroupBox(l) : ls.Caption = "Single-Line Lyrics"  : ls.Common.SetRect 10, 68, 205, 100

   Dim e
   Set e = UI.NewLabel(Sheet)
   e.Caption = "v" & sVersion & " "
   e.Common.Align = 4 ' Right
   e.Common.FontColor = &HF0 'Dark red

   Set e = UI.NewCheckbox(t)
   e.Common.SetRect 15, 60, 250, 20
   e.Common.ControlName = "TryBracesT"
   e.Common.Hint = "Remove anything within braces {}"
   e.Caption = Translate("Remove Within Braces")
   e.Checked = TryBracesT

   Set e = UI.NewCheckbox(a)
   e.Common.SetRect 15, 20, 250, 20
   e.Common.ControlName = "TryParensA"
   e.Common.Hint = "Remove anything within parentheses ()"
   e.Caption = Translate("Remove Within Parentheses")
   e.Checked = TryParensA

   Set e = UI.NewCheckbox(a)
   e.Common.SetRect 15, 40, 250, 20
   e.Common.ControlName = "TryBracketsA"
   e.Common.Hint = "Remove anything within brackets []"
   e.Caption = Translate("Remove Within Brackets")
   e.Checked = TryBracketsA

   Set e = UI.NewCheckbox(a)
   e.Common.SetRect 15, 60, 250, 20
   e.Common.ControlName = "TryBracesA"
   e.Common.Hint = "Remove anything within braces {}"
   e.Caption = Translate("Remove Within Braces")
   e.Checked = TryBracesA

   Set e = UI.NewCheckbox(a)
   e.Common.SetRect 15, 80, 250, 20
   e.Common.ControlName = "TryQuotesA"
   e.Common.Hint = "Ignore single- and double-quotation marks"
   e.Caption = Translate("Ignore Single/Double Quotes")
   e.Checked = TryQuotesA

   Set e = UI.NewCheckbox(a)
   e.Common.SetRect 15, 100, 250, 20
   e.Common.ControlName = "TryTheA"
   e.Common.Hint = "Try removing 'The'. Example 'The Offsping' to 'Offsping'."
   e.Caption = Translate("Try removing 'The' from results")
   e.Checked = TryTheA

   Set e = UI.NewCheckbox(a)
   e.Common.SetRect 15, 120, 250, 20
   e.Common.ControlName = "TryFeatA"
   e.Common.Hint = "Try removing 'Feat'. Example 'The Offsping' to 'Offsping'."
   e.Caption = Translate("Try removing 'Featuring' combinations")
   e.Checked = TryFeatA

   Set e = UI.NewCheckbox(a)
   e.Common.SetRect 15, 140, 250, 20
   e.Common.ControlName = "TryAllArtists"
   e.Common.Hint = "Attempt all artists (separated by semi-colon)"
   e.Caption = Translate("Attempt All Artists")
   e.Checked = TryAllArtists

   Set e = UI.NewCheckbox(a)
   e.Common.SetRect 15, 160, 250, 20
   e.Common.ControlName = "TryCommaArtists"
   e.Common.Hint = "Convert ""Surname, Name"" to ""Name Surname"""
   e.Caption = Translate("Fix Comma Surnames")
   e.Checked = TryCommaArtists

   Set e = UI.NewLabel(a)
   e.Alignment = 0
   e.Autosize = False
   e.Common.SetRect 15, 190, 200, 20
   e.Caption = Translate("Delimiter Array") & ":"

   Set e = ui.NewEdit(a)
   e.Common.SetRect 100, 187, 100, 17
   e.Common.ControlName = "TrySplitArrayA"
   e.Common.Hint = "Semi-colon-separated delimeter array"
   e.Text = TrySplitArrayA

   Set e = UI.NewLabel(a)
   e.Alignment = 0
   e.Autosize = False
   e.Common.SetRect 15, 215, 200, 20
   e.Caption = Translate("Black List") & ":"

   Set e = ui.NewEdit(a)
   e.Common.SetRect 100, 212, 100, 17
   e.Common.ControlName = "TryBlackListA"
   e.Common.Hint = "Semi-colon-separated Black List (ignore these words)"
   e.Text = TryBlackListA

   Set e = UI.NewCheckbox(t)
   e.Common.SetRect 15, 20, 250, 20
   e.Common.ControlName = "TryParensT"
   e.Common.Hint = "Remove anything within parentheses ()"
   e.Caption = Translate("Remove Within Parentheses")
   e.Checked = TryParensT

   Set e = UI.NewCheckbox(t)
   e.Common.SetRect 15, 40, 250, 20
   e.Common.ControlName = "TryBracketsT"
   e.Common.Hint = "Remove anything within brackets []"
   e.Caption = Translate("Remove Within Brackets")
   e.Checked = TryBracketsT

   Set e = UI.NewCheckbox(t)
   e.Common.SetRect 15, 60, 250, 20
   e.Common.ControlName = "TryBracesT"
   e.Common.Hint = "Remove anything within braces {}"
   e.Caption = Translate("Remove Within Braces")
   e.Checked = TryBracesT

   Set e = UI.NewCheckbox(t)
   e.Common.SetRect 15, 80, 250, 20
   e.Common.ControlName = "TryQuotesT"
   e.Common.Hint = "Ignore single- and double-quotation marks"
   e.Caption = Translate("Ignore Single/Double Quotes")
   e.Checked = TryQuotesT

   Set e = UI.NewCheckbox(t)
   e.Common.SetRect 15, 100, 250, 20
   e.Common.ControlName = "TryTheT"
   e.Common.Hint = "Try removing 'The'. Example 'The Offsping' to 'Offsping'."
   e.Caption = Translate("Try removing 'The' from results")
   e.Checked = TryTheT

   Set e = UI.NewCheckbox(t)
   e.Common.SetRect 15, 120, 250, 20
   e.Common.ControlName = "TryFeatT"
   e.Common.Hint = "Try removing 'Feat'. Example 'The Offsping' to 'Offsping'."
   e.Caption = Translate("Try removing 'Featuring' combinations")
   e.Checked = TryFeatT

   Set e = UI.NewLabel(t)
   e.Alignment = 0
   e.Autosize = False
   e.Common.SetRect 15, 150, 200, 20
   e.Caption = Translate("Delimiter Array") & ":"

   Set e = ui.NewEdit(t)
   e.Common.SetRect 100, 147, 100, 17
   e.Common.ControlName = "TrySplitArrayT"
   e.Common.Hint = "Semi-colon-separated delimeter array"
   e.Text = TrySplitArrayT

   Set e = UI.NewLabel(t)
   e.Alignment = 0
   e.Autosize = False
   e.Common.SetRect 15, 180, 200, 20
   e.Caption = Translate("Black List") & ":"

   Set e = ui.NewEdit(t)
   e.Common.SetRect 100, 177, 100, 17
   e.Common.ControlName = "TryBlackListT"
   e.Common.Hint = "Semi-colon-separated Black List (ignore these words)"
   e.Text = TryBlackListT

   Set e = UI.NewCheckbox(l)
   e.Common.SetRect 15, 20, 250, 20
   e.Common.ControlName = "TryCleanupWhiteSpace"
   e.Common.Hint = "Consolidate excess white-space (e.g. three or more line breaks)"
   e.Caption = Translate("Cleanup Whitespace")
   e.Checked = TryCleanupWhiteSpace

   Set e = UI.NewCheckbox(ls)
   e.Common.SetRect 15, 20, 250, 20
   e.Common.ControlName = "TryRejectSingleLine"
   e.Common.Hint = "Ignore lyrics that contain only one single line"
   e.Caption = Translate("Ignore")
   e.Checked = TryRejectSingleLine

   Set e = UI.NewLabel(ls)
   e.Alignment = 0
   e.Autosize = False
   e.Common.SetRect 15, 50, 200, 20
   e.Caption = Translate("Search String") & ":"

   Set e = ui.NewEdit(ls)
   e.Common.SetRect 100, 47, 100, 17
   e.Common.ControlName = "TrySingleLineSearch"
   e.Common.Hint = "Single-Line Search String"
   e.Text = TrySingleLineSearch

   Set e = UI.NewLabel(ls)
   e.Alignment = 0
   e.Autosize = False
   e.Common.SetRect 15, 80, 200, 20
   e.Caption = Translate("Replace String") & ":"

   Set e = ui.NewEdit(ls)
   e.Common.SetRect 100, 75, 100, 17
   e.Common.ControlName = "TrySingleLineReplace"
   e.Common.Hint = "Single-Line Replace String"
   e.Text = TrySingleLineReplace

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 20, 250, 20
   e.Common.ControlName = "tryAZLyrics"
   e.Common.Hint = "Search using www.AZLyrics.com"
   e.Caption = Translate("www.AZLyrics.com")
   e.Checked = tryAZLyrics

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 40, 250, 20
   e.Common.ControlName = "tryLyricWikia"
   e.Common.Hint = "Search using Lyric.Wikia.com"
   e.Caption = Translate("Lyric.Wikia.com")
   e.Checked = tryLyricWikia

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 60, 250, 20
   e.Common.ControlName = "tryLyrDB"
   e.Common.Hint = "Search using www.LyrDB.com"
   e.Caption = Translate("www.LyrDB.com")
   e.Checked = tryLyrDB

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 80, 250, 20
   e.Common.ControlName = "tryLyricsVIP"
   e.Common.Hint = "Search using www.LyricsVIP.com." & vbnewline & "* Limited amount of searches before you're 'temporary' blocked."
   e.Caption = Translate("www.LyricsVIP.com (Capped searches *)")
   e.Checked = tryLyricsVIP

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 100, 250, 20
   e.Common.ControlName = "tryLyricsSong"
   e.Common.Hint = "Search using www.Lyrics-Songs.com"
   e.Caption = Translate("Lyrics-Songs.com (Unreliable)")
   e.Checked = tryLyricsSong

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 120, 250, 20
   e.Common.ControlName = "tryLyricsMode"
   e.Common.Hint = "Search using www.lyricsmode.com"
   e.Caption = Translate("www.lyricsmode.com")
   e.Checked = tryLyricsMode

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 140, 250, 20
   e.Common.ControlName = "tryMp3Lyrics"
   e.Common.Hint = "Search using www.mp3lyrics.org"
   e.Caption = Translate("www.mp3lyrics.org")
   e.Checked = tryMp3Lyrics

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 160, 250, 20
   e.Common.ControlName = "trySeekALyric"
   e.Common.Hint = "Search using www.seekalyric.com"
   e.Caption = Translate("www.seekalyric.com")
   e.Checked = trySeekALyric

   Set e = UI.NewCheckbox(s)
   e.Common.SetRect 15, 180, 250, 20
   e.Common.ControlName = "tryMetroLyrics"
   e.Common.Hint = "Search using www.metrolyrics.com"
   e.Caption = Translate("www.metrolyrics.com")
   e.Checked = tryMetroLyrics

   Set e = UI.NewCheckbox(g)
   e.Common.SetRect 15, 15, 250, 20
   e.Common.ControlName = "TryAutoClose"
   e.Common.Hint = "Auto-Close when done saving lyrics"
   e.Caption = Translate("Auto-Close After Save")
   e.Checked = TryAutoClose

   Set e = UI.NewCheckbox(g)
   e.Common.SetRect 15, 35, 250, 20
   e.Common.ControlName = "ToolbarIcon"
   e.Common.Hint = "Create a short on the toolbar to run Lyricator"
   e.Caption = Translate("Enabletoolbar icon")
   e.Checked = ToolbarIcon
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub SaveSheet(Sheet)
   Dim ini : Set ini = SDB.IniFile

   ini.BoolValue("Lyricator", "TryAllArtists") = Sheet.Common.ChildControl("TryAllArtists").Checked
   ini.BoolValue("Lyricator", "TryCommaArtists") = Sheet.Common.ChildControl("TryCommaArtists").Checked
   ini.BoolValue("Lyricator", "TryCleanupWhiteSpace") = Sheet.Common.ChildControl("TryCleanupWhiteSpace").Checked
   ini.BoolValue("Lyricator", "TryRejectSingleLine") = Sheet.Common.ChildControl("TryRejectSingleLine").Checked

   ini.StringValue("Lyricator", "TrySingleLineSearch") = Sheet.Common.ChildControl("TrySingleLineSearch").Text
   ini.StringValue("Lyricator", "TrySingleLineReplace") = Sheet.Common.ChildControl("TrySingleLineReplace").Text

   ini.BoolValue("Lyricator", "TryParensA") = Sheet.Common.ChildControl("TryParensA").Checked
   ini.BoolValue("Lyricator", "TryBracketsA") = Sheet.Common.ChildControl("TryBracketsA").Checked
   ini.BoolValue("Lyricator", "TryBracesA") = Sheet.Common.ChildControl("TryBracesA").Checked
   ini.BoolValue("Lyricator", "TryQuotesA") = Sheet.Common.ChildControl("TryQuotesA").Checked
   ini.BoolValue("Lyricator", "TryTheA") = Sheet.Common.ChildControl("TryTheA").Checked
   ini.BoolValue("Lyricator", "TryFeatA") = Sheet.Common.ChildControl("TryFeatA").Checked
   ini.StringValue("Lyricator", "TrySplitArrayA") = Sheet.Common.ChildControl("TrySplitArrayA").Text
   ini.StringValue("Lyricator", "TryBlackListA") = Sheet.Common.ChildControl("TryBlackListA").Text

   ini.BoolValue("Lyricator", "TryParensT") = Sheet.Common.ChildControl("TryParensT").Checked
   ini.BoolValue("Lyricator", "TryBracketsT") = Sheet.Common.ChildControl("TryBracketsT").Checked
   ini.BoolValue("Lyricator", "TryBracesT") = Sheet.Common.ChildControl("TryBracesT").Checked
   ini.BoolValue("Lyricator", "TryQuotesT") = Sheet.Common.ChildControl("TryQuotesT").Checked
   ini.BoolValue("Lyricator", "TryTheT") = Sheet.Common.ChildControl("TryTheT").Checked
   ini.BoolValue("Lyricator", "TryFeatT") = Sheet.Common.ChildControl("TryFeatT").Checked
   ini.StringValue("Lyricator", "TrySplitArrayT") = Sheet.Common.ChildControl("TrySplitArrayT").Text
   ini.StringValue("Lyricator", "TryBlackListT") = Sheet.Common.ChildControl("TryBlackListT").Text

   If Not Sheet.Common.ChildControl("trySeekALyric").Checked And Not Sheet.Common.ChildControl("tryAZLyrics").Checked And Not Sheet.Common.ChildControl("tryLyricsVIP").Checked And Not Sheet.Common.ChildControl("tryLyricWikia").Checked And Not Sheet.Common.ChildControl("tryLyrDB").Checked And Not Sheet.Common.ChildControl("tryLyricsSong").Checked And Not Sheet.Common.ChildControl("tryLyricsMode").Checked And Not Sheet.Common.ChildControl("tryMp3Lyrics").Checked And Not Sheet.Common.ChildControl("tryMetroLyrics").Checked Then
      Debug "You Must Have One Lyric Server Checked" & vbnewline & vbnewline & "Enabling: AZLyrics.com, Lyric.Wikia.com, LyrDB.com and LyricsVIP.com"
      Sheet.Common.ChildControl("tryAZLyrics").Checked = True
      Sheet.Common.ChildControl("tryLyricWikia").Checked = True
      Sheet.Common.ChildControl("tryLyrDB").Checked = True
      Sheet.Common.ChildControl("tryLyricsVIP").Checked = True
      Sheet.Common.ChildControl("tryLyricsMode").Checked = True
      Sheet.Common.ChildControl("tryMp3Lyrics").Checked = True
      Sheet.Common.ChildControl("trySeekALyric").Checked = True
      Sheet.Common.ChildControl("tryMetroLyrics").Checked = True
   End If

   ini.BoolValue("Lyricator", "tryAZLyrics") = Sheet.Common.ChildControl("tryAZLyrics").Checked
   ini.BoolValue("Lyricator", "tryLyricWikia") = Sheet.Common.ChildControl("tryLyricWikia").Checked
   ini.BoolValue("Lyricator", "tryLyrDB") = Sheet.Common.ChildControl("tryLyrDB").Checked
   ini.BoolValue("Lyricator", "tryLyricsVIP") = Sheet.Common.ChildControl("tryLyricsVIP").Checked
   ini.BoolValue("Lyricator", "tryLyricsSong") = Sheet.Common.ChildControl("tryLyricsSong").Checked
   ini.BoolValue("Lyricator", "tryLyricsMode") = Sheet.Common.ChildControl("tryLyricsMode").Checked
   ini.BoolValue("Lyricator", "tryMp3Lyrics") = Sheet.Common.ChildControl("tryMp3Lyrics").Checked
   ini.BoolValue("Lyricator", "trySeekALyric") = Sheet.Common.ChildControl("trySeekALyric").Checked
   ini.BoolValue("Lyricator", "tryMetroLyrics") = Sheet.Common.ChildControl("tryMetroLyrics").Checked

   ini.BoolValue("Lyricator", "TryAutoClose") = Sheet.Common.ChildControl("TryAutoClose").Checked
   ini.BoolValue("Lyricator", "ToolbarIcon") = Sheet.Common.ChildControl("ToolbarIcon").Checked

   Dim but : Set but = SDB.Objects("LyricatorIcon")
   but.Visible = ini.BoolValue("Lyricator","ToolbarIcon")
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function Translate(str)
   Translate = str
   Dim dic : Set dic = SDB.Objects("LyrDict")
   If Not (dic Is Nothing) Then
      If dic.Exists(str) Then
         Translate = dic.Item(str)
      End If
   End If
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Install()
   Dim iniFile : iniFile = SDB.ApplicationPath & "Scripts\Scripts.ini"
   Dim f : Set f = SDB.Tools.IniFileByPath(iniFile)
   If Not (f Is Nothing) Then
      f.StringValue("Lyricator", "Filename") = "Auto\lyricator.vbs"
      f.StringValue("Lyricator", "Procname") = "Lyricator"
      f.StringValue("Lyricator", "Order") = "99"
      f.StringValue("Lyricator", "DisplayName") = "Lyricator"
      f.StringValue("Lyricator", "Description") = "Batch Import Lyrics"
      f.StringValue("Lyricator", "Language") = "VBScript"
      f.StringValue("Lyricator", "ScriptType") = "0"
      SDB.RefreshScriptItems
   End If

   Dim ini : Set ini = SDB.IniFile

   If Not ini.BoolValue("Lyricator", "TryAllArtists") Then ini.BoolValue("Lyricator", "TryAllArtists") = False End If
   If Not ini.BoolValue("Lyricator", "TryCommaArtists") Then ini.BoolValue("Lyricator", "TryCommaArtists") = True End If
   If Not ini.BoolValue("Lyricator", "TryCleanupWhiteSpace") Then ini.BoolValue("Lyricator", "TryCleanupWhiteSpace") = True End If
   If Not ini.BoolValue("Lyricator", "TryRejectSingleLine") Then ini.BoolValue("Lyricator", "TryRejectSingleLine") = False End If

   If ini.StringValue("Lyricator", "TrySingleLineSearch") = "" Then ini.StringValue("Lyricator", "TrySingleLineSearch") = "Instr" End If
   If ini.StringValue("Lyricator", "TrySingleLineReplace") = "" Then ini.StringValue("Lyricator", "TrySingleLineReplace") = "[Instrumental]" End If

   If Not ini.BoolValue("Lyricator", "TryParensA") Then ini.BoolValue("Lyricator", "TryParensA") = True End If
   If Not ini.BoolValue("Lyricator", "TryBracketsA") Then ini.BoolValue("Lyricator", "TryBracketsA") = True End If
   If Not ini.BoolValue("Lyricator", "TryBracesA") Then ini.BoolValue("Lyricator", "TryBracesA") = True End If
   If Not ini.BoolValue("Lyricator", "TryQuotesA") Then ini.BoolValue("Lyricator", "TryQuotesA") = True End If
   If Not ini.BoolValue("Lyricator", "TryTheA") Then ini.BoolValue("Lyricator", "TryTheA") = True End If
   If Not ini.BoolValue("Lyricator", "TryFeatA") Then ini.BoolValue("Lyricator", "TryFeatA") = True End If
   If ini.StringValue("Lyricator", "TrySplitArrayA") = "" Then ini.StringValue("Lyricator", "TrySplitArrayA") = "and;&;+" End If
   If ini.StringValue("Lyricator", "TryBlackListA") = "" Then ini.StringValue("Lyricator", "TryBlackListA") = "" End If

   If Not ini.BoolValue("Lyricator", "TryParensT") Then ini.BoolValue("Lyricator", "TryParensT") = True End If
   If Not ini.BoolValue("Lyricator", "TryBracketsT") Then ini.BoolValue("Lyricator", "TryBracketsT") = True End If
   If Not ini.BoolValue("Lyricator", "TryBracesT") Then ini.BoolValue("Lyricator", "TryBracesT") = True End If
   If Not ini.BoolValue("Lyricator", "TryQuotesT") Then ini.BoolValue("Lyricator", "TryQuotesT") = True End If
   If Not ini.BoolValue("Lyricator", "TryTheT") Then ini.BoolValue("Lyricator", "TryTheT") = True End If
   If Not ini.BoolValue("Lyricator", "TryFeatT") Then ini.BoolValue("Lyricator", "TryFeatT") = True End If
   If ini.StringValue("Lyricator", "TrySplitArrayT") = "" Then ini.StringValue("Lyricator", "TrySplitArrayT") = "" End If
   If ini.StringValue("Lyricator", "TryBlackListT") = "" Then ini.StringValue("Lyricator", "TryBlackListT") = "Medley" End If

   If Not ini.BoolValue("Lyricator", "tryAZLyrics") Then ini.BoolValue("Lyricator", "tryAZLyrics") = True End If
   If Not ini.BoolValue("Lyricator", "tryLyricWikia") Then ini.BoolValue("Lyricator", "tryLyricWikia") = True End If
   If Not ini.BoolValue("Lyricator", "tryLyrDB") Then ini.BoolValue("Lyricator", "tryLyrDB") = True End If
   If Not ini.BoolValue("Lyricator", "tryLyricsVIP") Then ini.BoolValue("Lyricator", "tryLyricsVIP") = True End If
   If Not ini.BoolValue("Lyricator", "tryLyricsSong") Then ini.BoolValue("Lyricator", "tryLyricsSong") = False End If
   If Not ini.BoolValue("Lyricator", "tryLyricsMode") Then ini.BoolValue("Lyricator", "tryLyricsMode") = True End If
   If Not ini.BoolValue("Lyricator", "tryMetroLyrics") Then ini.BoolValue("Lyricator", "tryMetroLyrics") = True End If

   If Not ini.BoolValue("Lyricator", "TryAutoClose") Then ini.BoolValue("Lyricator", "TryAutoClose") = True End If
   If Not ini.BoolValue("Lyricator", "ToolbarIcon") Then ini.BoolValue("Lyricator", "ToolbarIcon") = True End If

   Debug "You'll need to restart MediaMonkey for Lyrictor to work correctly."
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' "Dreams"/Ideas (Search: *** TO DO ***):
' > Improve "CleanUp" - Remove spaces at end of lines, Auto-Case etc
' > Improve "search" order when bruteforcing - search AlbumArtist THEN add other names (reserve of the current method!)
' > Improve bruteforcing - with track title remove = ,-,(Half Brackets, etc Artist, albumartist
' Add "Lyrics on the fly" option - Save as soon as lyrics are downloaded
' "Use another source" option
' Tag missing album art/id3 info
' Upload to a source if already found to APIs (Help support sites) - or create our own?
' "Hide all tracks that DON'T have lyrics" option
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'####################################################################
' Added by C:\Program Files (x86)\MediaMonkey\Scripts\Auto\RightClickForScripts.vbs
Sub RightClickForScripts_Lyricator(o)
    Lyricator
End Sub
'####################################################################
Last edited by thehammer on Wed Jan 01, 2014 10:02 pm, edited 1 time in total.
ImageSpoon!
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Updated script to include more lyrics sites

Post by thehammer »

I have spent the afternoon getting elyrics working as well. I also think metrolyrics is no longer working and may look into that next. I don't plan on taking over support for this project, but will continue to post updates if I get the time to add support for more lyrics sites.

I will hold off on posting more updates until I get metrolyrics working again or give up and just post elyrics support.
ImageSpoon!
brooklynspo
Posts: 46
Joined: Wed Jan 23, 2008 5:11 pm

Re: Lyricator v1.1.1 #31 (2010-12-16)

Post by brooklynspo »

Hammer - thanks for the updates!
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Lyricator v1.1.1 #31 (2010-12-16)

Post by thehammer »

You are quite welcome. Stay tuned, I just finished going through all the lyrics sources and found that many of them had broken along the way and I hadn't noticed. I got them going again and am testing various scenarios to make sure they work with various characters and what not. I am only tackling the single quote issue for now, but plan to handle question marks in song titles as well.
ImageSpoon!
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Lyricator v1.1.1 #33 (2010-12-16)

Post by thehammer »

After pulling a bunch of hours testing and tweaking, I have all the lyrics sources working except for LyricsVIP which looks to be no longer serving lyrics for some unknown reason. I have also incorporated a fix so that single quotes should not be a problem with all the working lyrics sources. This will probably be the last time I get a chance to make any updates for a while unless something is drastically broken. Unfortunately, the lyricator.vbs file is now larger than i can post so I had to remove prior history entries and will post code in three separate posts. (Note: It was discovered that this only works with the installs where MediaMonkey was installed for all users in WIndows and everything lives in Program Files/MediaMonkey directory instead of the Users appData/Roaming/MediaMonkey directory. I will have to do some work to merge my changes into the latest install file posted a couple posts earlier to work for this type of install.)
Last edited by thehammer on Sat Jan 04, 2014 12:38 pm, edited 2 times in total.
ImageSpoon!
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Lyricator v1.1.1 #33 (2010-12-16)

Post by thehammer »

lyricator.vbs:

Code: Select all

    
Option Explicit
    Dim sVersion : sVersion = "1.1.1.33"
    ' 1.1.1.33 (2013-01-01)
    ' - Add: elyrics.net as source
    ' - Update: change LyricsSongs to the actual new name of the service(Letras)
    ' - Fix: Letras, LyricsMode, Mp3Lyrics, MetroLyrics, SeekALyric working again
    ' - Fix: AZLyrics, LyrDB, MetroLyrics, ELyrics, Mp3Lyrics, LyricsMode, SeekALyric support single quote in artist and song title
    ' - Fix: removed MySql warnings from lyrics returned by LyrDB
    ' 1.1.1.32 (2013-03-28)
    ' - Add: lyricsmode.com, lyrics.com, seekalyric.com, metrolyrics.com as sources
    ' 1.1.1.31 (2010-12-16)
    ' - Add: AZLyrics.com and LyrDB.com as sources
    ' - Add: Option to remove "The" and "Ft,Ft.,feat,feat.,featuring" from artist and/or title.
    ' - Add: Toolbar icon
    ' - Add: "Legend" on output window
    ' - Add: "Lyric sources" to output window
    ' - Add: "Lyric stats" to output window
    ' - Add: "Lyrics provided by" to lyrics
    ' - Add: "Time out" feature
    ' - Add: "Update" feature (Tools -> Extension -> Find Updates)
    ' - Add: colour coding of sites in results
    ' - Fix: LyricWikia.org (now Lyric.wikia.com) & Lyrics-songs.com (now Letras.Terra.com.br)sources
    ' - Fix: "Duplicate Artist Search" bug
    ' - Fix: "Percent Sign/Ampersand in ID3" bug
    ' - Fix: "Source Selection" bug
    ' - Update: Enabled "multi domain searching" again
    ' - Update: Move a few things about in options
    ' - Update: Replaced LyricsPlugin with LyricsVIP.com (Cuts out "the middle man")
    ' - Update: Tweaked the log file and the internal workings
    ' - Update: Lyric text cleanup

    Dim sPath : sPath = sdb.ApplicationPath & "Scripts\Auto\lyricator.vbs"
    'Dim sHTML : sHTML = sdb.ApplicationPath & "Scripts\Lyricator\temp.html"
    Dim sHTML : sHTML = sdb.TemporaryFolder & "Lyricator.htm"
    'Dim sAppPath: sAppPath = Replace(Mid(sdb.ApplicationPath,3) & "Scripts\Lyricator\", "\", "\\")
    'Dim sAppPath: sAppPath = Mid(sdb.ApplicationPath,3) & "Scripts\Lyricator\"
    Dim sAppPath: sAppPath = sdb.ApplicationPath & "Scripts\Lyricator\"
    Dim sLyrMOO : sLyrMOO = sAppPath & "moo.js"
    Dim sLyrJS : sLyrJS = sAppPath & "lyricator.js"
    Dim sLyrCSS : sLyrCSS = sAppPath & "lyricator.css"
    Dim sLoad : sLoad = sAppPath & "loading.gif"
    Dim sLOG : sLOG = sdb.ApplicationPath & "Scripts\Lyricator\" & "Lyricator.log"

    Const mmAnchorRight = 4
    Const mmAnchorBottom = 8
    Const mmAlignTop = 1
    Const mmAlignBottom = 2
    Const mmAlignClient = 5
    Const mmListDropdown = 2
    Const mmFormScreenCenter = 4

    ' Initialize for fso, html & log
    Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
    Dim fLog
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub Destroy
       SDB.Objects("LyricatorForm") = Nothing
       SDB.Objects("LyricatorWB") = Nothing
       SDB.Objects("LyricatorTracks") = Nothing
       SDB.Objects("LyricatorStatus") = Nothing

       If fso.FileExists(sHTML) Then
          fso.DeleteFile(sHTML)
       End If
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub OnSave(Btn)
       log("")
       log("Saving")
       Btn.Caption = SDB.Localize("Saving ...")
       Btn.Common.Enabled = False

       Dim ini : Set ini = SDB.IniFile
       Dim TryAutoClose : TryAutoClose = ini.BoolValue("Lyricator", "TryAutoClose")
       Dim ToolbarIcon : ToolbarIcon = ini.BoolValue("Lyricator", "ToolbarIcon")

       Dim doc : Set doc = SDB.Objects("LyricatorWB").Interf.Document
       Dim tracks: Set tracks = SDB.Objects("LyricatorTracks")
       Dim status : Set status = SDB.Objects("LyricatorStatus")

       Dim cnt : cnt = 0

       Dim interval : interval = 1
       If tracks.count > 10000 Then
          interval = 100
       ElseIf tracks.count > 1000 Then
          interval = 25
       ElseIf tracks.count > 100 Then
          interval = 10
       End If

       Dim i
       For i = 0 to tracks.count - 1
          'Keep GUI responsive
           SDB.ProcessMessages

          'Update progress bar
           If (i + 1) Mod interval = 0 Then
              status.Caption = SDB.Localize("Writing " & (i+1) & "/" & (tracks.count) & " ...")
           End If

           Dim t : Set t = doc.getElementById(tracks.Item(i).ID)
           Dim d : Set d = t.getElementsByTagName("div")
           Dim c : Set c = d(0).getElementsByTagName("input")(0)
           Dim ti: ti = d(1).innerHTML

           If clng(ti) = i Then
              If c.checked Then
                 cnt = cnt + 1
                 Dim l : l = Replace(d(4).innerHTML, "<BR>", vbNewLine)
                 l = Replace(l, "<BR/>", vbNewLine)
                 l = Replace(l, "<BR />", vbNewLine)
                 tracks.Item(i).Lyrics = l
                 tracks.Item(i).UpdateDB
                 tracks.Item(i).WriteTags
                 t.innerHTML = Replace(t.innerHTML, "<DIV class=lyrics>", "<div class=Saved>")
                 log("Saved Track[" & i & "] ID[" & tracks.Item(i).ID & "] Lyric[" & Left(l, 60) &"]")
              End If
           Else
              log("Save Aborted Track[" & i & "] ID[" & tracks.Item(i).ID & "] Index[" & ti & "]")
           End If
       Next

       log("Finished")

       status.Caption = cnt & " Lyrics Saved"

       If TryAutoClose Then
          Destroy
       End If
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub OnCancel(Btn)
       Destroy
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub OnAbort(Btn)
       log("")
       log("Abort")
       SDB.Objects("LyricatorWB") = Nothing

       Btn.Caption = SDB.Localize("C&lose")
       Btn.OnClickFunc = "OnCancel"
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub log(sText)
       ' Open log for append, create if needed, unicode
       Set fLog = fso.OpenTextFile(sLOG, 8, true, -1)
       fLog.WriteLine sText
       fLog.Close
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub Lyricator()
       If fso.FileExists(sLOG) Then    ' Remove log if needed
          fso.DeleteFile(sLOG)
       End If
       log("Lyricator v" & sVersion & " started")
       log("Log: " & sLOG)
       log("App: " & sAppPath)

       Dim ini : Set ini = SDB.IniFile
       Dim UI : Set UI = SDB.UI

       Dim TryAllArtists : TryAllArtists = ini.BoolValue("Lyricator", "TryAllArtists")
       Dim TryCommaArtists : TryCommaArtists = ini.BoolValue("Lyricator", "TryCommaArtists")
       Dim TryCleanupWhiteSpace : TryCleanupWhiteSpace = ini.BoolValue("Lyricator", "TryCleanupWhiteSpace")
       Dim TryRejectSingleLine : TryRejectSingleLine = ini.BoolValue("Lyricator", "TryRejectSingleLine")

       Dim TrySingleLineSearch : TrySingleLineSearch = ini.StringValue("Lyricator", "TrySingleLineSearch")
       Dim TrySingleLineReplace : TrySingleLineReplace = ini.StringValue("Lyricator", "TrySingleLineReplace")

       Dim TryParensA : TryParensA = ini.BoolValue("Lyricator", "TryParensA")
       Dim TryBracketsA : TryBracketsA = ini.BoolValue("Lyricator", "TryBracketsA")
       Dim TryBracesA : TryBracesA = ini.BoolValue("Lyricator", "TryBracesA")
       Dim TryQuotesA : TryQuotesA = ini.BoolValue("Lyricator", "TryQuotesA")
       Dim TryTheA : TryTheA = ini.BoolValue("Lyricator", "TryTheA")
       Dim TryFeatA : TryFeatA = ini.BoolValue("Lyricator", "TryFeatA")
       Dim TrySplitArrayA : TrySplitArrayA = ini.StringValue("Lyricator", "TrySplitArrayA")
       Dim TryBlackListA : TryBlackListA = ini.StringValue("Lyricator", "TryBlackListA")

       Dim TryParensT : TryParensT = ini.BoolValue("Lyricator", "TryParensT")
       Dim TryBracketsT : TryBracketsT = ini.BoolValue("Lyricator", "TryBracketsT")
       Dim TryBracesT : TryBracesT = ini.BoolValue("Lyricator", "TryBracesT")
       Dim TryQuotesT : TryQuotesT = ini.BoolValue("Lyricator", "TryQuotesT")
       Dim TryTheT : TryTheT = ini.BoolValue("Lyricator", "TryTheT")
       Dim TryFeatT : TryFeatT = ini.BoolValue("Lyricator", "TryFeatT")
       Dim TrySplitArrayT : TrySplitArrayT = ini.StringValue("Lyricator", "TrySplitArrayT")
       Dim TryBlackListT : TryBlackListT = ini.StringValue("Lyricator", "TryBlackListT")

       Dim tryAZLyrics : tryAZLyrics = ini.BoolValue("Lyricator", "tryAZLyrics")
       Dim tryLyricWikia : tryLyricWikia = ini.BoolValue("Lyricator", "tryLyricWikia")
       Dim tryLyrDB : tryLyrDB = ini.BoolValue("Lyricator", "tryLyrDB")
       Dim tryLyricsVIP : tryLyricsVIP = ini.BoolValue("Lyricator", "tryLyricsVIP")
       Dim tryLetras : tryLetras = ini.BoolValue("Lyricator", "tryLetras")
       Dim tryLyricsMode : tryLyricsMode = ini.BoolValue("Lyricator", "tryLyricsMode")
       Dim tryMp3Lyrics : tryMp3Lyrics = ini.BoolValue("Lyricator", "tryMp3Lyrics")
       Dim trySeekALyric : trySeekALyric = ini.BoolValue("Lyricator", "trySeekALyric")
       Dim tryMetroLyrics : tryMetroLyrics = ini.BoolValue("Lyricator", "tryMetroLyrics")
       Dim tryELyrics : tryELyrics = ini.BoolValue("Lyricator", "tryELyrics")
       Dim ToolbarIcon : ToolbarIcon = ini.BoolValue("Lyricator", "ToolbarIcon")

       Dim TryAutoClose : TryAutoClose = ini.BoolValue("Lyricator", "TryAutoClose")

       Dim FormWidth : FormWidth = 800
       Dim FormHeight : FormHeight = 600

       Dim frmMain : Set frmMain = UI.NewForm
       frmMain.Common.SetRect 50, 50, FormWidth, FormHeight
       frmMain.Common.MinWidth = 200
       frmMain.Common.MinHeight = 150
       frmMain.FormPosition = mmFormScreenCenter
       frmMain.Caption = SDB.Localize("Lyricator")
       frmMain.StayOnTop = True
       frmMain.Common.Visible = True

       Dim WB : Set WB = UI.NewActiveX(frmMain, "Shell.Explorer")
       WB.Common.Align = mmAlignClient
       WB.Common.ControlName = "WB"

       WB.Interf.Navigate(sLoad)

       Dim pnlFooter : Set pnlFooter = UI.NewPanel(frmMain)
       pnlFooter.Common.Align = mmAlignBottom
       pnlFooter.Common.Height = 37

       Dim lblStatus : Set lblStatus = UI.NewLabel(pnlFooter)
       lblStatus.Caption = ""
       lblStatus.Common.SetRect FormWidth - 450, 16, 120, 25
       lblStatus.Common.Anchors = mmAnchorRight + mmAnchorBottom

       Dim btnSave : Set btnSave = UI.NewButton(pnlFooter)
       btnSave.Caption = SDB.Localize("&Save")
       btnSave.Common.SetRect FormWidth - 280, 6, 120, 25
       btnSave.Common.Anchors = mmAnchorRight + mmAnchorBottom
       btnSave.UseScript = sPath
       btnSave.OnClickFunc = "OnSave"
       btnSave.Default = true

       Dim btnCancel : Set btnCancel = UI.NewButton(pnlFooter)
       btnCancel.Caption = SDB.Localize("C&lose")
       btnCancel.Common.SetRect FormWidth - 150, 6, 120, 25
       btnCancel.Common.Anchors = mmAnchorRight + mmAnchorBottom
       btnCancel.UseScript = sPath
       btnCancel.OnClickFunc = "OnCancel"
       btnCancel.Cancel = true

       btnSave.Caption = SDB.Localize("Loading ...")
       btnSave.Common.Enabled = False
       btnCancel.Caption = SDB.Localize("Abort")
       btnCancel.OnClickFunc = "OnAbort"

       SDB.Objects("LyricatorStatus") = lblStatus
       SDB.Objects("LyricatorForm") = frmMain
       SDB.Objects("LyricatorWB") = WB

       Dim tracks : Set tracks = SDB.SelectedSongList

       Dim html : html = ""

       html = html & "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"
       html = html & "<html>"
       html = html & "   <head>"
       html = html & "      <script type=""text/javascript"" src=""" & sLyrMOO & """></script>"
       html = html & "      <script type=""text/javascript"" src=""" & sLyrJS & """></script>"
       html = html & "      <link type=""text/css"" rel=""stylesheet"" href=""" & sLyrCSS & """ />"

       html = html & "<script type=""text/javascript"">"
       log("Settings:")
       If TryAllArtists Then
          html = html & "tryAllArtists = true;"
          log("tryAllArtists")
       End If
       If TryCommaArtists Then
          html = html & "tryCommaArtists = true;"
          log("tryCommaArtists")
       End If
       If TryCleanupWhiteSpace Then
          html = html & "tryCleanupWhiteSpace = true;"
          log("tryCleanupWhiteSpace")
       End If
       If TryRejectSingleLine Then
          html = html & "tryRejectSingleLine = true;"
          log("tryRejectSingleLine")
       End If

       If TrySingleLineSearch <> "" Then
          html = html & "trySingleLineSearch = '" & TrySingleLineSearch & "';"
          log("trySingleLineSearch = '" & TrySingleLineSearch & "'")
       End If
       If TrySingleLineReplace <> "" Then
          html = html & "trySingleLineReplace = '" & TrySingleLineReplace & "';"
          log("trySingleLineReplace = '" & TrySingleLineReplace & "'" )
       End If

       If TryParensA Then
          html = html & "tryParensA = true;"
          log("tryParensA")
       End If
       If TryBracketsA Then
          html = html & "tryBracketsA = true;"
          log("tryBracketsA")
       End If
       If TryBracesA Then
          html = html & "tryBracesA = true;"
          log("tryBracesA")
       End If
       If TryQuotesA Then
          html = html & "tryQuotesA = true;"
          log("tryQuotesA")
       End If
       If TryTheA Then
          html = html & "tryTheA = true;"
          log("tryTheA")
       End If
       If TryFeatA Then
          html = html & "tryFeatA = true;"
          log("tryFeatA")
       End If
       If TrySplitArrayA <> "" Then
          html = html & "trySplitArrayA = '" & TrySplitArrayA & "';"
          log("trySplitArrayA = '" & TrySplitArrayA & "'")
       End If
       If TryBlackListA <> "" Then
          html = html & "tryBlackListA = '" & TryBlackListA & "';"
          log("tryBlackListA = '" & TryBlackListA & "'")
       End If

       If TryParensT Then
          html = html & "tryParensT = true;"
          log("tryParensT")
       End If
       If TryBracketsT Then
          html = html & "tryBracketsT = true;"
          log("tryBracketsT")
       End If
       If TryBracesT Then
          html = html & "tryBracesT = true;"
          log("tryBracesT")
       End If
       If TryQuotesT Then
          html = html & "tryQuotesT = true;"
          log("tryQuotesT")
       End If
       If TryTheT Then
          html = html & "tryTheT = true;"
          log("tryTheT")
       End If
       If TryFeatT Then
          html = html & "tryFeatT = true;"
          log("tryFeatT")
       End If
       If TrySplitArrayT <> "" Then
          html = html & "trySplitArrayT = '" & TrySplitArrayT & "';"
          log("trySplitArrayT = '" & TrySplitArrayT & "'")
       End If
       If TryBlackListT <> "" Then
          html = html & "tryBlackListT = '" & TryBlackListT & "';"
          log("tryBlackListT = '" & TryBlackListT & "'")
       End If

       If tryAZLyrics Then
          html = html & "tryAZLyrics = true;"
          log("tryAZLyrics")
       End If
       If tryLyricWikia Then
          html = html & "tryLyricWikia = true;"
          log("tryLyricWikia")
       End If
       If tryLyrDB Then
          html = html & "tryLyrDB = true;"
          log("tryLyrDB")
       End If
       If tryLyricsVIP Then
          html = html & "tryLyricsVIP = true;"
          log("tryLyricsVIP")
       End If
       If tryLetras Then
          html = html & "tryLetras = true;"
          log("tryLetras")
       End If
       If tryLyricsMode Then
          html = html & "tryLyricsMode = true;"
          log("tryLyricsMode")
       End If
       If tryMp3Lyrics Then
          html = html & "tryMp3Lyrics = true;"
          log("tryMp3Lyrics")
       End If
       If trySeekALyric Then
          html = html & "trySeekALyric = true;"
          log("trySeekALyric")
       End If
       If tryMetroLyrics Then
          html = html & "tryMetroLyrics = true;"
          log("tryMetroLyrics")
       End If
       If tryELyrics Then
          html = html & "tryELyrics = true;"
          log("tryELyrics")
       End If

       html = html & "lyricatorLog ='" & Replace(sLog,"\","\\") & "';"
       html = html & "loadinggif ='" & Replace(sLoad,"\","\\") & "';"
       log("")

       html = html & "</script>"
       html = html & "   </head>"
       html = html & "   <body>"
       html = html & "   <div id=""Header""><div id=""Legend""></div></div>"
       html = html & "   <div id=""Popup""></div>"
       html = html & "   <div id=""Hidden""></div>"
       html = html & "   <div id=""Status""></div>"
       html = html & " <div id=""DataScroll"">"
       html = html & " <div id=""Data"">"

       Dim abort : abort = false
       Dim interval : interval = 1
       log(tracks.count & " Tracks Selected")
       If tracks.count > 10000 Then
          interval = 100
       ElseIf tracks.count > 1000 Then
          interval = 25
       ElseIf tracks.count > 100 Then
          interval = 10
       ElseIf tracks.count = 0 Then
          Debug "No Tracks selected"
          log("No Tracks selected")
          Destroy
          Exit Sub
       End If

       Dim status : Set status = SDB.Objects("LyricatorStatus")

       Dim i
       Dim i2: i2 = 0
       For i = 0 to tracks.count - 1
          SDB.ProcessMessages
          If SDB.Objects("LyricatorWB") is nothing Then
             abort = true
             Exit For
          End If

          If (i + 1) Mod interval = 0 Then
             status.Caption = SDB.Localize("Loading " & (i+1) & "/" & (tracks.count) & " ...")
          End If

          With tracks.item(i)
             If .ID <> -1 Then
                i2 = i2 + 1
                html = html & "<div id=""" & .ID & """ class=""track"">"
                html = html & "<div class=""checkbox""><input type=""checkbox"" disabled=""true"" /></div>"
                html = html & "<div class=""trackindex"">" & i & "</div>"
                html = html & "<div class=""artist"">" & .ArtistName
                If TryAllArtists Then
                   If .Conductor <> "" And .Conductor <> .ArtistName Then html = html & ";" & .Conductor End If
                   If .InvolvedPeople <> "" And .InvolvedPeople <> .ArtistName Then html = html & ";" & .InvolvedPeople End If
                   If .Lyricist <> ""  And .Lyricist <> .ArtistName Then html = html & ";" & .Lyricist End If
                   If .MusicComposer <> "" And .MusicComposer <> .ArtistName Then html = html & ";" & .MusicComposer End If
                   If .OriginalArtist <> "" And .OriginalArtist <>.ArtistName Then html = html & ";" & .OriginalArtist End If
                   If .OriginalLyricist <> "" And .OriginalLyricist <> .ArtistName Then html = html & ";" & .OriginalLyricist End If
                End If
                html = html & "</div>"
                html = html & "<div class=""title"">" & .Title & "</div>"
                html = html & "<div class=""lyrics""></div>"
                html = html & "</div>"
                log("i[" & i & "] ID[" & .ID & "] A[" & .ArtistName & "] T[" & .Title & "]")
             Else
                log("Error i[" & i & "] ID[" & .ID & "] A[" & .ArtistName & "] T[" & .Title & "]")
             End If
          End With
       Next
       html = html & " </div>"
       html = html & " </div>"
       html = html & "   </body>"
       html = html & "</html>"

       status.Caption = ""
       SDB.ProcessMessages
       SDB.Objects("LyricatorTracks") = tracks

       html = Replace(html, ChrW(-257), "")

       if i2 = 0 Then
          log("No library tracks to process")
          abort = true
       End If

       If abort Then
          log("Lyricator aborted")
          Destroy
       Else
          log("Starting temp.html")

          Dim f : Set f = fso.OpenTextFile(sHTML, 2, true, -1) 'Owyn - Needs to be opened for Unicode
          f.WriteLine html
          f.close
          Set f = Nothing
          Set fLog = Nothing

          btnSave.Caption = SDB.Localize("&Save")
          btnSave.Common.Enabled = True

          btnCancel.Caption = SDB.Localize("C&lose")
          btnCancel.OnClickFunc = "OnCancel"

          WB.Interf.Navigate(sHTML)
       End If
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Function INIDefault(v, d)
       If v = "" Or v = "False" Then
       Debug v
          v = d
       End If
       INIDefault = v
    End Function
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Function Debug(s)
       Call SDB.MessageBox(s, mtInformation, Array(mbOk))
    End Function
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub OnStartUp
       Dim i : i = SDB.UI.AddOptionSheet("Lyricator", Script.ScriptPath, "InitSheet", "SaveSheet", -3)
       Dim but : Set but = SDB.Objects("LyricatorIcon")
       If (but Is Nothing) Then
          Set but = SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard,0,0)
          but.Caption = "Lyricator"
          but.IconIndex = SDB.RegisterIcon("Scripts\Lyricator\App.ico",0)
          but.UseScript = Script.ScriptPath
          but.OnClickFunc = "Toolbar"
          Set SDB.Objects("LyricatorIcon") = but
       End If
       Dim ini : Set ini = SDB.IniFile
       but.Visible = ini.BoolValue("Lyricator","ToolbarIcon")
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub Toolbar(but)
      Call Lyricator()
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub InitSheet(Sheet)
       Dim UI : Set UI = SDB.UI
       Dim ini : Set ini = SDB.IniFile

       Dim TryAllArtists : TryAllArtists = ini.BoolValue("Lyricator", "TryAllArtists")
       Dim TryCommaArtists : TryCommaArtists = ini.BoolValue("Lyricator", "TryCommaArtists")
       Dim TryCleanupWhiteSpace : TryCleanupWhiteSpace = ini.BoolValue("Lyricator", "TryCleanupWhiteSpace")
       Dim TryRejectSingleLine : TryRejectSingleLine = ini.BoolValue("Lyricator", "TryRejectSingleLine")

       Dim TrySingleLineSearch : TrySingleLineSearch = ini.StringValue("Lyricator", "TrySingleLineSearch")
       Dim TrySingleLineReplace : TrySingleLineReplace = ini.StringValue("Lyricator", "TrySingleLineReplace")

       Dim TryParensA : TryParensA = ini.BoolValue("Lyricator", "TryParensA")
       Dim TryBracketsA : TryBracketsA = ini.BoolValue("Lyricator", "TryBracketsA")
       Dim TryBracesA : TryBracesA = ini.BoolValue("Lyricator", "TryBracesA")
       Dim TryQuotesA : TryQuotesA = ini.BoolValue("Lyricator", "TryQuotesA")
       Dim TryTheA : TryTheA = ini.BoolValue("Lyricator", "TryTheA")
       Dim TryFeatA : TryFeatA = ini.BoolValue("Lyricator", "TryFeatA")
       Dim TrySplitArrayA : TrySplitArrayA = ini.StringValue("Lyricator", "TrySplitArrayA")
       Dim TryBlackListA : TryBlackListA = ini.StringValue("Lyricator", "TryBlackListA")

       Dim TryParensT : TryParensT = ini.BoolValue("Lyricator", "TryParensT")
       Dim TryBracketsT : TryBracketsT = ini.BoolValue("Lyricator", "TryBracketsT")
       Dim TryBracesT : TryBracesT = ini.BoolValue("Lyricator", "TryBracesT")
       Dim TryQuotesT : TryQuotesT = ini.BoolValue("Lyricator", "TryQuotesT")
       Dim TryTheT : TryTheT = ini.BoolValue("Lyricator", "TryTheT")
       Dim TryFeatT : TryFeatT = ini.BoolValue("Lyricator", "TryFeatT")
       Dim TrySplitArrayT : TrySplitArrayT = ini.StringValue("Lyricator", "TrySplitArrayT")
       Dim TryBlackListT : TryBlackListT = ini.StringValue("Lyricator", "TryBlackListT")

       Dim tryAZLyrics : tryAZLyrics = ini.BoolValue("Lyricator", "tryAZLyrics")
       Dim tryLyricWikia : tryLyricWikia = ini.BoolValue("Lyricator", "tryLyricWikia")
       Dim tryLyrDB : tryLyrDB = ini.BoolValue("Lyricator", "tryLyrDB")
       Dim tryLyricsVIP : tryLyricsVIP = ini.BoolValue("Lyricator", "tryLyricsVIP")
       Dim tryLetras : tryLetras = ini.BoolValue("Lyricator", "tryLetras")
       Dim tryLyricsMode : tryLyricsMode = ini.BoolValue("Lyricator", "tryLyricsMode")
       Dim tryMp3Lyrics : tryMp3Lyrics = ini.BoolValue("Lyricator", "tryMp3Lyrics")
       Dim trySeekALyric : trySeekALyric = ini.BoolValue("Lyricator", "trySeekALyric")
       Dim tryMetroLyrics : tryMetroLyrics = ini.BoolValue("Lyricator", "tryMetroLyrics")
       Dim tryELyrics : tryELyrics = ini.BoolValue("Lyricator", "tryELyrics")

       Dim TryAutoClose : TryAutoClose = ini.BoolValue("Lyricator", "TryAutoClose")
       Dim ToolbarIcon : ToolbarIcon = ini.BoolValue("Lyricator", "ToolbarIcon")

       Dim a : Set a = UI.NewGroupBox(Sheet) : a.Caption = "Artist Settings" : a.Common.SetRect 10, 12, 220, 240
       Dim t : Set t = UI.NewGroupBox(Sheet) : t.Caption = "Title Settings"  : t.Common.SetRect 240, 12, 230, 210
       Dim l : Set l = UI.NewGroupBox(Sheet) : l.Caption = "Lyrics" : l.Common.SetRect 10, 257, 220, 170
       Dim s : Set s = UI.NewGroupBox(Sheet) : s.Caption = "Sources"  : s.Common.SetRect 240, 223, 230, 220
       Dim g : Set g = UI.NewGroupBox(Sheet) : g.Caption = "General"  : g.Common.SetRect 240, 450, 230, 55
       Dim ls : Set ls = UI.NewGroupBox(l) : ls.Caption = "Single-Line Lyrics"  : ls.Common.SetRect 10, 68, 205, 100

       Dim e
       Set e = UI.NewLabel(Sheet)
       e.Caption = "v" & sVersion & " "
       e.Common.Align = 4 ' Right
       e.Common.FontColor = &HF0 'Dark red

       Set e = UI.NewCheckbox(t)
       e.Common.SetRect 15, 60, 250, 20
       e.Common.ControlName = "TryBracesT"
       e.Common.Hint = "Remove anything within braces {}"
       e.Caption = Translate("Remove Within Braces")
       e.Checked = TryBracesT

       Set e = UI.NewCheckbox(a)
       e.Common.SetRect 15, 20, 250, 20
       e.Common.ControlName = "TryParensA"
       e.Common.Hint = "Remove anything within parentheses ()"
       e.Caption = Translate("Remove Within Parentheses")
       e.Checked = TryParensA

       Set e = UI.NewCheckbox(a)
       e.Common.SetRect 15, 40, 250, 20
       e.Common.ControlName = "TryBracketsA"
       e.Common.Hint = "Remove anything within brackets []"
       e.Caption = Translate("Remove Within Brackets")
       e.Checked = TryBracketsA

       Set e = UI.NewCheckbox(a)
       e.Common.SetRect 15, 60, 250, 20
       e.Common.ControlName = "TryBracesA"
       e.Common.Hint = "Remove anything within braces {}"
       e.Caption = Translate("Remove Within Braces")
       e.Checked = TryBracesA

       Set e = UI.NewCheckbox(a)
       e.Common.SetRect 15, 80, 250, 20
       e.Common.ControlName = "TryQuotesA"
       e.Common.Hint = "Ignore single- and double-quotation marks"
       e.Caption = Translate("Ignore Single/Double Quotes")
       e.Checked = TryQuotesA

       Set e = UI.NewCheckbox(a)
       e.Common.SetRect 15, 100, 250, 20
       e.Common.ControlName = "TryTheA"
       e.Common.Hint = "Try removing 'The'. Example 'The Offsping' to 'Offsping'."
       e.Caption = Translate("Try removing 'The' from results")
       e.Checked = TryTheA

       Set e = UI.NewCheckbox(a)
       e.Common.SetRect 15, 120, 250, 20
       e.Common.ControlName = "TryFeatA"
       e.Common.Hint = "Try removing 'Feat'. Example 'The Offsping' to 'Offsping'."
       e.Caption = Translate("Try removing 'Featuring' combinations")
       e.Checked = TryFeatA

       Set e = UI.NewCheckbox(a)
       e.Common.SetRect 15, 140, 250, 20
       e.Common.ControlName = "TryAllArtists"
       e.Common.Hint = "Attempt all artists (separated by semi-colon)"
       e.Caption = Translate("Attempt All Artists")
       e.Checked = TryAllArtists

       Set e = UI.NewCheckbox(a)
       e.Common.SetRect 15, 160, 250, 20
       e.Common.ControlName = "TryCommaArtists"
       e.Common.Hint = "Convert ""Surname, Name"" to ""Name Surname"""
       e.Caption = Translate("Fix Comma Surnames")
       e.Checked = TryCommaArtists

       Set e = UI.NewLabel(a)
       e.Alignment = 0
       e.Autosize = False
       e.Common.SetRect 15, 190, 200, 20
       e.Caption = Translate("Delimiter Array") & ":"

       Set e = ui.NewEdit(a)
       e.Common.SetRect 100, 187, 100, 17
       e.Common.ControlName = "TrySplitArrayA"
       e.Common.Hint = "Semi-colon-separated delimeter array"
       e.Text = TrySplitArrayA

       Set e = UI.NewLabel(a)
       e.Alignment = 0
       e.Autosize = False
       e.Common.SetRect 15, 215, 200, 20
       e.Caption = Translate("Black List") & ":"

       Set e = ui.NewEdit(a)
       e.Common.SetRect 100, 212, 100, 17
       e.Common.ControlName = "TryBlackListA"
       e.Common.Hint = "Semi-colon-separated Black List (ignore these words)"
       e.Text = TryBlackListA

       Set e = UI.NewCheckbox(t)
       e.Common.SetRect 15, 20, 250, 20
       e.Common.ControlName = "TryParensT"
       e.Common.Hint = "Remove anything within parentheses ()"
       e.Caption = Translate("Remove Within Parentheses")
       e.Checked = TryParensT

       Set e = UI.NewCheckbox(t)
       e.Common.SetRect 15, 40, 250, 20
       e.Common.ControlName = "TryBracketsT"
       e.Common.Hint = "Remove anything within brackets []"
       e.Caption = Translate("Remove Within Brackets")
       e.Checked = TryBracketsT

       Set e = UI.NewCheckbox(t)
       e.Common.SetRect 15, 60, 250, 20
       e.Common.ControlName = "TryBracesT"
       e.Common.Hint = "Remove anything within braces {}"
       e.Caption = Translate("Remove Within Braces")
       e.Checked = TryBracesT

       Set e = UI.NewCheckbox(t)
       e.Common.SetRect 15, 80, 250, 20
       e.Common.ControlName = "TryQuotesT"
       e.Common.Hint = "Ignore single- and double-quotation marks"
       e.Caption = Translate("Ignore Single/Double Quotes")
       e.Checked = TryQuotesT

       Set e = UI.NewCheckbox(t)
       e.Common.SetRect 15, 100, 250, 20
       e.Common.ControlName = "TryTheT"
       e.Common.Hint = "Try removing 'The'. Example 'The Offsping' to 'Offsping'."
       e.Caption = Translate("Try removing 'The' from results")
       e.Checked = TryTheT

       Set e = UI.NewCheckbox(t)
       e.Common.SetRect 15, 120, 250, 20
       e.Common.ControlName = "TryFeatT"
       e.Common.Hint = "Try removing 'Feat'. Example 'The Offsping' to 'Offsping'."
       e.Caption = Translate("Try removing 'Featuring' combinations")
       e.Checked = TryFeatT

       Set e = UI.NewLabel(t)
       e.Alignment = 0
       e.Autosize = False
       e.Common.SetRect 15, 150, 200, 20
       e.Caption = Translate("Delimiter Array") & ":"

       Set e = ui.NewEdit(t)
       e.Common.SetRect 100, 147, 100, 17
       e.Common.ControlName = "TrySplitArrayT"
       e.Common.Hint = "Semi-colon-separated delimeter array"
       e.Text = TrySplitArrayT

       Set e = UI.NewLabel(t)
       e.Alignment = 0
       e.Autosize = False
       e.Common.SetRect 15, 180, 200, 20
       e.Caption = Translate("Black List") & ":"

       Set e = ui.NewEdit(t)
       e.Common.SetRect 100, 177, 100, 17
       e.Common.ControlName = "TryBlackListT"
       e.Common.Hint = "Semi-colon-separated Black List (ignore these words)"
       e.Text = TryBlackListT

       Set e = UI.NewCheckbox(l)
       e.Common.SetRect 15, 20, 250, 20
       e.Common.ControlName = "TryCleanupWhiteSpace"
       e.Common.Hint = "Consolidate excess white-space (e.g. three or more line breaks)"
       e.Caption = Translate("Cleanup Whitespace")
       e.Checked = TryCleanupWhiteSpace

       Set e = UI.NewCheckbox(ls)
       e.Common.SetRect 15, 20, 250, 20
       e.Common.ControlName = "TryRejectSingleLine"
       e.Common.Hint = "Ignore lyrics that contain only one single line"
       e.Caption = Translate("Ignore")
       e.Checked = TryRejectSingleLine

       Set e = UI.NewLabel(ls)
       e.Alignment = 0
       e.Autosize = False
       e.Common.SetRect 15, 50, 200, 20
       e.Caption = Translate("Search String") & ":"

       Set e = ui.NewEdit(ls)
       e.Common.SetRect 100, 47, 100, 17
       e.Common.ControlName = "TrySingleLineSearch"
       e.Common.Hint = "Single-Line Search String"
       e.Text = TrySingleLineSearch

       Set e = UI.NewLabel(ls)
       e.Alignment = 0
       e.Autosize = False
       e.Common.SetRect 15, 80, 200, 20
       e.Caption = Translate("Replace String") & ":"

       Set e = ui.NewEdit(ls)
       e.Common.SetRect 100, 75, 100, 17
       e.Common.ControlName = "TrySingleLineReplace"
       e.Common.Hint = "Single-Line Replace String"
       e.Text = TrySingleLineReplace

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 20, 250, 20
       e.Common.ControlName = "tryAZLyrics"
       e.Common.Hint = "Search using www.AZLyrics.com"
       e.Caption = Translate("www.AZLyrics.com")
       e.Checked = tryAZLyrics

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 40, 250, 20
       e.Common.ControlName = "tryLyricWikia"
       e.Common.Hint = "Search using Lyric.Wikia.com"
       e.Caption = Translate("Lyric.Wikia.com")
       e.Checked = tryLyricWikia

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 60, 250, 20
       e.Common.ControlName = "tryLyrDB"
       e.Common.Hint = "Search using www.LyrDB.com"
       e.Caption = Translate("www.LyrDB.com")
       e.Checked = tryLyrDB

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 80, 250, 20
       e.Common.ControlName = "tryLyricsVIP"
       e.Common.Hint = "Status of site is unknown but doesn't appear to work anymore. May get removed."
       e.Caption = Translate("www.LyricsVIP.com (no longer works)")
       e.Checked = tryLyricsVIP

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 100, 250, 20
       e.Common.ControlName = "tryLetras"
       e.Common.Hint = "Search using letras.mus.br. Site can sometimes give odd lyric results, so scrutinize any matches from here."
       e.Caption = Translate("letras.mus.br (Can be Unreliable)")
       e.Checked = tryLetras

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 120, 250, 20
       e.Common.ControlName = "tryLyricsMode"
       e.Common.Hint = "Search using www.lyricsmode.com"
       e.Caption = Translate("www.lyricsmode.com")
       e.Checked = tryLyricsMode

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 140, 250, 20
       e.Common.ControlName = "tryMp3Lyrics"
       e.Common.Hint = "Search using www.mp3lyrics.org"
       e.Caption = Translate("www.mp3lyrics.org")
       e.Checked = tryMp3Lyrics

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 160, 250, 20
       e.Common.ControlName = "trySeekALyric"
       e.Common.Hint = "Search using www.seekalyric.com"
       e.Caption = Translate("www.seekalyric.com")
       e.Checked = trySeekALyric

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 180, 250, 20
       e.Common.ControlName = "tryMetroLyrics"
       e.Common.Hint = "Search using www.metrolyrics.com"
       e.Caption = Translate("www.metrolyrics.com")
       e.Checked = tryMetroLyrics

       Set e = UI.NewCheckbox(s)
       e.Common.SetRect 15, 200, 250, 20
       e.Common.ControlName = "tryELyrics"
       e.Common.Hint = "Search using www.elyrics.net"
       e.Caption = Translate("www.elyrics.net")
       e.Checked = tryELyrics

       Set e = UI.NewCheckbox(g)
       e.Common.SetRect 15, 15, 250, 20
       e.Common.ControlName = "TryAutoClose"
       e.Common.Hint = "Auto-Close when done saving lyrics"
       e.Caption = Translate("Auto-Close After Save")
       e.Checked = TryAutoClose

       Set e = UI.NewCheckbox(g)
       e.Common.SetRect 15, 35, 250, 20
       e.Common.ControlName = "ToolbarIcon"
       e.Common.Hint = "Create a short on the toolbar to run Lyricator"
       e.Caption = Translate("Enabletoolbar icon")
       e.Checked = ToolbarIcon
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub SaveSheet(Sheet)
       Dim ini : Set ini = SDB.IniFile

       ini.BoolValue("Lyricator", "TryAllArtists") = Sheet.Common.ChildControl("TryAllArtists").Checked
       ini.BoolValue("Lyricator", "TryCommaArtists") = Sheet.Common.ChildControl("TryCommaArtists").Checked
       ini.BoolValue("Lyricator", "TryCleanupWhiteSpace") = Sheet.Common.ChildControl("TryCleanupWhiteSpace").Checked
       ini.BoolValue("Lyricator", "TryRejectSingleLine") = Sheet.Common.ChildControl("TryRejectSingleLine").Checked

       ini.StringValue("Lyricator", "TrySingleLineSearch") = Sheet.Common.ChildControl("TrySingleLineSearch").Text
       ini.StringValue("Lyricator", "TrySingleLineReplace") = Sheet.Common.ChildControl("TrySingleLineReplace").Text

       ini.BoolValue("Lyricator", "TryParensA") = Sheet.Common.ChildControl("TryParensA").Checked
       ini.BoolValue("Lyricator", "TryBracketsA") = Sheet.Common.ChildControl("TryBracketsA").Checked
       ini.BoolValue("Lyricator", "TryBracesA") = Sheet.Common.ChildControl("TryBracesA").Checked
       ini.BoolValue("Lyricator", "TryQuotesA") = Sheet.Common.ChildControl("TryQuotesA").Checked
       ini.BoolValue("Lyricator", "TryTheA") = Sheet.Common.ChildControl("TryTheA").Checked
       ini.BoolValue("Lyricator", "TryFeatA") = Sheet.Common.ChildControl("TryFeatA").Checked
       ini.StringValue("Lyricator", "TrySplitArrayA") = Sheet.Common.ChildControl("TrySplitArrayA").Text
       ini.StringValue("Lyricator", "TryBlackListA") = Sheet.Common.ChildControl("TryBlackListA").Text

       ini.BoolValue("Lyricator", "TryParensT") = Sheet.Common.ChildControl("TryParensT").Checked
       ini.BoolValue("Lyricator", "TryBracketsT") = Sheet.Common.ChildControl("TryBracketsT").Checked
       ini.BoolValue("Lyricator", "TryBracesT") = Sheet.Common.ChildControl("TryBracesT").Checked
       ini.BoolValue("Lyricator", "TryQuotesT") = Sheet.Common.ChildControl("TryQuotesT").Checked
       ini.BoolValue("Lyricator", "TryTheT") = Sheet.Common.ChildControl("TryTheT").Checked
       ini.BoolValue("Lyricator", "TryFeatT") = Sheet.Common.ChildControl("TryFeatT").Checked
       ini.StringValue("Lyricator", "TrySplitArrayT") = Sheet.Common.ChildControl("TrySplitArrayT").Text
       ini.StringValue("Lyricator", "TryBlackListT") = Sheet.Common.ChildControl("TryBlackListT").Text

       If Not Sheet.Common.ChildControl("trySeekALyric").Checked And Not Sheet.Common.ChildControl("tryAZLyrics").Checked And Not Sheet.Common.ChildControl("tryLyricsVIP").Checked And Not Sheet.Common.ChildControl("tryLyricWikia").Checked And Not Sheet.Common.ChildControl("tryLyrDB").Checked And Not Sheet.Common.ChildControl("tryLetras").Checked And Not Sheet.Common.ChildControl("tryLyricsMode").Checked And Not Sheet.Common.ChildControl("tryMp3Lyrics").Checked And Not Sheet.Common.ChildControl("tryMetroLyrics").Checked And Not Sheet.Common.ChildControl("tryELyrics").Checked Then
          Debug "You Must Have One Lyric Server Checked" & vbnewline & vbnewline & "Enabling: AZLyrics.com, Lyric.Wikia.com, LyrDB.com and LyricsVIP.com"
          Sheet.Common.ChildControl("tryAZLyrics").Checked = True
          Sheet.Common.ChildControl("tryLyricWikia").Checked = True
          Sheet.Common.ChildControl("tryLyrDB").Checked = True
          Sheet.Common.ChildControl("tryLyricsVIP").Checked = True
          Sheet.Common.ChildControl("tryLyricsMode").Checked = True
          Sheet.Common.ChildControl("tryMp3Lyrics").Checked = True
          Sheet.Common.ChildControl("trySeekALyric").Checked = True
          Sheet.Common.ChildControl("tryMetroLyrics").Checked = True
          Sheet.Common.ChildControl("tryELyrics").Checked = True
       End If

       ini.BoolValue("Lyricator", "tryAZLyrics") = Sheet.Common.ChildControl("tryAZLyrics").Checked
       ini.BoolValue("Lyricator", "tryLyricWikia") = Sheet.Common.ChildControl("tryLyricWikia").Checked
       ini.BoolValue("Lyricator", "tryLyrDB") = Sheet.Common.ChildControl("tryLyrDB").Checked
       ini.BoolValue("Lyricator", "tryLyricsVIP") = Sheet.Common.ChildControl("tryLyricsVIP").Checked
       ini.BoolValue("Lyricator", "tryLetras") = Sheet.Common.ChildControl("tryLetras").Checked
       ini.BoolValue("Lyricator", "tryLyricsMode") = Sheet.Common.ChildControl("tryLyricsMode").Checked
       ini.BoolValue("Lyricator", "tryMp3Lyrics") = Sheet.Common.ChildControl("tryMp3Lyrics").Checked
       ini.BoolValue("Lyricator", "trySeekALyric") = Sheet.Common.ChildControl("trySeekALyric").Checked
       ini.BoolValue("Lyricator", "tryMetroLyrics") = Sheet.Common.ChildControl("tryMetroLyrics").Checked
       ini.BoolValue("Lyricator", "tryELyrics") = Sheet.Common.ChildControl("tryELyrics").Checked

       ini.BoolValue("Lyricator", "TryAutoClose") = Sheet.Common.ChildControl("TryAutoClose").Checked
       ini.BoolValue("Lyricator", "ToolbarIcon") = Sheet.Common.ChildControl("ToolbarIcon").Checked

       Dim but : Set but = SDB.Objects("LyricatorIcon")
       but.Visible = ini.BoolValue("Lyricator","ToolbarIcon")
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Function Translate(str)
       Translate = str
       Dim dic : Set dic = SDB.Objects("LyrDict")
       If Not (dic Is Nothing) Then
          If dic.Exists(str) Then
             Translate = dic.Item(str)
          End If
       End If
    End Function
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub Install()
       Dim iniFile : iniFile = SDB.ApplicationPath & "Scripts\Scripts.ini"
       Dim f : Set f = SDB.Tools.IniFileByPath(iniFile)
       If Not (f Is Nothing) Then
          f.StringValue("Lyricator", "Filename") = "Auto\lyricator.vbs"
          f.StringValue("Lyricator", "Procname") = "Lyricator"
          f.StringValue("Lyricator", "Order") = "99"
          f.StringValue("Lyricator", "DisplayName") = "Lyricator"
          f.StringValue("Lyricator", "Description") = "Batch Import Lyrics"
          f.StringValue("Lyricator", "Language") = "VBScript"
          f.StringValue("Lyricator", "ScriptType") = "0"
          SDB.RefreshScriptItems
       End If

       Dim ini : Set ini = SDB.IniFile

       If Not ini.BoolValue("Lyricator", "TryAllArtists") Then ini.BoolValue("Lyricator", "TryAllArtists") = False End If
       If Not ini.BoolValue("Lyricator", "TryCommaArtists") Then ini.BoolValue("Lyricator", "TryCommaArtists") = True End If
       If Not ini.BoolValue("Lyricator", "TryCleanupWhiteSpace") Then ini.BoolValue("Lyricator", "TryCleanupWhiteSpace") = True End If
       If Not ini.BoolValue("Lyricator", "TryRejectSingleLine") Then ini.BoolValue("Lyricator", "TryRejectSingleLine") = False End If

       If ini.StringValue("Lyricator", "TrySingleLineSearch") = "" Then ini.StringValue("Lyricator", "TrySingleLineSearch") = "Instr" End If
       If ini.StringValue("Lyricator", "TrySingleLineReplace") = "" Then ini.StringValue("Lyricator", "TrySingleLineReplace") = "[Instrumental]" End If

       If Not ini.BoolValue("Lyricator", "TryParensA") Then ini.BoolValue("Lyricator", "TryParensA") = True End If
       If Not ini.BoolValue("Lyricator", "TryBracketsA") Then ini.BoolValue("Lyricator", "TryBracketsA") = True End If
       If Not ini.BoolValue("Lyricator", "TryBracesA") Then ini.BoolValue("Lyricator", "TryBracesA") = True End If
       If Not ini.BoolValue("Lyricator", "TryQuotesA") Then ini.BoolValue("Lyricator", "TryQuotesA") = True End If
       If Not ini.BoolValue("Lyricator", "TryTheA") Then ini.BoolValue("Lyricator", "TryTheA") = True End If
       If Not ini.BoolValue("Lyricator", "TryFeatA") Then ini.BoolValue("Lyricator", "TryFeatA") = True End If
       If ini.StringValue("Lyricator", "TrySplitArrayA") = "" Then ini.StringValue("Lyricator", "TrySplitArrayA") = "and;&;+" End If
       If ini.StringValue("Lyricator", "TryBlackListA") = "" Then ini.StringValue("Lyricator", "TryBlackListA") = "" End If

       If Not ini.BoolValue("Lyricator", "TryParensT") Then ini.BoolValue("Lyricator", "TryParensT") = True End If
       If Not ini.BoolValue("Lyricator", "TryBracketsT") Then ini.BoolValue("Lyricator", "TryBracketsT") = True End If
       If Not ini.BoolValue("Lyricator", "TryBracesT") Then ini.BoolValue("Lyricator", "TryBracesT") = True End If
       If Not ini.BoolValue("Lyricator", "TryQuotesT") Then ini.BoolValue("Lyricator", "TryQuotesT") = True End If
       If Not ini.BoolValue("Lyricator", "TryTheT") Then ini.BoolValue("Lyricator", "TryTheT") = True End If
       If Not ini.BoolValue("Lyricator", "TryFeatT") Then ini.BoolValue("Lyricator", "TryFeatT") = True End If
       If ini.StringValue("Lyricator", "TrySplitArrayT") = "" Then ini.StringValue("Lyricator", "TrySplitArrayT") = "" End If
       If ini.StringValue("Lyricator", "TryBlackListT") = "" Then ini.StringValue("Lyricator", "TryBlackListT") = "Medley" End If

       If Not ini.BoolValue("Lyricator", "tryAZLyrics") Then ini.BoolValue("Lyricator", "tryAZLyrics") = True End If
       If Not ini.BoolValue("Lyricator", "tryLyricWikia") Then ini.BoolValue("Lyricator", "tryLyricWikia") = True End If
       If Not ini.BoolValue("Lyricator", "tryLyrDB") Then ini.BoolValue("Lyricator", "tryLyrDB") = True End If
       If Not ini.BoolValue("Lyricator", "tryLyricsVIP") Then ini.BoolValue("Lyricator", "tryLyricsVIP") = True End If
       If Not ini.BoolValue("Lyricator", "tryLetras") Then ini.BoolValue("Lyricator", "tryLetras") = False End If
       If Not ini.BoolValue("Lyricator", "tryLyricsMode") Then ini.BoolValue("Lyricator", "tryLyricsMode") = True End If
       If Not ini.BoolValue("Lyricator", "tryMetroLyrics") Then ini.BoolValue("Lyricator", "tryMetroLyrics") = True End If
       If Not ini.BoolValue("Lyricator", "tryELyrics") Then ini.BoolValue("Lyricator", "tryELyrics") = True End If

       If Not ini.BoolValue("Lyricator", "TryAutoClose") Then ini.BoolValue("Lyricator", "TryAutoClose") = True End If
       If Not ini.BoolValue("Lyricator", "ToolbarIcon") Then ini.BoolValue("Lyricator", "ToolbarIcon") = True End If

       Debug "You'll need to restart MediaMonkey for Lyrictor to work correctly."
    End Sub

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' "Dreams"/Ideas (Search: *** TO DO ***):
    ' > Improve "CleanUp" - Remove spaces at end of lines, Auto-Case etc
    ' > Improve "search" order when bruteforcing - search AlbumArtist THEN add other names (reserve of the current method!)
    ' > Improve bruteforcing - with track title remove = ,-,(Half Brackets, etc Artist, albumartist
    ' Add "Lyrics on the fly" option - Save as soon as lyrics are downloaded
    ' "Use another source" option
    ' Tag missing album art/id3 info
    ' Upload to a source if already found to APIs (Help support sites) - or create our own?
    ' "Hide all tracks that DON'T have lyrics" option
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    '####################################################################
    ' Added by C:\Program Files (x86)\MediaMonkey\Scripts\Auto\RightClickForScripts.vbs
    Sub RightClickForScripts_Lyricator(o)
        Lyricator
    End Sub
    '####################################################################
ImageSpoon!
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Lyricator v1.1.1 #33 (2010-12-16)

Post by thehammer »

lyricator.js:

Code: Select all

//  1.1.1.33 (2013-01-01)
//     - Add: elyrics.net as source
//     - Fix: Letras, LyricsMode, Mp3Lyrics, MetroLyrics, SeekALyric working again
//     - Fix: AZLyrics, LyrDB, MetroLyrics, ELyrics, Mp3Lyrics, LyricsMode, SeekALyric support single quote in artist and song title
//     - Fix: removed MySql warnings from lyrics returned by LyrDB
//     - Update: change LyricsSongs to the actual new name of the service(Letras)
//  1.1.1.32 (2013-03-28)
//     - Add: lyricsmode.com, lyrics.com, seekalyric.com, metrolyrics.com as sources

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

var currentTrack = -1;
var foundTracks = 0;
var currentArtist = 0;
var currentTitle = 0;
var currentRequest = 0;
var cachedArtist;
var cachedTitle;
var cachedTrack;
var loading;
var status;
var tracks;
var artistFirstChar;

var tryAZLyrics;
var rAZLyrics;
var tryLyricWikia;
var rLyricWikia;
var tryLyrDB;
var rLyrDB;
var tryLyricsVIP;
var rLyricsVIP;
var tryLetras;
var rLetras;
var tryLyricsMode;
var rLyricsMode;
var tryMp3Lyrics;
var rMp3Lyrics;
var trySeekALyric;
var rSeekALyric;
var tryMetroLyrics;
var rMetroLyrics;
var tryELyrics;
var rELyrics;

var aA = new Array();
var aT = new Array();
var aR = new Array();

var bruteForce = false;
var tryCleanupWhitespace = false;
var tryAllArtists = false;
var tryCommaArtists = false;
var tryRejectSingleLine = false;
var trySingleLineSearch = ''; var trySingleLineReplace = '';
var tryParensA = false; var tryParensT = false;
var tryBracketsA = false; var tryBracketsT = false;
var tryBracesA = false; var tryBracesT = false;
var tryQuotesA = false; var tryQuotesT = false;
var tryTheA = false; var tryTheT = false;
var tryFeatA = false; var tryFeatT = false;
var trySplitArrayA = ''; var trySplitArrayT = '';
var tryBlackListA = ''; var tryBlackListT = '';
var artistFirstChar = '';


var bDebug = false;
var paused = false;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var init = function() {
   if(tryAZLyrics) {
      rAZLyrics = new Request({method:'get',onSuccess:rSuccessAZLyrics,onException:rNextAZLyrics,onFailure:rNextAZLyrics,onCancel:rNextAZLyrics});
      rAZLyrics.host = 'http://www.azlyrics.com/lyrics/%artist%/%title%.html';
      rAZLyrics.sendString = '';
      rAZLyrics.timeout = '20000';
      rAZLyrics.name = 'AZ Lyrics';
      rAZLyrics.className = 'AZLyrics';

      aR.include(rAZLyrics);
   }
   if(tryLyricWikia) {
      rLyricWikia = new Request({method:'get',onSuccess:rSuccessLyricWikia,onException:rNextLyricWikia,onFailure:rNextLyricWikia,onCancel:rNextLyricWikia});
      rLyricWikia.host = 'http://lyrics.wikia.com/%artist%:%title%';
      rLyricWikia.sendString = '';
      rLyricWikia.timeout = '20000';
      rLyricWikia.name = 'Lyrics Wiki';
      rLyricWikia.className = 'LyricWikia';

      aR.include(rLyricWikia);
   }
   if(tryLyricsVIP) {
      rLyricsVIP = new Request({method:'get',onSuccess:rSuccessLyricsVIP,onException:rNextLyricsVIP,onFailure:rNextLyricsVIP,onCancel:rNextLyricsVIP});
      rLyricsVIP.host = 'http://www.lyricsvip.com/%artist%/%title%-Lyrics.html';
      rLyricsVIP.sendString = '';
      rLyricsVIP.timeout = '20000';
      rLyricsVIP.name = 'Lyrics VIP';
      rLyricsVIP.className = 'LyricsVIP';

      aR.include(rLyricsVIP);
   }
   if(tryLetras) {
      rLetras = new Request({method:'get',onSuccess:rSuccessLetras,onException:rNextLetras,onFailure:rNextLetras,onCancel:rNextLetras});
      rLetras.host = 'http://letras.mus.br/winamp.php?artista=%artist%&musica=%title%';
      rLetras.sendString = 'artista=%artist%&musica=%title%';
      rLetras.timeout = '20000';
      rLetras.name = 'Letras';
      rLetras.className = 'Letras';

      aR.include(rLetras);
   }
   if(tryLyricsMode) {
      rLyricsMode = new Request({method:'get',onSuccess:rSuccessLyricsMode,onException:rNextLyricsMode,onFailure:rNextLyricsMode,onCancel:rNextLyricsMode});
      rLyricsMode.host = 'http://www.lyricsmode.com/lyrics/%artistfirstchar%/%artist%/%title%.html';
      rLyricsMode.sendString = '';
      rLyricsMode.timeout = '20000';
      rLyricsMode.name = 'Lyrics Mode';
      rLyricsMode.className = 'LyricsMode';

      aR.include(rLyricsMode);
   }
   if(tryMp3Lyrics) {
      rMp3Lyrics = new Request({method:'get',onSuccess:rSuccessMp3Lyrics,onException:rNextMp3Lyrics,onFailure:rNextMp3Lyrics,onCancel:rNextMp3Lyrics});
      rMp3Lyrics.host = 'http://www.mp3lyrics.org/%artist%/%title%';
      rMp3Lyrics.sendString = '';
      rMp3Lyrics.timeout = '20000';
      rMp3Lyrics.name = 'Mp3Lyrics';
      rMp3Lyrics.className = 'Mp3Lyrics';

      aR.include(rMp3Lyrics);
   }
   if(trySeekALyric) {
      rSeekALyric = new Request({method:'get',onSuccess:rSuccessSeekALyric,onException:rNextSeekALyric,onFailure:rNextSeekALyric,onCancel:rNextSeekALyric});
      rSeekALyric.host = 'http://www.seekalyric.com/song/%artist%/%title%';
      rSeekALyric.sendString = '';
      rSeekALyric.timeout = '20000';
      rSeekALyric.name = 'Seek A Lyric';
      rSeekALyric.className = 'SeekALyric';

      aR.include(rSeekALyric);
   }
   if(tryMetroLyrics) {
      rMetroLyrics = new Request({method:'get',onSuccess:rSuccessMetroLyrics,onException:rNextMetroLyrics,onFailure:rNextMetroLyrics,onCancel:rNextMetroLyrics});
      rMetroLyrics.host = 'http://www.metrolyrics.com/%title%-lyrics-%artist%.html';
      rMetroLyrics.sendString = '';
      rMetroLyrics.timeout = '20000';
      rMetroLyrics.name = 'Metro Lyrics';
      rMetroLyrics.className = 'MetroLyrics';

      aR.include(rMetroLyrics);
   }
   if(tryLyrDB) {
      rLyrDB = new Request({method:'get',onSuccess:rSuccessLyrDB,onException:rNextLyrDB,onFailure:rNextLyrDB,onCancel:rNextLyrDB});
      rLyrDB.host = 'http://webservices.lyrdb.com/lookup.php?for=match&q=%artist%|%title%&agent=MediaMonkey';
      rLyrDB.sendString = '';
      rLyrDB.timeout = '20000';
      rLyrDB.name = 'Lyr DB';
      rLyrDB.className = 'LyrDB';

      aR.include(rLyrDB);
   }
   if(tryELyrics) {
      rELyrics = new Request({method:'get',onSuccess:rSuccessELyrics,onException:rNextELyrics,onFailure:rNextELyrics,onCancel:rNextELyrics});
      rELyrics.host = 'http://www.elyrics.net/read/%artistfirstchar%/%artist%-lyrics/%title%-lyrics.html';
      rELyrics.sendString = '';
      rELyrics.timeout = '20000';
      rELyrics.name = 'ELyrics';
      rELyrics.className = 'ELyrics';

      aR.include(rELyrics);
   }

   bruteForce = tryAllArtists || tryCommaArtists || tryParensA || tryBracketsA || tryBracesA || trySplitArrayA || tryParensT || tryBracketsT || tryBracesT || trySplitArrayT;

   loading = new Asset.image(loadinggif);
   status = $('Status');
   tracks = $$('div[class=track]');
   if(!tracks.length) return;
   tracks.each(
      function(e) {
         e.addEvent('click', trackClick);
         e.addEvent('mouseover', trackOver);
         e.addEvent('mouseout', trackOut);
         e.addEvent('contextmenu', trackContextMenu);
      }
   )
   $$('input[type=checkbox]').each(function(e) { e.addEvent('click', function() {if(!e.checked) e.parentNode.parentNode.addClass('unchecked'); else e.parentNode.parentNode.removeClass('unchecked'); window.event.cancelBubble = true;});});
   $('Header').innerHTML = '<button id="PauseButton" onclick="pause();">Pause</button><span id="GlobalStatus"></span><span id="GlobalStats"></span><span id="GlobalHost"></span><br><br><span id="Legend">Legend: </span>';
   if(tryAZLyrics) {  $('Header').innerHTML += '<span class="textAZLyrics">AZLyrics</span> ' ; }
   if(tryLyricWikia) {  $('Header').innerHTML += '<span class="textLyricWikia">LyricWikia</span> ' ; }
   if(tryLyrDB) {  $('Header').innerHTML += '<span class="textLyrDB">LyrDB</span> ' ; }
   if(tryLyricsVIP) {  $('Header').innerHTML += '<span class="textLyricsVIP">LyricsVIP</span> ' ; }
   if(tryLetras) {  $('Header').innerHTML += '<span class="textLetras">Letras</span> ' ; }
   if(tryLyricsMode) {  $('Header').innerHTML += '<span class="textLyricsMode">LyricsMode</span> ' ; }
   if(tryMp3Lyrics) {  $('Header').innerHTML += '<span class="textMp3Lyrics">Mp3Lyrics</span> ' ; }
   if(trySeekALyric) {  $('Header').innerHTML += '<span class="textSeekALyric">SeekALyric</span> ' ; }
   if(tryMetroLyrics) {  $('Header').innerHTML += '<span class="textMetroLyrics">MetroLyrics</span> ' ; }
   if(tryELyrics) {  $('Header').innerHTML += '<span class="textELyrics">ELyrics</span> ' ; }
   $('Popup').innerHTML = '<button onclick="updateLyrics();">Update Lyrics</button><button onclick="closeLyrics();">Cancel changes</button><br /><textarea id="PopupLyrics"></textarea>';

   whatNext(null, null, null, true);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var rNextAZLyrics = function() { whatNext(''); }
var rNextLyricWikia = function() { whatNext(''); }
var rNextLyrDB = function() { whatNext(''); }
var rNextLyricsVIP = function() { whatNext(''); }
var rNextLetras = function() { whatNext(''); }
var rNextLyricsMode = function() { whatNext(''); }
var rNextMp3Lyrics = function() { whatNext(''); }
var rNextSeekALyric = function() { whatNext(''); }
var rNextMetroLyrics = function() { whatNext(''); }
var rNextELyrics = function() { whatNext(''); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var rSuccessAZLyrics = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<!-- start of lyrics -->')[1].split('<!-- end of lyrics -->')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<title>')[1].split('</title>')[0].trim().split('LYRICS -')[0].trim();
         t = html.split('<title>')[1].split('</title>')[0].trim().split('LYRICS -')[1].trim();
         l += "<br><br><br>Lyrics provided by: AZLyrics.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessLyricWikia = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<div class=\'lyricbox\'>')[1].split('<!--')[0].trim();
      l = cleanupLyrics(l);
      l = l.substr(2,l.length-2);
      if(l) {
         a = html.split('<title>')[1].split('Lyrics - LyricWiki')[0].trim().split(':')[0].trim();
         t = html.split('<title>')[1].split('Lyrics - LyricWiki')[0].trim().split(':')[1].trim();
         l += "<br><br><br>Lyrics provided by: Lyric.Wikia.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessLyrDB = function(html, xml) {
   var l = '';  var a = '';   var t = '';  var id = '';
   try {
      id = html.split('\\')[0].split('\n')[0];
      if(id.length != 0) {
          a = html.split('\\')[2].split('\n')[0];
          t = html.split('\\')[1].split('\n')[0];
          rLyrDB = new Request({method:'get', onSuccess: function(responseText) {
                                   l = cleanupLyrics(responseText.replace(/(\r\n|\n)/g, '<br>')) ; 
                                   l = l.replace(/[<br>]\s*Warning: mysql[\S\s]*150/gi, "");
                                   l = l.replace(/\s*Warning: mysql[\S\s]*182/gi, "");
                                   if(l) { l+= "<br><br><br>Lyrics provided by: LyrDB.com<br>Artist: " + a + "<br>Track: " + t}; whatNext(l, a, t);}
                              });
          rLyrDB.host = 'http://webservices.lyrdb.com/getlyr.php?q=' + id

          rLyrDB.host = encodeURI(rLyrDB.host);
          rLyrDB.send({url: rLyrDB.host});
     } else {
        whatNext(null);
     }
   } catch(ex) {}
}
var rSuccessLyricsVIP = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<td class="td1">')[1].split('</td>')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h2>')[1].split('</h2>')[0].trim();
         t = html.split('<h1">')[1].split('</h1>')[0].trim();
         l += "<br><br><br>Lyrics provided by: LyricsVIP.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessLetras = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<h2>')[1].split('<noscript>')[0].replace(/<\/P>/gi, "<br>").trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h2>')[1].split('</h2>')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<h1>')[1].split('</h1>')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: letras.mus.br<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessLyricsMode = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<p id="lyrics_text" class="ui-annotatable">')[1].split('</p>')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
//         a = html.split('<h2 class="h2l">')[1].split('<br>')[0].replace(/<[^>]*>/gi, "").trim();
//         t = html.split('<h2 class="h2l">')[1].split('<br>')[1].split('lyrics</h2>')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: lyricsmode.com";
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessMp3Lyrics = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<div id="lyrics_text"')[1].split('">')[1].split('<span id=')[0];
      l += html.split('<span id="findmorespan">')[1].split('</span>')[1].split('<span class=')[0].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('id="ed_artistname">')[1].split('</a>')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<span id="ed_songtitle">')[1].split('</span>')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: mp3lyrics.org<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessSeekALyric = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
      l = html.split('<div id="contentt" style="FONT-SIZE: 13px;">')[1].split('</div>')[0].split('<span id=')[0];
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h2>')[1].split(' - ')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<h2>')[1].split(' - ')[1].split('Lyrics')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: seekalyric.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessMetroLyrics = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
     l = html.split('<div id="lyrics-body-text">')[1].split('</div>')[0].replace(/<p class='verse'>/gi, "<br><br>").trim();
     l = cleanupLyrics(l);
     if(l) {
         a = html.split('<h3 itemprop="name">')[1].split('</h3>')[0].replace(/<[^>]*>/gi, "").trim();
         t = html.split('<h2>')[1].split('Lyrics')[0].replace(/<[^>]*>/gi, "").trim();
         l += "<br><br><br>Lyrics provided by: metrolyrics.com<br>Artist: " + a + "<br>Track: " + t;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
var rSuccessELyrics = function(html, xml) {
   var l = '';   var a = '';   var t = '';
   try {
l=html.trim();
      l = html.split('<p>')[1].trim();
      l = cleanupLyrics(l);
      if(l) {
         a = html.split('<h2>')[1].split('</h2>')[0].trim();
         t = html.split('<strong>')[2].split('Lyrics')[0].trim();
         l += "<br><br><br>Lyrics provided by: ELyrics.com<br>Artist: " + a + "<br>Track: " + t ;
      }
   } catch(ex) {}
   whatNext(l, a, t);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
try {   l = html.replace('Not found', '').replace(/<[^>]*>/g, "").replace(/\n/g, '<br>'); l = cleanupLyrics(l); }   catch(ex) {}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var cleanupLyrics = function(l) {
   if(l.test(/&#93;&#10;/)) l=''; //LyricWikia - Missing due to copyright law.
   if(l.test(/Sorry, but these lyrics are protected by copyright./)) l=''; //LyrDB - Missing due to copyright law.
   if(l.test(/We haven\'t lyrics of this song/)) l=''; //LyrDB - Missing
   
   l = l.replace(/\<br[\s]*[\/]*\>/gi, '<br>'); // Converts all "New Line" to the same
   l = l.replace(/[\s]+/g, ' ');    // Converts all "spaces" to the same
   l = l.replace(/^(<br>|\s)/gi, ''); // Lyrics starts with a "New Line" or Space
   l = l.replace(/\r/g, '');        // End of Line
   l = l.replace(/&nbsp;+/gi, ' '); // HTML Code
   l = l.replace(/&+/gi, 'and'); // HTML Code
   l = l.replace(/(<i>|<\/i>|<b>|<\/b>|<div(.*?)>)+/gi, ''); // HTML Tags
   l = l.replace(/(<img(.*?)>(.*?)>|<a(.*?)>(.*?)<\/a>)+/gi, ''); // Images & Links
   l = l.replace(/<(h1|h2)>(.*?)<\/(h1|h2)> <br>/gi, ''); // For source: AZLyrics
   l = l.replace(/<\/?[^br>]+(>|$)+/gi, ''); // All other HTML tags that isn't <br>

   if(tryCleanupWhitespace) {
      l = l.replace(/\<br\>\<br\>(\<br\>)+/g, '<br><br>');
      l = l.replace(/(\s)*\<br\>/g, '<br>');
      l = l.replace(/\s\s/gi, ' ');
   }
   if(tryRejectSingleLine || trySingleLineSearch) {
      var a = l.split('<br>');
      if(a.length <= 1 || (a.length == 2 && a[1].trim() == '')) {
         if(tryRejectSingleLine) return false;
         if(l.toUpperCase().indexOf(trySingleLineSearch.toUpperCase()) >= 0)
            l = trySingleLineReplace;
      }
   }
   if(l.replace(/<br>/g,'').test(/^[\s]+$/)) l='';
   return l;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var searchSend = function(r, a, t) {
      artistFirstChar = a.substr(0,1);
      var s = r.sendString.replace('%artistfirstchar%', artistFirstChar).replace('%artist%', escape(a)).replace('%title%', escape(t));
      var site = r.className
      a = a.replace('&', '%26'); t = t.replace('&', '%26'); // Dirty Dirty hack.....
      var host = r.host.replace('%artistfirstchar%', artistFirstChar).replace('%artist%', a).replace('%title%',t);
      if (site == 'AZLyrics') {
         host = host.replace(/(\s|\&)+/g, '').replace(/\'+/g, '').toLowerCase();
      } else if (site == 'LyricWikia') {
         host = host.replace(/\s+/g, '_');
      } else if (site == 'SeekALyric') {
         host = host.replace(/\s+/g, '_').replace(/\'+/g, '_');
      } else if (site == 'LyricsMode') {
         host = host.replace(/\s+/g, '_').replace(/\'+/g, '').toLowerCase();
      } else if (site == 'LyrDB') {
         host = host.replace(/\s+/g, '+').replace(/\'+/g, '');
      } else if (site == 'LyricsVIP' || site == 'MetroLyrics' || site == 'Mp3Lyrics') {
         host = host.replace(/\s+/g, '-').replace(/\'+/g, '').toLowerCase();
      } else if (site == 'ELyrics') {
         host = host.replace(/\s+/g, '-').replace(/\'+/g, '_').toLowerCase();      
      }

      host = encodeURI(host).replace('%2526', '%26');      
      r.send({url: host, data: s});
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var lyricsPopulate = function(l, a, t) {
   var e = $(tracks[currentTrack]);
   if(l) {
      loading.inject('hidden');
      status.inject('hidden');
      if(currentArtist || currentTitle || currentRequest || aR[currentRequest].name == 'Lyrics Songs') {
         e.addClass(aR[currentRequest].className);
         if(!a) a = aA[currentArtist];
         if(!t) t = aT[currentTitle];
         e.getElement('div[class=artist]').innerHTML += '<br/><i>' + a + '</i>';
         e.getElement('div[class=title]').innerHTML += '<br/><i>' + t + '</i>';
      }
      e.getElement('div[class=lyrics]').innerHTML = l;
      var c = e.getElement('input[type=checkbox]')
      c.checked = true; c.disabled = false;
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var lyricsFailed = function() {
   loading.inject('hidden');
   status.inject('hidden');
   var e = $(tracks[currentTrack]);
   e.getElement('input[type=checkbox]').checked = false;
   e.addClass('disabled');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var reS = new RegExp("[']*", "g");
var reD = new RegExp("[\"]*", "g");
var mapTrim = function(e, i) { return e.trim(); }
var mapQuoteS = function(e, i) { return e.replace(reS, '').trim(); }
var mapQuoteD = function(e, i) { return e.replace(reD, '').trim(); }
var mapParens = function(e, i) { return e.replace(/\(.*?\)/g, '').trim(); }  //  *** TODO ***  What about half?
var mapBrackets = function(e, i) { return e.replace(/\[.*?\]/g, '').trim(); }  //  *** TODO ***  What about half?
var mapBraces = function(e, i) { return e.replace(/\{.*?\}/g, '').trim(); } //  *** TODO ***  What about half?
var mapThe = function(e, i) { return e.replace(/The /gi, '').trim(); } // *** TODO *** What about "and" , / & + - =
var mapFeat = function(e, i) { return e.replace(/ (Ft|Ft.|feat|feat.|featuring) .*/gi, '').trim(); }
var mapDash = function(e, i) { return e.replace(/-(.*?)+/g, '').trim(); }
var mapIncomplete = function(e, i) { return e.replace(/\((.*?)+/g, '').trim(); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var buildBruteForce = function() {
   aA.empty(); aT.empty();

   aA.include(cachedArtist);
   aT.include(cachedTitle);

   var s; var sa;
   if(tryAllArtists) {
      s = cachedArtist.split(';');
      s.each(function(e) { aA.include(e.trim()); });
   }

   if(tryCommaArtists) { aA.include(cachedArtist.replace(/([\w ]+), ([\w ]+)/g, "$2 $1")); } // Code from "datta"

   if(tryTheA) { aA.merge(aA.map(mapThe)); }
   if(tryTheT) { aT.merge(aT.map(mapThe)); }

   if(tryFeatA) { aA.merge(aA.map(mapFeat)); }
   if(tryFeatT) { aT.merge(aT.map(mapFeat)); }

   if(tryFeatT) { aT.merge(aT.map(mapDash)); }
   if(tryFeatT) { aT.merge(aT.map(mapIncomplete)); }

   if(tryParensA) aA.merge(aA.map(mapParens));      if(tryParensT) aT.merge(aT.map(mapParens));
   if(tryBracketsA) aA.merge(aA.map(mapBrackets));  if(tryBracketsT) aT.merge(aT.map(mapBrackets));
   if(tryBracesA) aA.merge(aA.map(mapBraces));      if(tryBracesT) aT.merge(aT.map(mapBraces));

   if(trySplitArrayA) { sa = trySplitArrayA.split(';'); sa.each(function(e) { aA.each(function(e2) { aA.merge(e2.split(e).map(mapTrim)); }); }); }
   if(trySplitArrayT) { sa = trySplitArrayT.split(';'); sa.each(function(e) { aT.each(function(e2) { aT.merge(e2.split(e).map(mapTrim)); }); }); }

   if(tryBlackListA) { sa = tryBlackListA.split(';'); sa.each(function(e) { aA.remove(e); }); }
   if(tryBlackListT) { sa = tryBlackListT.split(';'); sa.each(function(e) { aT.remove(e); }); }

   if(tryAllArtists) {
      aA.include('Various');
   }

   aA = aA.clean();
   aT = aT.clean();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var cache = function() {
   var c = $(tracks[currentTrack]);
   if(c) {
      cachedArtist = c.getElement('div[class=artist]').innerText;
      cachedTitle = c.getElement('div[class=title]').innerText;
      cachedTrack = c;
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var newTrack = function() {
   currentArtist = currentTitle = currentRequest = 0;
   cache();
   if(cachedTrack) loading.inject(cachedTrack.getElement('div[class=lyrics]'));
   if(currentTrack < tracks.length) {
      $('GlobalStatus').innerHTML = 'Processing Track #' + (currentTrack + 1) + '/' + tracks.length;
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var pauseL, pauseA, pauseT;
var whatNext = function(l, foundA, foundT, init) {
   if(paused) {
      pauseL = l;
      pauseA = foundA;
      pauseT = foundT;
      $('PauseButton').disabled = false;
      $('PauseButton').innerHTML = 'Resume';
      return false;
   }
   var a; var t;
   if(init) {
      currentTrack = 0;   newTrack();
      a = cachedArtist; t = cachedTitle;
   } else if (l) {
      lyricsPopulate(l, foundA, foundT);
      currentTrack++;  foundTracks++;  newTrack();
      a = cachedArtist; t = cachedTitle;
      $('GlobalStats').innerHTML = 'Found: ' + (foundTracks) + ' lyrics (' + ((foundTracks / tracks.length) * 100).toFixed(1) +'%)';
   } else {
      var failed = false;
      if(bruteForce) {
         if(!currentArtist && !currentTitle && !currentRequest) {
            buildBruteForce();
            if(cachedTrack) status.inject(cachedTrack.getElement('div[class=lyrics]'));
         }
         if(currentRequest < aR.length - 1) {
            currentRequest++;
         } else {
            currentRequest = 0;
            if(currentTitle < aT.length - 1) {
               currentTitle++;
            } else {
               currentTitle = 0; currentArtist++;
            }
         }
         if(currentArtist >= aA.length) {
            failed = true;
         } else {
            a = aA[currentArtist]; t = aT[currentTitle];
         }
      } else {
         failed = true;
      }
      if(failed) {
         lyricsFailed();
         currentTrack++; newTrack();
         a = cachedArtist; t = cachedTitle;
      } else {
         status.innerHTML = 'Trying ' + a + ' - ' + t;
      }
   }
   if(currentTrack < tracks.length) {
      cachedTrack.scrollIntoView(false);
      (function() {searchSend(aR[currentRequest], a, t)}).delay(10);
      $('GlobalHost').innerHTML = 'Searching: <span class="text' + aR[currentRequest].className + '">' + aR[currentRequest].name +  '</span>';
   } else {
      loading.remove();
      status.remove();
      $('PauseButton').disabled = true;
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var currentPopup = -1;
var closeLyrics = function() {
   currentPopup = -1;
   var p = $('Popup');
   var pl = $('PopupLyrics');
   pl.value = '';
   p.style.visibility = 'hidden';
   return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var updateLyrics = function() {
   var p = $('Popup');
   var pl = $('PopupLyrics');
   var l = pl.value.replace(/\r/g, '<br>');
   $(currentPopup).getElement('div[class=lyrics]').innerHTML = cleanupLyrics(l);
   closeLyrics();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var trackContextMenu = function() {
   currentPopup = this.id;
   var l = this.getElement('div[class=lyrics]');
   var p = $('Popup');
   var pl = $('PopupLyrics');
   pl.value = l.innerHTML.replace(/\<br\>/gi, '\n');
   p.style.visibility = 'visible';
   p.style.top = document.body.scrollTop;
   return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var trackClick = function() {
   var c = this.getElement('input[type=checkbox]');
   if(!c.disabled)   c.checked = !c.checked;
   if(!c.checked) this.addClass('unchecked'); else this.removeClass('unchecked');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var pause = function() {
   var p = $('PauseButton');
   if(p.innerHTML == 'Pause') {
      p.disabled = true;
      p.innerHTML = 'Pausing ...';
      paused = true;
      loading.inject('hidden');
      status.inject('hidden');
   } else {
      paused = false;
      p.innerHTML = 'Pause';
      whatNext(pauseL, pauseA, pauseT);
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var trackOver = function() { this.style.backgroundColor = '#fffff0'; }
var trackOut = function() { this.style.backgroundColor = ''; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
window.addEvent('domready', init);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var test = function() {
   currentTrack = -1;
   whatNext(null, null, null, true);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var debug = function(t) {
   if(bDebug) $('Debug').innerHTML += currentTrack + '|' + t + '<br />';
}
ImageSpoon!
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Lyricator v1.1.1 #33 (2010-12-16)

Post by thehammer »

lyricator.css

Code: Select all

body { overflow: hidden; background-color: #fafafa;}
div { font-family: arial; font-size: 8pt; }
.checkbox, .artist, .title, .lyrics, .Saved { height: 32px; float: left; overflow: hidden; white-space: nowrap; padding: 2px; }
.checkbox { width: 24px; border-right: 1px solid silver; }
.trackindex { display: none }
.artist { width: 100px; border-right: 1px solid silver; }
.title { width: 200px; border-right: 1px solid silver; }
.lyrics, .Saved { width: 400px; }
.track {	height: 32px; white-space: nowrap; clear: both; width: 100%; border-top: 1px solid silver; color: #333; cursor: pointer; }
.disabled { color: #666 !important; background-color: #eee !important; }
.unchecked { color: #333 !important; background-color: #fdfdfd !important; }
.AZLyrics { background-color: #facac3; color: #000000; }     /* Light Red */
.textAZLyrics {  color: #facac3; font-weight: bold;  }
.LyricWikia { background-color: #808000; color: #000000; }   /* Olive */
.textLyricWikia { color: #808000; font-weight: bold;  }
.LyrDB { background-color: #af907f; color: #000000; }        /* Light Brown */
.textLyrDB { color: #af907f; font-weight: bold; }
/* .ChartLyrics{ background-color: #6495ED; color: #000000; }  CornflowerBlue
.textChartLyrics { color: #6495ED; font-weight: bold;  } */
.LyricsVIP { background-color: #0000FF; color: #FFFFFF; }    /* Blue */
.textLyricsVIP { color: #0000FF; font-weight: bold; }
.LyricsSongs { background-color: #bfbfd7; color: #000000; }  /* Light Purple */
.textLyricsSongs { color: #bfbfd7; font-weight: bold; }
.LyricsMode { background-color: #bfbf00; color: #000000; }  /* light green */
.textLyricsMode { color: #bfbf00; font-weight: bold; }
.Mp3Lyrics { background-color: #6495ED; color: #000000; }  /* Cornflower Blue */
.textMp3Lyrics { color: #6495ED; font-weight: bold; }
.SeekALyric { background-color: green; color: #000000; }  /* green */
.textSeekALyric { color: green; font-weight: bold; }
.MetroLyrics { background-color: #FFA500; color: #000000; }  /* orange */
.textMetroLyrics { color: #FFA500; font-weight: bold; }
.ELyrics { background-color: #800000; color: #000000; }  /* maroon */
.textELyrics { color: #800000; font-weight: bold; }
.Saved { background-color: 	#00FF00; color: #000000; }       /* Green */
#Hidden { display: none; }
#Data { white-space: nowrap; border-bottom: 1px solid silver; border-left: 1px solid silver; background-color: #fff; }
#DataScroll { width: 100%; height: 90%; overflow: hidden; overflow-y: scroll; }
#Status { font-family: arial; font-size: 8pt; }
i { font-weight: bold; }
#Popup { position: absolute; visibility: hidden; margin-top: 10px; z-index: 1000; padding: 0px; background-color: #fff; border: 1px solid silver; text-align: center; }
#Popup button { margin: 4px; width: 120px; }
#Popup textarea { height: 480px; width: 100%; padding: 4px; background-color: #333; color: #ccc; border-width: 0px; }
#Header { height: 40px; }
#PauseButton { width: 100px; height: 22px; float: left; }
#GlobalStatus { font-family: verdana; font-size: 10pt; color: #333; width: 100%; text-align: right; }
#GlobalStats { font-family: arial; font-size: 8pt; width: 135px; height: 22px; float: right; text-align: left; }
#GlobalHost { font-family: arial; font-size: 8pt; width: 135px; height: 22px; float: right; text-align: left; }
#Legend { float:left; font-family: arial; font-size: 8pt; }
#Debug { position: absolute; top: 300px; background-color: white; height: 200px; overflow-y: scroll; }
ImageSpoon!
greengeek
Posts: 2
Joined: Thu Aug 20, 2009 10:02 pm

Re: Lyricator v1.1.1 #31 (2010-12-16)

Post by greengeek »

@thehammer
Thanks it worked great!


I had to copy the lyricator script folder out of my profile and into my program files for it to work, which I guess was something we had to do with the original. Only thing I notice now is that every time I run lyricator it pops up a popup window wanting me to save or open the loading image file. If i open or cancel it, the program continues and runs just fine.
thehammer
Posts: 153
Joined: Wed Dec 15, 2004 2:15 pm

Re: Lyricator v1.1.1 #31 (2010-12-16)

Post by thehammer »

Interesting. It is probably the way things got set up along the upgrade process. Or perhaps one of the install options to install portable or not. When I get a chance I'll look into that image problem it may be a setting somewhere, or a matter of copying an image to the right directory.
ImageSpoon!
Locked