From: <sa...@us...> - 2010-08-13 16:27:17
|
Revision: 3720 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3720&view=rev Author: saamand Date: 2010-08-13 16:27:09 +0000 (Fri, 13 Aug 2010) Log Message: ----------- - LyricsPluginSite fixed and reenabled by yoavain Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsPluginSite.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsWebClient.cs trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.resx trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsPluginSite.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsPluginSite.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsPluginSite.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -10,10 +10,13 @@ { internal class LyricsPluginSite { + private bool firstStepComplete; private bool complete; private string lyric = ""; private int timeLimit; private Timer timer; + private string timestamp; + private string checkCode; public LyricsPluginSite(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { @@ -31,18 +34,44 @@ artist = fixHebrew(artist); title = fixHebrew(title); - string urlString = "http://www.lyricsplugin.com/winamp03/plugin/?" + "artist=" + artist + "&title=" + title; - + // timer timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); - Uri uri = new Uri(urlString); - LyricsWebClient client = new LyricsWebClient(); - client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); - client.OpenReadAsync(uri); + // LyricsPlugin.com changed their API to need 2 calls. The first is to get a timer & code + // 1st step + string firstUrlString = "http://www.lyricsplugin.com/winamp03/plugin/?" + "artist=" + artist + "&title=" + title; + + Uri uri1 = new Uri(firstUrlString); + LyricsWebClient client1 = new LyricsWebClient(); + client1.OpenReadCompleted += new OpenReadCompletedEventHandler(firstCallbackMethod); + client1.OpenReadAsync(uri1); + + while (firstStepComplete == false) + { + if (m_EventStop_SiteSearches.WaitOne(1, true)) + { + firstStepComplete = true; + } + else + { + Thread.Sleep(100); + } + } + + // assertion: !timestamp.Equals("") & !checkCode.Equals(""); + + // 2nd step + string secondUrlString = "http://www.lyricsplugin.com/winamp03/plugin/content.php?" + "artist=" + artist + "&title=" + title + "&time=" + timestamp + "&check=" + checkCode; + + Uri uri2 = new Uri(secondUrlString); + LyricsWebClient client2 = new LyricsWebClient(firstUrlString); + client2.OpenReadCompleted += new OpenReadCompletedEventHandler(secondCallbackMethod); + client2.OpenReadAsync(uri2); + while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) @@ -61,103 +90,81 @@ get { return lyric; } } - private static string fixEscapeCharacters(string text) + private void firstCallbackMethod(object sender, OpenReadCompletedEventArgs e) { - text = text.Replace("(", ""); - text = text.Replace(")", ""); - text = text.Replace("#", ""); - text = text.Replace("/", ""); + bool thisMayBeTheCorrectPage = true; + StringBuilder lyricsCommand = new StringBuilder(); - text = text.Replace("%", "%25"); + LyricsWebClient client = (LyricsWebClient) sender; + Stream reply = null; + StreamReader sr = null; - text = text.Replace(" ", "%20"); - text = text.Replace("$", "%24"); - text = text.Replace("&", "%26"); - text = text.Replace("+", "%2B"); - text = text.Replace(",", "%2C"); - text = text.Replace(":", "%3A"); - text = text.Replace(";", "%3B"); - text = text.Replace("=", "%3D"); - text = text.Replace("?", "%3F"); - text = text.Replace("@", "%40"); - text = text.Replace("&", "&"); + try + { + reply = (Stream) e.Result; + sr = new StreamReader(reply, Encoding.UTF8); - return text; - } + string line = ""; + int noOfLinesCount = 0; - private static string fixHebrew(string text) - { - text = text.Replace("\uC3A0", "%d7%90"); // \xE0 - text = text.Replace("\uC3A1", "%D7%91"); - text = text.Replace("\uC3A2", "%D7%92"); - text = text.Replace("\uC3A3", "%D7%93"); - text = text.Replace("\uC3A4", "%D7%94"); - text = text.Replace("\uC3A5", "%D7%95"); - text = text.Replace("\uC3A6", "%D7%96"); - text = text.Replace("\uC3A7", "%D7%97"); - text = text.Replace("\uC3A8", "%D7%98"); - text = text.Replace("\uC3A9", "%D7%99"); - text = text.Replace("\uC3AA", "%D7%9A"); - text = text.Replace("\uC3AB", "%D7%9B"); - text = text.Replace("\uC3AC", "%D7%9C"); - text = text.Replace("\uC3AD", "%D7%9D"); - text = text.Replace("\uC3AE", "%D7%9E"); - text = text.Replace("\uC3AF", "%D7%9F"); - text = text.Replace("\uC3B0", "%D7%A0"); - text = text.Replace("\uC3B1", "%D7%A1"); - text = text.Replace("\uC3B2", "%D7%A2"); - text = text.Replace("\uC3B3", "%D7%A3"); - text = text.Replace("\uC3B4", "%D7%A4"); - text = text.Replace("\uC3B5", "%D7%A5"); - text = text.Replace("\uC3B6", "%D7%A6"); - text = text.Replace("\uC3B7", "%D7%A7"); - text = text.Replace("\uC3B8", "%D7%A8"); - text = text.Replace("\uC3B9", "%D7%A9"); - text = text.Replace("\uC3BA", "%D7%AA"); // \xFA + while (line.IndexOf(@"getContent(") == -1) + { + if (sr.EndOfStream || ++noOfLinesCount > 300) + { + thisMayBeTheCorrectPage = false; + break; + } + else + { + line = sr.ReadLine(); + } + } - text = text.Replace("\uD790", "%d7%90"); // \xE0 - text = text.Replace("\uD791", "%D7%91"); - text = text.Replace("\uD792", "%D7%92"); - text = text.Replace("\uD793", "%D7%93"); - text = text.Replace("\uD794", "%D7%94"); - text = text.Replace("\uD795", "%D7%95"); - text = text.Replace("\uD796", "%D7%96"); - text = text.Replace("\uD797", "%D7%97"); - text = text.Replace("\uD798", "%D7%98"); - text = text.Replace("\uD799", "%D7%99"); - text = text.Replace("\uD79A", "%D7%9A"); - text = text.Replace("\uD79B", "%D7%9B"); - text = text.Replace("\uD79C", "%D7%9C"); - text = text.Replace("\uD79D", "%D7%9D"); - text = text.Replace("\uD79E", "%D7%9E"); - text = text.Replace("\uD79F", "%D7%9F"); - text = text.Replace("\uD7A0", "%D7%A0"); - text = text.Replace("\uD7A1", "%D7%A1"); - text = text.Replace("\uD7A2", "%D7%A2"); - text = text.Replace("\uD7A3", "%D7%A3"); - text = text.Replace("\uD7A4", "%D7%A4"); - text = text.Replace("\uD7A5", "%D7%A5"); - text = text.Replace("\uD7A6", "%D7%A6"); - text = text.Replace("\uD7A7", "%D7%A7"); - text = text.Replace("\uD7A8", "%D7%A8"); - text = text.Replace("\uD7A9", "%D7%A9"); - text = text.Replace("\uD7AA", "%D7%AA"); // \xFA + if (thisMayBeTheCorrectPage) + { + lyricsCommand.Append(line); - return text; + string[] parameters = line.Split('\''); + + // todo - Find a better check here + if (parameters.Length == 9) + { + timestamp = parameters[5]; + checkCode = parameters[7]; + } + } + } + catch + { + lyric = "Not found"; + } + finally + { + if (sr != null) + { + sr.Close(); + } + + if (reply != null) + { + reply.Close(); + } + firstStepComplete = true; + } } - private void callbackMethod(object sender, OpenReadCompletedEventArgs e) + private void secondCallbackMethod(object sender, OpenReadCompletedEventArgs e) { bool thisMayBeTheCorrectLyric = true; StringBuilder lyricTemp = new StringBuilder(); - LyricsWebClient client = (LyricsWebClient) sender; + LyricsWebClient client = (LyricsWebClient)sender; Stream reply = null; StreamReader sr = null; try { - reply = (Stream) e.Result; + reply = (Stream)e.Result; sr = new StreamReader(reply, Encoding.UTF8); string line = ""; @@ -197,13 +204,10 @@ } } - lyricTemp.Replace("<br>", Environment.NewLine); - lyricTemp.Replace("<br />", Environment.NewLine); - lyricTemp.Replace(""", "\""); + // Clean lyrics + lyric = cleanLyrics(lyricTemp); - lyric = lyricTemp.ToString().Trim(); - - if (lyric.Length == 0 || lyric.Contains("www.lyricsvip.com")) + if (lyric.Length == 0) { lyric = "Not found"; } @@ -228,6 +232,15 @@ } } + private string cleanLyrics(StringBuilder lyricTemp) + { + lyricTemp.Replace("<br>", Environment.NewLine); + lyricTemp.Replace("<br />", Environment.NewLine); + lyricTemp.Replace(""", "\""); + + return lyricTemp.ToString().Trim(); + } + private void timer_Elapsed(object sender, ElapsedEventArgs e) { timer.Stop(); @@ -238,5 +251,90 @@ complete = true; Thread.CurrentThread.Abort(); } + + private static string fixEscapeCharacters(string text) + { + text = text.Replace("(", ""); + text = text.Replace(")", ""); + text = text.Replace("#", ""); + text = text.Replace("/", ""); + + text = text.Replace("%", "%25"); + + text = text.Replace(" ", "%20"); + text = text.Replace("$", "%24"); + text = text.Replace("&", "%26"); + text = text.Replace("+", "%2B"); + text = text.Replace(",", "%2C"); + text = text.Replace(":", "%3A"); + text = text.Replace(";", "%3B"); + text = text.Replace("=", "%3D"); + text = text.Replace("?", "%3F"); + text = text.Replace("@", "%40"); + text = text.Replace("&", "&"); + + return text; + } + + private static string fixHebrew(string text) + { + text = text.Replace("\uC3A0", "%d7%90"); // \xE0 + text = text.Replace("\uC3A1", "%D7%91"); + text = text.Replace("\uC3A2", "%D7%92"); + text = text.Replace("\uC3A3", "%D7%93"); + text = text.Replace("\uC3A4", "%D7%94"); + text = text.Replace("\uC3A5", "%D7%95"); + text = text.Replace("\uC3A6", "%D7%96"); + text = text.Replace("\uC3A7", "%D7%97"); + text = text.Replace("\uC3A8", "%D7%98"); + text = text.Replace("\uC3A9", "%D7%99"); + text = text.Replace("\uC3AA", "%D7%9A"); + text = text.Replace("\uC3AB", "%D7%9B"); + text = text.Replace("\uC3AC", "%D7%9C"); + text = text.Replace("\uC3AD", "%D7%9D"); + text = text.Replace("\uC3AE", "%D7%9E"); + text = text.Replace("\uC3AF", "%D7%9F"); + text = text.Replace("\uC3B0", "%D7%A0"); + text = text.Replace("\uC3B1", "%D7%A1"); + text = text.Replace("\uC3B2", "%D7%A2"); + text = text.Replace("\uC3B3", "%D7%A3"); + text = text.Replace("\uC3B4", "%D7%A4"); + text = text.Replace("\uC3B5", "%D7%A5"); + text = text.Replace("\uC3B6", "%D7%A6"); + text = text.Replace("\uC3B7", "%D7%A7"); + text = text.Replace("\uC3B8", "%D7%A8"); + text = text.Replace("\uC3B9", "%D7%A9"); + text = text.Replace("\uC3BA", "%D7%AA"); // \xFA + + text = text.Replace("\uD790", "%d7%90"); // \xE0 + text = text.Replace("\uD791", "%D7%91"); + text = text.Replace("\uD792", "%D7%92"); + text = text.Replace("\uD793", "%D7%93"); + text = text.Replace("\uD794", "%D7%94"); + text = text.Replace("\uD795", "%D7%95"); + text = text.Replace("\uD796", "%D7%96"); + text = text.Replace("\uD797", "%D7%97"); + text = text.Replace("\uD798", "%D7%98"); + text = text.Replace("\uD799", "%D7%99"); + text = text.Replace("\uD79A", "%D7%9A"); + text = text.Replace("\uD79B", "%D7%9B"); + text = text.Replace("\uD79C", "%D7%9C"); + text = text.Replace("\uD79D", "%D7%9D"); + text = text.Replace("\uD79E", "%D7%9E"); + text = text.Replace("\uD79F", "%D7%9F"); + text = text.Replace("\uD7A0", "%D7%A0"); + text = text.Replace("\uD7A1", "%D7%A1"); + text = text.Replace("\uD7A2", "%D7%A2"); + text = text.Replace("\uD7A3", "%D7%A3"); + text = text.Replace("\uD7A4", "%D7%A4"); + text = text.Replace("\uD7A5", "%D7%A5"); + text = text.Replace("\uD7A6", "%D7%A6"); + text = text.Replace("\uD7A7", "%D7%A7"); + text = text.Replace("\uD7A8", "%D7%A8"); + text = text.Replace("\uD7A9", "%D7%A9"); + text = text.Replace("\uD7AA", "%D7%AA"); // \xFA + + return text; + } } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsWebClient.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsWebClient.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsWebClient.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -11,6 +11,7 @@ private CookieContainer cookieContainer; private int timeout; private string userAgent; + private string referer; public LyricsWebClient() { @@ -19,6 +20,13 @@ cookieContainer = new CookieContainer(); } + public LyricsWebClient(string referer) + { + timeout = -1; + this.referer = referer; + cookieContainer = new CookieContainer(); + } + public CookieContainer CookieContainer { get { return cookieContainer; } @@ -45,6 +53,11 @@ { ((HttpWebRequest) request).CookieContainer = cookieContainer; ((HttpWebRequest) request).UserAgent = userAgent; + if (referer != null) + { + ((HttpWebRequest)request).Referer = referer; + } + (request).Timeout = timeout; (request).Proxy.Credentials = CredentialCache.DefaultCredentials; } Modified: trunk/plugins/MyLyrics/LyricsEngine/Setup.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -5,7 +5,7 @@ { public static class Setup { - public static string[] BatchSearchSites = new string[7] + public static string[] BatchSearchSites = new string[8] { "LrcFinder", "LyricWiki", @@ -13,7 +13,8 @@ "LyricsOnDemand", "HotLyrics", "Actionext", - "LyrDB" + "LyrDB", + "LyricsPluginSite" }; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -80,7 +80,7 @@ this.lbInfo1.Name = "lbInfo1"; this.lbInfo1.Size = new System.Drawing.Size(197, 18); this.lbInfo1.TabIndex = 3; - this.lbInfo1.Text = "MyLyrics plugin, version 1.5.0.0"; + this.lbInfo1.Text = "MyLyrics plugin, version 1.5.2.0"; // // label2 // Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.Designer.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.Designer.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -50,6 +50,7 @@ this.cbLyricsOnDemand = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricsPluginSite = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.btClose = new System.Windows.Forms.Button(); this.btUpdate = new System.Windows.Forms.Button(); this.gbSearchInfo.SuspendLayout(); @@ -195,6 +196,7 @@ this.gbLyricSites.Controls.Add(this.cbLyricsOnDemand); this.gbLyricSites.Controls.Add(this.cbLyrics007); this.gbLyricSites.Controls.Add(this.cbLyricWiki); + this.gbLyricSites.Controls.Add(this.cbLyricsPluginSite); this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.gbLyricSites.Location = new System.Drawing.Point(9, 115); this.gbLyricSites.Name = "gbLyricSites"; @@ -209,7 +211,7 @@ this.cbLrcFinder.Checked = true; this.cbLrcFinder.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLrcFinder.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLrcFinder.Location = new System.Drawing.Point(237, 19); + this.cbLrcFinder.Location = new System.Drawing.Point(338, 21); this.cbLrcFinder.Name = "cbLrcFinder"; this.cbLrcFinder.Size = new System.Drawing.Size(68, 17); this.cbLrcFinder.TabIndex = 19; @@ -222,7 +224,7 @@ this.cbLyrDB.Checked = true; this.cbLyrDB.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLyrDB.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyrDB.Location = new System.Drawing.Point(237, 44); + this.cbLyrDB.Location = new System.Drawing.Point(338, 44); this.cbLyrDB.Name = "cbLyrDB"; this.cbLyrDB.Size = new System.Drawing.Size(53, 17); this.cbLyrDB.TabIndex = 18; @@ -235,7 +237,7 @@ this.cbActionext.Checked = true; this.cbActionext.CheckState = System.Windows.Forms.CheckState.Checked; this.cbActionext.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbActionext.Location = new System.Drawing.Point(18, 44); + this.cbActionext.Location = new System.Drawing.Point(131, 44); this.cbActionext.Name = "cbActionext"; this.cbActionext.Size = new System.Drawing.Size(68, 17); this.cbActionext.TabIndex = 17; @@ -248,7 +250,7 @@ this.cbHotLyrics.Checked = true; this.cbHotLyrics.CheckState = System.Windows.Forms.CheckState.Checked; this.cbHotLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbHotLyrics.Location = new System.Drawing.Point(132, 44); + this.cbHotLyrics.Location = new System.Drawing.Point(237, 44); this.cbHotLyrics.Name = "cbHotLyrics"; this.cbHotLyrics.Size = new System.Drawing.Size(71, 17); this.cbHotLyrics.TabIndex = 14; @@ -274,7 +276,7 @@ this.cbLyrics007.Checked = true; this.cbLyrics007.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLyrics007.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyrics007.Location = new System.Drawing.Point(131, 19); + this.cbLyrics007.Location = new System.Drawing.Point(237, 21); this.cbLyrics007.Name = "cbLyrics007"; this.cbLyrics007.Size = new System.Drawing.Size(72, 17); this.cbLyrics007.TabIndex = 13; @@ -287,13 +289,26 @@ this.cbLyricWiki.Checked = true; this.cbLyricWiki.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLyricWiki.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyricWiki.Location = new System.Drawing.Point(338, 21); + this.cbLyricWiki.Location = new System.Drawing.Point(18, 44); this.cbLyricWiki.Name = "cbLyricWiki"; this.cbLyricWiki.Size = new System.Drawing.Size(67, 17); this.cbLyricWiki.TabIndex = 11; this.cbLyricWiki.Text = "LyricWiki"; this.cbLyricWiki.UseVisualStyleBackColor = true; // + // cbLyricsPluginSite + // + this.cbLyricsPluginSite.AutoSize = true; + this.cbLyricsPluginSite.Checked = true; + this.cbLyricsPluginSite.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbLyricsPluginSite.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyricsPluginSite.Location = new System.Drawing.Point(131, 21); + this.cbLyricsPluginSite.Name = "cbLyricsPluginSite"; + this.cbLyricsPluginSite.Size = new System.Drawing.Size(80, 17); + this.cbLyricsPluginSite.TabIndex = 15; + this.cbLyricsPluginSite.Text = "LyricsPlugin"; + this.cbLyricsPluginSite.UseVisualStyleBackColor = true; + // // btClose // this.btClose.Location = new System.Drawing.Point(361, 546); @@ -319,7 +334,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(448, 573); + this.ClientSize = new System.Drawing.Size(448, 575); this.ControlBox = false; this.Controls.Add(this.btUpdate); this.Controls.Add(this.btClose); @@ -361,6 +376,7 @@ internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsOnDemand; internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyrics007; internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricWiki; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsPluginSite; private System.Windows.Forms.ListView lvSearchResults; private System.Windows.Forms.ColumnHeader cbSite; private System.Windows.Forms.ColumnHeader cbResult; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -110,6 +110,11 @@ "True") ? true : false; + cbLyricsPluginSite.Checked = + ((string) xmlreader.GetValueAsString("myLyrics", "useLyricsPluginSite", "True")).ToString().Equals( + "True") + ? true + : false; cbHotLyrics.Checked = ((string) xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true @@ -205,6 +210,10 @@ { sitesToSearch.Add("LyricsOnDemand"); } + if (cbLyricsPluginSite.Checked) + { + sitesToSearch.Add("LyricsPluginSite"); + } // If automaticUpdate is set then return after the first positive search m_EventStopThread = new ManualResetEvent(false); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -534,6 +534,10 @@ sitesToSearch.Add("LyricsOnDemand"); if (((string) xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True")) sitesToSearch.Add("HotLyrics"); + if ( + ((string) xmlreader.GetValueAsString("myLyrics", "useLyricsPluginSite", "True")).ToString().Equals( + "True")) + sitesToSearch.Add("LyricsPluginSite"); m_find = xmlreader.GetValueAsString("myLyrics", "find", ""); m_replace = xmlreader.GetValueAsString("myLyrics", "replace", ""); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -107,6 +107,7 @@ this.cbLyricsOnDemand = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbHotLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricsPluginSite = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.mpLabel2 = new MediaPortal.UserInterface.Controls.MPLabel(); this.trackBar = new System.Windows.Forms.TrackBar(); @@ -935,6 +936,7 @@ this.groupBox2.Controls.Add(this.cbLyricsOnDemand); this.groupBox2.Controls.Add(this.cbLyricWiki); this.groupBox2.Controls.Add(this.cbHotLyrics); + this.groupBox2.Controls.Add(this.cbLyricsPluginSite); this.groupBox2.Location = new System.Drawing.Point(229, 48); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(301, 90); @@ -962,7 +964,7 @@ this.cbLyrDB.Checked = true; this.cbLyrDB.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLyrDB.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyrDB.Location = new System.Drawing.Point(214, 17); + this.cbLyrDB.Location = new System.Drawing.Point(216, 40); this.cbLyrDB.Name = "cbLyrDB"; this.cbLyrDB.Size = new System.Drawing.Size(53, 17); this.cbLyrDB.TabIndex = 9; @@ -976,7 +978,7 @@ this.cbActionext.Checked = true; this.cbActionext.CheckState = System.Windows.Forms.CheckState.Checked; this.cbActionext.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbActionext.Location = new System.Drawing.Point(134, 61); + this.cbActionext.Location = new System.Drawing.Point(216, 17); this.cbActionext.Name = "cbActionext"; this.cbActionext.Size = new System.Drawing.Size(68, 17); this.cbActionext.TabIndex = 8; @@ -990,7 +992,7 @@ this.cbLyrics007.Checked = true; this.cbLyrics007.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLyrics007.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyrics007.Location = new System.Drawing.Point(20, 40); + this.cbLyrics007.Location = new System.Drawing.Point(130, 17); this.cbLyrics007.Name = "cbLyrics007"; this.cbLyrics007.Size = new System.Drawing.Size(72, 17); this.cbLyrics007.TabIndex = 4; @@ -1018,7 +1020,7 @@ this.cbLyricWiki.Checked = true; this.cbLyricWiki.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLyricWiki.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyricWiki.Location = new System.Drawing.Point(134, 17); + this.cbLyricWiki.Location = new System.Drawing.Point(130, 40); this.cbLyricWiki.Name = "cbLyricWiki"; this.cbLyricWiki.Size = new System.Drawing.Size(67, 17); this.cbLyricWiki.TabIndex = 2; @@ -1032,7 +1034,7 @@ this.cbHotLyrics.Checked = true; this.cbHotLyrics.CheckState = System.Windows.Forms.CheckState.Checked; this.cbHotLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbHotLyrics.Location = new System.Drawing.Point(134, 40); + this.cbHotLyrics.Location = new System.Drawing.Point(130, 61); this.cbHotLyrics.Name = "cbHotLyrics"; this.cbHotLyrics.Size = new System.Drawing.Size(71, 17); this.cbHotLyrics.TabIndex = 7; @@ -1040,6 +1042,20 @@ this.cbHotLyrics.UseVisualStyleBackColor = true; this.cbHotLyrics.Leave += new System.EventHandler(this.WriteMediaPortalXML); // + // cbLyricsPluginSite + // + this.cbLyricsPluginSite.AutoSize = true; + this.cbLyricsPluginSite.Checked = true; + this.cbLyricsPluginSite.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbLyricsPluginSite.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyricsPluginSite.Location = new System.Drawing.Point(20, 40); + this.cbLyricsPluginSite.Name = "cbLyricsPluginSite"; + this.cbLyricsPluginSite.Size = new System.Drawing.Size(80, 17); + this.cbLyricsPluginSite.TabIndex = 9; + this.cbLyricsPluginSite.Text = "LyricsPlugin"; + this.cbLyricsPluginSite.UseVisualStyleBackColor = true; + this.cbLyricsPluginSite.Leave += new System.EventHandler(this.WriteMediaPortalXML); + // // groupBox1 // this.groupBox1.Controls.Add(this.mpLabel2); @@ -1290,6 +1306,7 @@ private MediaPortal.UserInterface.Controls.MPLabel lbPluginName; private MediaPortal.UserInterface.Controls.MPGroupBox gbLyricSites; internal MediaPortal.UserInterface.Controls.MPCheckBox cbHotLyrics; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsPluginSite; internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsOnDemand; internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyrics007; internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricWiki; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -225,6 +225,7 @@ cbLyrics007.Checked = xmlreader.GetValue("myLyrics", "useLyrics007").Equals("True"); cbLyricsOnDemand.Checked = xmlreader.GetValue("myLyrics", "useLyricsOnDemand").Equals("True"); cbHotLyrics.Checked = xmlreader.GetValue("myLyrics", "useHotLyrics").Equals("True"); + cbLyricsPluginSite.Checked = xmlreader.GetValue("myLyrics", "useLyricsPluginSite").Equals("True"); } else { @@ -499,6 +500,8 @@ sitesToSearch.Add("LyricsOnDemand"); if (cbHotLyrics.Checked) sitesToSearch.Add("HotLyrics"); + if (cbLyricsPluginSite.Checked) + sitesToSearch.Add("LyricsPluginSite"); if (sitesToSearch.Count == 0) { @@ -1082,7 +1085,8 @@ if (trackBar.Value == 0) { cbLyricsOnDemand.Checked = true; - cbLyrics007.Checked = true; + cbLyricsPluginSite.Checked = true; + cbLyrics007.Checked = false; cbLrcFinder.Checked = false; cbLyricWiki.Checked = false; cbHotLyrics.Checked = false; @@ -1092,8 +1096,9 @@ else if (trackBar.Value == 1) { cbLyricsOnDemand.Checked = true; + cbLyricsPluginSite.Checked = true; + cbLrcFinder.Checked = true; cbLyrics007.Checked = true; - cbLrcFinder.Checked = true; cbLyricWiki.Checked = false; cbHotLyrics.Checked = false; cbActionext.Checked = false; @@ -1102,6 +1107,7 @@ else if (trackBar.Value == 2) { cbLyricsOnDemand.Checked = true; + cbLyricsPluginSite.Checked = true; cbLyrics007.Checked = true; cbLrcFinder.Checked = true; cbLyricWiki.Checked = true; @@ -1118,6 +1124,7 @@ cbHotLyrics.Checked = true; cbLyrDB.Checked = true; cbActionext.Checked = true; + cbLyricsPluginSite.Checked = true; } if (sender != null) @@ -1135,6 +1142,7 @@ cbLrcFinder.Checked = true; cbLyricWiki.Checked = true; cbHotLyrics.Checked = true; + cbLyricsPluginSite.Checked = true; trackBar.Value = 2; } @@ -1149,6 +1157,7 @@ cbLyrics007.Enabled = false; cbLrcFinder.Enabled = false; cbLyricWiki.Enabled = false; + cbLyricsPluginSite.Enabled = false; cbHotLyrics.Enabled = false; cbActionext.Enabled = false; cbLyrDB.Enabled = false; @@ -1167,6 +1176,7 @@ cbLyrics007.Enabled = true; cbLrcFinder.Enabled = true; cbLyricWiki.Enabled = true; + cbLyricsPluginSite.Enabled = true; cbHotLyrics.Enabled = true; cbActionext.Enabled = true; cbLyrDB.Enabled = true; @@ -1182,6 +1192,7 @@ cbHotLyrics.Enabled = false; cbActionext.Enabled = false; cbLyrDB.Enabled = false; + cbLyricsPluginSite.Enabled = false; cbLyricsOnDemand.Checked = false; cbLyrics007.Checked = false; @@ -1190,6 +1201,7 @@ cbHotLyrics.Checked = false; cbActionext.Checked = false; cbLyrDB.Checked = false; + cbLyricsPluginSite.Checked = false; cbMusicTagAlwaysCheck.Checked = false; cbMusicTagWrite.Checked = true; @@ -1229,6 +1241,7 @@ xmlwriter.SetValue("myLyrics", "useLyrics007", cbLyrics007.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useLyricsOnDemand", cbLyricsOnDemand.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useHotLyrics", cbHotLyrics.Checked.ToString()); + xmlwriter.SetValue("myLyrics", "useLyricsPluginSite", cbLyricsPluginSite.Checked.ToString()); xmlwriter.SetValueAsBool("myLyrics", "useAutoscroll", cbUseAutoScrollAsDefault.Checked); xmlwriter.SetValueAsBool("myLyrics", "uploadLrcToLrcFinder", cbUploadLrcAutomatically.Checked); xmlwriter.SetValueAsBool("myLyrics", "alwaysAskUploadLrcToLrcFinder", cbAlwaysAskForUploadToLrcFinder.Checked); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.resx 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.resx 2010-08-13 16:27:09 UTC (rev 3720) @@ -123,12 +123,6 @@ <metadata name="Replace.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> - <metadata name="Find.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="Replace.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> <metadata name="bgWorkerSearch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>6, 4</value> </metadata> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2010-08-13 16:03:06 UTC (rev 3719) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2010-08-13 16:27:09 UTC (rev 3720) @@ -98,7 +98,8 @@ private bool _useLyrDB; private bool _useLyrics007, - _useLyricsOnDemand; + _useLyricsOnDemand, + _useLyricsPluginSite; private bool _useLyricWiki; @@ -685,6 +686,10 @@ : false; _useLyricsOnDemand = (xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).Equals("True") ? true : false; + _useLyricsPluginSite = + (xmlreader.GetValueAsString("myLyrics", "useLyricsPluginSite", "True")).Equals("True") + ? true + : false; _useHotLyrics = (xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).Equals("True") ? true : false; @@ -800,6 +805,10 @@ { sitesToSearch.Add("HotLyrics"); } + if (_useLyricsPluginSite && Setup.IsMember("LyricsPluginSite")) + { + sitesToSearch.Add("LyricsPluginSite"); + } _LyricSitesTosearch = (string[])sitesToSearch.ToArray(typeof(string)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |