From: <sa...@us...> - 2007-01-29 21:07:39
|
Revision: 42 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=42&view=rev Author: saamand Date: 2007-01-29 13:07:30 -0800 (Mon, 29 Jan 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-01-29 16:38:44 UTC (rev 41) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-01-29 21:07:30 UTC (rev 42) @@ -60,6 +60,8 @@ int m_managedThreadId = -1; public static event EventHandler StopTheSearchAndAbort; + + private bool m_noMoreValidLicenseKeys = false; @@ -319,5 +321,11 @@ { set { LyricController.noOfLyricsToSearch = value; } } + + public bool NoMoreValidLicenseKeys + { + get { return m_noMoreValidLicenseKeys; } + set { m_noMoreValidLicenseKeys = value; } + } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/Setup.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-01-29 16:38:44 UTC (rev 41) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-01-29 21:07:30 UTC (rev 42) @@ -15,7 +15,7 @@ "LeosLyrics", "LyricsFreak", "SongMeanings" - //"LyricsHostring", + //"LyricsHosting", //"MusicMadeMe", }; Modified: trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs 2007-01-29 16:38:44 UTC (rev 41) +++ trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs 2007-01-29 21:07:30 UTC (rev 42) @@ -33,7 +33,7 @@ IAsyncResult ar = del.BeginInvoke(this.artist, this.title, null, null); - while (noOfTries < 12) + while (noOfTries < 20) { // If the user has aborted stop the search and return (false) if (Abort) @@ -46,7 +46,7 @@ } else { - Thread.Sleep(2000); + Thread.Sleep(500); } ++noOfTries; } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-01-29 16:38:44 UTC (rev 41) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-01-29 21:07:30 UTC (rev 42) @@ -75,7 +75,9 @@ static bool lyricsFound = false; + String[] m_sitesToSearch; + public GUIMyLyrics() { m_EventStopThread = new ManualResetEvent(false); @@ -202,14 +204,67 @@ GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); + bool useSing365, useLyricsHosting, useLyricsMania, useSongMeanings, useLyricsFreak, useMMMD, useLeosLyrics, useLyrics007, useLyricWiki; + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { - m_GoogleLicenseKeys[0] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey1", ""); + m_GoogleLicenseKeys[0] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey1", "zhQlW3ZQFHLE2dibwGRcpcDJvThQ/TTU"); m_GoogleLicenseKeys[1] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey2", ""); m_GoogleLicenseKeys[2] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey3", ""); m_GoogleLicenseKeys[3] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey4", ""); m_GoogleLicenseKeys[4] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey5", ""); + + useSing365 = ((string)xmlreader.GetValueAsString("myLyrics", "useSing365", "False")).ToString().Equals("True") ? true : false; + useLyricsHosting = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsHosting", "False")).ToString().Equals("True") ? true : false; + useLyricsMania = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsMania", "False")).ToString().Equals("True") ? true : false; + useSongMeanings = ((string)xmlreader.GetValueAsString("myLyrics", "useSongMeaning", "False")).ToString().Equals("True") ? true : false; + useLyricsFreak = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsFreak", "False")).ToString().Equals("True") ? true : false; + useMMMD = ((string)xmlreader.GetValueAsString("myLyrics", "useMMMD", "False")).ToString().Equals("True") ? true : false; + useLeosLyrics = ((string)xmlreader.GetValueAsString("myLyrics", "useLeosLyrics", "False")).ToString().Equals("True") ? true : false; + useLyrics007 = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "False")).ToString().Equals("True") ? true : false; + useLyricWiki = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; } + + ArrayList sitesToSearch = new ArrayList(); + + if (useSing365 && Setup.IsMember("Sing365")) + { + sitesToSearch.Add("Sing365"); + } + if (useLyricsHosting && Setup.IsMember("LyricsHosting")) + { + sitesToSearch.Add("LyricsHosting"); + } + if (useLyricsMania && Setup.IsMember("LyricsMania")) + { + sitesToSearch.Add("LyricsMania"); + } + if (useSongMeanings && Setup.IsMember("SongMeanings")) + { + sitesToSearch.Add("SongMeanings"); + } + if (useLyricsFreak && Setup.IsMember("LyricsFreak")) + { + sitesToSearch.Add("LyricsFreak"); + } + if (useMMMD && Setup.IsMember("MusicMadeMe")) + { + sitesToSearch.Add("MusicMadeMe"); + } + if (useLeosLyrics && Setup.IsMember("LeosLyrics")) + { + sitesToSearch.Add("LeosLyrics"); + } + if (useLyrics007 && Setup.IsMember("Lyrics007")) + { + sitesToSearch.Add("Lyrics007"); + } + if (useLyricWiki && Setup.IsMember("LyricWiki")) + { + sitesToSearch.Add("LyricWiki"); + } + + m_sitesToSearch = (string[])sitesToSearch.ToArray(typeof(string)); } void SaveSettings() @@ -320,7 +375,7 @@ lc.GoogleLicenseKey = m_GoogleLicenseKeys[m_GoogleLicenseKeyIndex]; - LyricConfigInfo lyricConfigInfo = new LyricConfigInfo(lc.GoogleLicenseKey, m_artist, m_title, "lyrics", Setup.accessibleLyricSites); + LyricConfigInfo lyricConfigInfo = new LyricConfigInfo(lc.GoogleLicenseKey, m_artist, m_title, "lyrics", m_sitesToSearch); lc.addNewLyricSearch(lyricConfigInfo); } } @@ -447,8 +502,10 @@ { set { - //m_StatusText = ((String)value[0]).ToString() + ((String)value[1]).ToString(); - //GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); + string line1 = (string)value[0]; + string line2 = (string)value[1]; + m_StatusText = line1 + "\r\n" + line2; + GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); } } @@ -456,10 +513,7 @@ { set { - //int noToSearch = (int)value[0]; - //int noSearched = (int)value[1]; - //int noFound = (int)value[2]; - //int noNotFound = (int)value[2]; + } } @@ -480,7 +534,8 @@ ShowLyricOnScreen(lyricText, site); SaveLyricToDatabase(); - if (lc != null) + // if not found by LyricWiki, write which license key was used + if (lc != null && !site.Equals("LyricWiki")) { LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + (lc.GoogleLicenseKey.Equals("") ? "empty key" : lc.GoogleLicenseKey)); } @@ -507,7 +562,7 @@ if (!lyricsFound && m_artist.Equals(artist) && m_title.Equals(title)) { LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Search terminates: No lyric found..."); - m_StatusText = "No lyric found."; + m_StatusText = "No lyric found"; GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); } } @@ -551,8 +606,9 @@ if (googlePopUpMessageShown == false) { LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Warning, 0, LyricDiagnostics.elapsedTimeString() + noValidKeysMessage); - PopUpMessage("Google license key", "All queries of your google license key(s)", "has been used, which properly will result", "in decrease of the lyrics hit ratio."); + PopUpMessage("LyricWiki only valid source", "Your google license keys don't hold any valid query entries", "Therefore only LyricWiki will be searched.", ""); googlePopUpMessageShown = true; + lc.NoMoreValidLicenseKeys = true; } } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-01-29 16:38:44 UTC (rev 41) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-01-29 21:07:30 UTC (rev 42) @@ -631,7 +631,7 @@ this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); this.tabPageSetup.Size = new System.Drawing.Size(520, 502); this.tabPageSetup.TabIndex = 2; - this.tabPageSetup.Text = "Setup"; + this.tabPageSetup.Text = "Search Setup"; this.tabPageSetup.UseVisualStyleBackColor = true; // // gbSettings @@ -773,8 +773,6 @@ // cbLeosLyrics // this.cbLeosLyrics.AutoSize = true; - this.cbLeosLyrics.Checked = true; - this.cbLeosLyrics.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLeosLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.cbLeosLyrics.Location = new System.Drawing.Point(208, 43); this.cbLeosLyrics.Name = "cbLeosLyrics"; @@ -799,8 +797,6 @@ // cbLyricsMania // this.cbLyricsMania.AutoSize = true; - this.cbLyricsMania.Checked = true; - this.cbLyricsMania.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLyricsMania.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.cbLyricsMania.Location = new System.Drawing.Point(49, 43); this.cbLyricsMania.Name = "cbLyricsMania"; @@ -812,8 +808,6 @@ // cbLyrics007 // this.cbLyrics007.AutoSize = true; - 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(208, 21); this.cbLyrics007.Name = "cbLyrics007"; @@ -825,8 +819,6 @@ // cbSing365 // this.cbSing365.AutoSize = true; - this.cbSing365.Checked = true; - this.cbSing365.CheckState = System.Windows.Forms.CheckState.Checked; this.cbSing365.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.cbSing365.Location = new System.Drawing.Point(49, 65); this.cbSing365.Name = "cbSing365"; @@ -838,8 +830,6 @@ // cbSongMeaning // this.cbSongMeaning.AutoSize = true; - this.cbSongMeaning.Checked = true; - this.cbSongMeaning.CheckState = System.Windows.Forms.CheckState.Checked; this.cbSongMeaning.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.cbSongMeaning.Location = new System.Drawing.Point(366, 21); this.cbSongMeaning.Name = "cbSongMeaning"; @@ -851,8 +841,6 @@ // cbLyricsFreak // this.cbLyricsFreak.AutoSize = true; - this.cbLyricsFreak.Checked = true; - this.cbLyricsFreak.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLyricsFreak.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.cbLyricsFreak.Location = new System.Drawing.Point(208, 65); this.cbLyricsFreak.Name = "cbLyricsFreak"; @@ -921,19 +909,19 @@ this.mpLabel6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.mpLabel6.Location = new System.Drawing.Point(11, 72); this.mpLabel6.Name = "mpLabel6"; - this.mpLabel6.Size = new System.Drawing.Size(55, 16); + this.mpLabel6.Size = new System.Drawing.Size(50, 16); this.mpLabel6.TabIndex = 19; this.mpLabel6.Text = "Notice:"; // // lbGoogleNotice // this.lbGoogleNotice.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbGoogleNotice.Location = new System.Drawing.Point(62, 72); + this.lbGoogleNotice.Location = new System.Drawing.Point(67, 72); this.lbGoogleNotice.Name = "lbGoogleNotice"; - this.lbGoogleNotice.Size = new System.Drawing.Size(412, 25); + this.lbGoogleNotice.Size = new System.Drawing.Size(433, 38); this.lbGoogleNotice.TabIndex = 18; - this.lbGoogleNotice.Text = "Currently the Google web service does not require a license key to operate!\r\nAcco" + - "rdingly it is recommended to use all of the seven working lyric sites."; + this.lbGoogleNotice.Text = "As of December 5, 2006, Google are no longer issuing new API keys for the SOAP Se" + + "arch API. Users with existing SOAP Search API keys will not be affected.\r\n"; // // labelPluginBannerHint // @@ -980,7 +968,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(529, 566); + this.ClientSize = new System.Drawing.Size(530, 562); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-01-29 16:38:44 UTC (rev 41) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-01-29 21:07:30 UTC (rev 42) @@ -118,21 +118,21 @@ { try { - tbLicenseKey1.Text = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey1", ""); + tbLicenseKey1.Text = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey1", "zhQlW3ZQFHLE2dibwGRcpcDJvThQ/TTU"); tbLicenseKey2.Text = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey2", ""); tbLicenseKey3.Text = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey3", ""); tbLicenseKey4.Text = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey4", ""); tbLicenseKey5.Text = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey5", ""); lbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", "100"); - cbSing365.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSing365", "True")).ToString().Equals("True") ? true : false; + cbSing365.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSing365", "False")).ToString().Equals("True") ? true : false; cbLyricsHosting.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsHosting", "False")).ToString().Equals("True") ? true : false; - cbLyricsMania.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsMania", "True")).ToString().Equals("True") ? true : false; - cbSongMeaning.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSongMeaning", "True")).ToString().Equals("True") ? true : false; - cbLyricsFreak.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsFreak", "True")).ToString().Equals("True") ? true : false; + cbLyricsMania.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsMania", "False")).ToString().Equals("True") ? true : false; + cbSongMeaning.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSongMeaning", "False")).ToString().Equals("True") ? true : false; + cbLyricsFreak.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsFreak", "False")).ToString().Equals("True") ? true : false; cbMMMD.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useMMMD", "False")).ToString().Equals("True") ? true : false; - cbLeosLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLeosLyrics", "True")).ToString().Equals("True") ? true : false; - cbLyrics007.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false; + cbLeosLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLeosLyrics", "False")).ToString().Equals("True") ? true : false; + cbLyrics007.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "False")).ToString().Equals("True") ? true : false; cbLyricWiki.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; if (Setup.IsMember("Sing365") == false) @@ -140,7 +140,7 @@ cbSing365.Checked = false; cbSing365.Enabled = false; } - if (Setup.IsMember("LyricsHostring") == false) + if (Setup.IsMember("LyricsHosting") == false) { cbLyricsHosting.Checked = false; cbLyricsHosting.Enabled = false; @@ -472,6 +472,7 @@ } else { + lc.NoMoreValidLicenseKeys = true; ThreadFinished = new String[] { m_artist, m_track, "The search has ended due to no more valid license keys entries today.", "" }; } } @@ -568,7 +569,7 @@ if (cbLyricsFreak.Checked) sitesToSearch.Add("LyricsFreak"); if (cbSongMeaning.Checked) sitesToSearch.Add("SongMeanings"); if (cbMMMD.Checked) sitesToSearch.Add("MusicMadeMe"); - if (cbLyricsHosting.Checked) sitesToSearch.Add("LyricsHostring"); + if (cbLyricsHosting.Checked) sitesToSearch.Add("LyricsHosting"); return (string[])sitesToSearch.ToArray("".GetType()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-01-28 20:06:10
|
Revision: 37 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=37&view=rev Author: saamand Date: 2007-01-28 12:06:07 -0800 (Sun, 28 Jan 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/GetGoogleSearchResult.cs trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx Modified: trunk/plugins/MyLyrics/LyricsEngine/GetGoogleSearchResult.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/GetGoogleSearchResult.cs 2007-01-28 18:37:20 UTC (rev 36) +++ trunk/plugins/MyLyrics/LyricsEngine/GetGoogleSearchResult.cs 2007-01-28 20:06:07 UTC (rev 37) @@ -7,28 +7,30 @@ namespace LyricsEngine { - class GetGoogleSearchResult + class GetGoogleSearchResult : IDisposable { private LyricSearch m_LyricSearh; + GetGoogleSearchResultsDelegate delSearch; + IAsyncResult ar; + public static bool Abort = false; - // Constructor public GetGoogleSearchResult(LyricSiteInfo siteInfo, LyricSearch lyricSearch2) { - Thread.Sleep(2000); + Thread.Sleep(1000); + this.m_LyricSearh = lyricSearch2; Google.GoogleSearchService s = new Google.GoogleSearchService(); Google.GoogleSearchResult searchResult = new Google.GoogleSearchResult(); - GetGoogleSearchResultsDelegate delSearch = - new GetGoogleSearchResultsDelegate(GetGoogleSearchResults); + delSearch = new GetGoogleSearchResultsDelegate(GetGoogleSearchResults); string[] artistWords = siteInfo.artist.Split(' '); string m_lastUsedLicenseKey = m_LyricSearh.GoogleLicenseKey; - IAsyncResult ar = delSearch.BeginInvoke(m_lastUsedLicenseKey, ((!m_LyricSearh.TestedAll) ? "intitle:" + siteInfo.artistWithDoubleQuotes : "intitle:" + artistWords[artistWords.Length - 1]) + " " + "intitle:" + siteInfo.trackWithDoubleQuotes + " " + "intitle:" + siteInfo.extra + " " + siteInfo.siteNameToSearch + " " + "site:" + siteInfo.siteWWW, + ar = delSearch.BeginInvoke(m_lastUsedLicenseKey, ((!m_LyricSearh.TestedAll) ? "intitle:" + siteInfo.artistWithDoubleQuotes : "intitle:" + artistWords[artistWords.Length - 1]) + " " + "intitle:" + siteInfo.trackWithDoubleQuotes + " " + "intitle:" + siteInfo.extra + " " + siteInfo.siteNameToSearch + " " + "site:" + siteInfo.siteWWW, 0, siteInfo.noOfHitsUsed, false, "", false, "", "", "", new AsyncCallback(getGoogleSearchResultsCallBack), siteInfo); if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "GetGoogleSearchResult(" + siteInfo.artist + ", " + siteInfo.track + ", " + siteInfo.siteName + ")"); @@ -58,40 +60,57 @@ } } - private void getGoogleSearchResultsCallBack(IAsyncResult ar) + public void Dispose() { - AsyncResult result = (AsyncResult)ar; - - // grab the delegate - GetGoogleSearchResultsDelegate del = - (GetGoogleSearchResultsDelegate)result.AsyncDelegate; - - LyricSiteInfo siteInfo = (LyricSiteInfo)ar.AsyncState; - - if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "getGoogleSearchResultsCallBack(" + siteInfo.artist + ", " + siteInfo.track + ", " + siteInfo.siteName + ")"); - - Google.GoogleSearchResult searchResult = null; - - // call EndInvoke on the delegate to get all the information about our method call try { - searchResult = del.EndInvoke(ar); + ar = null; + //Google.GoogleSearchResult searchResult = delSearch.EndInvoke + delSearch = null; } catch (Exception e) { - //System.Windows.Forms.MessageBox.Show(e.ToString()); + //System.Console.WriteLine(e.Message); + //delSearch = null; } + System.Console.WriteLine("*****************************"); + } - if (searchResult != null) + private void getGoogleSearchResultsCallBack(IAsyncResult ar) + { + if (!Abort) { - m_LyricSearh.validateSearchResult(searchResult.resultElements, siteInfo); + AsyncResult result = (AsyncResult)ar; + + // grab the delegate + GetGoogleSearchResultsDelegate del = + (GetGoogleSearchResultsDelegate)result.AsyncDelegate; + + LyricSiteInfo siteInfo = (LyricSiteInfo)ar.AsyncState; + + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "getGoogleSearchResultsCallBack(" + siteInfo.artist + ", " + siteInfo.track + ", " + siteInfo.siteName + ")"); + + Google.GoogleSearchResult searchResult = null; + + // call EndInvoke on the delegate to get all the information about our method call + try + { + searchResult = del.EndInvoke(ar); + + if (searchResult != null) + { + m_LyricSearh.validateSearchResult(searchResult.resultElements, siteInfo); + } + else + { + m_LyricSearh.validateSearchResult(null, siteInfo); + } + } + catch (Exception e) + { + //System.Windows.Forms.MessageBox.Show(e.ToString()); + } } - else - { - m_LyricSearh.validateSearchResult(null, siteInfo); - } - - if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "getGoogleSearchResultsCallBack - END(" + siteInfo.artist + ", " + siteInfo.track + ", " + siteInfo.siteName + ")"); } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-01-28 18:37:20 UTC (rev 36) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-01-28 20:06:07 UTC (rev 37) @@ -32,7 +32,7 @@ private bool m_MessageMode; private string m_GoogleLicenseKey = ""; - private bool m_AllowSearches = false; + private bool m_StopSearches = false; // status private static int noOfLyricsToSearch; @@ -59,7 +59,10 @@ int m_managedThreadId = -1; + public static event EventHandler StopTheSearchAndAbort; + + public LyricController(ILyricForm mainForm, ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped, bool messageMode) { this.m_Form = mainForm; @@ -70,13 +73,15 @@ noOfLyricsSearched = 0; noOfLyricsFound = 0; noOfLyricsNotFound = 0; - + // initialize events m_EventStop_LyricController = eventStopThread; m_EventStopped_LyricController = eventThreadStopped; m_EventStop_LyricSearches = new ManualResetEvent(false); m_EventStop_LyricSearches.Set(); + + LyricSearch.Abort = false; } // Function runs in worker thread and emulates long process. @@ -141,7 +146,7 @@ // inform main thread that this thread stopped m_EventStopped_LyricController.Set(); - finishThread("", "", "The search has ended. Please wait a few seconds for all threads to end before closing the configuration.", ""); + finishThread("", "", "The search has ended.", ""); } public void updateManualResetEvents(ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped) @@ -235,19 +240,26 @@ internal void lyricFound(String lyricStrings, String artist, String title, String site) { - m_Form.LyricFound = new Object[] { lyricStrings, artist, title, site}; - statusUpdate(artist, title, site, true); + if (m_StopSearches == false) + { + m_Form.LyricFound = new Object[] { lyricStrings, artist, title, site }; + statusUpdate(artist, title, site, true); + } } internal void lyricNotFound(String artist, String title, String message, String site) { - m_Form.LyricNotFound = new Object[] {artist, title, message, site}; - statusUpdate(artist, title, site, false); + if (m_StopSearches == false) + { + m_Form.LyricNotFound = new Object[] { artist, title, message, site }; + statusUpdate(artist, title, site, false); + } } public void finishThread(String artist, String title, String message, String site) { m_EventStop_LyricController.Set(); + m_EventStopped_LyricController.Set(); m_Form.ThreadFinished = new Object[] { artist, title, message, site }; } @@ -272,15 +284,20 @@ public bool StopSearches { - get { return m_AllowSearches; } + get { return m_StopSearches; } set { if (value == true) { + m_StopSearches = true; m_EventStop_LyricSearches.Reset(); + LyricSearch.Abort = true; + //StopTheSearchAndAbort.Invoke(this, EventArgs.Empty); } else { + m_StopSearches = false; m_EventStop_LyricSearches.Set(); + LyricSearch.Abort = false; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs 2007-01-28 18:37:20 UTC (rev 36) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs 2007-01-28 20:06:07 UTC (rev 37) @@ -12,6 +12,8 @@ private static Stopwatch stopWatch; private static string logName = "MyLyrics.log"; private static string logFileName = ""; + private static FileStream objStream; + private static TextWriterTraceListener objTraceListener; public static void OpenLog(string logDir) @@ -32,8 +34,8 @@ ts = new TraceSource("MyLyrics"); ts.Switch = new SourceSwitch("sw1", "All"); - FileStream objStream = new FileStream(logFileName, FileMode.OpenOrCreate); - TextWriterTraceListener objTraceListener = new TextWriterTraceListener(objStream); + objStream = new FileStream(logFileName, FileMode.OpenOrCreate); + objTraceListener = new TextWriterTraceListener(objStream); objTraceListener.Filter = new EventTypeFilter(SourceLevels.All); ts.Listeners.Add(objTraceListener); startTimer(); @@ -47,6 +49,21 @@ ts.Flush(); ts.Close(); stopTimer(); + + objStream.Close(); + objStream.Dispose(); + try + { + objTraceListener.Close(); + objTraceListener.Dispose(); + } + catch { } + + if (System.IO.File.Exists(logFileName)) + { + FileStream file = new FileStream(logFileName, FileMode.OpenOrCreate, FileAccess.Write); + file.Close(); + } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs 2007-01-28 18:37:20 UTC (rev 36) +++ trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs 2007-01-28 20:06:07 UTC (rev 37) @@ -15,6 +15,7 @@ private string artist = ""; private string title = ""; private int noOfTries = 0; + public static bool Abort = false; private string[] commonReplacementsLyricWiki = new string[16] { "<br>", "", "<BR>", "", "?d", "'d", "?s", "'s", "?t", "'t", "?v", "'v", "?e", "'e", "?r", "'r" }; private string[] commonRemoveFromLyricWiki = new string[2] { "[[category", "[[Category" }; @@ -34,6 +35,10 @@ while (noOfTries < 12) { + // If the user has aborted stop the search and return (false) + if (Abort) + return false; + if (ar.AsyncWaitHandle.WaitOne(0, true)) { lyricsResult = del.EndInvoke(ar); @@ -65,7 +70,7 @@ try { // Step 1: search title as it is - if (searchForWiki(this.artist, this.title)) + if (Abort == false && searchForWiki(this.artist, this.title)) { return makeLyricFit(lyricsResult.lyrics); } @@ -110,28 +115,28 @@ return lyricsResult.lyrics; } - Thread.Sleep(1000); + //Thread.Sleep(1000); - // Step 2: search with parentheses and other disturbance removed - optimizeString(ref this.artist, ref this.title); - lyricsResult = lyricWiki.getSongResult(this.artist, this.title); - if (isLyric(lyricsResult.lyrics)) - { - return lyricsResult.lyrics; - } + //// Step 2: search with parentheses and other disturbance removed + //optimizeString(ref this.artist, ref this.title); + //lyricsResult = lyricWiki.getSongResult(this.artist, this.title); + //if (isLyric(lyricsResult.lyrics)) + //{ + // return lyricsResult.lyrics; + //} - Thread.Sleep(1000); + //Thread.Sleep(1000); - // Step 3: search with altered and strings if any - this.artist = LyricUtil.changeAnd_and_and(this.artist); - this.title = LyricUtil.changeAnd_and_and(this.title); - lyricsResult = lyricWiki.getSongResult(this.artist, this.title); - if (isLyric(lyricsResult.lyrics)) - { - return lyricsResult.lyrics; - } + //// Step 3: search with altered and strings if any + //this.artist = LyricUtil.changeAnd_and_and(this.artist); + //this.title = LyricUtil.changeAnd_and_and(this.title); + //lyricsResult = lyricWiki.getSongResult(this.artist, this.title); + //if (isLyric(lyricsResult.lyrics)) + //{ + // return lyricsResult.lyrics; + //} - Thread.Sleep(3000); + //Thread.Sleep(3000); // final step: return "Not found" if no lyric found return "Not found"; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-01-28 18:37:20 UTC (rev 36) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-01-28 20:06:07 UTC (rev 37) @@ -542,7 +542,7 @@ //GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); lc.GoogleLicenseKey = m_GoogleLicenseKeys[nextGoogleLicenseKeyIndex]; - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Warning, 0, LyricDiagnostics.elapsedTimeString() + "Exception: " + m_StatusText); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Exception: " + m_StatusText); } else { Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-01-28 18:37:20 UTC (rev 36) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-01-28 20:06:07 UTC (rev 37) @@ -80,6 +80,17 @@ this.mpLabel1 = new MediaPortal.UserInterface.Controls.MPLabel(); this.btImportAll = new MediaPortal.UserInterface.Controls.MPButton(); this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); + this.gbSettings = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.tbLicenseKey5 = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.mpLabel5 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.tbLicenseKey4 = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.mpLabel4 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.tbLicenseKey3 = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.mpLabel3 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.tbLicenseKey2 = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.mpLabel2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.tbLicenseKey1 = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.lbGoogleLicenceKey = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.cbLyricsHosting = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLeosLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); @@ -94,24 +105,13 @@ this.lbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbSongsLimit = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLicenseKeyHelp = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.mpLabel6 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbGoogleNotice = new MediaPortal.UserInterface.Controls.MPLabel(); + this.labelPluginBannerHint = new MediaPortal.UserInterface.Controls.MPLabel(); this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); this.bgWorkerTestWebservices = new System.ComponentModel.BackgroundWorker(); this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); - this.lbGoogleNotice = new MediaPortal.UserInterface.Controls.MPLabel(); - this.gbSettings = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.tbLicenseKey5 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.mpLabel5 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLicenseKey4 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.mpLabel4 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLicenseKey3 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.mpLabel3 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLicenseKey2 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.mpLabel2 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLicenseKey1 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.lbGoogleLicenceKey = new MediaPortal.UserInterface.Controls.MPLabel(); - this.labelPluginBannerHint = new MediaPortal.UserInterface.Controls.MPLabel(); - this.mpLabel6 = new MediaPortal.UserInterface.Controls.MPLabel(); this.tabControl.SuspendLayout(); this.tabPageDatabase.SuspendLayout(); this.gbGoogleLicKeyStatuses.SuspendLayout(); @@ -120,10 +120,10 @@ this.gbMusicDBSearchStats.SuspendLayout(); this.gbMusicDBSearch.SuspendLayout(); this.tabPageSetup.SuspendLayout(); + this.gbSettings.SuspendLayout(); this.gbLyricSites.SuspendLayout(); this.gbGenerel.SuspendLayout(); this.gbLicenseKeyHelp.SuspendLayout(); - this.gbSettings.SuspendLayout(); this.SuspendLayout(); // // tabControl @@ -142,7 +142,7 @@ this.tabPageLyricsDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageLyricsDatabase.Name = "tabPageLyricsDatabase"; this.tabPageLyricsDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 513); + this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 502); this.tabPageLyricsDatabase.TabIndex = 1; this.tabPageLyricsDatabase.Text = "Lyrics database"; this.tabPageLyricsDatabase.UseVisualStyleBackColor = true; @@ -629,11 +629,116 @@ this.tabPageSetup.Location = new System.Drawing.Point(4, 22); this.tabPageSetup.Name = "tabPageSetup"; this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSetup.Size = new System.Drawing.Size(520, 513); + this.tabPageSetup.Size = new System.Drawing.Size(520, 502); this.tabPageSetup.TabIndex = 2; this.tabPageSetup.Text = "Setup"; this.tabPageSetup.UseVisualStyleBackColor = true; // + // gbSettings + // + this.gbSettings.Controls.Add(this.tbLicenseKey5); + this.gbSettings.Controls.Add(this.mpLabel5); + this.gbSettings.Controls.Add(this.tbLicenseKey4); + this.gbSettings.Controls.Add(this.mpLabel4); + this.gbSettings.Controls.Add(this.tbLicenseKey3); + this.gbSettings.Controls.Add(this.mpLabel3); + this.gbSettings.Controls.Add(this.tbLicenseKey2); + this.gbSettings.Controls.Add(this.mpLabel2); + this.gbSettings.Controls.Add(this.tbLicenseKey1); + this.gbSettings.Controls.Add(this.lbGoogleLicenceKey); + this.gbSettings.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbSettings.Location = new System.Drawing.Point(4, 169); + this.gbSettings.Name = "gbSettings"; + this.gbSettings.Size = new System.Drawing.Size(510, 148); + this.gbSettings.TabIndex = 29; + this.gbSettings.TabStop = false; + this.gbSettings.Text = "Google license keys"; + // + // tbLicenseKey5 + // + this.tbLicenseKey5.BorderColor = System.Drawing.Color.Empty; + this.tbLicenseKey5.Location = new System.Drawing.Point(114, 118); + this.tbLicenseKey5.Name = "tbLicenseKey5"; + this.tbLicenseKey5.Size = new System.Drawing.Size(218, 20); + this.tbLicenseKey5.TabIndex = 15; + // + // mpLabel5 + // + this.mpLabel5.AutoSize = true; + this.mpLabel5.Location = new System.Drawing.Point(12, 121); + this.mpLabel5.Name = "mpLabel5"; + this.mpLabel5.Size = new System.Drawing.Size(76, 13); + this.mpLabel5.TabIndex = 10; + this.mpLabel5.Text = "License key 5:"; + // + // tbLicenseKey4 + // + this.tbLicenseKey4.BorderColor = System.Drawing.Color.Empty; + this.tbLicenseKey4.Location = new System.Drawing.Point(114, 92); + this.tbLicenseKey4.Name = "tbLicenseKey4"; + this.tbLicenseKey4.Size = new System.Drawing.Size(218, 20); + this.tbLicenseKey4.TabIndex = 14; + // + // mpLabel4 + // + this.mpLabel4.AutoSize = true; + this.mpLabel4.Location = new System.Drawing.Point(12, 95); + this.mpLabel4.Name = "mpLabel4"; + this.mpLabel4.Size = new System.Drawing.Size(76, 13); + this.mpLabel4.TabIndex = 8; + this.mpLabel4.Text = "License key 4:"; + // + // tbLicenseKey3 + // + this.tbLicenseKey3.BorderColor = System.Drawing.Color.Empty; + this.tbLicenseKey3.Location = new System.Drawing.Point(114, 66); + this.tbLicenseKey3.Name = "tbLicenseKey3"; + this.tbLicenseKey3.Size = new System.Drawing.Size(218, 20); + this.tbLicenseKey3.TabIndex = 13; + // + // mpLabel3 + // + this.mpLabel3.AutoSize = true; + this.mpLabel3.Location = new System.Drawing.Point(12, 69); + this.mpLabel3.Name = "mpLabel3"; + this.mpLabel3.Size = new System.Drawing.Size(76, 13); + this.mpLabel3.TabIndex = 6; + this.mpLabel3.Text = "License key 3:"; + // + // tbLicenseKey2 + // + this.tbLicenseKey2.BorderColor = System.Drawing.Color.Empty; + this.tbLicenseKey2.Location = new System.Drawing.Point(114, 40); + this.tbLicenseKey2.Name = "tbLicenseKey2"; + this.tbLicenseKey2.Size = new System.Drawing.Size(218, 20); + this.tbLicenseKey2.TabIndex = 12; + // + // mpLabel2 + // + this.mpLabel2.AutoSize = true; + this.mpLabel2.Location = new System.Drawing.Point(12, 43); + this.mpLabel2.Name = "mpLabel2"; + this.mpLabel2.Size = new System.Drawing.Size(76, 13); + this.mpLabel2.TabIndex = 4; + this.mpLabel2.Text = "License key 2:"; + // + // tbLicenseKey1 + // + this.tbLicenseKey1.BorderColor = System.Drawing.Color.Empty; + this.tbLicenseKey1.Location = new System.Drawing.Point(114, 14); + this.tbLicenseKey1.Name = "tbLicenseKey1"; + this.tbLicenseKey1.Size = new System.Drawing.Size(218, 20); + this.tbLicenseKey1.TabIndex = 11; + // + // lbGoogleLicenceKey + // + this.lbGoogleLicenceKey.AutoSize = true; + this.lbGoogleLicenceKey.Location = new System.Drawing.Point(12, 17); + this.lbGoogleLicenceKey.Name = "lbGoogleLicenceKey"; + this.lbGoogleLicenceKey.Size = new System.Drawing.Size(76, 13); + this.lbGoogleLicenceKey.TabIndex = 0; + this.lbGoogleLicenceKey.Text = "License key 1:"; + // // gbLyricSites // this.gbLyricSites.AutoSize = true; @@ -811,6 +916,33 @@ this.gbLicenseKeyHelp.TabStop = false; this.gbLicenseKeyHelp.Text = "Google license keys info"; // + // mpLabel6 + // + this.mpLabel6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.mpLabel6.Location = new System.Drawing.Point(11, 72); + this.mpLabel6.Name = "mpLabel6"; + this.mpLabel6.Size = new System.Drawing.Size(55, 16); + this.mpLabel6.TabIndex = 19; + this.mpLabel6.Text = "Notice:"; + // + // lbGoogleNotice + // + this.lbGoogleNotice.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbGoogleNotice.Location = new System.Drawing.Point(62, 72); + this.lbGoogleNotice.Name = "lbGoogleNotice"; + this.lbGoogleNotice.Size = new System.Drawing.Size(412, 25); + this.lbGoogleNotice.TabIndex = 18; + this.lbGoogleNotice.Text = "Currently the Google web service does not require a license key to operate!\r\nAcco" + + "rdingly it is recommended to use all of the seven working lyric sites."; + // + // labelPluginBannerHint + // + this.labelPluginBannerHint.Location = new System.Drawing.Point(11, 20); + this.labelPluginBannerHint.Name = "labelPluginBannerHint"; + this.labelPluginBannerHint.Size = new System.Drawing.Size(489, 43); + this.labelPluginBannerHint.TabIndex = 17; + this.labelPluginBannerHint.Text = resources.GetString("labelPluginBannerHint.Text"); + // // btSave // this.btSave.Location = new System.Drawing.Point(356, 538); @@ -844,143 +976,11 @@ this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); // - // lbGoogleNotice - // - this.lbGoogleNotice.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbGoogleNotice.Location = new System.Drawing.Point(62, 72); - this.lbGoogleNotice.Name = "lbGoogleNotice"; - this.lbGoogleNotice.Size = new System.Drawing.Size(412, 25); - this.lbGoogleNotice.TabIndex = 18; - this.lbGoogleNotice.Text = "Currently the Google web service does not require a license key to operate!\r\nAcco" + - "rdingly it is recommended to use all of the seven working lyric sites."; - // - // gbSettings - // - this.gbSettings.Controls.Add(this.tbLicenseKey5); - this.gbSettings.Controls.Add(this.mpLabel5); - this.gbSettings.Controls.Add(this.tbLicenseKey4); - this.gbSettings.Controls.Add(this.mpLabel4); - this.gbSettings.Controls.Add(this.tbLicenseKey3); - this.gbSettings.Controls.Add(this.mpLabel3); - this.gbSettings.Controls.Add(this.tbLicenseKey2); - this.gbSettings.Controls.Add(this.mpLabel2); - this.gbSettings.Controls.Add(this.tbLicenseKey1); - this.gbSettings.Controls.Add(this.lbGoogleLicenceKey); - this.gbSettings.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbSettings.Location = new System.Drawing.Point(4, 169); - this.gbSettings.Name = "gbSettings"; - this.gbSettings.Size = new System.Drawing.Size(510, 148); - this.gbSettings.TabIndex = 29; - this.gbSettings.TabStop = false; - this.gbSettings.Text = "Google license keys"; - // - // tbLicenseKey5 - // - this.tbLicenseKey5.BorderColor = System.Drawing.Color.Empty; - this.tbLicenseKey5.Location = new System.Drawing.Point(114, 118); - this.tbLicenseKey5.Name = "tbLicenseKey5"; - this.tbLicenseKey5.Size = new System.Drawing.Size(218, 20); - this.tbLicenseKey5.TabIndex = 15; - // - // mpLabel5 - // - this.mpLabel5.AutoSize = true; - this.mpLabel5.Location = new System.Drawing.Point(12, 121); - this.mpLabel5.Name = "mpLabel5"; - this.mpLabel5.Size = new System.Drawing.Size(76, 13); - this.mpLabel5.TabIndex = 10; - this.mpLabel5.Text = "License key 5:"; - // - // tbLicenseKey4 - // - this.tbLicenseKey4.BorderColor = System.Drawing.Color.Empty; - this.tbLicenseKey4.Location = new System.Drawing.Point(114, 92); - this.tbLicenseKey4.Name = "tbLicenseKey4"; - this.tbLicenseKey4.Size = new System.Drawing.Size(218, 20); - this.tbLicenseKey4.TabIndex = 14; - // - // mpLabel4 - // - this.mpLabel4.AutoSize = true; - this.mpLabel4.Location = new System.Drawing.Point(12, 95); - this.mpLabel4.Name = "mpLabel4"; - this.mpLabel4.Size = new System.Drawing.Size(76, 13); - this.mpLabel4.TabIndex = 8; - this.mpLabel4.Text = "License key 4:"; - // - // tbLicenseKey3 - // - this.tbLicenseKey3.BorderColor = System.Drawing.Color.Empty; - this.tbLicenseKey3.Location = new System.Drawing.Point(114, 66); - this.tbLicenseKey3.Name = "tbLicenseKey3"; - this.tbLicenseKey3.Size = new System.Drawing.Size(218, 20); - this.tbLicenseKey3.TabIndex = 13; - // - // mpLabel3 - // - this.mpLabel3.AutoSize = true; - this.mpLabel3.Location = new System.Drawing.Point(12, 69); - this.mpLabel3.Name = "mpLabel3"; - this.mpLabel3.Size = new System.Drawing.Size(76, 13); - this.mpLabel3.TabIndex = 6; - this.mpLabel3.Text = "License key 3:"; - // - // tbLicenseKey2 - // - this.tbLicenseKey2.BorderColor = System.Drawing.Color.Empty; - this.tbLicenseKey2.Location = new System.Drawing.Point(114, 40); - this.tbLicenseKey2.Name = "tbLicenseKey2"; - this.tbLicenseKey2.Size = new System.Drawing.Size(218, 20); - this.tbLicenseKey2.TabIndex = 12; - // - // mpLabel2 - // - this.mpLabel2.AutoSize = true; - this.mpLabel2.Location = new System.Drawing.Point(12, 43); - this.mpLabel2.Name = "mpLabel2"; - this.mpLabel2.Size = new System.Drawing.Size(76, 13); - this.mpLabel2.TabIndex = 4; - this.mpLabel2.Text = "License key 2:"; - // - // tbLicenseKey1 - // - this.tbLicenseKey1.BorderColor = System.Drawing.Color.Empty; - this.tbLicenseKey1.Location = new System.Drawing.Point(114, 14); - this.tbLicenseKey1.Name = "tbLicenseKey1"; - this.tbLicenseKey1.Size = new System.Drawing.Size(218, 20); - this.tbLicenseKey1.TabIndex = 11; - // - // lbGoogleLicenceKey - // - this.lbGoogleLicenceKey.AutoSize = true; - this.lbGoogleLicenceKey.Location = new System.Drawing.Point(12, 17); - this.lbGoogleLicenceKey.Name = "lbGoogleLicenceKey"; - this.lbGoogleLicenceKey.Size = new System.Drawing.Size(76, 13); - this.lbGoogleLicenceKey.TabIndex = 0; - this.lbGoogleLicenceKey.Text = "License key 1:"; - // - // labelPluginBannerHint - // - this.labelPluginBannerHint.Location = new System.Drawing.Point(11, 20); - this.labelPluginBannerHint.Name = "labelPluginBannerHint"; - this.labelPluginBannerHint.Size = new System.Drawing.Size(489, 43); - this.labelPluginBannerHint.TabIndex = 17; - this.labelPluginBannerHint.Text = resources.GetString("labelPluginBannerHint.Text"); - // - // mpLabel6 - // - this.mpLabel6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.mpLabel6.Location = new System.Drawing.Point(11, 72); - this.mpLabel6.Name = "mpLabel6"; - this.mpLabel6.Size = new System.Drawing.Size(55, 16); - this.mpLabel6.TabIndex = 19; - this.mpLabel6.Text = "Notice:"; - // // MyLyricsSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(523, 562); + this.ClientSize = new System.Drawing.Size(529, 566); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); @@ -991,6 +991,7 @@ this.Name = "MyLyricsSetup"; this.ShowIcon = false; this.Text = "MyLyrics Configuration"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MyLyricsSetup_FormClosing); this.tabControl.ResumeLayout(false); this.tabPageDatabase.ResumeLayout(false); this.gbGoogleLicKeyStatuses.ResumeLayout(false); @@ -1001,13 +1002,13 @@ this.gbMusicDBSearch.PerformLayout(); this.tabPageSetup.ResumeLayout(false); this.tabPageSetup.PerformLayout(); + this.gbSettings.ResumeLayout(false); + this.gbSettings.PerformLayout(); this.gbLyricSites.ResumeLayout(false); this.gbLyricSites.PerformLayout(); this.gbGenerel.ResumeLayout(false); this.gbGenerel.PerformLayout(); this.gbLicenseKeyHelp.ResumeLayout(false); - this.gbSettings.ResumeLayout(false); - this.gbSettings.PerformLayout(); this.ResumeLayout(false); } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-01-28 18:37:20 UTC (rev 36) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-01-28 20:06:07 UTC (rev 37) @@ -80,10 +80,9 @@ bool m_DisregardMarkedLyric = true; int m_noOfCurrentlySearches = 0; - int m_NoOfCurrentSearchesAllowed = 10; + const int m_NoOfCurrentSearchesAllowed = 10; + int m_Limit = 100; - int m_Limit = 1000; - ArrayList songs = new ArrayList(); ArrayList artists = new ArrayList(); @@ -206,7 +205,6 @@ { //MessageBox.Show("bgWorkerTestWebservices.IsBusy!!"); } - } // Stop worker thread if it is running. @@ -218,6 +216,7 @@ //GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); // set event "Stop" m_EventStopThread.Set(); + //m_LyricControllerThread = null; // wait when thread will stop or finish while (m_LyricControllerThread.IsAlive) @@ -262,10 +261,6 @@ } } - - - - private void button1_Click(object sender, System.EventArgs e) { this.Close(); @@ -304,12 +299,18 @@ lbStep1a.Text = "The collecting of songs has started."; MusicDatabase dbs = new MusicDatabase(); m_TotalTitles = dbs.GetNumOfSongs(); + + // Reset text in textboxes + lbLastActivity2.Text = ""; + lbMessage.Text = ""; lbTotalSongs2.Text = m_TotalTitles.ToString(); m_EventStopThread = new ManualResetEvent(false); m_EventThreadStopped = new ManualResetEvent(false); + m_noOfMessages = 0; m_GoogleLicenseKeyIndex = 0; + m_noOfCurrentlySearches = 0; btImportAll.Enabled = false; progressBar.Enabled = true; @@ -462,10 +463,12 @@ { // new license key is used int nextNextGoogleLicenseKeyIndex = nextGoogleLicenseKeyIndex + 1; - lbMessage.Text = "#" + ((int)(++m_noOfMessages)).ToString() + " - " + "All queries of key license number " + nextGoogleLicenseKeyIndex.ToString() + " has been used, so number " + nextNextGoogleLicenseKeyIndex.ToString() + " is used instead." + "\r\n" + lbMessage.Text + "\r\n"; + string messageAboutNewKey = "All queries of key license number " + nextGoogleLicenseKeyIndex.ToString() + " has been used, so number " + nextNextGoogleLicenseKeyIndex.ToString() + " is used instead."; + lbMessage.Text = "#" + ((int)(++m_noOfMessages)).ToString() + " - " + messageAboutNewKey + "\r\n" + lbMessage.Text + "\r\n"; setGoogleLicenseKeysStatusesText(); lbOverallWsStatusa.Text = "No more queries today!"; lc.GoogleLicenseKey = m_GoogleLicenseKeys[nextGoogleLicenseKeyIndex]; + System.Console.WriteLine(messageAboutNewKey); } else { @@ -536,6 +539,7 @@ { set { + Thread.Sleep(1000); this.Invoke(m_DelegateThreadFinished, value); } } @@ -837,16 +841,24 @@ { if (lc != null) { - m_LyricControllerThread = null; + btCancel.Enabled = false; lc.finishThread(m_artist, m_track, "The search has been cancelled by the user.", "none"); lc.Dispose(); lc = null; - bgWorkerSearch.Dispose(); - bgWorkerSearch = null; - bgWorkerTestWebservices.Dispose(); - bgWorkerTestWebservices = null; - btCancel.Enabled = false; + + m_LyricControllerThread = null; + + //bgWorkerSearch.Dispose(); + //bgWorkerSearch = null; + + //bgWorkerTestWebservices.Dispose(); + //bgWorkerTestWebservices = null; } } + + private void MyLyricsSetup_FormClosing(object sender, FormClosingEventArgs e) + { + LyricDiagnostics.Dispose(); + } } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-01-28 18:37:20 UTC (rev 36) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-01-28 20:06:07 UTC (rev 37) @@ -117,15 +117,15 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <data name="labelPluginBannerHint.Text" xml:space="preserve"> + <value>The Google Web service is a free service which offers the users to query billions of web pages directly from their own computer programs. To use a lyric site other than LyricWiki, you have to apply for at least one license key.</value> + </data> <metadata name="bgWorkerTestWebservices.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> <metadata name="bgWorkerSearch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>200, 17</value> </metadata> - <data name="labelPluginBannerHint.Text" xml:space="preserve"> - <value>The Google Web service is a free service which offers the users to query billions of web pages directly from their own computer programs. To use a lyric site other than LyricWiki, you have to apply for at least one license key.</value> - </data> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>51</value> </metadata> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-02-11 09:17:52
|
Revision: 111 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=111&view=rev Author: saamand Date: 2007-02-11 01:17:50 -0800 (Sun, 11 Feb 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.Designer.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.settings trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-02-10 10:47:10 UTC (rev 110) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-02-11 09:17:50 UTC (rev 111) @@ -55,7 +55,6 @@ // Lyric sites private string[] lyricSites; private string[] eastSites; - private string[] googleSites; public LyricController(ILyricForm mainForm, ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped, @@ -70,25 +69,17 @@ this.lyricSites = lyricSites; - // Sort the sites in easy and google sites ArrayList easySitesArrayList = new ArrayList(); - ArrayList googleArrayList = new ArrayList(); + foreach (string site in lyricSites) { if (Setup.IsMemberOfEasySites(site)) { easySitesArrayList.Add(site); } - if (Setup.IsMemberOfGoogleSites(site)) - { - googleArrayList.Add(site); - } } eastSites = (string[])easySitesArrayList.ToArray(typeof(string)); LyricSearch_EasySites.EasySites = eastSites; - - googleSites = (string[])googleArrayList.ToArray(typeof(string)); - LyricSearch_GoogleSites.GoogleSites = googleSites; // initialize events m_EventStop_LyricController = eventStopThread; @@ -97,7 +88,7 @@ m_EventStop_LyricSearches = new ManualResetEvent(false); m_EventStop_LyricSearches.Set(); - LyricSearch_GoogleSites.Abort = false; + LyricSearch_EasySites.Abort = false; } @@ -168,7 +159,7 @@ this.m_EventStopped_LyricController = eventThreadStopped; } - public void addNewLyricSearch(LyricConfigInfo lyricConfigInfo) + public void addNewLyricSearch(string artist, string title) { if (eastSites.Length > 0) { @@ -177,32 +168,16 @@ { LyricSearch_EasySites lyricSearch_EasySites = new LyricSearch_EasySites(m_EventStop_LyricController, m_EventStopped_LyricController, this); - lyricSearch_EasySites.setLyricInfo(lyricConfigInfo.artist, lyricConfigInfo.track, lyricConfigInfo.extra); + lyricSearch_EasySites.setLyricInfo(artist, title); lyricSearch_EasySites.Run(); }; Thread lyricSearchThread = new Thread(easySitesThreadInstance); - lyricSearchThread.Name = "BasicSearch for " + lyricConfigInfo.artist + " - " + lyricConfigInfo.track; // looks nice in Output window + lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; // looks nice in Output window lyricSearchThread.IsBackground = true; lyricSearchThread.Start(); threadList.Add(lyricSearchThread); } - - //if (googleSites.Length > 0) - //{ - // ThreadStart googleSitesThreadInstance = delegate - // { - // LyricSearch_GoogleSites lyricSearch_GoogleSites = new LyricSearch_GoogleSites(m_EventStop_LyricController, m_EventStopped_LyricController, this); - // lyricSearch_GoogleSites.setLyricInfo(lyricConfigInfo.artist, lyricConfigInfo.track, lyricConfigInfo.extra); - // lyricSearch_GoogleSites.Run(); - // }; - - // Thread lyricSearchThread = new Thread(googleSitesThreadInstance); - // lyricSearchThread.Name = "GoogleSearch for " + lyricConfigInfo.artist + " - " + lyricConfigInfo.track; // looks nice in Output window - // lyricSearchThread.IsBackground = true; - // lyricSearchThread.Start(); - // threadList.Add(lyricSearchThread); - //} } public void suspendAllSearchThreadsExceptMe(int managedThreadId) @@ -223,27 +198,6 @@ m_EventStop_LyricSearches.Reset(); } - public static object isLicenseKeyWorking(string licenseKey) - { - Google.GoogleSearchService s = new Google.GoogleSearchService(); - Google.GoogleSearchResult searchResults = new Google.GoogleSearchResult(); - - try - { - //MessageBox.Show("licenseKey: " + licenseKey); - searchResults = s.doGoogleSearch(licenseKey, "this is a test", 0, 3, false, "", false, "", "", ""); - return true; - } - catch (System.Net.WebException webExc) - { - return webExc;// true; //todo - } - catch (System.Web.Services.Protocols.SoapException) - { - return false; - } - } - internal void updateString(String message, String site) { m_Form.UpdateString = new Object[] { message, site }; @@ -312,14 +266,14 @@ { m_StopSearches = true; m_EventStop_LyricSearches.Reset(); - LyricSearch_GoogleSites.Abort = true; + LyricSearch_EasySites.Abort = true; //StopTheSearchAndAbort.Invoke(this, EventArgs.Empty); } else { m_StopSearches = false; m_EventStop_LyricSearches.Set(); - LyricSearch_GoogleSites.Abort = false; + LyricSearch_EasySites.Abort = false; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2007-02-10 10:47:10 UTC (rev 110) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2007-02-11 09:17:50 UTC (rev 111) @@ -8,6 +8,7 @@ { static string[] parenthesesAndAlike = new string[6] { "(album", "(acoustic", "(live", "(radio", "[", "{" }; + static string[] charsToDelete = new string[11] { ".", ",", "&", "'", "!", "\"", "&", "?", "(", ")", "+" }; // capatalize string and make ready for XML @@ -38,7 +39,7 @@ return str; } - public static bool trimForParenthesis(ref string str) + public static void trimForParenthesis(ref string str) { for (int i = 0; i < parenthesesAndAlike.Length; i++) { @@ -46,12 +47,18 @@ if (index != -1) { str = str.Substring(0, index).Trim(); - return true; } } - return false; } + public static void deleteSpecificChars(ref string str) + { + for (int i = 0; i < charsToDelete.Length; i++) + { + str = str.Replace(charsToDelete[i], ""); + } + } + public static string changeAnd_and_and(string str) { string strTemp = str; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-02-10 10:47:10 UTC (rev 110) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-02-11 09:17:50 UTC (rev 111) @@ -42,11 +42,13 @@ <ItemGroup> <Compile Include="LyricSearch_EasySites.cs" /> <Compile Include="LyricDiagnostics.cs" /> + <Compile Include="LyricSites\EvilLabs.cs" /> + <Compile Include="LyricSites\Lyrics007.cs" /> + <Compile Include="LyricSites\LyricsOnDemand.cs" /> + <Compile Include="LyricSites\SeekLyrics.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="GetGoogleSearchResult.cs" /> <Compile Include="ICommand.cs" /> <Compile Include="ILyricForm.cs" /> - <Compile Include="LyricConfigInfo.cs" /> <Compile Include="LyricController.cs" /> <Compile Include="LyricSiteInfo.cs" /> <EmbeddedResource Include="Properties\Resources.resx"> @@ -54,26 +56,16 @@ <LastGenOutput>Resources.Designer.cs</LastGenOutput> <SubType>Designer</SubType> </EmbeddedResource> - <Compile Include="LyricSearch_GoogleSites.cs" /> <Compile Include="LyricUtil.cs" /> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DependentUpon>Resources.resx</DependentUpon> <DesignTime>True</DesignTime> </Compile> - <None Include="app.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> </None> - <None Include="Web References\Google\GoogleSearch.wsdl" /> - <None Include="Web References\Google\GoogleSearchResult.datasource"> - <DependentUpon>Reference.map</DependentUpon> - </None> - <None Include="Web References\Google\Reference.map"> - <Generator>MSDiscoCodeGenerator</Generator> - <LastGenOutput>Reference.cs</LastGenOutput> - </None> <None Include="Web References\org.lyricwiki\LyricsResult.datasource"> <DependentUpon>Reference.map</DependentUpon> </None> @@ -94,33 +86,17 @@ <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> <Compile Include="Setup.cs" /> - <Compile Include="Web References\Google\Reference.cs"> - <AutoGen>True</AutoGen> - <DesignTime>True</DesignTime> - <DependentUpon>Reference.map</DependentUpon> - </Compile> <Compile Include="Web References\org.lyricwiki\Reference.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Reference.map</DependentUpon> </Compile> - <Compile Include="Wiki.cs" /> + <Compile Include="LyricSites\Wiki.cs" /> </ItemGroup> <ItemGroup> <WebReferences Include="Web References\" /> </ItemGroup> <ItemGroup> - <WebReferenceUrl Include="http://api.google.com/GoogleSearch.wsdl"> - <UrlBehavior>Dynamic</UrlBehavior> - <RelPath>Web References\Google\</RelPath> - <UpdateFromURL>http://api.google.com/GoogleSearch.wsdl</UpdateFromURL> - <ServiceLocationURL> - </ServiceLocationURL> - <CachedDynamicPropName> - </CachedDynamicPropName> - <CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName> - <CachedSettingsPropName>MyLyrics_Google_GoogleSearchService</CachedSettingsPropName> - </WebReferenceUrl> <WebReferenceUrl Include="http://lyricwiki.org/server.php%3fwsdl"> <UrlBehavior>Dynamic</UrlBehavior> <RelPath>Web References\org.lyricwiki\</RelPath> Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.Designer.cs 2007-02-10 10:47:10 UTC (rev 110) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.Designer.cs 2007-02-11 09:17:50 UTC (rev 111) @@ -26,31 +26,11 @@ [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] - [global::System.Configuration.DefaultSettingValueAttribute("http://api.google.com/search/beta2")] - public string Google_GoogleSearchService { - get { - return ((string)(this["Google_GoogleSearchService"])); - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] [global::System.Configuration.DefaultSettingValueAttribute("http://lyricwiki.org/server.php")] public string LyricsEngine_org_lyricwiki_LyricWiki { get { return ((string)(this["LyricsEngine_org_lyricwiki_LyricWiki"])); } } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] - [global::System.Configuration.DefaultSettingValueAttribute("http://api.google.com/search/beta2")] - public string MyLyrics_Google_GoogleSearchService { - get { - return ((string)(this["MyLyrics_Google_GoogleSearchService"])); - } - } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.settings =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.settings 2007-02-10 10:47:10 UTC (rev 110) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.settings 2007-02-11 09:17:50 UTC (rev 111) @@ -2,14 +2,8 @@ <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="LyricsEngine.Properties" GeneratedClassName="Settings"> <Profiles /> <Settings> - <Setting Name="Google_GoogleSearchService" Type="(Web Service URL)" Scope="Application"> - <Value Profile="(Default)">http://api.google.com/search/beta2</Value> - </Setting> <Setting Name="LyricsEngine_org_lyricwiki_LyricWiki" Type="(Web Service URL)" Scope="Application"> <Value Profile="(Default)">http://lyricwiki.org/server.php</Value> </Setting> - <Setting Name="MyLyrics_Google_GoogleSearchService" Type="(Web Service URL)" Scope="Application"> - <Value Profile="(Default)">http://api.google.com/search/beta2</Value> - </Setting> </Settings> </SettingsFile> \ No newline at end of file Modified: trunk/plugins/MyLyrics/LyricsEngine/Setup.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-02-10 10:47:10 UTC (rev 110) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-02-11 09:17:50 UTC (rev 111) @@ -6,37 +6,27 @@ { public static class Setup { - public static string[] EasySites = new string[2] + public static string[] EasySites = new string[4] { "LyricWiki", - "EvilLabs" - }; - - public static string[] GoogleSites = new string[8 - 2] - { - "Sing365", - "LyricsMania", + //"EvilLabs", "Lyrics007", - "LeosLyrics", - "LyricsFreak", - "SongMeanings" - //"LyricsHosting", - //"MusicMadeMe", + "LyricsOnDemand", + "SeekLyrics" }; + public static string[] AllSites() { ArrayList allSites = new ArrayList(); allSites.AddRange(EasySites); - allSites.AddRange(GoogleSites); string[] allSitesArray = (string[])allSites.ToArray(typeof(string)); return allSitesArray; } public static bool IsMember(string value) { - return (System.Array.IndexOf(Setup.EasySites, value) != -1 - || System.Array.IndexOf(Setup.GoogleSites, value) != -1); + return System.Array.IndexOf(Setup.EasySites, value) != -1; } public static bool IsMemberOfEasySites(string value) @@ -44,14 +34,9 @@ return System.Array.IndexOf(Setup.EasySites, value) != -1; } - public static bool IsMemberOfGoogleSites(string value) - { - return System.Array.IndexOf(Setup.GoogleSites, value) != -1; - } - public static int NoOfSites() { - return EasySites.Length + GoogleSites.Length; + return EasySites.Length; } } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-02-10 10:47:10 UTC (rev 110) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-02-11 09:17:50 UTC (rev 111) @@ -33,13 +33,13 @@ const int MAX_NO_OF_LICENSE_KEYS = 5; string[] m_GoogleLicenseKeys = new String[5] { "", "", "", "", "" }; int startingScrollSpeedVertical = 2; - bool googlePopUpMessageShown = false; const int SHIFT_WHEN_HIT = 10; #endregion #region Fields related to the skin engine [SkinControlAttribute(20)] - protected GUITextScrollUpControl CONTROL_Lyric = null; + //protected GUITextScrollUpControl CONTROL_Lyric = null; + protected GUITextControl CONTROL_Lyric = null; enum Controls { CONTROL_BACKGROUND = 1, @@ -234,69 +234,37 @@ GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); - bool useSing365, useLyricsHosting, useLyricsMania, useSongMeanings, useLyricsFreak, useMMMD, useLeosLyrics, useLyrics007, useLyricWiki, useEvilLabs; + bool useLyricWiki, useEvilLabs, useLyrics007, useLyricsOnDemand, useSeekLyrics; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { - m_GoogleLicenseKeys[0] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey1", "zhQlW3ZQFHLE2dibwGRcpcDJvThQ/TTU"); - m_GoogleLicenseKeys[1] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey2", ""); - m_GoogleLicenseKeys[2] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey3", ""); - m_GoogleLicenseKeys[3] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey4", ""); - m_GoogleLicenseKeys[4] = xmlreader.GetValueAsString("myLyrics", "googleLicenseKey5", ""); - - useSing365 = ((string)xmlreader.GetValueAsString("myLyrics", "useSing365", "False")).ToString().Equals("True") ? true : false; - useLyricsHosting = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsHosting", "False")).ToString().Equals("True") ? true : false; - useLyricsMania = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsMania", "False")).ToString().Equals("True") ? true : false; - useSongMeanings = ((string)xmlreader.GetValueAsString("myLyrics", "useSongMeaning", "False")).ToString().Equals("True") ? true : false; - useLyricsFreak = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsFreak", "False")).ToString().Equals("True") ? true : false; - useMMMD = ((string)xmlreader.GetValueAsString("myLyrics", "useMMMD", "False")).ToString().Equals("True") ? true : false; - useLeosLyrics = ((string)xmlreader.GetValueAsString("myLyrics", "useLeosLyrics", "False")).ToString().Equals("True") ? true : false; - useLyrics007 = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "False")).ToString().Equals("True") ? true : false; useLyricWiki = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; useEvilLabs = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false; + useLyrics007 = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false; + useLyricsOnDemand = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false; + useSeekLyrics = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false; } ArrayList sitesToSearch = new ArrayList(); - - if (useSing365 && Setup.IsMember("Sing365")) + if (useLyricWiki && Setup.IsMember("LyricWiki")) { - sitesToSearch.Add("Sing365"); + sitesToSearch.Add("LyricWiki"); } - if (useLyricsHosting && Setup.IsMember("LyricsHosting")) + if (useEvilLabs && Setup.IsMember("EvilLabs")) { - sitesToSearch.Add("LyricsHosting"); + sitesToSearch.Add("EvilLabs"); } - if (useLyricsMania && Setup.IsMember("LyricsMania")) - { - sitesToSearch.Add("LyricsMania"); - } - if (useSongMeanings && Setup.IsMember("SongMeanings")) - { - sitesToSearch.Add("SongMeanings"); - } - if (useLyricsFreak && Setup.IsMember("LyricsFreak")) - { - sitesToSearch.Add("LyricsFreak"); - } - if (useMMMD && Setup.IsMember("MusicMadeMe")) - { - sitesToSearch.Add("MusicMadeMe"); - } - if (useLeosLyrics && Setup.IsMember("LeosLyrics")) - { - sitesToSearch.Add("LeosLyrics"); - } if (useLyrics007 && Setup.IsMember("Lyrics007")) { sitesToSearch.Add("Lyrics007"); } - if (useLyricWiki && Setup.IsMember("LyricWiki")) + if (useLyricsOnDemand && Setup.IsMember("LyricsOnDemand")) { - sitesToSearch.Add("LyricWiki"); + sitesToSearch.Add("LyricsOnDemand"); } - if (useEvilLabs && Setup.IsMember("EvilLabs")) + if (useSeekLyrics && Setup.IsMember("SeekLyrics")) { - sitesToSearch.Add("EvilLabs"); + sitesToSearch.Add("SeekLyrics"); } m_sitesToSearch = (string[])sitesToSearch.ToArray(typeof(string)); @@ -418,8 +386,7 @@ lc.GoogleLicenseKey = m_GoogleLicenseKeys[m_GoogleLicenseKeyIndex]; - LyricConfigInfo lyricConfigInfo = new LyricConfigInfo(lc.GoogleLicenseKey, m_artist, m_title, "lyrics"); - lc.addNewLyricSearch(lyricConfigInfo); + lc.addNewLyricSearch(m_artist, m_title); } } @@ -576,12 +543,6 @@ { ShowLyricOnScreen(lyricText, site); SaveLyricToDatabase(); - - // if not found by LyricWiki, write which license key was used - if (lc != null && !site.Equals("LyricWiki")) - { - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + (lc.GoogleLicenseKey.Equals("") ? "empty key" : lc.GoogleLicenseKey)); - } } } } @@ -616,60 +577,11 @@ set { string message = (string)value; - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Warning, 0, LyricDiagnostics.elapsedTimeString() + "Exception: " + message); - - // GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, message.ToString()); - - string[] entries = message.Split(' '); - string currentKey = entries[entries.Length - 1]; - - bool keyLicensedAlreadyIn = lc.GoogleLicenseKeysUsed.Contains(currentKey); - - // if first time the current licensekey failed - if (!keyLicensedAlreadyIn) - { - lc.addToGoogleLicenseKeysUsed(currentKey); - int nextGoogleLicenseKeyIndex = ++m_GoogleLicenseKeyIndex; - if (nextGoogleLicenseKeyIndex < MAX_NO_OF_LICENSE_KEYS && !m_GoogleLicenseKeys[m_GoogleLicenseKeyIndex].Equals("")) - { - // new license key is used - int nextNextGoogleLicenseKeyIndex = nextGoogleLicenseKeyIndex + 1; - - m_StatusText = "All queries of key license number " + nextGoogleLicenseKeyIndex.ToString() + " has been used, so number " + nextNextGoogleLicenseKeyIndex.ToString() + " is used instead."; - //GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); - lc.GoogleLicenseKey = m_GoogleLicenseKeys[nextGoogleLicenseKeyIndex]; - - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Exception: " + m_StatusText); - } - else - { - string noValidKeysMessage = "The search has ended due to no more valid license keys entries today."; - ThreadFinished = new String[] { m_artist, m_title, message, "" }; - if (googlePopUpMessageShown == false) - { - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Warning, 0, LyricDiagnostics.elapsedTimeString() + noValidKeysMessage); - PopUpMessage("LyricWiki only valid source", "Your google license keys don't hold any valid query entries", "Therefore only LyricWiki will be searched.", ""); - googlePopUpMessageShown = true; - lc.NoMoreValidLicenseKeys = true; - } - } - } } } #endregion - - private void PopUpMessage(string header, string line1, string line2, string line3) - { - GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); - dlg.SetHeading(header); - dlg.SetLine(1, line1); - dlg.SetLine(2, line2); - dlg.SetLine(3, line3); - dlg.DoModal(GUIWindowManager.ActiveWindow); - } - #region ISetup Interface methods /// <summary> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-02-10 10:47:10 UTC (rev 110) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-02-11 09:17:50 UTC (rev 111) @@ -28,23 +28,24 @@ /// </summary> private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MyLyricsSetup)); this.tabControl = new MediaPortal.UserInterface.Controls.MPTabControl(); this.tabPageLyricsDatabase = new MediaPortal.UserInterface.Controls.MPTabPage(); + this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); + this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.cbSeekLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricsOnDemand = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbEvilLabs = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.tabPageDatabase = new MediaPortal.UserInterface.Controls.MPTabPage(); - this.gbGoogleLicKeyStatuses = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.lbOverallWsStatusa = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbOverallWsStatus = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus4a = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus4 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus3a = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus3 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus2a = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus2 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus1a = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus1 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus5a = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbWsStatus5 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.btImportAll = new MediaPortal.UserInterface.Controls.MPButton(); + this.btCancel = new MediaPortal.UserInterface.Controls.MPButton(); + this.mpLabel3 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.gbGenerel = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.lbSongsLimitNote = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.lbSongsLimit = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbMessages = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.lbMessage = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbProgress = new MediaPortal.UserInterface.Controls.MPGroupBox(); @@ -70,74 +71,34 @@ this.lbTotalSongs = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbLyricsFound2 = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbLyricsFound = new MediaPortal.UserInterface.Controls.MPLabel(); - this.gbMusicDBSearch = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); + this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); + this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); this.cbDisregardSongWithLyricInTag = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.btCancel = new MediaPortal.UserInterface.Controls.MPButton(); this.cbDisregardVariousArtist = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbDisregardSongsWithNoLyric = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbMarkSongsWithNoLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbDisconsiderTitlesWithLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.mpLabel1 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.btImportAll = new MediaPortal.UserInterface.Controls.MPButton(); - this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); - this.gbSettings = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.tbLicenseKey5 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.mpLabel5 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLicenseKey4 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.mpLabel4 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLicenseKey3 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.mpLabel3 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLicenseKey2 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.mpLabel2 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLicenseKey1 = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.lbGoogleLicenceKey = new MediaPortal.UserInterface.Controls.MPLabel(); - this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.cbEvilLabs = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.gbGenerel = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.lbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.lbSongsLimit = new MediaPortal.UserInterface.Controls.MPLabel(); - this.gbLicenseKeyHelp = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.mpLabel6 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbGoogleNotice = new MediaPortal.UserInterface.Controls.MPLabel(); - this.labelPluginBannerHint = new MediaPortal.UserInterface.Controls.MPLabel(); - this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); - this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); - this.bgWorkerTestWebservices = new System.ComponentModel.BackgroundWorker(); - this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); - this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.cbLyricsHosting = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLeosLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyricsMania = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbSing365 = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbSongMeaning = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyricsFreak = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbMMMD = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.tabControl.SuspendLayout(); + this.tabPageSetup.SuspendLayout(); + this.gbLyricSites.SuspendLayout(); this.tabPageDatabase.SuspendLayout(); - this.gbGoogleLicKeyStatuses.SuspendLayout(); + this.mpGroupBox1.SuspendLayout(); + this.gbGenerel.SuspendLayout(); this.gbMessages.SuspendLayout(); this.gbProgress.SuspendLayout(); this.gbMusicDBSearchStats.SuspendLayout(); - this.gbMusicDBSearch.SuspendLayout(); - this.tabPageSetup.SuspendLayout(); - this.gbSettings.SuspendLayout(); - this.gbLyricSites.SuspendLayout(); - this.gbGenerel.SuspendLayout(); - this.gbLicenseKeyHelp.SuspendLayout(); - this.mpGroupBox1.SuspendLayout(); this.SuspendLayout(); // // tabControl // this.tabControl.Controls.Add(this.tabPageLyricsDatabase); - this.tabControl.Controls.Add(this.tabPageDatabase); this.tabControl.Controls.Add(this.tabPageSetup); - this.tabControl.Location = new System.Drawing.Point(5, 4); + this.tabControl.Controls.Add(this.tabPageDatabase); + this.tabControl.Location = new System.Drawing.Point(12, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(528, 528); + this.tabControl.Size = new System.Drawing.Size(528, 476); this.tabControl.TabIndex = 1; // // tabPageLyricsDatabase @@ -145,160 +106,224 @@ this.tabPageLyricsDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageLyricsDatabase.Name = "tabPageLyricsDatabase"; this.tabPageLyricsDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 502); + this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 450); this.tabPageLyricsDatabase.TabIndex = 1; this.tabPageLyricsDatabase.Text = "Lyrics database"; this.tabPageLyricsDatabase.UseVisualStyleBackColor = true; // - // tabPageDatabase + // tabPageSetup // - this.tabPageDatabase.Controls.Add(this.gbGoogleLicKeyStatuses); - this.tabPageDatabase.Controls.Add(this.gbMessages); - this.tabPageDatabase.Controls.Add(this.gbProgress); - this.tabPageDatabase.Controls.Add(this.gbMusicDBSearchStats); - this.tabPageDatabase.Controls.Add(this.gbMusicDBSearch); - this.tabPageDatabase.Location = new System.Drawing.Point(4, 22); - this.tabPageDatabase.Name = "tabPageDatabase"; - this.tabPageDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDatabase.Size = new System.Drawing.Size(520, 502); - this.tabPageDatabase.TabIndex = 2; - this.tabPageDatabase.Text = "Music database"; - this.tabPageDatabase.UseVisualStyleBackColor = true; + this.tabPageSetup.Controls.Add(this.gbLyricSites); + this.tabPageSetup.Location = new System.Drawing.Point(4, 22); + this.tabPageSetup.Name = "tabPageSetup"; + this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); + this.tabPageSetup.Size = new System.Drawing.Size(520, 450); + this.tabPageSetup.TabIndex = 2; + this.tabPageSetup.Text = "General setup"; + this.tabPageSetup.UseVisualStyleBackColor = true; // - // gbGoogleLicKeyStatuses + // gbLyricSites // - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbOverallWsStatusa); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbOverallWsStatus); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus4a); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus4); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus3a); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus3); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus2a); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus2); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus1a); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus1); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus5a); - this.gbGoogleLicKeyStatuses.Controls.Add(this.lbWsStatus5); - this.gbGoogleLicKeyStatuses.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbGoogleLicKeyStatuses.Location = new System.Drawing.Point(254, 276); - this.gbGoogleLicKeyStatuses.Name = "gbGoogleLicKeyStatuses"; - this.gbGoogleLicKeyStatuses.Size = new System.Drawing.Size(263, 126); - this.gbGoogleLicKeyStatuses.TabIndex = 30; - this.gbGoogleLicKeyStatuses.TabStop = false; - this.gbGoogleLicKeyStatuses.Text = "Google license key status"; + this.gbLyricSites.AutoSize = true; + this.gbLyricSites.Controls.Add(this.cbSeekLyrics); + this.gbLyricSites.Controls.Add(this.cbLyricsOnDemand); + this.gbLyricSites.Controls.Add(this.cbLyrics007); + this.gbLyricSites.Controls.Add(this.cbEvilLabs); + this.gbLyricSites.Controls.Add(this.cbLyricWiki); + this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbLyricSites.Location = new System.Drawing.Point(4, 6); + this.gbLyricSites.Name = "gbLyricSites"; + this.gbLyricSites.Size = new System.Drawing.Size(510, 102); + this.gbLyricSites.TabIndex = 28; + this.gbLyricSites.TabStop = false; + this.gbLyricSites.Text = "Lyric sites to search"; // - // lbOverallWsStatusa + // cbSeekLyrics // - this.lbOverallWsStatusa.Location = new System.Drawing.Point(94, 95); - this.lbOverallWsStatusa.Name = "lbOverallWsStatusa"; - this.lbOverallWsStatusa.Size = new System.Drawing.Size(160, 15); - this.lbOverallWsStatusa.TabIndex = 31; - this.lbOverallWsStatusa.Text = "-"; + this.cbSeekLyrics.AutoSize = true; + this.cbSeekLyrics.Checked = true; + this.cbSeekLyrics.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbSeekLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbSeekLyrics.Location = new System.Drawing.Point(148, 21); + this.cbSeekLyrics.Name = "cbSeekLyrics"; + this.cbSeekLyrics.Size = new System.Drawing.Size(79, 17); + this.cbSeekLyrics.TabIndex = 6; + this.cbSeekLyrics.Text = "Seek Lyrics"; + this.cbSeekLyrics.UseVisualStyleBackColor = true; // - // lbOverallWsStatus + // cbLyricsOnDemand // - this.lbOverallWsStatus.Location = new System.Drawing.Point(12, 95); - this.lbOverallWsStatus.Name = "lbOverallWsStatus"; - this.lbOverallWsStatus.Size = new System.Drawing.Size(91, 15); - this.lbOverallWsStatus.TabIndex = 30; - this.lbOverallWsStatus.Text = "Overall status:"; + this.cbLyricsOnDemand.AutoSize = true; + this.cbLyricsOnDemand.Checked = true; + this.cbLyricsOnDemand.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbLyricsOnDemand.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyricsOnDemand.Location = new System.Drawing.Point(16, 43); + this.cbLyricsOnDemand.Name = "cbLyricsOnDemand"; + this.cbLyricsOnDemand.Size = new System.Drawing.Size(108, 17); + this.cbLyricsOnDemand.TabIndex = 5; + this.cbLyricsOnDemand.Text = "Lyrics OnDemand"; + this.cbLyricsOnDemand.UseVisualStyleBackColor = true; // - // lbWsStatus4a + // cbLyrics007 // - this.lbWsStatus4a.Location = new System.Drawing.Point(94, 63); - this.lbWsStatus4a.Name = "lbWsStatus4a"; - this.lbWsStatus4a.Size = new System.Drawing.Size(160, 15); - this.lbWsStatus4a.TabIndex = 29; - this.lbWsStatus4a.Text = "-"; + this.cbLyrics007.AutoSize = true; + 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(16, 66); + this.cbLyrics007.Name = "cbLyrics007"; + this.cbLyrics007.Size = new System.Drawing.Size(72, 17); + this.cbLyrics007.TabIndex = 4; + this.cbLyrics007.Text = "Lyrics 007"; + this.cbLyrics007.UseVisualStyleBackColor = true; // - // lbWsStatus4 + // cbEvilLabs // - this.lbWsStatus4.Location = new System.Drawing.Point(12, 62); - this.lbWsStatus4.Name = "lbWsStatus4"; - this.lbWsStatus4.Size = new System.Drawing.Size(91, 16); - this.lbWsStatus4.TabIndex = 28; - this.lbWsStatus4.Text = "License key 4:"; + this.cbEvilLabs.AutoSize = true; + this.cbEvilLabs.Checked = true; + this.cbEvilLabs.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbEvilLabs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbEvilLabs.Location = new System.Drawing.Point(148, 44); + this.cbEvilLabs.Name = "cbEvilLabs"; + this.cbEvilLabs.Size = new System.Drawing.Size(67, 17); + this.cbEvilLabs.TabIndex = 3; + this.cbEvilLabs.Text = "Evil Labs"; + this.cbEvilLabs.UseVisualStyleBackColor = true; // - // lbWsStatus3a + // cbLyricWiki // - this.lbWsStatus3a.Location = new System.Drawing.Point(94, 47); - this.lbWsStatus3a.Name = "lbWsStatus3a"; - this.lbWsStatus3a.Size = new System.Drawing.Size(160, 15); - this.lbWsStatus3a.TabIndex = 25; - this.lbWsStatus3a.Text = "-"; + this.cbLyricWiki.AutoSize = true; + 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(16, 21); + this.cbLyricWiki.Name = "cbLyricWiki"; + this.cbLyricWiki.Size = new System.Drawing.Size(67, 17); + this.cbLyricWiki.TabIndex = 2; + this.cbLyricWiki.Text = "LyricWiki"; + this.cbLyricWiki.UseVisualStyleBackColor = true; // - // lbWsStatus3 + // tabPageDatabase // - this.lbWsStatus3.Location = new System.Drawing.Point(12, 46); - this.lbWsStatus3.Name = "lbWsStatus3"; - this.lbWsStatus3.Size = new System.Drawing.Size(91, 16); - this.lbWsStatus3.TabIndex = 24; - this.lbWsStatus3.Text = "License key 3:"; + this.tabPageDatabase.Controls.Add(this.mpGroupBox1); + this.tabPageDatabase.Controls.Add(this.gbGenerel); + this.tabPageDatabase.Controls.Add(this.gbMessages); + this.tabPageDatabase.Controls.Add(this.gbProgress); + this.tabPageDatabase.Controls.Add(this.gbMusicDBSearchStats); + this.tabPageDatabase.Location = new System.Drawing.Point(4, 22); + this.tabPageDatabase.Name = "tabPageDatabase"; + this.tabPageDatabase.Padding = new System.Windows.Forms.Padding(3); + this.tabPageDatabase.Size = new System.Drawing.Size(520, 450); + this.tabPageDatabase.TabIndex = 2; + this.tabPageDatabase.Text = "Search music database"; + this.tabPageDatabase.UseVisualStyleBackColor = true; // - // lbWsStatus2a + // mpGroupBox1 // - this.lbWsStatus2a.Location = new System.Drawing.Point(94, 31); - this.lbWsStatus2a.Name = "lbWsStatus2a"; - this.lbWsStatus2a.Size = new System.Drawing.Size(160, 15); - this.lbWsStatus2a.TabIndex = 23; - this.lbWsStatus2a.Text = "-"; + this.mpGroupBox1.Controls.Add(this.btImportAll); + this.mpGroupBox1.Controls.Add(this.btCancel); + this.mpGroupBox1.Controls.Add(this.mpLabel3); + this.mpGroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.mpGroupBox1.Location = new System.Drawing.Point(2, 133); + this.mpGroupBox1.Name = "mpGroupBox1"; + this.mpGroupBox1.Size = new System.Drawing.Size(509, 52); + this.mpGroupBox1.TabIndex = 32; + this.mpGroupBox1.TabStop = false; + this.mpGroupBox1.Text = "Search music database"; // - // lbWsStatus2 + // btImportAll // - this.lbWsStatus2.Location = new System.Drawing.Point(12, 31); - this.lbWsStatus2.Name = "lbWsStatus2"; - this.lbWsStatus2.Size = new System.Drawing.Size(91, 15); - this.lbWsStatus2.TabIndex = 22; - this.lbWsStatus2.Text = "License key 2:"; + this.btImportAll.Location = new System.Drawing.Point(338, 19); + this.btImportAll.Name = "btImportAll"; + this.btImportAll.Size = new System.Drawing.Size(78, 23); + this.btImportAll.TabIndex = 32; + this.btImportAll.Text = "Start"; + this.btImportAll.UseVisualStyleBackColor = true; + this.btImportAll.Click += new System.EventHandler(this.btImportAll_Click); // - // lbWsStatus1a + // btCancel // - this.lbWsStatus1a.Location = new System.Drawing.Point(94, 16); - this.lbWsStatus1a.Name = "lbWsStatus1a"; - this.lbWsStatus1a.Size = new System.Drawing.Size(160, 15); - this.lbWsStatus1a.TabIndex = 21; - this.lbWsStatus1a.Text = "-"; + this.btCancel.Enabled = false; + this.btCancel.Location = new System.Drawing.Point(422, 19); + this.btCancel.Name = "btCancel"; + this.btCancel.Size = new System.Drawing.Size(78, 23); + this.btCancel.TabIndex = 33; + this.btCancel.Text = "Stop"; + this.btCancel.UseVisualStyleBackColor = true; + this.btCancel.Click += new System.EventHandler(this.btCancel_Click); // - // lbWsStatus1 + // mpLabel3 // - this.lbWsStatus1.Location = new System.Drawing.Point(12, 16); - this.lbWsStatus1.Name = "lbWsStatus1"; - this.lbWsStatus1.Size = new System.Drawing.Size(91, 15); - this.lbWsStatus1.TabIndex = 20; - this.lbWsStatus1.Text = "License key 1:"; + this.mpLabel3.AutoSize = true; + this.mpLabel3.Location = new System.Drawing.Point(12, 16); + this.mpLabel3.Name = "mpLabel3"; + this.mpLabel3.Size = new System.Drawing.Size(304, 26); + this.mpLabel3.TabIndex = 12; + this.mpLabel3.Text = "Press \'Start\' to fetch lyrics matching content of music database.\r\nPress \'Stop\' t" + + "o stop an ongoing lyrics search."; // - // lbWsStatus5a + // gbGenerel // - this.lbWsStatus5a.Location = new System.Drawing.Point(94, 78); - this.lbWsStatus5a.Name = "lbWsStatus5a"; - this.lbWsStatus5a.Size = new System.Drawing.Size(160, 15); - this.lbWsStatus5a.TabIndex = 15; - this.lbWsStatus5a.Text = "-"; + this.gbGenerel.Controls.Add(this.cbDisregardSongWithLyricInTag); + this.gbGenerel.Controls.Add(this.cbDisregardVariousArtist); + this.gbGenerel.Controls.Add(this.cbDisregardSongsWithNoLyric); + this.gbGenerel.Controls.Add(this.cbMarkSongsWithNoLyrics); + this.gbGenerel.Controls.Add(this.cbDisconsiderTitlesWithLyrics); + this.gbGenerel.Controls.Add(this.lbSongsLimitNote); + this.gbGenerel.Controls.Add(this.lbLimit); + this.gbGenerel.Controls.Add(this.lbSongsLimit); + this.gbGenerel.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbGenerel.Location = new System.Drawing.Point(3, 6); + this.gbGenerel.Name = "gbGenerel"; + this.gbGenerel.Size = new System.Drawing.Size(509, 121); + this.gbGenerel.TabIndex = 32; + this.gbGenerel.TabStop = false; + this.gbGenerel.Text = "Music database search setup"; // - // lbWsStatus5 + // lbSongsLimitNote // - this.lbWsStatus5.Location = new System.Drawing.Point(12, 78); - this.lbWsStatus5.Name = "lbWsStatus5"; - this.lbWsStatus5.Size = new System.Drawing.Size(91, 15); - this.lbWsStatus5.TabIndex = 14; - this.lbWsStatus5.Text = "License key 5:"; + this.lbSongsLimitNote.AutoSize = true; + this.lbSongsLimitNote.Location = new System.Drawing.Point(208, 22); + this.lbSongsLimitNote.Name = "lbSongsLimitNote"; + this.lbSongsLimitNote.Size = new System.Drawing.Size(82, 13); + this.lbSongsLimitNote.TabIndex = 13; + this.lbSongsLimitNote.Text = "(1000 is default)"; // + // lbLimit + // + this.lbLimit.BorderColor = System.Drawing.Color.Empty; + this.lbLimit.Location = new System.Drawing.Point(158, 19); + this.lbLimit.Name = "lbLimit"; + this.lbLimit.Size = new System.Drawing.Size(44, 20); + this.lbLimit.TabIndex = 1; + this.lbLimit.Text = "1000"; + this.lbLimit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // lbSongsLimit + // + this.lbSongsLimit.AutoSize = true; + this.lbSongsLimit.Location = new System.Drawing.Point(12, 22); + this.lbSongsLimit.Name = "lbSongsLimit"; + this.lbSongsLimit.Size = new System.Drawing.Size(139, 13); + this.lbSongsLimit.TabIndex = 12; + this.lbSongsLimit.Text = "Top limit of songs to search:"; + // // gbMessages // this.gbMessages.Controls.Add(this.lbMessage); this.gbMessages.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbMessages.Location = new System.Drawing.Point(2, 409); + this.gbMessages.Location = new System.Drawing.Point(257, 317); this.gbMessages.Name = "gbMessages"; - this.gbMessages.Size = new System.Drawing.Size(515, 85); + this.gbMessages.Size = new System.Drawing.Size(255, 127); this.gbMessages.TabIndex = 28; this.gbMessages.TabStop = false; this.gbMessages.Text = "Messages"; // // lbMessage // - this.lbMessage.Location = new System.Drawing.Point(6, 16); + this.lbMessage.Location = new System.Drawing.Point(6, 18); this.lbMessage.Name = "lbMessage"; - this.lbMessage.Size = new System.Drawing.Size(504, 65); + this.lbMessage.Size = new System.Drawing.Size(245, 106); this.lbMessage.TabIndex = 28; // // gbProgress @@ -311,24 +336,24 @@ this.gbProgress.Controls.Add(this.progressBar); this.gbProgress.Controls.Add(this.lbStep1); this.gbProgress.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbProgress.Location = new System.Drawing.Point(2, 150); + this.gbProgress.Location = new System.Drawing.Point(2, 191); this.gbProgress.Name = "gbProgress"; - this.gbProgress.Size = new System.Drawing.Size(515, 120); + this.gbProgress.Size = new System.Drawing.Size(509, 120); this.gbProgress.TabIndex = 18; this.gbProgress.TabStop = false; this.gbProgress.Text = "Progress"; // // lbLastActivity2 // - this.lbLastActivity2.Location = new System.Drawing.Point(82, 95); + this.lbLastActivity2.Location = new System.Drawing.Point(82, 92); this.lbLastActivity2.Name = "lbLastActivity2"; - this.lbLastActivity2.Size = new System.Drawing.Size(427, 18); + this.lbLastActivity2.Size = new System.Drawing.Size(427, 25); this.lbLastActivity2.TabIndex = 23; this.lbLastActivity2.Text = "-"; // // lbLastActivity // - this.lbLastActivity.Location = new System.Drawing.Point(12, 95); + this.lbLastActivity.Location = new System.Drawing.Point(12, 92); this.lbLastActivity.Name = "lbLastActivity"; this.lbLastActivity.Size = new System.Drawing.Size(77, 18); this.lbLastActivity.TabIndex = 22; @@ -392,7 +417,7 @@ this.gbMusicDBSearchStats.Controls.Add(this.lbLyricsFound2); this.gbMusicDBSearchStats.Controls.Add(this.lbLyricsFound); this.gbMusicDBSearchStats.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbMusicDBSearchStats.Location = new System.Drawing.Point(2, 276); + this.gbMusicDBSearchStats.Location = new System.Drawing.Point(2, 317); this.gbMusicDBSearchStats.Name = "gbMusicDBSearchStats"; this.gbMusicDBSearchStats.Size = new System.Drawing.Size(249, 127); this.gbMusicDBSearchStats.TabIndex = 12; @@ -511,58 +536,56 @@ this.lbLyricsFound.TabIndex = 14; this.lbLyricsFound.Text = "Lyrics found (during search):"; // - // gbMusicDBSearch + // btSave // - this.gbMusicDBSearch.Controls.Add(this.cbDisregardSongWithLyricInTag); - this.gbMusicDBSearch.Controls.Add(this.btCancel); - this.gbMusicDBSearch.Controls.Add(this.cbDisregardVariousArtist); - this.gbMusicDBSearch.Controls.Add(this.cbDisregardSongsWithNoLyric); - this.gbMusicDBSearch.Controls.Add(this.cbMarkSongsWithNoLyrics); - this.gbMusicDBSearch.Controls.Add(this.cbDisconsiderTitlesWithLyrics); - this.gbMusicDBSearch.Controls.Add(this.mpLabel1); - this.gbMusicDBSearch.Controls.Add(this.btImportAll); - this.gbMusicDBSearch.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbMusicDBSearch.Location = new System.Drawing.Point(2, 6); - this.gbMusicDBSearch.Name = "gbMusicDBSearch"; - this.gbMusicDBSearch.Size = new System.Drawing.Size(515, 138); - this.gbMusicDBSearch.TabIndex = 11; - this.gbMusicDBSearch.TabStop = false; - this.gbMusicDBSearch.Text = "Search Music database"; + this.btSave.Location = new System.Drawing.Point(356, 494); + this.btSave.Name = "btSave"; + this.btSave.Size = new System.Drawing.Size(78, 23); + this.btSave.TabIndex = 16; + this.btSave.Text = "&Save"; + this.btSave.UseVisualStyleBackColor = true; + this.btSave.Click += new System.EventHandler(this.btSave_Click); // + // btClose + // + this.btClose.Location = new System.Drawing.Point(440, 494); + this.btClose.Name = "btClose"; + this.btClose.Size = new System.Drawing.Size(78, 23); + this.btClose.TabIndex = 99; + this.btClose.Text = "Close"; + this.btClose.UseVisualStyleBackColor = true; + this.btClose.Click += new System.EventHandler(this.button1_Click); + // + // bgWorkerSearch + // + this.bgWorkerSearch.WorkerReportsProgress = true; + this.bgWorkerSearch.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bgWorkerSearch_DoWork); + this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); + this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); + // // cbDisregardSongWithLyricInTag // this.cbDisregardSongWithLyricInTag.AutoSize = true; this.cbDisregardSongWithLyricInTag.Checked = true; this.cbDisregardSongWithLyricInTag.CheckState = System.Windows.Forms.CheckState.Checked; thi... [truncated message content] |
From: <sa...@us...> - 2007-02-21 20:13:56
|
Revision: 129 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=129&view=rev Author: saamand Date: 2007-02-21 12:13:55 -0800 (Wed, 21 Feb 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.Designer.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/MyLyric Windows Application.csproj trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs Modified: trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("0.14")] -[assembly: AssemblyFileVersion("0.14")] +[assembly: AssemblyVersion("0.15")] +[assembly: AssemblyFileVersion("0.15")] Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -79,7 +79,7 @@ } } eastSites = (string[])easySitesArrayList.ToArray(typeof(string)); - LyricSearch_EasySites.EasySites = eastSites; + LyricSearch.EasySites = eastSites; // initialize events m_EventStop_LyricController = eventStopThread; @@ -88,7 +88,7 @@ m_EventStop_LyricSearches = new ManualResetEvent(false); m_EventStop_LyricSearches.Set(); - LyricSearch_EasySites.Abort = false; + LyricSearch.Abort = false; } @@ -167,7 +167,7 @@ ThreadStart easySitesThreadInstance = delegate { - LyricSearch_EasySites lyricSearch_EasySites = new LyricSearch_EasySites(m_EventStop_LyricController, m_EventStopped_LyricController, this); + LyricSearch lyricSearch_EasySites = new LyricSearch(m_EventStop_LyricController, m_EventStopped_LyricController, this); lyricSearch_EasySites.setLyricInfo(artist, title); lyricSearch_EasySites.Run(); }; @@ -266,14 +266,14 @@ { m_StopSearches = true; m_EventStop_LyricSearches.Reset(); - LyricSearch_EasySites.Abort = true; + LyricSearch.Abort = true; //StopTheSearchAndAbort.Invoke(this, EventArgs.Empty); } else { m_StopSearches = false; m_EventStop_LyricSearches.Set(); - LyricSearch_EasySites.Abort = false; + LyricSearch.Abort = false; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -8,7 +8,7 @@ { static string[] parenthesesAndAlike = new string[6] { "(album", "(acoustic", "(live", "(radio", "[", "{" }; - static string[] charsToDelete = new string[11] { ".", ",", "&", "'", "!", "\"", "&", "?", "(", ")", "+" }; + static string[] charsToDelete = new string[11] { ".", ",", "&", "'", "!", "\"", "&", "?", "(", ")", "+" /*, "ä", "ö", "ü", "Ä", "Ö", "Ü", "ß" */ }; // capatalize string and make ready for XML @@ -28,7 +28,7 @@ { capatalizedTitle += words[i].Substring(0, 1).ToUpper() + (words[i].Length > 1 ? words[i].Substring(1, words[i].Length - 1).ToLower() : "") + " "; } - return capatalizedTitle.Trim(); ; + return capatalizedTitle.Trim(); } public static string removeFeatComment(string str) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-02-21 20:13:55 UTC (rev 129) @@ -40,8 +40,9 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="LyricSearch_EasySites.cs" /> + <Compile Include="LyricSearch.cs" /> <Compile Include="LyricDiagnostics.cs" /> + <Compile Include="LyricSites\HotLyrics.cs" /> <Compile Include="LyricSites\EvilLabs.cs" /> <Compile Include="LyricSites\Lyrics007.cs" /> <Compile Include="LyricSites\LyricsOnDemand.cs" /> Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -26,7 +26,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.14")] +[assembly: AssemblyVersion("0.15")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/LyricsEngine/Setup.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -12,7 +12,8 @@ //"EvilLabs", "Lyrics007", "LyricsOnDemand", - "SeekLyrics" + "HotLyrics" + //"SeekLyrics" }; @@ -26,12 +27,12 @@ public static bool IsMember(string value) { - return System.Array.IndexOf(Setup.EasySites, value) != -1; + return System.Array.IndexOf<string>(Setup.EasySites, value) != -1; } public static bool IsMemberOfEasySites(string value) { - return System.Array.IndexOf(Setup.EasySites, value) != -1; + return System.Array.IndexOf<string>(Setup.EasySites, value) != -1; } public static int NoOfSites() Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -214,7 +214,22 @@ StopThread(); m_Path = g_Player.CurrentFile; MusicTag tag = MediaPortal.TagReader.TagReader.ReadTag(m_Path); - findLyric(tag); + + if (!m_Path.Equals("")) + { + findLyric(tag); + } + else + { + m_artist = ""; + m_title = ""; + m_TrackText = ""; + GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBTrack, m_StatusText); + m_StatusText = "No music file playing"; + GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); + m_LyricText = ""; + GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); + } } base.Process(); } @@ -234,7 +249,7 @@ GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); - bool useLyricWiki, useEvilLabs, useLyrics007, useLyricsOnDemand, useSeekLyrics; + bool useLyricWiki, useEvilLabs, useLyrics007, useLyricsOnDemand, useSeekLyrics, useHotLyrics; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { @@ -243,6 +258,7 @@ useLyrics007 = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false; useLyricsOnDemand = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false; useSeekLyrics = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false; + useHotLyrics = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false; } ArrayList sitesToSearch = new ArrayList(); @@ -266,6 +282,10 @@ { sitesToSearch.Add("SeekLyrics"); } + if (useHotLyrics && Setup.IsMember("HotLyrics")) + { + sitesToSearch.Add("HotLyrics"); + } m_sitesToSearch = (string[])sitesToSearch.ToArray(typeof(string)); } @@ -284,12 +304,13 @@ m_EventStopThread.Reset(); m_EventThreadStopped.Reset(); + GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, ""); if (tag != null && tag.Artist != "") { - m_artist = tag.Artist; - m_title = tag.Title; + m_artist = tag.Artist.Trim(); + m_title = tag.Title.Trim(); m_TrackText = m_artist + " - " + m_title; GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBTrack, m_TrackText); m_StatusText = "Searching for a matching lyric. Please wait a moment..."; @@ -394,7 +415,7 @@ { m_TrackText = ""; GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBTrack, m_StatusText); - m_StatusText = "No music file playing"; + m_StatusText = "The music tag isn't complete"; GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); return; } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -32,6 +32,7 @@ this.tabPageLyricsDatabase = new MediaPortal.UserInterface.Controls.MPTabPage(); this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.cbHotLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbSeekLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLyricsOnDemand = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); @@ -43,12 +44,19 @@ this.btCancel = new MediaPortal.UserInterface.Controls.MPButton(); this.mpLabel3 = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbGenerel = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.cbDisregardSongWithLyricInTag = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbDisregardVariousArtist = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbDisregardSongsWithNoLyric = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbMarkSongsWithNoLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbDisconsiderTitlesWithLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.lbSongsLimitNote = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbSongsLimit = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbMessages = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.lbMessage = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbProgress = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.lbTimer = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbTimeElapsed = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbLastActivity2 = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbLastActivity = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbStep2a = new MediaPortal.UserInterface.Controls.MPLabel(); @@ -74,11 +82,7 @@ this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); - this.cbDisregardSongWithLyricInTag = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbDisregardVariousArtist = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbDisregardSongsWithNoLyric = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbMarkSongsWithNoLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbDisconsiderTitlesWithLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.tbNote = new MediaPortal.UserInterface.Controls.MPLabel(); this.tabControl.SuspendLayout(); this.tabPageSetup.SuspendLayout(); this.gbLyricSites.SuspendLayout(); @@ -98,7 +102,7 @@ this.tabControl.Location = new System.Drawing.Point(12, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(528, 476); + this.tabControl.Size = new System.Drawing.Size(528, 495); this.tabControl.TabIndex = 1; // // tabPageLyricsDatabase @@ -106,18 +110,19 @@ this.tabPageLyricsDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageLyricsDatabase.Name = "tabPageLyricsDatabase"; this.tabPageLyricsDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 450); + this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 469); this.tabPageLyricsDatabase.TabIndex = 1; this.tabPageLyricsDatabase.Text = "Lyrics database"; this.tabPageLyricsDatabase.UseVisualStyleBackColor = true; // // tabPageSetup // + this.tabPageSetup.Controls.Add(this.tbNote); this.tabPageSetup.Controls.Add(this.gbLyricSites); this.tabPageSetup.Location = new System.Drawing.Point(4, 22); this.tabPageSetup.Name = "tabPageSetup"; this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSetup.Size = new System.Drawing.Size(520, 450); + this.tabPageSetup.Size = new System.Drawing.Size(520, 469); this.tabPageSetup.TabIndex = 2; this.tabPageSetup.Text = "General setup"; this.tabPageSetup.UseVisualStyleBackColor = true; @@ -125,6 +130,7 @@ // gbLyricSites // this.gbLyricSites.AutoSize = true; + this.gbLyricSites.Controls.Add(this.cbHotLyrics); this.gbLyricSites.Controls.Add(this.cbSeekLyrics); this.gbLyricSites.Controls.Add(this.cbLyricsOnDemand); this.gbLyricSites.Controls.Add(this.cbLyrics007); @@ -138,13 +144,26 @@ this.gbLyricSites.TabStop = false; this.gbLyricSites.Text = "Lyric sites to search"; // + // cbHotLyrics + // + this.cbHotLyrics.AutoSize = true; + 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(148, 21); + this.cbHotLyrics.Name = "cbHotLyrics"; + this.cbHotLyrics.Size = new System.Drawing.Size(71, 17); + this.cbHotLyrics.TabIndex = 7; + this.cbHotLyrics.Text = "Hot Lyrics"; + this.cbHotLyrics.UseVisualStyleBackColor = true; + // // cbSeekLyrics // this.cbSeekLyrics.AutoSize = true; this.cbSeekLyrics.Checked = true; this.cbSeekLyrics.CheckState = System.Windows.Forms.CheckState.Checked; this.cbSeekLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbSeekLyrics.Location = new System.Drawing.Point(148, 21); + this.cbSeekLyrics.Location = new System.Drawing.Point(148, 43); this.cbSeekLyrics.Name = "cbSeekLyrics"; this.cbSeekLyrics.Size = new System.Drawing.Size(79, 17); this.cbSeekLyrics.TabIndex = 6; @@ -183,7 +202,7 @@ this.cbEvilLabs.Checked = true; this.cbEvilLabs.CheckState = System.Windows.Forms.CheckState.Checked; this.cbEvilLabs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbEvilLabs.Location = new System.Drawing.Point(148, 44); + this.cbEvilLabs.Location = new System.Drawing.Point(148, 66); this.cbEvilLabs.Name = "cbEvilLabs"; this.cbEvilLabs.Size = new System.Drawing.Size(67, 17); this.cbEvilLabs.TabIndex = 3; @@ -213,7 +232,7 @@ this.tabPageDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageDatabase.Name = "tabPageDatabase"; this.tabPageDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDatabase.Size = new System.Drawing.Size(520, 450); + this.tabPageDatabase.Size = new System.Drawing.Size(520, 469); this.tabPageDatabase.TabIndex = 2; this.tabPageDatabase.Text = "Search music database"; this.tabPageDatabase.UseVisualStyleBackColor = true; @@ -226,7 +245,7 @@ this.mpGroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.mpGroupBox1.Location = new System.Drawing.Point(2, 133); this.mpGroupBox1.Name = "mpGroupBox1"; - this.mpGroupBox1.Size = new System.Drawing.Size(509, 52); + this.mpGroupBox1.Size = new System.Drawing.Size(509, 53); this.mpGroupBox1.TabIndex = 32; this.mpGroupBox1.TabStop = false; this.mpGroupBox1.Text = "Search music database"; @@ -280,6 +299,71 @@ this.gbGenerel.TabStop = false; this.gbGenerel.Text = "Music database search setup"; // + // cbDisregardSongWithLyricInTag + // + this.cbDisregardSongWithLyricInTag.AutoSize = true; + this.cbDisregardSongWithLyricInTag.Checked = true; + this.cbDisregardSongWithLyricInTag.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbDisregardSongWithLyricInTag.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbDisregardSongWithLyricInTag.Location = new System.Drawing.Point(15, 68); + this.cbDisregardSongWithLyricInTag.Name = "cbDisregardSongWithLyricInTag"; + this.cbDisregardSongWithLyricInTag.Size = new System.Drawing.Size(202, 17); + this.cbDisregardSongWithLyricInTag.TabIndex = 18; + this.cbDisregardSongWithLyricInTag.Text = "Disregard songs with lyric in music tag"; + this.cbDisregardSongWithLyricInTag.UseVisualStyleBackColor = true; + // + // cbDisregardVariousArtist + // + this.cbDisregardVariousArtist.AutoSize = true; + this.cbDisregardVariousArtist.Checked = true; + this.cbDisregardVariousArtist.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbDisregardVariousArtist.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbDisregardVariousArtist.Location = new System.Drawing.Point(15, 91); + this.cbDisregardVariousArtist.Name = "cbDisregardVariousArtist"; + this.cbDisregardVariousArtist.Size = new System.Drawing.Size(191, 17); + this.cbDisregardVariousArtist.TabIndex = 17; + this.cbDisregardVariousArtist.Text = "Disregard songs by \"various artists\""; + this.cbDisregardVariousArtist.UseVisualStyleBackColor = true; + // + // cbDisregardSongsWithNoLyric + // + this.cbDisregardSongsWithNoLyric.AutoSize = true; + this.cbDisregardSongsWithNoLyric.Checked = true; + this.cbDisregardSongsWithNoLyric.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbDisregardSongsWithNoLyric.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbDisregardSongsWithNoLyric.Location = new System.Drawing.Point(245, 68); + this.cbDisregardSongsWithNoLyric.Name = "cbDisregardSongsWithNoLyric"; + this.cbDisregardSongsWithNoLyric.Size = new System.Drawing.Size(246, 17); + this.cbDisregardSongsWithNoLyric.TabIndex = 16; + this.cbDisregardSongsWithNoLyric.Text = "Disregard previously marked songs (only batch)"; + this.cbDisregardSongsWithNoLyric.UseVisualStyleBackColor = true; + // + // cbMarkSongsWithNoLyrics + // + this.cbMarkSongsWithNoLyrics.AutoSize = true; + this.cbMarkSongsWithNoLyrics.Checked = true; + this.cbMarkSongsWithNoLyrics.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbMarkSongsWithNoLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbMarkSongsWithNoLyrics.Location = new System.Drawing.Point(245, 45); + this.cbMarkSongsWithNoLyrics.Name = "cbMarkSongsWithNoLyrics"; + this.cbMarkSongsWithNoLyrics.Size = new System.Drawing.Size(224, 17); + this.cbMarkSongsWithNoLyrics.TabIndex = 15; + this.cbMarkSongsWithNoLyrics.Text = "Mark songs to which no lyric can be found"; + this.cbMarkSongsWithNoLyrics.UseVisualStyleBackColor = true; + // + // cbDisconsiderTitlesWithLyrics + // + this.cbDisconsiderTitlesWithLyrics.AutoSize = true; + this.cbDisconsiderTitlesWithLyrics.Checked = true; + this.cbDisconsiderTitlesWithLyrics.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbDisconsiderTitlesWithLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbDisconsiderTitlesWithLyrics.Location = new System.Drawing.Point(15, 45); + this.cbDisconsiderTitlesWithLyrics.Name = "cbDisconsiderTitlesWithLyrics"; + this.cbDisconsiderTitlesWithLyrics.Size = new System.Drawing.Size(201, 17); + this.cbDisconsiderTitlesWithLyrics.TabIndex = 14; + this.cbDisconsiderTitlesWithLyrics.Text = "Disregard songs with lyric in database"; + this.cbDisconsiderTitlesWithLyrics.UseVisualStyleBackColor = true; + // // lbSongsLimitNote // this.lbSongsLimitNote.AutoSize = true; @@ -312,7 +396,7 @@ // this.gbMessages.Controls.Add(this.lbMessage); this.gbMessages.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbMessages.Location = new System.Drawing.Point(257, 317); + this.gbMessages.Location = new System.Drawing.Point(257, 334); this.gbMessages.Name = "gbMessages"; this.gbMessages.Size = new System.Drawing.Size(255, 127); this.gbMessages.TabIndex = 28; @@ -328,6 +412,8 @@ // // gbProgress // + this.gbProgress.Controls.Add(this.lbTimer); + this.gbProgress.Controls.Add(this.lbTimeElapsed); this.gbProgress.Controls.Add(this.lbLastActivity2); this.gbProgress.Controls.Add(this.lbLastActivity); this.gbProgress.Controls.Add(this.lbStep2a); @@ -336,24 +422,40 @@ this.gbProgress.Controls.Add(this.progressBar); this.gbProgress.Controls.Add(this.lbStep1); this.gbProgress.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbProgress.Location = new System.Drawing.Point(2, 191); + this.gbProgress.Location = new System.Drawing.Point(2, 192); this.gbProgress.Name = "gbProgress"; - this.gbProgress.Size = new System.Drawing.Size(509, 120); + this.gbProgress.Size = new System.Drawing.Size(509, 136); this.gbProgress.TabIndex = 18; this.gbProgress.TabStop = false; this.gbProgress.Text = "Progress"; // + // lbTimer + // + this.lbTimer.Location = new System.Drawing.Point(86, 88); + this.lbTimer.Name = "lbTimer"; + this.lbTimer.Size = new System.Drawing.Size(135, 15); + this.lbTimer.TabIndex = 25; + this.lbTimer.Text = "-"; + // + // lbTimeElapsed + // + this.lbTimeElapsed.Location = new System.Drawing.Point(12, 88); + this.lbTimeElapsed.Name = "lbTimeElapsed"; + this.lbTimeElapsed.Size = new System.Drawing.Size(77, 17); + this.lbTimeElapsed.TabIndex = 24; + this.lbTimeElapsed.Text = "Time elapsed:"; + // // lbLastActivity2 // - this.lbLastActivity2.Location = new System.Drawing.Point(82, 92); + this.lbLastActivity2.Location = new System.Drawing.Point(86, 108); this.lbLastActivity2.Name = "lbLastActivity2"; - this.lbLastActivity2.Size = new System.Drawing.Size(427, 25); + this.lbLastActivity2.Size = new System.Drawing.Size(420, 25); this.lbLastActivity2.TabIndex = 23; this.lbLastActivity2.Text = "-"; // // lbLastActivity // - this.lbLastActivity.Location = new System.Drawing.Point(12, 92); + this.lbLastActivity.Location = new System.Drawing.Point(12, 108); this.lbLastActivity.Name = "lbLastActivity"; this.lbLastActivity.Size = new System.Drawing.Size(77, 18); this.lbLastActivity.TabIndex = 22; @@ -386,7 +488,7 @@ // progressBar // this.progressBar.Enabled = false; - this.progressBar.Location = new System.Drawing.Point(28, 64); + this.progressBar.Location = new System.Drawing.Point(28, 62); this.progressBar.Name = "progressBar"; this.progressBar.Size = new System.Drawing.Size(466, 20); this.progressBar.Step = 1; @@ -417,7 +519,7 @@ this.gbMusicDBSearchStats.Controls.Add(this.lbLyricsFound2); this.gbMusicDBSearchStats.Controls.Add(this.lbLyricsFound); this.gbMusicDBSearchStats.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbMusicDBSearchStats.Location = new System.Drawing.Point(2, 317); + this.gbMusicDBSearchStats.Location = new System.Drawing.Point(2, 334); this.gbMusicDBSearchStats.Name = "gbMusicDBSearchStats"; this.gbMusicDBSearchStats.Size = new System.Drawing.Size(249, 127); this.gbMusicDBSearchStats.TabIndex = 12; @@ -538,7 +640,7 @@ // // btSave // - this.btSave.Location = new System.Drawing.Point(356, 494); + this.btSave.Location = new System.Drawing.Point(356, 513); this.btSave.Name = "btSave"; this.btSave.Size = new System.Drawing.Size(78, 23); this.btSave.TabIndex = 16; @@ -548,7 +650,7 @@ // // btClose // - this.btClose.Location = new System.Drawing.Point(440, 494); + this.btClose.Location = new System.Drawing.Point(440, 513); this.btClose.Name = "btClose"; this.btClose.Size = new System.Drawing.Size(78, 23); this.btClose.TabIndex = 99; @@ -563,76 +665,20 @@ this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); // - // cbDisregardSongWithLyricInTag + // tbNote // - this.cbDisregardSongWithLyricInTag.AutoSize = true; - this.cbDisregardSongWithLyricInTag.Checked = true; - this.cbDisregardSongWithLyricInTag.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbDisregardSongWithLyricInTag.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbDisregardSongWithLyricInTag.Location = new System.Drawing.Point(15, 68); - this.cbDisregardSongWithLyricInTag.Name = "cbDisregardSongWithLyricInTag"; - this.cbDisregardSongWithLyricInTag.Size = new System.Drawing.Size(202, 17); - this.cbDisregardSongWithLyricInTag.TabIndex = 18; - this.cbDisregardSongWithLyricInTag.Text = "Disregard songs with lyric in music tag"; - this.cbDisregardSongWithLyricInTag.UseVisualStyleBackColor = true; + this.tbNote.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tbNote.Location = new System.Drawing.Point(17, 111); + this.tbNote.Name = "tbNote"; + this.tbNote.Size = new System.Drawing.Size(377, 18); + this.tbNote.TabIndex = 19; + this.tbNote.Text = "(Seek Lyrics and Evil Labs are currently disabled due to instable servers)"; // - // cbDisregardVariousArtist - // - this.cbDisregardVariousArtist.AutoSize = true; - this.cbDisregardVariousArtist.Checked = true; - this.cbDisregardVariousArtist.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbDisregardVariousArtist.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbDisregardVariousArtist.Location = new System.Drawing.Point(15, 91); - this.cbDisregardVariousArtist.Name = "cbDisregardVariousArtist"; - this.cbDisregardVariousArtist.Size = new System.Drawing.Size(191, 17); - this.cbDisregardVariousArtist.TabIndex = 17; - this.cbDisregardVariousArtist.Text = "Disregard songs by \"various artists\""; - this.cbDisregardVariousArtist.UseVisualStyleBackColor = true; - // - // cbDisregardSongsWithNoLyric - // - this.cbDisregardSongsWithNoLyric.AutoSize = true; - this.cbDisregardSongsWithNoLyric.Checked = true; - this.cbDisregardSongsWithNoLyric.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbDisregardSongsWithNoLyric.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbDisregardSongsWithNoLyric.Location = new System.Drawing.Point(245, 68); - this.cbDisregardSongsWithNoLyric.Name = "cbDisregardSongsWithNoLyric"; - this.cbDisregardSongsWithNoLyric.Size = new System.Drawing.Size(246, 17); - this.cbDisregardSongsWithNoLyric.TabIndex = 16; - this.cbDisregardSongsWithNoLyric.Text = "Disregard previously marked songs (only batch)"; - this.cbDisregardSongsWithNoLyric.UseVisualStyleBackColor = true; - // - // cbMarkSongsWithNoLyrics - // - this.cbMarkSongsWithNoLyrics.AutoSize = true; - this.cbMarkSongsWithNoLyrics.Checked = true; - this.cbMarkSongsWithNoLyrics.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbMarkSongsWithNoLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbMarkSongsWithNoLyrics.Location = new System.Drawing.Point(245, 45); - this.cbMarkSongsWithNoLyrics.Name = "cbMarkSongsWithNoLyrics"; - this.cbMarkSongsWithNoLyrics.Size = new System.Drawing.Size(224, 17); - this.cbMarkSongsWithNoLyrics.TabIndex = 15; - this.cbMarkSongsWithNoLyrics.Text = "Mark songs to which no lyric can be found"; - this.cbMarkSongsWithNoLyrics.UseVisualStyleBackColor = true; - // - // cbDisconsiderTitlesWithLyrics - // - this.cbDisconsiderTitlesWithLyrics.AutoSize = true; - this.cbDisconsiderTitlesWithLyrics.Checked = true; - this.cbDisconsiderTitlesWithLyrics.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbDisconsiderTitlesWithLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbDisconsiderTitlesWithLyrics.Location = new System.Drawing.Point(15, 45); - this.cbDisconsiderTitlesWithLyrics.Name = "cbDisconsiderTitlesWithLyrics"; - this.cbDisconsiderTitlesWithLyrics.Size = new System.Drawing.Size(201, 17); - this.cbDisconsiderTitlesWithLyrics.TabIndex = 14; - this.cbDisconsiderTitlesWithLyrics.Text = "Disregard songs with lyric in database"; - this.cbDisconsiderTitlesWithLyrics.UseVisualStyleBackColor = true; - // // MyLyricsSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(546, 520); + this.ClientSize = new System.Drawing.Size(541, 539); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); @@ -714,5 +760,9 @@ private MediaPortal.UserInterface.Controls.MPCheckBox cbDisregardSongsWithNoLyric; private MediaPortal.UserInterface.Controls.MPCheckBox cbMarkSongsWithNoLyrics; private MediaPortal.UserInterface.Controls.MPCheckBox cbDisconsiderTitlesWithLyrics; + private MediaPortal.UserInterface.Controls.MPLabel lbTimer; + private MediaPortal.UserInterface.Controls.MPLabel lbTimeElapsed; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbHotLyrics; + private MediaPortal.UserInterface.Controls.MPLabel tbNote; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -76,7 +76,7 @@ bool m_DisregardMarkedLyric = true; int m_noOfCurrentlySearches = 0; - const int m_NoOfCurrentSearchesAllowed = 5; + const int m_NoOfCurrentSearchesAllowed = 4; int m_Limit = 100; ArrayList songs = new ArrayList(); @@ -93,7 +93,15 @@ MusicDatabase dbs; + // Timer variables + int hour = 0; + int min = 0; + int sec = 0; + System.Windows.Forms.Timer timer; + StopWatch stopwatch = new StopWatch(); + + public MyLyricsSetup() { InitializeComponent(); @@ -127,6 +135,7 @@ cbLyrics007.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false; cbLyricsOnDemand.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false; cbSeekLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false; + cbHotLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false; if (Setup.IsMember("LyricWiki") == false) { @@ -148,6 +157,10 @@ { cbSeekLyrics.Visible = false; } + if (Setup.IsMember("HotLyrics") == false) + { + cbHotLyrics.Visible = false; + } } catch { MessageBox.Show("Something has gone wrong when reading Mediaportal.xml"); @@ -197,6 +210,7 @@ xmlwriter.SetValue("myLyrics", "useLyrics007", cbLyrics007.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useLyricOnDemand", cbLyricsOnDemand.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useSeekLyrics", cbSeekLyrics.Checked.ToString()); + xmlwriter.SetValue("myLyrics", "useHotLyrics", cbHotLyrics.Checked.ToString()); } } @@ -229,6 +243,14 @@ private void btImportAll_Click(object sender, System.EventArgs e) { + stopwatch.StartZero(); + lbTimer.Text = "00:00.00"; + timer = new System.Windows.Forms.Timer(); + timer.Enabled = true; + timer.Interval = 1000; + timer.Tick += new EventHandler(timer_Tick); + timer.Start(); + isSearching(true); lbStep1a.Text = "The collecting of songs has started."; lbStep2a.Text = ""; @@ -271,7 +293,6 @@ m_MarkSongsWhenNoLyricFound = cbMarkSongsWithNoLyrics.Checked; m_DisregardMarkedLyric = cbDisregardSongsWithNoLyric.Checked; - m_TotalTitles = 0; m_SongsNotKnown = 0; m_SongsWithLyric = 0; m_SongsWithMark = 0; @@ -298,6 +319,8 @@ sitesToSearch.Add("LyricsOnDemand"); if (cbSeekLyrics.Checked) sitesToSearch.Add("SeekLyrics"); + if (cbHotLyrics.Checked) + sitesToSearch.Add("HotLyrics"); sitesToSearchArray = (string[])sitesToSearch.ToArray(typeof(string)); @@ -385,6 +408,15 @@ // Called from worker thread using delegate and Control.Invoke private void ThreadFinishedMethod(String artist, String title, String message, String site) { + if (timer != null) + { + timer.Enabled = false; + timer.Stop(); + timer.Dispose(); + timer = null; + hour = 0; min = 0; sec = 0; + } + if (lc != null) { lc.StopSearches = true; @@ -396,6 +428,7 @@ lbStep2a.Text = "Completed"; lbMessage.Text = "#" + ((int)(++m_noOfMessages)).ToString() + " - " + message + "\r\n" + lbMessage.Text + "\r\n"; btImportAll.Enabled = true; + btCancel.Enabled = false; isSearching(false); lyricUC.updateLyricsTree(); } @@ -597,7 +630,6 @@ { if (lc != null) { - btCancel.Enabled = false; lc.finishThread(m_artist, m_track, "The search has been cancelled by the user.", "none"); lc.Dispose(); lc = null; @@ -608,9 +640,6 @@ //bgWorkerSearch.Dispose(); //bgWorkerSearch = null; - - //bgWorkerTestWebservices.Dispose(); - //bgWorkerTestWebservices = null; } } @@ -618,5 +647,21 @@ { LyricDiagnostics.Dispose(); } + + private void timer_Tick(object sender, EventArgs e) + { + int t = (int)stopwatch.ElapsedMilliseconds; + sec = (t /= 1000); + + int secOverflow = sec / 60; + sec -= (secOverflow * 60); + min = secOverflow; + + int minOverflow = min / 60; + min -= (minOverflow * 60); + hour = minOverflow; + + lbTimer.Text = (hour < 10 ? "0" + hour.ToString() : hour.ToString()) + ":" + (min < 10 ? "0" + min.ToString() : min.ToString()) + "." + (sec < 10 ? "0" + sec.ToString() : sec.ToString()); + } } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-02-21 20:13:55 UTC (rev 129) @@ -118,7 +118,7 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <metadata name="bgWorkerSearch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>200, 17</value> + <value>94, 17</value> </metadata> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>51</value> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -255,7 +255,8 @@ lbTitle.Text = ""; tbLyrics.Enabled = false; - + + // Selected a title if (treeView.SelectedNode != null && treeView.SelectedNode.Parent != null) { string artist = treeView.SelectedNode.Parent.Text; @@ -281,6 +282,12 @@ lbTitle.Text = m_CurrentArtist + " - " + m_CurrentTitle; } } + // Selected an artist + else if (treeView.SelectedNode != null) + { + string artist = treeView.SelectedNode.Text; + m_CurrentArtist = LyricUtil.capatalizeString(artist); + } } private MusicTag GetTag(Song song) Modified: trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.14")] -[assembly: AssemblyFileVersion("0.14")] +[assembly: AssemblyVersion("0.15")] +[assembly: AssemblyFileVersion("0.15")] Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.Designer.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.Designer.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -35,11 +35,13 @@ this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.button1 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // + this.groupBox1.Controls.Add(this.button1); this.groupBox1.Controls.Add(this.textBox1); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label3); @@ -103,12 +105,22 @@ this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked; this.checkBox1.Location = new System.Drawing.Point(16, 3); this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(139, 17); + this.checkBox1.Size = new System.Drawing.Size(97, 17); this.checkBox1.TabIndex = 1; this.checkBox1.Text = "Enable test for "; this.checkBox1.UseVisualStyleBackColor = true; this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); // + // button1 + // + this.button1.Location = new System.Drawing.Point(240, 15); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 5; + this.button1.Text = "Show lyric"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // LyricSiteTestUC // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -133,5 +145,6 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.Button button1; } } Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.cs =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -94,5 +94,10 @@ { isSiteSelected = this.checkBox1.Checked; } + + private void button1_Click(object sender, EventArgs e) + { + MessageBox.Show(textBox1.Text); + } } } Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -128,33 +128,19 @@ m_EventStopThread.Reset(); m_EventThreadStopped.Reset(); - //resetGui(); - //LyricController lc = new LyricController(this, m_EventStopThread, m_EventThreadStopped, false); - //// create worker thread instance - //ThreadStart job = delegate - //{ - // lc.Run(); - //}; + ArrayList sites = new ArrayList(); - //m_LyricControllerThread = new Thread(job); - //m_LyricControllerThread.Name = "lyricSearch Thread"; // looks nice in Output window - //m_LyricControllerThread.Start(); - - //lc.GoogleLicenseKey = tbLicenseKey.Text; - - //ArrayList lyricStrings = new ArrayList(); - foreach (LyricSiteTestUC lyricSite in lyricSiteArray) { if (lyricSite.IsSiteSelected) { - //lyricStrings.Add(lyricSite.LyricSiteName); lyricSite.start(); + sites.Add(lyricSite.LyricSiteName); } } - LyricController lc = new LyricController(this, m_EventStopThread, m_EventThreadStopped, Setup.AllSites()); + LyricController lc = new LyricController(this, m_EventStopThread, m_EventThreadStopped, (string[])sites.ToArray(typeof(string))); ThreadStart job = delegate { @@ -189,7 +175,7 @@ private void updateStringMethod(String message, String site) { string m_message = message.ToString(); - int siteIndex = System.Array.IndexOf(Setup.AllSites(), site); + int siteIndex = System.Array.IndexOf<string>(Setup.AllSites(), site); lyricSiteArray[siteIndex].Lyric = m_message; lyricSiteArray[siteIndex].stop(); } @@ -201,7 +187,7 @@ private void lyricFoundMethod(String lyricStrings, String artist, String title, String site) { - int siteIndex = System.Array.IndexOf(Setup.AllSites(), site); + int siteIndex = System.Array.IndexOf<string>(Setup.AllSites(), site); lyricSiteArray[siteIndex].Lyric = lyricStrings; lyricSiteArray[siteIndex].stop(); setMark(artist, title, siteIndex, true); @@ -209,16 +195,13 @@ private void lyricNotFoundMethod(String artist, String title, String message, String site) { - int siteIndex = System.Array.IndexOf(Setup.AllSites(), site); + int siteIndex = System.Array.IndexOf<string>(Setup.AllSites(), site); if (lyricSiteArray[siteIndex].Lyric.Equals("")) { lyricSiteArray[siteIndex].Lyric = message; lyricSiteArray[siteIndex].stop(); } setMark(artist, title, siteIndex, false); - - - } Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/MyLyric Windows Application.csproj =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/MyLyric Windows Application.csproj 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/MyLyric Windows Application.csproj 2007-02-21 20:13:55 UTC (rev 129) @@ -9,8 +9,7 @@ <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MyLyric_Windows_Application</RootNamespace> <AssemblyName>MyLyric Windows Application</AssemblyName> - <StartupObject> - </StartupObject> + <StartupObject>MyLyric_Windows_Application.Class1</StartupObject> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs 2007-02-20 22:44:49 UTC (rev 128) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs 2007-02-21 20:13:55 UTC (rev 129) @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("0.14")] -[assembly: AssemblyFileVersion("0.14")] +[assembly: AssemblyVersion("0.15")] +[assembly: AssemblyFileVersion("0.15")] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-03-09 17:26:25
|
Revision: 171 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=171&view=rev Author: saamand Date: 2007-03-09 09:26:16 -0800 (Fri, 09 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs Modified: trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("0.15")] -[assembly: AssemblyFileVersion("0.15")] +[assembly: AssemblyVersion("0.16")] +[assembly: AssemblyFileVersion("0.16")] Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -26,7 +26,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.15")] +[assembly: AssemblyVersion("0.16")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -488,10 +488,7 @@ private void SaveLyricToDatabase() { - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("Lyrics.xml", false)) - { - xmlwriter.SetValue(LyricUtil.capatalizeString(m_artist), LyricUtil.capatalizeString(m_title), m_LyricText); - } + MyLyricsSetup.LyricsDB[MyLyricsUtil.CorrectKeyFormat(LyricUtil.capatalizeString(m_artist), LyricUtil.capatalizeString(m_title))].Lyrics = m_LyricText; } // Stop worker thread if it is running. Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -103,7 +103,7 @@ this.tabControl.Location = new System.Drawing.Point(12, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(528, 495); + this.tabControl.Size = new System.Drawing.Size(528, 494); this.tabControl.TabIndex = 1; // // tabPageLyricsDatabase @@ -111,7 +111,7 @@ this.tabPageLyricsDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageLyricsDatabase.Name = "tabPageLyricsDatabase"; this.tabPageLyricsDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 469); + this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 468); this.tabPageLyricsDatabase.TabIndex = 1; this.tabPageLyricsDatabase.Text = "Lyrics database"; this.tabPageLyricsDatabase.UseVisualStyleBackColor = true; @@ -123,7 +123,7 @@ this.tabPageSetup.Location = new System.Drawing.Point(4, 22); this.tabPageSetup.Name = "tabPageSetup"; this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSetup.Size = new System.Drawing.Size(520, 469); + this.tabPageSetup.Size = new System.Drawing.Size(520, 454); this.tabPageSetup.TabIndex = 2; this.tabPageSetup.Text = "General setup"; this.tabPageSetup.UseVisualStyleBackColor = true; @@ -242,7 +242,7 @@ this.tabPageDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageDatabase.Name = "tabPageDatabase"; this.tabPageDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDatabase.Size = new System.Drawing.Size(520, 469); + this.tabPageDatabase.Size = new System.Drawing.Size(520, 454); this.tabPageDatabase.TabIndex = 2; this.tabPageDatabase.Text = "Search music database"; this.tabPageDatabase.UseVisualStyleBackColor = true; @@ -663,7 +663,7 @@ // // btSave // - this.btSave.Location = new System.Drawing.Point(356, 513); + this.btSave.Location = new System.Drawing.Point(358, 512); this.btSave.Name = "btSave"; this.btSave.Size = new System.Drawing.Size(78, 23); this.btSave.TabIndex = 16; @@ -673,7 +673,7 @@ // // btClose // - this.btClose.Location = new System.Drawing.Point(440, 513); + this.btClose.Location = new System.Drawing.Point(442, 512); this.btClose.Name = "btClose"; this.btClose.Size = new System.Drawing.Size(78, 23); this.btClose.TabIndex = 99; @@ -692,7 +692,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(539, 542); + this.ClientSize = new System.Drawing.Size(538, 543); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -94,7 +94,10 @@ // worker thread Thread m_LyricControllerThread; - MusicDatabase dbs; + internal static LyricsDatabase LyricsDB = null; + internal static LyricsDatabase LyricsMarkedDB = null; + internal const string LyricsDBName = "LyricsDatabaseV2.db"; + internal const string LyricsMarkedDBName = "LyricsMarkedDatabaseV2.db"; // Timer variables int hour = 0; @@ -169,6 +172,77 @@ MessageBox.Show("Something has gone wrong when reading Mediaportal.xml"); } } + + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + LyricsDBName; + FileInfo fileInfo = new FileInfo(path); + + if (fileInfo.Exists == false) + { + MessageBox.Show("Serialize file - " + Environment.CurrentDirectory); + + if (MessageBox.Show(this, "Your database will have to be upgraded to work with this version\r\nUpgrade now?", "Upgrade lyricsdatabase", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + { + ConvertFromXMLtoLyricsDatabase convertFromXMLtoLyricsDatabase = new ConvertFromXMLtoLyricsDatabase(); + LyricsDB = convertFromXMLtoLyricsDatabase.Convert(); + + BinaryFormatter b = new BinaryFormatter(); + Stream s = File.Open(path, FileMode.CreateNew, FileAccess.ReadWrite); + b.Serialize(s, LyricsDB); + s.Close(); + + + + + + //// Create file to save the database to + //FileStream fs = new FileStream(path, FileMode.Create); + + //// Create a BinaryFormatter object to perform the serialization + //BinaryFormatter bf = new BinaryFormatter(); + + //// Use the BinaryFormatter object to serialize the database to the file + //bf.Serialize(fs, LyricsDB); + + //// Create likewise a database for the remainingLyrics + //path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + LyricsMarkedDBName; + //fs = new FileStream(path, FileMode.Create); + //LyricsMarkedDB = new LyricsDatabase(); + //bf.Serialize(fs, LyricsMarkedDB); + + //// Close the file + //fs.Close(); + } + } + else + { + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); + BinaryFormatter bf = new BinaryFormatter(); + Stream s = File.Open(path, FileMode.Open, FileAccess.Read); + LyricsDB = (LyricsDatabase)bf.Deserialize(s, null); + s.Close(); + + // Open database to read data from + FileStream fs = new FileStream(path, FileMode.Open); + + // Create a BinaryFormatter object to perform the deserialization + //BinaryFormatter bf = new BinaryFormatter(); + + // Use the BinaryFormatter object to deserialize the database + LyricsDB = new LyricsDatabase(); + LyricsDB = (LyricsDatabase)bf.Deserialize(fs); + + // Deserialize LyricsRemainingDatabase + path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + LyricsMarkedDBName; + fs = new FileStream(path, FileMode.Open); + LyricsMarkedDB = new LyricsDatabase(); + LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); + + // Close the file + fs.Close(); + } + + MyLyricsSetup_LyricsLibrary.CurrentDB = LyricsDB; + lyricUC.updateLyricsTree(); } // Stop worker thread if it is running. @@ -356,17 +430,15 @@ string capArtist = LyricUtil.capatalizeString(m_artist); string capTitle = LyricUtil.capatalizeString(m_track); - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("Lyrics.xml", false)) + + if (MyLyricsUtil.isTrackInLyricsDatabase(capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) { - xmlwriter.SetValue(capArtist, capTitle, m_LyricText); + LyricsDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, m_LyricText, site)); } if (MyLyricsUtil.isTrackInLyricsMarkedDatabase(capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_MARKED)) { - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("LyricsToFetch.xml", false)) - { - xmlwriter.RemoveEntry(capArtist, capTitle); - } + LyricsMarkedDB.Remove(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle)); } StreamReader sr = File.OpenText(logFullFileName); @@ -392,12 +464,9 @@ string capArtist = LyricUtil.capatalizeString(artist); string capTitle = LyricUtil.capatalizeString(title); - if (m_MarkSongsWhenNoLyricFound) + if (m_MarkSongsWhenNoLyricFound && MyLyricsUtil.isTrackInLyricsMarkedDatabase(capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) { - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("LyricsToFetch.xml", false)) - { - xmlwriter.SetValue(capArtist, capTitle, MyLyricsUtil.MARK); - } + LyricsMarkedDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, MyLyricsUtil.MARK, "")); } m_SongsWithMark += 1; @@ -444,6 +513,25 @@ btImportAll.Enabled = true; btCancel.Enabled = false; isSearching(false); + + if (LyricsDB != null) + { + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + LyricsDBName; + FileStream fs = new FileStream(path, FileMode.Create); + BinaryFormatter bf = new BinaryFormatter(); + bf.Serialize(fs, LyricsDB); + fs.Close(); + } + + if (LyricsMarkedDB != null) + { + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + LyricsMarkedDBName; + FileStream fs = new FileStream(path, FileMode.Create); + BinaryFormatter bf = new BinaryFormatter(); + bf.Serialize(fs, LyricsMarkedDB); + fs.Close(); + } + lyricUC.updateLyricsTree(); } @@ -579,50 +667,18 @@ } else { - XmlTextReader tr = null; - try + foreach (KeyValuePair<string, LyricsItem> kvp in LyricsMarkedDB) { - tr = new XmlTextReader("LyricsToFetch.xml"); - - string currentArtist = ""; - string currentTitle = ""; - while (tr.Read()) + if (++m_SongsNotKnown > m_Limit) { - switch (tr.Name) - { - case "section": - if (tr.AttributeCount == 1) - { - currentArtist = tr.GetAttribute(0); - } - break; - case "entry": - if (tr.AttributeCount == 1) - { - currentTitle = tr.GetAttribute(0); - string currentLyrics = tr.Value; - - if (++m_SongsNotKnown > m_Limit) - { - bgWorkerSearch.ReportProgress(-1); - goto startSearch; - } - - string[] lyricId = new string[2] { currentArtist, currentTitle }; - lyricConfigInfosQueue.Enqueue(lyricId); - } - break; - } - + bgWorkerSearch.ReportProgress(-1); + goto startSearch; } + string[] lyricId = new string[2] { kvp.Value.Artist, kvp.Value.Title }; + lyricConfigInfosQueue.Enqueue(lyricId); + } - } - catch { ;} - finally - { - tr.Close(); - } - //m_SongsToSearch = lyricConfigInfosQueue.Count; + m_SongsToSearch = lyricConfigInfosQueue.Count; //bgWorkerSearch.ReportProgress(songNotKnown); } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -15,14 +15,12 @@ private void InitializeComponent() { this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); - this.lbTitle = new MediaPortal.UserInterface.Controls.MPLabel(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.btDelete = new System.Windows.Forms.Button(); this.btAdd = new System.Windows.Forms.Button(); this.gbLibrary = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.comboDatabase = new MediaPortal.UserInterface.Controls.MPComboBox(); this.lbDatabase = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbTestSecondsLeft = new System.Windows.Forms.Label(); this.btImportLRC = new MediaPortal.UserInterface.Controls.MPButton(); this.lbSongs2 = new MediaPortal.UserInterface.Controls.MPLabel(); this.tbLyrics = new MediaPortal.UserInterface.Controls.MPTextBox(); @@ -36,6 +34,9 @@ this.btResetDatabase = new System.Windows.Forms.Button(); this.lbResetDatabase = new MediaPortal.UserInterface.Controls.MPLabel(); this.openFileDialog2 = new System.Windows.Forms.OpenFileDialog(); + this.lbTestSecondsLeft = new System.Windows.Forms.Label(); + this.lbTitle = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbSource = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLibrary.SuspendLayout(); this.gbResetDatabase.SuspendLayout(); this.SuspendLayout(); @@ -51,16 +52,6 @@ this.btSave.UseVisualStyleBackColor = true; this.btSave.Click += new System.EventHandler(this.btSave_Click); // - // lbTitle - // - this.lbTitle.AutoSize = true; - this.lbTitle.Location = new System.Drawing.Point(215, 66); - this.lbTitle.MaximumSize = new System.Drawing.Size(275, 13); - this.lbTitle.MinimumSize = new System.Drawing.Size(275, 13); - this.lbTitle.Name = "lbTitle"; - this.lbTitle.Size = new System.Drawing.Size(275, 13); - this.lbTitle.TabIndex = 4; - // // openFileDialog1 // this.openFileDialog1.FileName = "ARTIST - TITLE.txt"; @@ -91,6 +82,7 @@ // // gbLibrary // + this.gbLibrary.Controls.Add(this.lbSource); this.gbLibrary.Controls.Add(this.comboDatabase); this.gbLibrary.Controls.Add(this.lbDatabase); this.gbLibrary.Controls.Add(this.lbTestSecondsLeft); @@ -121,7 +113,7 @@ this.comboDatabase.FormattingEnabled = true; this.comboDatabase.Items.AddRange(new object[] { "Lyrics database", - "LyricsToFetct database"}); + "Marked database"}); this.comboDatabase.Location = new System.Drawing.Point(85, 15); this.comboDatabase.Name = "comboDatabase"; this.comboDatabase.Size = new System.Drawing.Size(144, 21); @@ -136,16 +128,6 @@ this.lbDatabase.TabIndex = 26; this.lbDatabase.Text = "Database:"; // - // lbTestSecondsLeft - // - this.lbTestSecondsLeft.AutoSize = true; - this.lbTestSecondsLeft.Location = new System.Drawing.Point(215, 335); - this.lbTestSecondsLeft.Name = "lbTestSecondsLeft"; - this.lbTestSecondsLeft.Size = new System.Drawing.Size(93, 13); - this.lbTestSecondsLeft.TabIndex = 25; - this.lbTestSecondsLeft.Text = "SecondsLeftLabel"; - this.lbTestSecondsLeft.Visible = false; - // // btImportLRC // this.btImportLRC.Location = new System.Drawing.Point(95, 330); @@ -158,7 +140,7 @@ // // lbSongs2 // - this.lbSongs2.Location = new System.Drawing.Point(82, 59); + this.lbSongs2.Location = new System.Drawing.Point(82, 65); this.lbSongs2.Name = "lbSongs2"; this.lbSongs2.Size = new System.Drawing.Size(65, 15); this.lbSongs2.TabIndex = 23; @@ -179,7 +161,7 @@ // // lbSongs // - this.lbSongs.Location = new System.Drawing.Point(11, 59); + this.lbSongs.Location = new System.Drawing.Point(11, 65); this.lbSongs.Name = "lbSongs"; this.lbSongs.Size = new System.Drawing.Size(60, 15); this.lbSongs.TabIndex = 22; @@ -197,7 +179,7 @@ // // lbArtists2 // - this.lbArtists2.Location = new System.Drawing.Point(82, 44); + this.lbArtists2.Location = new System.Drawing.Point(82, 50); this.lbArtists2.Name = "lbArtists2"; this.lbArtists2.Size = new System.Drawing.Size(65, 15); this.lbArtists2.TabIndex = 21; @@ -205,7 +187,7 @@ // // lbArtists // - this.lbArtists.Location = new System.Drawing.Point(11, 44); + this.lbArtists.Location = new System.Drawing.Point(11, 50); this.lbArtists.Name = "lbArtists"; this.lbArtists.Size = new System.Drawing.Size(60, 15); this.lbArtists.TabIndex = 20; @@ -238,7 +220,7 @@ this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(181, 23); this.button1.TabIndex = 11; - this.button1.Text = "Reset LyricsToFetch database"; + this.button1.Text = "Reset marked database"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // @@ -258,8 +240,8 @@ this.lbResetDatabase.Name = "lbResetDatabase"; this.lbResetDatabase.Size = new System.Drawing.Size(282, 41); this.lbResetDatabase.TabIndex = 9; - this.lbResetDatabase.Text = "Reset the \"Lyrics\" and/or \"LyricsToFetch\" database.\r\n\r\nAll data in each database" + - " that is reset is lost for ever"; + this.lbResetDatabase.Text = "Reset the \"Lyrics\" and/or \"marked\" database.\r\n\r\nAll data in each database that is" + + " reset is lost for ever"; // // openFileDialog2 // @@ -268,6 +250,36 @@ this.openFileDialog2.Multiselect = true; this.openFileDialog2.RestoreDirectory = true; // + // lbTestSecondsLeft + // + this.lbTestSecondsLeft.AutoSize = true; + this.lbTestSecondsLeft.Location = new System.Drawing.Point(215, 335); + this.lbTestSecondsLeft.Name = "lbTestSecondsLeft"; + this.lbTestSecondsLeft.Size = new System.Drawing.Size(93, 13); + this.lbTestSecondsLeft.TabIndex = 25; + this.lbTestSecondsLeft.Text = "SecondsLeftLabel"; + this.lbTestSecondsLeft.Visible = false; + // + // lbTitle + // + this.lbTitle.AutoSize = true; + this.lbTitle.Location = new System.Drawing.Point(221, 53); + this.lbTitle.MaximumSize = new System.Drawing.Size(290, 26); + this.lbTitle.MinimumSize = new System.Drawing.Size(290, 26); + this.lbTitle.Name = "lbTitle"; + this.lbTitle.Size = new System.Drawing.Size(290, 26); + this.lbTitle.TabIndex = 4; + this.lbTitle.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // lbSource + // + this.lbSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbSource.Location = new System.Drawing.Point(357, 297); + this.lbSource.Name = "lbSource"; + this.lbSource.Size = new System.Drawing.Size(142, 15); + this.lbSource.TabIndex = 28; + this.lbSource.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // MyLyricsSetup_LyricsLibrary // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -275,7 +287,7 @@ this.Controls.Add(this.gbResetDatabase); this.Controls.Add(this.gbLibrary); this.Name = "MyLyricsSetup_LyricsLibrary"; - this.Size = new System.Drawing.Size(525, 515); + this.Size = new System.Drawing.Size(525, 456); this.gbLibrary.ResumeLayout(false); this.gbLibrary.PerformLayout(); this.gbResetDatabase.ResumeLayout(false); @@ -285,7 +297,6 @@ #endregion - private MediaPortal.UserInterface.Controls.MPLabel lbTitle; private System.Windows.Forms.OpenFileDialog openFileDialog1; private MediaPortal.UserInterface.Controls.MPGroupBox gbLibrary; private MediaPortal.UserInterface.Controls.MPTextBox tbLyrics; @@ -301,11 +312,13 @@ internal MediaPortal.UserInterface.Controls.MPButton btImportSingle; internal MediaPortal.UserInterface.Controls.MPButton btImportLRC; private System.Windows.Forms.OpenFileDialog openFileDialog2; - private System.Windows.Forms.Label lbTestSecondsLeft; - private MediaPortal.UserInterface.Controls.MPComboBox comboDatabase; private MediaPortal.UserInterface.Controls.MPLabel lbDatabase; internal System.Windows.Forms.Button button1; internal System.Windows.Forms.Button btResetDatabase; private MediaPortal.UserInterface.Controls.MPLabel lbResetDatabase; + private MediaPortal.UserInterface.Controls.MPComboBox comboDatabase; + private System.Windows.Forms.Label lbTestSecondsLeft; + private MediaPortal.UserInterface.Controls.MPLabel lbTitle; + private MediaPortal.UserInterface.Controls.MPLabel lbSource; } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -5,12 +5,13 @@ using System.Data; using System.Text; using System.Windows.Forms; -using System.Xml; using System.IO; using System.Collections; using System.Threading; using System.Text.RegularExpressions; using System.Diagnostics; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters.Binary; using MediaPortal.GUI.Library; using MediaPortal.Dialogs; @@ -42,61 +43,34 @@ string nextLineToShow; int lineCounter; const int SHIFT_WHEN_HIT = 15; - string currentDatabase = ""; + internal static LyricsDatabase CurrentDB; public MyLyricsSetup_LyricsLibrary(Form form) { this.m_Form = form; InitializeComponent(); - currentDatabase = "Lyrics.xml"; comboDatabase.SelectedIndex = 0; updateLyricsTree(); } internal void updateLyricsTree() { - //if file is not found, create a new xml file - if (!System.IO.File.Exists("Lyrics.xml")) + if (CurrentDB == null) { - MyLyricsUtil.createLyricDatabase(); + return; } - if (!System.IO.File.Exists("LyricsToFetch.xml")) - { - MyLyricsUtil.createLyricToFetchDatabase(); - } - // catch error when treeView suddenly is disposed due to application shutdown try { treeView.Nodes.Clear(); m_NoOfArtists = 0; m_NoOfTitles = 0; - XmlTextReader tr = new XmlTextReader(currentDatabase); - - string currentArtist = ""; - string currentTitle = ""; - while (tr.Read()) + foreach (KeyValuePair<string, LyricsItem> kvp in CurrentDB) { - - switch (tr.Name) - { - case "section": - if (tr.AttributeCount == 1) - { - currentArtist = tr.GetAttribute(0); - } - break; - case "entry": - if (tr.AttributeCount == 1) - { - currentTitle = tr.GetAttribute(0); - AddSong(currentArtist, currentTitle); - } - break; - } + AddSong(kvp.Value); } - tr.Close(); + treeView.Sort(); updateLyricDatabaseStats(); } @@ -111,40 +85,16 @@ private ArrayList getTitlesByArtist(string artist) { - XmlTextReader tr = new XmlTextReader(currentDatabase); ArrayList titles = new ArrayList(); - while (tr.Read()) + foreach (KeyValuePair<string, LyricsItem> kvp in CurrentDB) { - switch (tr.Name) + if (kvp.Value.Artist.Equals(artist)) { - case "section": - if (tr.AttributeCount == 1 && tr.GetAttribute(0).Equals(artist)) - { - while (tr.Read()) - { - if (tr.Name.Equals("entry")) - { - if (tr.AttributeCount == 1) - { - titles.Add(tr.GetAttribute(0)); - } - } - else if (tr.Name.Equals("section")) - { - tr.Close(); - return titles; - } - } - } - break; - - default: - break; + titles.Add(kvp.Value.Title); } } - tr.Close(); - return null; + return titles; } /// <summary> @@ -152,10 +102,10 @@ /// </summary> /// <param name="artist"></param> /// <param name="title"></param> - private void AddSong(string artist, string title) + private void AddSong(LyricsItem item) { - artist = LyricUtil.capatalizeString(artist); - title = LyricUtil.capatalizeString(title); + string artist = LyricUtil.capatalizeString(item.Artist); + string title = LyricUtil.capatalizeString(item.Title); // add artist, if it doesn't exists if (!treeView.Nodes.ContainsKey(artist)) @@ -169,6 +119,7 @@ if (!treeView.Nodes[artistIndex].Nodes.ContainsKey(title)) { treeView.Nodes[artistIndex].Nodes.Add(title, title); + treeView.Nodes[artistIndex].Nodes[treeView.Nodes[artistIndex].Nodes.Count - 1].Tag = item; ++m_NoOfTitles; } treeView.Update(); @@ -180,14 +131,10 @@ /// <param name="artist"></param> /// <param name="title"></param> /// <param name="lyric"></param> - private void AddSong(string artist, string title, string lyric) + private void AddSong(string artist, string title, string lyrics) { - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(currentDatabase, false)) - { - xmlwriter.SetValue(artist, title, lyric); - } - - AddSong(artist, title); + LyricsItem item = new LyricsItem(artist, title, lyrics, "MP config"); + AddSong(item); } private void RemoveArtist(string artist) @@ -206,11 +153,8 @@ treeView.Nodes[artistIndex].Nodes.RemoveAt(titleIndex); --m_NoOfTitles; - // remove title from xml-file - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(currentDatabase, false)) - { - xmlwriter.RemoveEntry(artist, title); - } + // remove title from database + CurrentDB.Remove(MyLyricsUtil.CorrectKeyFormat(artist, title)); // remove title from treeView if (treeView.Nodes[artistIndex].Nodes.Count == 0) @@ -233,13 +177,9 @@ m_CurrentArtist = artist; m_CurrentTitle = LyricUtil.capatalizeString(title); - string lyricText = ""; - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(currentDatabase, false)) - { - lyricText = xmlreader.GetValueAsString(m_CurrentArtist, m_CurrentTitle, ""); - } + string lyricsText = (string)CurrentDB[MyLyricsUtil.CorrectKeyFormat(artist, title)].Lyrics; - LRC.SimpleLRC lrc = new LRC.SimpleLRC(artist, title, lyricText); + LRC.SimpleLRC lrc = new LRC.SimpleLRC(artist, title, lyricsText); if (lrc.IsValid) { return true; @@ -259,6 +199,7 @@ m_CurrentTitle = ""; tbLyrics.Text = ""; lbTitle.Text = ""; + lbSource.Text = ""; tbLyrics.Enabled = false; @@ -273,19 +214,17 @@ m_CurrentArtist = LyricUtil.capatalizeString(artist); m_CurrentTitle = LyricUtil.capatalizeString(title); - string lyricText = ""; - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(currentDatabase, false)) - { - lyricText = xmlreader.GetValueAsString(m_CurrentArtist, m_CurrentTitle, ""); - } + LyricsItem item = CurrentDB[MyLyricsUtil.CorrectKeyFormat(m_CurrentArtist, m_CurrentTitle)]; + string lyricsText = item.Lyrics; - lyricText = LyricsEngine.LyricUtil.ReturnEnvironmentNewLine(lyricText); + lyricsText = LyricsEngine.LyricUtil.ReturnEnvironmentNewLine(lyricsText); - m_OriginalLyric = lyricText; + m_OriginalLyric = lyricsText; tbLyrics.Text = m_OriginalLyric; tbLyrics.Enabled = true; - lbTitle.Text = m_CurrentArtist + " - " + m_CurrentTitle; + lbTitle.Text = "\"" + m_CurrentArtist + " - " + m_CurrentTitle + "\""; + lbSource.Text = "(" + item.Source + ")"; } } // Selected an artist @@ -327,11 +266,8 @@ private void btSave_Click(object sender, EventArgs e) { - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(currentDatabase, false)) - { - xmlwriter.SetValue(LyricUtil.capatalizeString(m_CurrentArtist), LyricUtil.capatalizeString(m_CurrentTitle), tbLyrics.Text); - btSave.Enabled = false; - } + CurrentDB[MyLyricsUtil.CorrectKeyFormat(LyricUtil.capatalizeString(m_CurrentArtist), LyricUtil.capatalizeString(m_CurrentTitle))].Lyrics = tbLyrics.Text; + btSave.Enabled = false; } private void tbLyrics_KeyUp(object sender, KeyEventArgs e) @@ -480,43 +416,6 @@ { if (MessageBox.Show(this, "Are you sure the lyrics database should be upgraded?", "Upgrade lyrics database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - StreamReader freader = File.OpenText("Lyrics.xml"); - StreamWriter fwriter = File.CreateText("LyricsTemp.xml"); - - string text_line; - while ((text_line = freader.ReadLine()) != null) - { - string strStart = "entry name="; - string strFinish = ">"; - - int indexStart = text_line.IndexOf(strStart); - int indexFinish = text_line.IndexOf(strFinish); - - // if both strings are found, you have a line holding title of track - - if (indexStart != -1 && indexFinish != -1 && ((char)(text_line[indexFinish - 2])).Equals(' ')) - { - string text_newline = - text_line.Substring(0, indexFinish - 2) + text_line.Substring(indexFinish - 1); - text_line = text_newline; - } - - // write to output file - fwriter.WriteLine(text_line); - } - - // must explicitly close the readers - freader.Close(); - fwriter.Close(); - - FileInfo fi = new FileInfo("Lyrics.xml"); - fi.Delete(); - - fi = new FileInfo("LyricsTemp.xml"); - fi.MoveTo("Lyrics.xml"); - fi = new FileInfo("LyricsTemp.xml"); - fi.Delete(); - updateLyricsTree(); } } @@ -626,12 +525,12 @@ { if (comboDatabase.SelectedIndex == 0) { - currentDatabase = "Lyrics.xml"; + CurrentDB = MyLyricsSetup.LyricsDB; updateLyricsTree(); } else { - currentDatabase = "LyricsToFetch.xml"; + CurrentDB = MyLyricsSetup.LyricsMarkedDB; updateLyricsTree(); } } @@ -640,8 +539,13 @@ { if (MessageBox.Show(this, "Are you sure the Lyrics database should be deleted?", "Delete Lyrics database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - MyLyricsUtil.createLyricDatabase(); - currentDatabase = "Lyrics.xml"; + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsDBName; + FileStream fs = new FileStream(path, FileMode.Create); + BinaryFormatter bf = new BinaryFormatter(); + bf.Serialize(fs, new LyricsDatabase()); + fs.Close(); + + CurrentDB = MyLyricsSetup.LyricsDB; comboDatabase.SelectedIndex = 0; updateLyricsTree(); updateInfo(); @@ -651,10 +555,15 @@ private void button1_Click(object sender, EventArgs e) { - if (MessageBox.Show(this, "Are you sure the LyricsToFetch database should be deleted?", "Delete LyricsToFetch database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + if (MessageBox.Show(this, "Are you sure you want to delete the database with marked titles?", "Delete title database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - MyLyricsUtil.createLyricToFetchDatabase(); - currentDatabase = "LyricsToFetch.xml"; + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsMarkedDBName; + FileStream fs = new FileStream(path, FileMode.Create); + BinaryFormatter bf = new BinaryFormatter(); + bf.Serialize(fs, new LyricsDatabase()); + fs.Close(); + + CurrentDB = MyLyricsSetup.LyricsDB; comboDatabase.SelectedIndex = 1; updateLyricsTree(); updateInfo(); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text; -using System.Xml; using LyricsEngine; @@ -20,19 +19,14 @@ string lyricText = ""; try { - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("Lyrics.xml", false)) - { - string capatalizedArtist = LyricUtil.capatalizeString(artist); - string capatalizedTitle = LyricUtil.capatalizeString(title); - lyricText = xmlreader.GetValue(capatalizedArtist, capatalizedTitle); - } + string capatalizedArtist = LyricUtil.capatalizeString(artist); + string capatalizedTitle = LyricUtil.capatalizeString(title); + + lyricText = MyLyricsSetup.LyricsDB[CorrectKeyFormat(capatalizedArtist, capatalizedTitle)].Lyrics; + } - catch (System.Xml.XPath.XPathException XPathExp) + catch { - //Catch the XPathException and write it to the Visual Studio .NET output window. - System.Diagnostics.Debug.WriteLine("XPathException:"); - System.Diagnostics.Debug.WriteLine("***************"); - System.Diagnostics.Debug.WriteLine(XPathExp.ToString()); return LYRIC_NOT_FOUND; } if (lyricText.Equals("")) @@ -44,55 +38,38 @@ internal static int isTrackInLyricsMarkedDatabase(string artist, string title) { - string lyricText = ""; + string lyricsText = ""; try { - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("LyricsToFetch.xml", false)) - { - string capatalizedArtist = LyricUtil.capatalizeString(artist); - string capatalizedTitle = LyricUtil.capatalizeString(title); - lyricText = xmlreader.GetValue(capatalizedArtist, capatalizedTitle); - } + lyricsText = MyLyricsSetup.LyricsMarkedDB[MyLyricsUtil.CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; } - catch{;} - if (lyricText.Equals(MyLyricsUtil.MARK)) + catch{ + return LYRIC_NOT_FOUND; + } + if (lyricsText.Equals(MyLyricsUtil.MARK)) return LYRIC_MARKED; - return LYRIC_NOT_FOUND; + else + return LYRIC_NOT_FOUND; } - internal static void createLyricDatabase() - { - XmlTextWriter xmlWriter = new XmlTextWriter("Lyrics.xml", System.Text.Encoding.UTF8); - xmlWriter.Formatting = Formatting.Indented; - xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); - xmlWriter.WriteStartElement("Lyrics"); - xmlWriter.Close(); - } - internal static void createLyricToFetchDatabase() - { - XmlTextWriter xmlWriter = new XmlTextWriter("LyricsToFetch.xml", System.Text.Encoding.UTF8); - xmlWriter.Formatting = Formatting.Indented; - xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); - xmlWriter.WriteStartElement("Lyrics"); - xmlWriter.Close(); - } - public static string LookUpLyricInDatabase(string artist, string title) { - string lyricText; - - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("Lyrics.xml", false)) + string lyricText = ""; + try { - lyricText = xmlreader.GetValueAsString(artist, title, ""); - if (lyricText.Equals("")) - { - lyricText = xmlreader.GetValueAsString(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title), ""); - } - lyricText = lyricText.Replace("\n", "\r\n"); + lyricText = MyLyricsSetup.LyricsDB[CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; + return lyricText.Replace("\n", "\r\n"); } + catch + { + return lyricText; + } + } - return lyricText; + public static string CorrectKeyFormat(string artist, string title) + { + return artist + "-" + title; } } } Modified: trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.15")] -[assembly: AssemblyFileVersion("0.15")] +[assembly: AssemblyVersion("0.16")] +[assembly: AssemblyFileVersion("0.16")] Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs 2007-03-09 13:23:31 UTC (rev 170) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs 2007-03-09 17:26:16 UTC (rev 171) @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("0.15")] -[assembly: AssemblyFileVersion("0.15")] +[assembly: AssemblyVersion("0.16")] +[assembly: AssemblyFileVersion("0.16")] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-03-18 11:13:41
|
Revision: 195 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=195&view=rev Author: saamand Date: 2007-03-17 06:53:17 -0700 (Sat, 17 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs 2007-03-17 13:53:17 UTC (rev 195) @@ -10,15 +10,14 @@ { private static TraceSource ts; private static Stopwatch stopWatch; - private static string logName = "MyLyrics.log"; private static string logFileName = ""; private static FileStream objStream; private static TextWriterTraceListener objTraceListener; - public static void OpenLog(string logDir) + public static void OpenLog(string url) { - logFileName = logDir + "\\" + logName; + logFileName = url; if (ts == null) { Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-17 13:53:17 UTC (rev 195) @@ -125,7 +125,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> <PreBuildEvent> </PreBuildEvent> </PropertyGroup> Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-03-17 13:53:17 UTC (rev 195) @@ -26,7 +26,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.16")] +[assembly: AssemblyVersion("0.17")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-17 13:53:17 UTC (rev 195) @@ -83,11 +83,12 @@ String[] m_sitesToSearch; - // Database settings + // Database and log settings internal static LyricsDatabase LyricsDB = null; internal static LyricsDatabase LyricsMarkedDB = null; internal const string LyricsDBName = "LyricsDatabaseV2.db"; internal const string LyricsMarkedDBName = "LyricsMarkedDatabaseV2.db"; + internal string logName = "MyLyrics.log"; #endregion @@ -192,8 +193,8 @@ startingScrollSpeedVertical = GUIGraphicsContext.ScrollSpeedVertical; GUIGraphicsContext.ScrollSpeedVertical = 1; - LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Log)); - //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Log)); + LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, logName)); + //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, logName)); LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens"); return true; } @@ -301,13 +302,13 @@ m_sitesToSearch = (string[])sitesToSearch.ToArray(typeof(string)); // Deserialize lyrics and marked database, and save references in LyricsDB - string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); FileStream fs = new FileStream(path, FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); LyricsDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); - path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); fs = new FileStream(path, FileMode.Open); LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); @@ -518,7 +519,7 @@ { LyricsDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, m_LyricText, site)); - string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); @@ -532,7 +533,7 @@ { LyricsMarkedDB.Remove(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle)); - string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); @@ -659,7 +660,11 @@ /// </summary> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) { - strButtonText = "My Lyrics";//GUILocalizeStrings.Get(9); // My News + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + strButtonText = ((string)xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics")).ToString(); + } + //strButtonText = "Myrics";//GUILocalizeStrings.Get(9); // My News strButtonImage = String.Empty; strButtonImageFocus = String.Empty; strPictureImage = "hover_my lyrics.png"; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-17 13:53:17 UTC (rev 195) @@ -31,6 +31,9 @@ this.tabControl = new MediaPortal.UserInterface.Controls.MPTabControl(); this.tabPageLyricsDatabase = new MediaPortal.UserInterface.Controls.MPTabPage(); this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); + this.mpGroupBox2 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.tbPluginName = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.lbPluginName = new MediaPortal.UserInterface.Controls.MPLabel(); this.tbNote = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.cbHotLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); @@ -52,7 +55,7 @@ this.cbMarkSongsWithNoLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbDisconsiderTitlesWithLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.lbSongsLimitNote = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.tbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbSongsLimit = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbMessages = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.lbMessage = new MediaPortal.UserInterface.Controls.MPLabel(); @@ -86,6 +89,7 @@ this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); this.tabControl.SuspendLayout(); this.tabPageSetup.SuspendLayout(); + this.mpGroupBox2.SuspendLayout(); this.gbLyricSites.SuspendLayout(); this.tabPageDatabase.SuspendLayout(); this.mpGroupBox1.SuspendLayout(); @@ -119,7 +123,7 @@ // // tabPageSetup // - this.tabPageSetup.Controls.Add(this.tbNote); + this.tabPageSetup.Controls.Add(this.mpGroupBox2); this.tabPageSetup.Controls.Add(this.gbLyricSites); this.tabPageSetup.Location = new System.Drawing.Point(4, 22); this.tabPageSetup.Name = "tabPageSetup"; @@ -129,10 +133,42 @@ this.tabPageSetup.Text = "General setup"; this.tabPageSetup.UseVisualStyleBackColor = true; // + // mpGroupBox2 + // + this.mpGroupBox2.AutoSize = true; + this.mpGroupBox2.Controls.Add(this.tbPluginName); + this.mpGroupBox2.Controls.Add(this.lbPluginName); + this.mpGroupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.mpGroupBox2.Location = new System.Drawing.Point(4, 6); + this.mpGroupBox2.Name = "mpGroupBox2"; + this.mpGroupBox2.Size = new System.Drawing.Size(510, 63); + this.mpGroupBox2.TabIndex = 29; + this.mpGroupBox2.TabStop = false; + this.mpGroupBox2.Text = "Lyric sites to search"; + // + // tbPluginName + // + this.tbPluginName.BorderColor = System.Drawing.Color.Empty; + this.tbPluginName.Location = new System.Drawing.Point(87, 24); + this.tbPluginName.MaxLength = 30; + this.tbPluginName.Name = "tbPluginName"; + this.tbPluginName.Size = new System.Drawing.Size(154, 20); + this.tbPluginName.TabIndex = 13; + this.tbPluginName.Text = "My Lyrics"; + // + // lbPluginName + // + this.lbPluginName.AutoSize = true; + this.lbPluginName.Location = new System.Drawing.Point(13, 27); + this.lbPluginName.Name = "lbPluginName"; + this.lbPluginName.Size = new System.Drawing.Size(68, 13); + this.lbPluginName.TabIndex = 14; + this.lbPluginName.Text = "Plugin name:"; + // // tbNote // this.tbNote.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.tbNote.Location = new System.Drawing.Point(17, 111); + this.tbNote.Location = new System.Drawing.Point(13, 91); this.tbNote.Name = "tbNote"; this.tbNote.Size = new System.Drawing.Size(377, 18); this.tbNote.TabIndex = 19; @@ -142,15 +178,16 @@ // this.gbLyricSites.AutoSize = true; this.gbLyricSites.Controls.Add(this.cbHotLyrics); + this.gbLyricSites.Controls.Add(this.tbNote); this.gbLyricSites.Controls.Add(this.cbSeekLyrics); this.gbLyricSites.Controls.Add(this.cbLyricsOnDemand); this.gbLyricSites.Controls.Add(this.cbLyrics007); this.gbLyricSites.Controls.Add(this.cbEvilLabs); this.gbLyricSites.Controls.Add(this.cbLyricWiki); this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbLyricSites.Location = new System.Drawing.Point(4, 6); + this.gbLyricSites.Location = new System.Drawing.Point(4, 75); this.gbLyricSites.Name = "gbLyricSites"; - this.gbLyricSites.Size = new System.Drawing.Size(510, 102); + this.gbLyricSites.Size = new System.Drawing.Size(510, 125); this.gbLyricSites.TabIndex = 28; this.gbLyricSites.TabStop = false; this.gbLyricSites.Text = "Lyric sites to search"; @@ -301,7 +338,7 @@ this.gbGenerel.Controls.Add(this.cbMarkSongsWithNoLyrics); this.gbGenerel.Controls.Add(this.cbDisconsiderTitlesWithLyrics); this.gbGenerel.Controls.Add(this.lbSongsLimitNote); - this.gbGenerel.Controls.Add(this.lbLimit); + this.gbGenerel.Controls.Add(this.tbLimit); this.gbGenerel.Controls.Add(this.lbSongsLimit); this.gbGenerel.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.gbGenerel.Location = new System.Drawing.Point(3, 6); @@ -397,16 +434,16 @@ this.lbSongsLimitNote.TabIndex = 13; this.lbSongsLimitNote.Text = "(1000 is default)"; // - // lbLimit + // tbLimit // - this.lbLimit.BorderColor = System.Drawing.Color.Empty; - this.lbLimit.Location = new System.Drawing.Point(158, 19); - this.lbLimit.MaxLength = 6; - this.lbLimit.Name = "lbLimit"; - this.lbLimit.Size = new System.Drawing.Size(44, 20); - this.lbLimit.TabIndex = 1; - this.lbLimit.Text = "1000"; - this.lbLimit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.tbLimit.BorderColor = System.Drawing.Color.Empty; + this.tbLimit.Location = new System.Drawing.Point(158, 19); + this.tbLimit.MaxLength = 6; + this.tbLimit.Name = "tbLimit"; + this.tbLimit.Size = new System.Drawing.Size(44, 20); + this.tbLimit.TabIndex = 1; + this.tbLimit.Text = "1000"; + this.tbLimit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // // lbSongsLimit // @@ -695,7 +732,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(540, 539); + this.ClientSize = new System.Drawing.Size(537, 537); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); @@ -710,6 +747,8 @@ this.tabControl.ResumeLayout(false); this.tabPageSetup.ResumeLayout(false); this.tabPageSetup.PerformLayout(); + this.mpGroupBox2.ResumeLayout(false); + this.mpGroupBox2.PerformLayout(); this.gbLyricSites.ResumeLayout(false); this.gbLyricSites.PerformLayout(); this.tabPageDatabase.ResumeLayout(false); @@ -765,7 +804,7 @@ internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsOnDemand; internal MediaPortal.UserInterface.Controls.MPCheckBox cbSeekLyrics; private MediaPortal.UserInterface.Controls.MPLabel lbSongsLimitNote; - private MediaPortal.UserInterface.Controls.MPTextBox lbLimit; + private MediaPortal.UserInterface.Controls.MPTextBox tbLimit; private MediaPortal.UserInterface.Controls.MPLabel lbSongsLimit; private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox1; private MediaPortal.UserInterface.Controls.MPButton btImportAll; @@ -782,5 +821,8 @@ internal MediaPortal.UserInterface.Controls.MPCheckBox cbHotLyrics; private MediaPortal.UserInterface.Controls.MPLabel tbNote; private MediaPortal.UserInterface.Controls.MPCheckBox cbSearchOnlyForMarkedSongs; + private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox2; + private MediaPortal.UserInterface.Controls.MPTextBox tbPluginName; + private MediaPortal.UserInterface.Controls.MPLabel lbPluginName; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-17 13:53:17 UTC (rev 195) @@ -93,6 +93,7 @@ internal static LyricsDatabase LyricsMarkedDB = null; internal const string LyricsDBName = "LyricsDatabaseV2.db"; internal const string LyricsMarkedDBName = "LyricsMarkedDatabaseV2.db"; + internal const string LyricsXMLName = "Lyrics.xml"; // Timer variables int hour = 0; @@ -101,17 +102,24 @@ System.Windows.Forms.Timer timer; StopWatch stopwatch = new StopWatch(); - // Batch log information + // log information private string log; - private string logFileName = "MyLyricsBatch.log"; + private string logName = "MyLyrics.log"; + private string logBatchFileName = "MyLyricsBatch.log"; private string logFullFileName = ""; + private int lastShownLyricsTitles = 0; + private int lastShownMarkedLyricsTitles = 0; + bool stopCollectingOfTitles = false; public MyLyricsSetup() { - // Initialize GUI + LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, logName)); + //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log)); + + #region Initialize GUI and class InitializeComponent(); lyricsLibraryUC = new MyLyricsSetup_LyricsLibrary(this); this.tabPageLyricsDatabase.Controls.Add(lyricsLibraryUC); @@ -122,19 +130,19 @@ m_DelegateThreadFinished = new DelegateThreadFinished(this.ThreadFinishedMethod); m_DelegateThreadException = new DelegateThreadException(this.ThreadExceptionMethod); - LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Log)); - //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Log)); // Grab music database MusicDatabase dbs = new MusicDatabase(); m_TotalTitles = dbs.GetNumOfSongs(); + #endregion - // Get settings saved in MediaPortal.xml + #region Get settings from in MediaPortal.xml using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { try { - lbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString()); + tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString()); + tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics"); lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)"); cbLyricWiki.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; @@ -173,60 +181,90 @@ MessageBox.Show("Something has gone wrong when reading Mediaportal.xml"); } } +#endregion - // Update database and serialize if needed... - string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); - FileInfo fileInfo = new FileInfo(path); + #region Serialzie/deserialize lyricsdatabases + string lyricsXMLpath = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Base, LyricsXMLName); + FileInfo lyricsXMLfileInfo = new FileInfo(lyricsXMLpath); - if (fileInfo.Exists == false) + + // If lyrics.xml present, then convert database to new format... + if (lyricsXMLfileInfo.Exists) { - if (MessageBox.Show(this, "Your database will have to be upgraded to work with this version\r\nUpgrade now?", "Upgrade lyricsdatabase", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + FileInfo fileInfo = new FileInfo(path); + + // .. but only if it hasn't already been converted + if (fileInfo.Exists == false) { - ConvertFromXMLtoLyricsDatabase convertFromXMLtoLyricsDatabase = new ConvertFromXMLtoLyricsDatabase(); - LyricsDB = convertFromXMLtoLyricsDatabase.Convert(); + if (MessageBox.Show(this, "Your database will have to be upgraded to work with this version\r\nUpgrade now?", "Upgrade lyricsdatabase", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + { + ConvertFromXMLtoLyricsDatabase convertFromXMLtoLyricsDatabase = new ConvertFromXMLtoLyricsDatabase(); + LyricsDB = convertFromXMLtoLyricsDatabase.Convert(lyricsXMLpath); - // Create file to save the database to - FileStream fs = new FileStream(path, FileMode.Create); + // Create file to save the database to + FileStream fs = new FileStream(path, FileMode.Create); - // Create a BinaryFormatter object to perform the serialization - BinaryFormatter bf = new BinaryFormatter(); + // Create a BinaryFormatter object to perform the serialization + BinaryFormatter bf = new BinaryFormatter(); - // Use the BinaryFormatter object to serialize the database to the file - bf.Serialize(fs, LyricsDB); + // Use the BinaryFormatter object to serialize the database to the file + bf.Serialize(fs, LyricsDB); + fs.Close(); - // Create likewise a database for the remainingLyrics - path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + LyricsMarkedDBName; - fs = new FileStream(path, FileMode.Create); - LyricsMarkedDB = new LyricsDatabase(); - bf.Serialize(fs, LyricsMarkedDB); + // Create likewise a database for the remainingLyrics + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + fs = new FileStream(path, FileMode.Create); + LyricsMarkedDB = new LyricsDatabase(); + bf.Serialize(fs, LyricsMarkedDB); - // Close the file - fs.Close(); + // Close the file + fs.Close(); + } } + + // ... else deserialize the databases and save reference in LyricsDB and LyricsMarkedDB + else + { + DeserializeBothDB(); + } } - // ... else deserialize the databases and save reference in LyricsDB and LyricsMarkedDB + // If no Lyrics.xml present in base, then create new serialized databases else { - // Open database to read data from - FileStream fs = new FileStream(path, FileMode.Open); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + FileInfo fileInfo = new FileInfo(path); - // Create a BinaryFormatter object to perform the deserialization - BinaryFormatter bf = new BinaryFormatter(); + // .. but only if the databases hasn't been created + if (fileInfo.Exists == false) + { + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); - // Use the BinaryFormatter object to deserialize the database - LyricsDB = (LyricsDatabase)bf.Deserialize(fs); - fs.Close(); + // Serialize empty LyricsDatabase if no lyrics.xml present + FileStream fs = new FileStream(path, FileMode.Create); + BinaryFormatter bf = new BinaryFormatter(); + LyricsDB = new LyricsDatabase(); + bf.Serialize(fs, LyricsDB); + fs.Close(); - // Deserialize LyricsRemainingDatabase - path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); - - fs = new FileStream(path, FileMode.Open); - LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); - fs.Close(); + // Serialize empty LyricsMarkedDatabase + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + fs = new FileStream(path, FileMode.Create); + LyricsMarkedDB = new LyricsDatabase(); + bf.Serialize(fs, LyricsMarkedDB); + fs.Close(); + } + else + { + DeserializeBothDB(); + } } MyLyricsSetup_LyricsLibrary.CurrentDB = LyricsDB; + #endregion + lyricsLibraryUC.updateLyricsTree(); } @@ -263,11 +301,13 @@ } } } + private void btSave_Click(object sender, System.EventArgs e) { using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MediaPortal.xml")) { - xmlwriter.SetValue("myLyrics", "limit", lbLimit.Text); + xmlwriter.SetValue("myLyrics", "limit", tbLimit.Text); + xmlwriter.SetValue("myLyrics", "pluginsName", tbPluginName.Text); xmlwriter.SetValue("myLyrics", "useLyricWiki", cbLyricWiki.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useEvilLabs", cbEvilLabs.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useLyrics007", cbLyrics007.Checked.ToString()); @@ -342,7 +382,7 @@ btImportAll.Enabled = false; - logFullFileName = Config.GetFile(Config.Dir.Log, logFileName); + logFullFileName = Config.GetFile(Config.Dir.Log, logBatchFileName); //if file is not found, create a new xml file if (!System.IO.File.Exists(logFullFileName)) @@ -358,7 +398,7 @@ writerLog.Close(); } - m_Limit = int.Parse(lbLimit.Text); + m_Limit = int.Parse(tbLimit.Text); m_DisregardKnownLyric = cbDisconsiderTitlesWithLyrics.Enabled && cbDisconsiderTitlesWithLyrics.Checked; m_MarkSongsWhenNoLyricFound = cbMarkSongsWithNoLyrics.Enabled && cbMarkSongsWithNoLyrics.Checked; @@ -804,11 +844,11 @@ string path = ""; if (ldb.Equals(LyricsDB)) { - path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); } else if (ldb.Equals(LyricsMarkedDB)) { - path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); } // Create file to save the database to @@ -827,6 +867,28 @@ } } + private void DeserializeBothDB() + { + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + + // Open database to read data from + FileStream fs = new FileStream(path, FileMode.Open); + + // Create a BinaryFormatter object to perform the deserialization + BinaryFormatter bf = new BinaryFormatter(); + + // Use the BinaryFormatter object to deserialize the database + LyricsDB = (LyricsDatabase)bf.Deserialize(fs); + fs.Close(); + + // Deserialize LyricsRemainingDatabase + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + + fs = new FileStream(path, FileMode.Open); + LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); + fs.Close(); + } + private void MyLyricsSetup_FormClosing(object sender, FormClosingEventArgs e) { @@ -875,8 +937,18 @@ { if (tabControl.SelectedIndex == 0) { + if ((MyLyricsSetup_LyricsLibrary.CurrentDB.Equals(LyricsDB) && LyricsDB.Count != lastShownLyricsTitles) + || (MyLyricsSetup_LyricsLibrary.CurrentDB.Equals(LyricsMarkedDB) && LyricsMarkedDB.Count != lastShownMarkedLyricsTitles)) + { + lyricsLibraryUC.updateLyricsTree(); + } lyricsLibraryUC.treeView.Select(); } + else + { + lastShownLyricsTitles = LyricsDB.Count; + lastShownMarkedLyricsTitles = LyricsMarkedDB.Count; + } } } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-17 13:53:17 UTC (rev 195) @@ -37,11 +37,6 @@ int m_NoOfTitles; LRC.SimpleLRC lrc; - System.Windows.Forms.Timer timer = null; - Stopwatch stopwatch = null; - string nextTimeToShow; - string nextLineToShow; - int lineCounter; const int SHIFT_WHEN_HIT = 15; internal static LyricsDatabase CurrentDB; private int currentDBIndex = 0; @@ -611,7 +606,7 @@ { if (MessageBox.Show(this, "Are you sure the Lyrics database should be deleted?", "Delete Lyrics database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsDBName; + string path = MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); MyLyricsSetup.LyricsDB = new LyricsDatabase(); @@ -630,7 +625,7 @@ { if (MessageBox.Show(this, "Are you sure you want to delete the database with marked titles?", "Delete title database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsMarkedDBName; + string path = MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsMarkedDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); MyLyricsSetup.LyricsMarkedDB = new LyricsDatabase(); Modified: trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-03-17 13:53:17 UTC (rev 195) @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.16")] -[assembly: AssemblyFileVersion("0.16")] +[assembly: AssemblyVersion("0.17")] +[assembly: AssemblyFileVersion("0.17")] Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs 2007-03-17 12:10:29 UTC (rev 194) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs 2007-03-17 13:53:17 UTC (rev 195) @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("0.16")] -[assembly: AssemblyFileVersion("0.16")] +[assembly: AssemblyVersion("0.17")] +[assembly: AssemblyFileVersion("0.17")] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-03-20 16:50:23
|
Revision: 199 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=199&view=rev Author: saamand Date: 2007-03-20 09:50:17 -0700 (Tue, 20 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-03-20 16:50:17 UTC (rev 199) @@ -27,67 +27,60 @@ private ILyricForm m_Form; // status - private static int noOfLyricsToSearch; - private static int noOfLyricsSearched; - private static int noOfLyricsFound; - private static int noOfLyricsNotFound; + private int noOfLyricsToSearch; + private int noOfLyricsSearched; + private int noOfLyricsFound; + private int noOfLyricsNotFound; private bool m_StopSearches = false; public static event EventHandler StopTheSearchAndAbort = null; ArrayList threadList = new ArrayList(); - ArrayList suspendedThreadList = new ArrayList(); - // Main thread sets this event to stop LyricController ManualResetEvent m_EventStop_LyricController; - // LyricController sets this event when it is stopped - ManualResetEvent m_EventStopped_LyricController; - // Main thread sets this event to pause all LyricSearches - public ManualResetEvent m_EventStop_LyricSearches; - // Variables related to GoogleSites - private ArrayList m_GoogleLicenseKeysUsed = new ArrayList(); - private string m_GoogleLicenseKey = ""; - private bool m_noMoreValidLicenseKeys = false; - int m_managedThreadId = -1; + private string[] lyricsSites; - // Lyric sites - private string[] lyricSites; - private string[] eastSites; + internal static bool ALLOW_ALL_TO_SEARCH = false; + + public LyricsController(ILyricForm mainForm, - ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped, - string[] lyricSites) + ManualResetEvent eventStopThread, + string[] lyricSites, bool allowAllToSearch) { this.m_Form = mainForm; - LyricsController.noOfLyricsToSearch = 1; - LyricsController.noOfLyricsSearched = 0; - LyricsController.noOfLyricsFound = 0; - LyricsController.noOfLyricsNotFound = 0; + noOfLyricsToSearch = 1; + noOfLyricsSearched = 0; + noOfLyricsFound = 0; + noOfLyricsNotFound = 0; - this.lyricSites = lyricSites; + ALLOW_ALL_TO_SEARCH = allowAllToSearch; - ArrayList easySitesArrayList = new ArrayList(); - - foreach (string site in lyricSites) + // If search all, then include all + if (allowAllToSearch) { - if (Setup.IsMemberOfEasySites(site)) + this.lyricsSites = lyricSites; + } + else + { + ArrayList tempArrayList = new ArrayList(); + foreach (string site in lyricSites) { - easySitesArrayList.Add(site); + if (Setup.IsMember(site)) + { + tempArrayList.Add(site); + } } + this.lyricsSites = (string[])tempArrayList.ToArray(typeof(string)); } - eastSites = (string[])easySitesArrayList.ToArray(typeof(string)); - LyricSearch.EasySites = eastSites; + + LyricSearch.LyricsSites = lyricsSites; - // initialize events m_EventStop_LyricController = eventStopThread; - m_EventStopped_LyricController = eventThreadStopped; - m_EventStop_LyricSearches = new ManualResetEvent(false); - m_EventStop_LyricSearches.Set(); - LyricSearch.Abort = false; } @@ -118,7 +111,6 @@ stillThreadsAlive = true; } } - m_EventStopped_LyricController.Set(); break; } } @@ -144,58 +136,33 @@ } } - Thread.Sleep(500); + Thread.Sleep(100); - // inform main thread that this thread stopped - m_EventStopped_LyricController.Set(); finishThread("", "", "The search has ended.", ""); } - public void updateManualResetEvents(ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped) - { - this.m_EventStop_LyricController = eventStopThread; - this.m_EventStopped_LyricController = eventThreadStopped; - } - public void addNewLyricSearch(string artist, string title) { - if (eastSites.Length > 0) + if (lyricsSites.Length > 0) { // create worker thread instance - ThreadStart easySitesThreadInstance = delegate + ThreadStart siteThreadInstance = delegate { - - LyricSearch lyricSearch_EasySites = new LyricSearch(m_EventStop_LyricController, m_EventStopped_LyricController, this); - lyricSearch_EasySites.setLyricInfo(artist, title); - lyricSearch_EasySites.Run(); + LyricSearch lyricSearch = new LyricSearch(this); + lyricSearch.setLyricInfo(artist, title); + lyricSearch.Run(); }; - Thread lyricSearchThread = new Thread(easySitesThreadInstance); - lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; // looks nice in Output window + Thread lyricSearchThread = new Thread(siteThreadInstance); + lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; lyricSearchThread.IsBackground = true; lyricSearchThread.Start(); threadList.Add(lyricSearchThread); } } - public void suspendAllSearchThreadsExceptMe(int managedThreadId) - { - //// clean-up operations may be placed here - //for (int i = 0; i < threadList.Count; i++) - //{ - // if (((Thread)threadList[i]).ManagedThreadId != managedThreadId) - // ((Thread)threadList[i]).Suspend(); - //} - m_managedThreadId = managedThreadId; - m_EventStop_LyricSearches.Reset(); - } - public void resumeAllSearchThreads() - { - m_EventStop_LyricSearches.Reset(); - } - internal void updateString(String message, String site) { m_Form.UpdateString = new Object[] { message, site }; @@ -203,7 +170,6 @@ internal void statusUpdate(string artist, string title, string site, bool lyricFound) { - //LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + artist + " - " + title + " - " + site + " - " +lyricFound.ToString() ); if (lyricFound) ++noOfLyricsFound; else @@ -213,7 +179,7 @@ m_Form.UpdateStatus = new Object[] { noOfLyricsToSearch, noOfLyricsSearched, noOfLyricsFound, noOfLyricsNotFound }; - if (noOfLyricsSearched >= noOfLyricsToSearch) + if ((noOfLyricsSearched >= noOfLyricsToSearch) && ALLOW_ALL_TO_SEARCH == false) { finishThread(artist, title, "All songs have been searched!", site); } @@ -241,7 +207,6 @@ public void finishThread(String artist, String title, String message, String site) { m_EventStop_LyricController.Set(); - m_EventStopped_LyricController.Set(); m_Form.ThreadFinished = new Object[] { artist, title, message, site }; } @@ -250,12 +215,6 @@ m_Form.ThreadException = s; } - public string GoogleLicenseKey - { - get { return m_GoogleLicenseKey; } - set { m_GoogleLicenseKey = value; } - } - public bool StopSearches { get { return m_StopSearches; } @@ -263,41 +222,20 @@ if (value == true) { m_StopSearches = true; - m_EventStop_LyricSearches.Reset(); LyricSearch.Abort = true; //StopTheSearchAndAbort.Invoke(this, EventArgs.Empty); } else { m_StopSearches = false; - m_EventStop_LyricSearches.Set(); LyricSearch.Abort = false; } } } - public ArrayList GoogleLicenseKeysUsed - { - get { return m_GoogleLicenseKeysUsed; } - } - - public void addToGoogleLicenseKeysUsed(string key) - { - if (!m_GoogleLicenseKeysUsed.Contains(key)) - { - m_GoogleLicenseKeysUsed.Add(key); - } - } - public int NoOfLyricsToSearch { - set { LyricsController.noOfLyricsToSearch = value; } + set { noOfLyricsToSearch = value; } } - - public bool NoMoreValidLicenseKeys - { - get { return m_noMoreValidLicenseKeys; } - set { m_noMoreValidLicenseKeys = value; } - } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-20 16:50:17 UTC (rev 199) @@ -125,7 +125,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> <PreBuildEvent> </PreBuildEvent> </PropertyGroup> Modified: trunk/plugins/MyLyrics/LyricsEngine/Setup.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-03-20 16:50:17 UTC (rev 199) @@ -6,7 +6,7 @@ { public static class Setup { - public static string[] EasySites = new string[4] + public static string[] BatchSearchSites = new string[4] { "LyricWiki", //"EvilLabs", @@ -20,24 +20,19 @@ public static string[] AllSites() { ArrayList allSites = new ArrayList(); - allSites.AddRange(EasySites); + allSites.AddRange(BatchSearchSites); string[] allSitesArray = (string[])allSites.ToArray(typeof(string)); return allSitesArray; } public static bool IsMember(string value) { - return System.Array.IndexOf<string>(Setup.EasySites, value) != -1; + return System.Array.IndexOf<string>(Setup.BatchSearchSites, value) != -1; } - public static bool IsMemberOfEasySites(string value) - { - return System.Array.IndexOf<string>(Setup.EasySites, value) != -1; - } - public static int NoOfSites() { - return EasySites.Length; + return BatchSearchSites.Length; } } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-20 16:50:17 UTC (rev 199) @@ -68,7 +68,6 @@ // events used to stop worker thread ManualResetEvent m_EventStopThread; - ManualResetEvent m_EventThreadStopped; // Track info string m_artist = ""; @@ -95,7 +94,6 @@ public GUIMyLyrics() { m_EventStopThread = new ManualResetEvent(false); - m_EventThreadStopped = new ManualResetEvent(false); GetID = (int)GUIMyLyrics.WINDOW_MYLYRICS; @@ -193,8 +191,8 @@ startingScrollSpeedVertical = GUIGraphicsContext.ScrollSpeedVertical; GUIGraphicsContext.ScrollSpeedVertical = 1; - LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, logName)); - //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, logName)); + LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); + //LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens"); return true; } @@ -302,13 +300,13 @@ m_sitesToSearch = (string[])sitesToSearch.ToArray(typeof(string)); // Deserialize lyrics and marked database, and save references in LyricsDB - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); FileStream fs = new FileStream(path, FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); LyricsDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); fs = new FileStream(path, FileMode.Open); LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); @@ -326,7 +324,6 @@ private void findLyric(MusicTag tag) { m_EventStopThread.Reset(); - m_EventThreadStopped.Reset(); GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, ""); @@ -351,7 +348,7 @@ // 1) + 2) Check if LRC in music tag or Database - string lyricText = MyLyrics.MyLyricsUtil.LookUpLyricInDatabase(LyricsDB, m_artist, m_title); + string lyricText = MyLyrics.DatabaseUtil.LookUpLyricInDatabase(LyricsDB, m_artist, m_title); if ((!tag.Lyrics.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, tag.Lyrics)).IsValid) || (!lyricText.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, lyricText)).IsValid)) @@ -418,7 +415,7 @@ { lyricsFound = false; - lc = new LyricsController(this, m_EventStopThread, m_EventThreadStopped, m_sitesToSearch); + lc = new LyricsController(this, m_EventStopThread, m_sitesToSearch, false); // create worker thread instance ThreadStart job = delegate { @@ -429,8 +426,6 @@ m_LyricControllerThread.Name = "lyricSearch Thread"; // looks nice in Output window m_LyricControllerThread.Start(); - lc.GoogleLicenseKey = m_GoogleLicenseKeys[m_GoogleLicenseKeyIndex]; - lc.addNewLyricSearch(m_artist, m_title); } } @@ -515,11 +510,11 @@ string capArtist = LyricUtil.capatalizeString(m_artist); string capTitle = LyricUtil.capatalizeString(m_title); - if (MyLyricsUtil.isTrackInLyricsDatabase(LyricsDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) + if (DatabaseUtil.IsTrackInLyricsDatabase(LyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) { - LyricsDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, m_LyricText, site)); + LyricsDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, m_LyricText, site)); - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); @@ -529,11 +524,11 @@ } } - if (MyLyricsUtil.isTrackInLyricsMarkedDatabase(LyricsMarkedDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_MARKED)) + if (DatabaseUtil.IsTrackInLyricsMarkedDatabase(LyricsMarkedDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_MARKED)) { - LyricsMarkedDB.Remove(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle)); + LyricsMarkedDB.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)); - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); @@ -556,25 +551,6 @@ m_LyricControllerThread = null; lc = null; - - //// wait when thread will stop or finish - //while (m_LyricControllerThread.IsAlive) - //{ - // // We cannot use here infinite wait because our thread - // // makes syncronous calls to main form, this will cause deadlock. - // // Instead of this we wait for event some appropriate time - // // (and by the way give time to worker thread) and - // // process events. These events may contain Invoke calls. - // if (WaitHandle.WaitAll( - // (new ManualResetEvent[] { m_EventThreadStopped }), - // 100, - // true)) - // { - // break; - // } - - // Application.DoEvents(); - //} } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-20 16:50:17 UTC (rev 199) @@ -34,9 +34,9 @@ this.mpGroupBox2 = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.tbPluginName = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbPluginName = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbNote = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.cbHotLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.tbNote = new MediaPortal.UserInterface.Controls.MPLabel(); this.cbSeekLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLyricsOnDemand = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); @@ -107,7 +107,7 @@ this.tabControl.Location = new System.Drawing.Point(7, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(528, 494); + this.tabControl.Size = new System.Drawing.Size(534, 494); this.tabControl.TabIndex = 1; this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); // @@ -116,7 +116,7 @@ this.tabPageLyricsDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageLyricsDatabase.Name = "tabPageLyricsDatabase"; this.tabPageLyricsDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageLyricsDatabase.Size = new System.Drawing.Size(520, 468); + this.tabPageLyricsDatabase.Size = new System.Drawing.Size(526, 468); this.tabPageLyricsDatabase.TabIndex = 1; this.tabPageLyricsDatabase.Text = "Lyrics database"; this.tabPageLyricsDatabase.UseVisualStyleBackColor = true; @@ -128,7 +128,7 @@ this.tabPageSetup.Location = new System.Drawing.Point(4, 22); this.tabPageSetup.Name = "tabPageSetup"; this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSetup.Size = new System.Drawing.Size(520, 468); + this.tabPageSetup.Size = new System.Drawing.Size(526, 468); this.tabPageSetup.TabIndex = 2; this.tabPageSetup.Text = "General setup"; this.tabPageSetup.UseVisualStyleBackColor = true; @@ -165,15 +165,6 @@ this.lbPluginName.TabIndex = 14; this.lbPluginName.Text = "Plugin name:"; // - // tbNote - // - this.tbNote.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.tbNote.Location = new System.Drawing.Point(13, 91); - this.tbNote.Name = "tbNote"; - this.tbNote.Size = new System.Drawing.Size(377, 18); - this.tbNote.TabIndex = 19; - this.tbNote.Text = "(Seek Lyrics and Evil Labs are currently disabled due to instable servers)"; - // // gbLyricSites // this.gbLyricSites.AutoSize = true; @@ -205,6 +196,15 @@ this.cbHotLyrics.Text = "Hot Lyrics"; this.cbHotLyrics.UseVisualStyleBackColor = true; // + // tbNote + // + this.tbNote.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tbNote.Location = new System.Drawing.Point(13, 91); + this.tbNote.Name = "tbNote"; + this.tbNote.Size = new System.Drawing.Size(377, 18); + this.tbNote.TabIndex = 19; + this.tbNote.Text = "(Seek Lyrics and Evil Labs are currently disabled due to instable servers)"; + // // cbSeekLyrics // this.cbSeekLyrics.AutoSize = true; @@ -280,7 +280,7 @@ this.tabPageDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageDatabase.Name = "tabPageDatabase"; this.tabPageDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDatabase.Size = new System.Drawing.Size(520, 468); + this.tabPageDatabase.Size = new System.Drawing.Size(526, 468); this.tabPageDatabase.TabIndex = 2; this.tabPageDatabase.Text = "Search music database"; this.tabPageDatabase.UseVisualStyleBackColor = true; @@ -702,7 +702,7 @@ // // btSave // - this.btSave.Location = new System.Drawing.Point(358, 512); + this.btSave.Location = new System.Drawing.Point(363, 512); this.btSave.Name = "btSave"; this.btSave.Size = new System.Drawing.Size(78, 23); this.btSave.TabIndex = 16; @@ -712,7 +712,7 @@ // // btClose // - this.btClose.Location = new System.Drawing.Point(442, 512); + this.btClose.Location = new System.Drawing.Point(447, 512); this.btClose.Name = "btClose"; this.btClose.Size = new System.Drawing.Size(78, 23); this.btClose.TabIndex = 99; @@ -732,7 +732,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(537, 537); + this.ClientSize = new System.Drawing.Size(548, 536); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-20 16:50:17 UTC (rev 199) @@ -37,7 +37,6 @@ // events used to stop worker thread ManualResetEvent m_EventStopThread; - ManualResetEvent m_EventThreadStopped; // Delegates public delegate void DelegateStringUpdate(String message, String site); @@ -88,13 +87,6 @@ private Queue lyricConfigInfosQueue; string[] sitesToSearchArray = null; - // Database settings - internal static LyricsDatabase LyricsDB = null; - internal static LyricsDatabase LyricsMarkedDB = null; - internal const string LyricsDBName = "LyricsDatabaseV2.db"; - internal const string LyricsMarkedDBName = "LyricsMarkedDatabaseV2.db"; - internal const string LyricsXMLName = "Lyrics.xml"; - // Timer variables int hour = 0; int min = 0; @@ -104,8 +96,6 @@ // log information private string log; - private string logName = "MyLyrics.log"; - private string logBatchFileName = "MyLyricsBatch.log"; private string logFullFileName = ""; private int lastShownLyricsTitles = 0; @@ -116,8 +106,8 @@ public MyLyricsSetup() { - LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, logName)); - //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log)); + LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, MyLyricsSettings.LogName)); + //LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log)); #region Initialize GUI and class InitializeComponent(); @@ -184,7 +174,7 @@ #endregion #region Serialzie/deserialize lyricsdatabases - string lyricsXMLpath = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Base, LyricsXMLName); + string lyricsXMLpath = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Base, MyLyricsSettings.LyricsXMLName); FileInfo lyricsXMLfileInfo = new FileInfo(lyricsXMLpath); @@ -192,7 +182,7 @@ if (lyricsXMLfileInfo.Exists) { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); FileInfo fileInfo = new FileInfo(path); // .. but only if it hasn't already been converted @@ -201,7 +191,7 @@ if (MessageBox.Show(this, "Your database will have to be upgraded to work with this version\r\nUpgrade now?", "Upgrade lyricsdatabase", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { ConvertFromXMLtoLyricsDatabase convertFromXMLtoLyricsDatabase = new ConvertFromXMLtoLyricsDatabase(); - LyricsDB = convertFromXMLtoLyricsDatabase.Convert(lyricsXMLpath); + MyLyricsSettings.LyricsDB = convertFromXMLtoLyricsDatabase.Convert(lyricsXMLpath); // Create file to save the database to FileStream fs = new FileStream(path, FileMode.Create); @@ -210,14 +200,14 @@ BinaryFormatter bf = new BinaryFormatter(); // Use the BinaryFormatter object to serialize the database to the file - bf.Serialize(fs, LyricsDB); + bf.Serialize(fs, MyLyricsSettings.LyricsDB); fs.Close(); // Create likewise a database for the remainingLyrics - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); fs = new FileStream(path, FileMode.Create); - LyricsMarkedDB = new LyricsDatabase(); - bf.Serialize(fs, LyricsMarkedDB); + MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); + bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); // Close the file fs.Close(); @@ -234,26 +224,26 @@ // If no Lyrics.xml present in base, then create new serialized databases else { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); FileInfo fileInfo = new FileInfo(path); // .. but only if the databases hasn't been created if (fileInfo.Exists == false) { - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); // Serialize empty LyricsDatabase if no lyrics.xml present FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); - LyricsDB = new LyricsDatabase(); - bf.Serialize(fs, LyricsDB); + MyLyricsSettings.LyricsDB = new LyricsDatabase(); + bf.Serialize(fs, MyLyricsSettings.LyricsDB); fs.Close(); // Serialize empty LyricsMarkedDatabase - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); fs = new FileStream(path, FileMode.Create); - LyricsMarkedDB = new LyricsDatabase(); - bf.Serialize(fs, LyricsMarkedDB); + MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); + bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); fs.Close(); } else @@ -262,7 +252,7 @@ } } - MyLyricsSetup_LyricsLibrary.CurrentDB = LyricsDB; + MyLyricsSetup_LyricsLibrary.CurrentDB = MyLyricsSettings.LyricsDB; #endregion lyricsLibraryUC.updateLyricsTree(); @@ -375,14 +365,13 @@ lbTotalSongs2.Text = m_TotalTitles.ToString(); m_EventStopThread = new ManualResetEvent(false); - m_EventThreadStopped = new ManualResetEvent(false); m_noOfMessages = 0; m_noOfCurrentlySearches = 0; btImportAll.Enabled = false; - logFullFileName = Config.GetFile(Config.Dir.Log, logBatchFileName); + logFullFileName = Config.GetFile(Config.Dir.Log, MyLyricsSettings.LogBatchFileName); //if file is not found, create a new xml file if (!System.IO.File.Exists(logFullFileName)) @@ -409,7 +398,7 @@ if (m_SearchOnlyMarkedSongs) { - progressBar.Maximum = LyricsMarkedDB.Count; + progressBar.Maximum = MyLyricsSettings.LyricsMarkedDB.Count; } else { @@ -453,7 +442,6 @@ sitesToSearchArray = (string[])sitesToSearch.ToArray(typeof(string)); m_EventStopThread.Reset(); - m_EventThreadStopped.Reset(); bgWorkerSearch.RunWorkerAsync(); @@ -479,16 +467,8 @@ string capArtist = LyricUtil.capatalizeString(m_artist); string capTitle = LyricUtil.capatalizeString(m_track); - if (MyLyricsUtil.isTrackInLyricsDatabase(LyricsDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) - { - LyricsDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, m_LyricText, site)); - } + DatabaseUtil.WriteToLyricsDatabase(MyLyricsSettings.LyricsDB, MyLyricsSettings.LyricsMarkedDB, capArtist, capTitle, lyricStrings, site); - if (MyLyricsUtil.isTrackInLyricsMarkedDatabase(LyricsMarkedDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_MARKED)) - { - LyricsMarkedDB.Remove(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle)); - } - StreamReader sr = File.OpenText(logFullFileName); log = sr.ReadToEnd(); sr.Close(); @@ -512,9 +492,9 @@ string capArtist = LyricUtil.capatalizeString(artist); string capTitle = LyricUtil.capatalizeString(title); - if (m_MarkSongsWhenNoLyricFound && MyLyricsUtil.isTrackInLyricsMarkedDatabase(LyricsMarkedDB ,capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) + if (m_MarkSongsWhenNoLyricFound && DatabaseUtil.IsTrackInLyricsMarkedDatabase(MyLyricsSettings.LyricsMarkedDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) { - LyricsMarkedDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, "", "")); + MyLyricsSettings.LyricsMarkedDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, "", "")); } m_SongsWithMark += 1; @@ -551,9 +531,7 @@ if (lc != null) { lc.StopSearches = true; - // Save databases to disc - SerializeDB(LyricsDB); - SerializeDB(LyricsMarkedDB); + DatabaseUtil.SerializeDBs(); lyricsLibraryUC.updateLyricsTree(); } bgWorkerSearch.CancelAsync(); @@ -677,24 +655,24 @@ string capArtist = LyricUtil.capatalizeString(tag.Artist); string capTitle = LyricUtil.capatalizeString(tag.Title); - if (MyLyricsUtil.isTrackInLyricsDatabase(LyricsDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) + if (DatabaseUtil.IsTrackInLyricsDatabase(MyLyricsSettings.LyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) { - LyricsDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, tag.Lyrics, "Tag")); + MyLyricsSettings.LyricsDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, tag.Lyrics, "Tag")); } - if (MyLyricsUtil.isTrackInLyricsMarkedDatabase(LyricsMarkedDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_MARKED)) + if (DatabaseUtil.IsTrackInLyricsMarkedDatabase(MyLyricsSettings.LyricsMarkedDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_MARKED)) { - LyricsMarkedDB.Remove(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle)); + MyLyricsSettings.LyricsMarkedDB.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)); } } else { - int status = MyLyricsUtil.isTrackInLyricsDatabase(LyricsDB, song.Artist, song.Title); + int status = DatabaseUtil.IsTrackInLyricsDatabase(MyLyricsSettings.LyricsDB, song.Artist, song.Title); bool isTrackInLyricsMarkedDatabase = true; - if (!m_DisregardKnownLyric && status.Equals(MyLyricsUtil.LYRIC_FOUND) - || (!m_DisregardMarkedLyric && ((isTrackInLyricsMarkedDatabase = MyLyricsUtil.isTrackInLyricsMarkedDatabase(LyricsMarkedDB, song.Artist, song.Title).Equals(MyLyricsUtil.LYRIC_MARKED)) || status.Equals(MyLyricsUtil.LYRIC_MARKED))) - || (status.Equals(MyLyricsUtil.LYRIC_NOT_FOUND) && !MyLyricsUtil.isTrackInLyricsMarkedDatabase(LyricsMarkedDB, song.Artist, song.Title).Equals(MyLyricsUtil.LYRIC_MARKED))) + if (!m_DisregardKnownLyric && status.Equals(DatabaseUtil.LYRIC_FOUND) + || (!m_DisregardMarkedLyric && ((isTrackInLyricsMarkedDatabase = DatabaseUtil.IsTrackInLyricsMarkedDatabase(MyLyricsSettings.LyricsMarkedDB, song.Artist, song.Title).Equals(DatabaseUtil.LYRIC_MARKED)) || status.Equals(DatabaseUtil.LYRIC_MARKED))) + || (status.Equals(DatabaseUtil.LYRIC_NOT_FOUND) && !DatabaseUtil.IsTrackInLyricsMarkedDatabase(MyLyricsSettings.LyricsMarkedDB, song.Artist, song.Title).Equals(DatabaseUtil.LYRIC_MARKED))) { songNotKnown = 1; @@ -711,7 +689,7 @@ m_SongsToSearch = lyricConfigInfosQueue.Count; bgWorkerSearch.ReportProgress(songNotKnown); } - else if (status.Equals(MyLyricsUtil.LYRIC_FOUND)) + else if (status.Equals(DatabaseUtil.LYRIC_FOUND)) { m_SongsWithLyric += 1; } @@ -726,7 +704,7 @@ } else { - foreach (KeyValuePair<string, LyricsItem> kvp in LyricsMarkedDB) + foreach (KeyValuePair<string, LyricsItem> kvp in MyLyricsSettings.LyricsMarkedDB) { int songNotKnown = 1; if (++m_SongsNotKnown > m_Limit) @@ -753,7 +731,7 @@ if (lyricConfigInfosQueue.Count > 0) { // start running the lyricController - lc = new LyricsController(this, m_EventStopThread, m_EventThreadStopped, sitesToSearchArray); + lc = new LyricsController(this, m_EventStopThread, sitesToSearchArray, false); lc.NoOfLyricsToSearch = lyricConfigInfosQueue.Count; ThreadStart runLyricController = delegate @@ -839,37 +817,9 @@ m_LyricControllerThread = null; } - internal static void SerializeDB(LyricsDatabase ldb) - { - string path = ""; - if (ldb.Equals(LyricsDB)) - { - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); - } - else if (ldb.Equals(LyricsMarkedDB)) - { - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); - } - - // Create file to save the database to - using (FileStream fs = new FileStream(path, FileMode.Open)) - { - // Create a BinaryFormatter object to perform the serialization - BinaryFormatter bf = new BinaryFormatter(); - - ldb.SetLastModified(); - - // Use the BinaryFormatter object to serialize the database to the file - bf.Serialize(fs, ldb); - - // Close the file - fs.Close(); - } - } - private void DeserializeBothDB() { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); // Open database to read data from FileStream fs = new FileStream(path, FileMode.Open); @@ -878,14 +828,14 @@ BinaryFormatter bf = new BinaryFormatter(); // Use the BinaryFormatter object to deserialize the database - LyricsDB = (LyricsDatabase)bf.Deserialize(fs); + MyLyricsSettings.LyricsDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); // Deserialize LyricsRemainingDatabase - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); fs = new FileStream(path, FileMode.Open); - LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); + MyLyricsSettings.LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); } @@ -937,8 +887,8 @@ { if (tabControl.SelectedIndex == 0) { - if ((MyLyricsSetup_LyricsLibrary.CurrentDB.Equals(LyricsDB) && LyricsDB.Count != lastShownLyricsTitles) - || (MyLyricsSetup_LyricsLibrary.CurrentDB.Equals(LyricsMarkedDB) && LyricsMarkedDB.Count != lastShownMarkedLyricsTitles)) + if ((MyLyricsSetup_LyricsLibrary.CurrentDB.Equals(MyLyricsSettings.LyricsDB) && MyLyricsSettings.LyricsDB.Count != lastShownLyricsTitles) + || (MyLyricsSetup_LyricsLibrary.CurrentDB.Equals(MyLyricsSettings.LyricsMarkedDB) && MyLyricsSettings.LyricsMarkedDB.Count != lastShownMarkedLyricsTitles)) { lyricsLibraryUC.updateLyricsTree(); } @@ -946,8 +896,8 @@ } else { - lastShownLyricsTitles = LyricsDB.Count; - lastShownMarkedLyricsTitles = LyricsMarkedDB.Count; + lastShownLyricsTitles = MyLyricsSettings.LyricsDB.Count; + lastShownMarkedLyricsTitles = MyLyricsSettings.LyricsMarkedDB.Count; } } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-03-20 16:50:17 UTC (rev 199) @@ -37,6 +37,7 @@ this.btResetLyricsDatabase = new System.Windows.Forms.Button(); this.lbResetDatabase = new MediaPortal.UserInterface.Controls.MPLabel(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); + this.btSearchSingle = new MediaPortal.UserInterface.Controls.MPButton(); this.gbLibrary.SuspendLayout(); this.gbResetDatabase.SuspendLayout(); this.SuspendLayout(); @@ -44,10 +45,10 @@ // btSave // this.btSave.Enabled = false; - this.btSave.Location = new System.Drawing.Point(218, 301); + this.btSave.Location = new System.Drawing.Point(224, 303); this.btSave.Name = "btSave"; this.btSave.Size = new System.Drawing.Size(75, 23); - this.btSave.TabIndex = 6; + this.btSave.TabIndex = 7; this.btSave.Text = "&Save"; this.btSave.UseVisualStyleBackColor = true; this.btSave.Click += new System.EventHandler(this.btSave_Click); @@ -83,6 +84,7 @@ // // gbLibrary // + this.gbLibrary.Controls.Add(this.btSearchSingle); this.gbLibrary.Controls.Add(this.lbSource); this.gbLibrary.Controls.Add(this.comboDatabase); this.gbLibrary.Controls.Add(this.lbDatabase); @@ -111,9 +113,9 @@ // lbSource // this.lbSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbSource.Location = new System.Drawing.Point(357, 297); + this.lbSource.Location = new System.Drawing.Point(386, 297); this.lbSource.Name = "lbSource"; - this.lbSource.Size = new System.Drawing.Size(142, 15); + this.lbSource.Size = new System.Drawing.Size(113, 15); this.lbSource.TabIndex = 28; this.lbSource.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -128,7 +130,7 @@ this.comboDatabase.Location = new System.Drawing.Point(85, 15); this.comboDatabase.Name = "comboDatabase"; this.comboDatabase.Size = new System.Drawing.Size(144, 21); - this.comboDatabase.TabIndex = 27; + this.comboDatabase.TabIndex = 1; this.comboDatabase.SelectedIndexChanged += new System.EventHandler(this.comboDatabase_SelectedIndexChanged); // // lbDatabase @@ -156,7 +158,7 @@ this.btImportDirs.Location = new System.Drawing.Point(95, 330); this.btImportDirs.Name = "btImportDirs"; this.btImportDirs.Size = new System.Drawing.Size(75, 23); - this.btImportDirs.TabIndex = 24; + this.btImportDirs.TabIndex = 5; this.btImportDirs.Text = "Import &dirs"; this.btImportDirs.UseVisualStyleBackColor = true; this.btImportDirs.Click += new System.EventHandler(this.btImportDIRS_Click); @@ -178,8 +180,8 @@ this.tbLyrics.Multiline = true; this.tbLyrics.Name = "tbLyrics"; this.tbLyrics.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tbLyrics.Size = new System.Drawing.Size(296, 213); - this.tbLyrics.TabIndex = 5; + this.tbLyrics.Size = new System.Drawing.Size(291, 213); + this.tbLyrics.TabIndex = 6; this.tbLyrics.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tbLyrics_KeyUp); // // lbSongs @@ -232,7 +234,7 @@ this.treeView.Location = new System.Drawing.Point(14, 81); this.treeView.Name = "treeView"; this.treeView.Size = new System.Drawing.Size(200, 213); - this.treeView.TabIndex = 1; + this.treeView.TabIndex = 2; this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); // // gbResetDatabase @@ -283,6 +285,16 @@ "erns [Artist]-[Title].txt and *.lrc will be included to the lyrics database."; this.folderBrowserDialog1.ShowNewFolderButton = false; // + // btSearchSingle + // + this.btSearchSingle.Location = new System.Drawing.Point(224, 330); + this.btSearchSingle.Name = "btSearchSingle"; + this.btSearchSingle.Size = new System.Drawing.Size(75, 23); + this.btSearchSingle.TabIndex = 8; + this.btSearchSingle.Text = "&Find"; + this.btSearchSingle.UseVisualStyleBackColor = true; + this.btSearchSingle.Click += new System.EventHandler(this.btSearchSingle_Click); + // // MyLyricsSetup_LyricsLibrary // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -324,5 +336,6 @@ private System.ComponentModel.IContainer components; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; internal System.Windows.Forms.TreeView treeView; + internal MediaPortal.UserInterface.Controls.MPButton btSearchSingle; } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-20 16:50:17 UTC (rev 199) @@ -144,12 +144,12 @@ { LyricsItem item = new LyricsItem(artist, title, lyrics, site); - if (MyLyricsUtil.isTrackInLyricsDatabase(CurrentDB, artist, title).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) + if (DatabaseUtil.IsTrackInLyricsDatabase(CurrentDB, artist, title).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) { - CurrentDB.Add(MyLyricsUtil.CorrectKeyFormat(artist, title), item); + CurrentDB.Add(DatabaseUtil.CorrectKeyFormat(artist, title), item); AddSong(item); treeView.Update(); - MyLyricsSetup.SerializeDB(CurrentDB); + DatabaseUtil.SerializeDB(CurrentDB); return true; } else @@ -184,8 +184,8 @@ treeView.Update(); // remove title from database - CurrentDB.Remove(MyLyricsUtil.CorrectKeyFormat(artist, title)); - MyLyricsSetup.SerializeDB(CurrentDB); + CurrentDB.Remove(DatabaseUtil.CorrectKeyFormat(artist, title)); + DatabaseUtil.SerializeDB(CurrentDB); } private bool isSelectedLyricALRC() @@ -200,7 +200,7 @@ m_CurrentArtist = artist; m_CurrentTitle = LyricUtil.capatalizeString(title); - string lyricsText = (string)CurrentDB[MyLyricsUtil.CorrectKeyFormat(artist, title)].Lyrics; + string lyricsText = (string)CurrentDB[DatabaseUtil.CorrectKeyFormat(artist, title)].Lyrics; LRC.SimpleLRC lrc = new LRC.SimpleLRC(artist, title, lyricsText); if (lrc.IsValid) @@ -216,13 +216,14 @@ return false; } - internal void updateInfo() + public void updateInfo() { m_CurrentArtist = ""; m_CurrentTitle = ""; tbLyrics.Text = ""; lbTitle.Text = ""; lbSource.Text = ""; + lbLRCTest.Text = ""; tbLyrics.Enabled = false; @@ -237,7 +238,7 @@ m_CurrentArtist = LyricUtil.capatalizeString(artist); m_CurrentTitle = LyricUtil.capatalizeString(title); - LyricsItem item = CurrentDB[MyLyricsUtil.CorrectKeyFormat(m_CurrentArtist, m_CurrentTitle)]; + LyricsItem item = CurrentDB[DatabaseUtil.CorrectKeyFormat(m_CurrentArtist, m_CurrentTitle)]; string lyricsText = item.Lyrics; lyricsText = LyricsEngine.LyricUtil.ReturnEnvironmentNewLine(lyricsText); @@ -289,7 +290,7 @@ private void btSave_Click(object sender, EventArgs e) { - CurrentDB[MyLyricsUtil.CorrectKeyFormat(LyricUtil.capatalizeString(m_CurrentArtist), LyricUtil.capatalizeString(m_CurrentTitle))].Lyrics = tbLyrics.Text; + CurrentDB[DatabaseUtil.CorrectKeyFormat(LyricUtil.capatalizeString(m_CurrentArtist), LyricUtil.capatalizeString(m_CurrentTitle))].Lyrics = tbLyrics.Text; btSave.Enabled = false; } @@ -586,7 +587,7 @@ { resetFields(); currentDBIndex = 0; - CurrentDB = MyLyricsSetup.LyricsDB; + CurrentDB = MyLyricsSettings.LyricsDB; btImportFiles.Enabled = true; btImportDirs.Enabled = true; updateLyricsTree(); @@ -595,7 +596,7 @@ { resetFields(); currentDBIndex = 1; - CurrentDB = MyLyricsSetup.LyricsMarkedDB; + CurrentDB = MyLyricsSettings.LyricsMarkedDB; btImportFiles.Enabled = false; btImportDirs.Enabled = false; updateLyricsTree(); @@ -606,14 +607,14 @@ { if (MessageBox.Show(this, "Are you sure the Lyrics database should be deleted?", "Delete Lyrics database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - string path = MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsDBName; + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); - MyLyricsSetup.LyricsDB = new LyricsDatabase(); - bf.Serialize(fs, MyLyricsSetup.LyricsDB); + MyLyricsSettings.LyricsDB = new LyricsDatabase(); + bf.Serialize(fs, MyLyricsSettings.LyricsDB); fs.Close(); - CurrentDB = MyLyricsSetup.LyricsDB; + CurrentDB = MyLyricsSettings.LyricsDB; comboDatabase.SelectedIndex = 0; updateLyricsTree(); updateInfo(); @@ -625,18 +626,36 @@ { if (MessageBox.Show(this, "Are you sure you want to delete the database with marked titles?", "Delete title database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - string path = MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsMarkedDBName; + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsMarkedDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); - MyLyricsSetup.LyricsMarkedDB = new LyricsDatabase(); - bf.Serialize(fs, MyLyricsSetup.LyricsMarkedDB); + MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); + bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); fs.Close(); - CurrentDB = MyLyricsSetup.LyricsMarkedDB; + CurrentDB = MyLyricsSettings.LyricsMarkedDB; comboDatabase.SelectedIndex = 1; updateLyricsTree(); updateInfo(); } } + + private void btSearchSingle_Click(object sender, EventArgs e) + { + string artist = ""; + string title = ""; + + if (treeView.SelectedNode != null) + { + title = treeView.SelectedNode.Text; + + if (treeView.SelectedNode.Parent != null) + { + artist = treeView.SelectedNode.Parent.Text; + } + } + + MyLyricsSetup_SearchTitleDialog std = new MyLyricsSetup_SearchTitleDialog(this, artist, title); + } } } Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs 2007-03-19 20:32:28 UTC (rev 198) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs 2007-03-20 16:50:17 UTC (rev 199) @@ -39,7 +39,6 @@ // events used to stop worker thread ManualResetEvent m_EventStopThread; - ManualResetEvent m_EventThreadStopped; private int START_XPOS = 0; private int START_YPOS = 450; @@ -66,7 +65,6 @@ // initialize events m_EventStopThread = new ManualResetEvent(false); - m_EventThreadStopped = new ManualResetEvent(false); noOfLyricSites = Setup.NoOfSites(); lyricSiteArray = new LyricSiteTestUC[noOfLyricSites]; @@ -127,7 +125,6 @@ } m_EventStopThread.Reset(); - m_EventThreadStopped.Reset(); ArrayList sites = new ArrayList(); @@ -140,7 +137,7 @@ } } - LyricsController lc = new LyricsController(this, m_EventStopThread, m_EventThreadStopped, (string[])sites.ToArray(typeof(string))); + LyricsController lc = new LyricsController(this, m_EventStopThread, (string[])sites.ToArray(typeof(string)), false); ThreadStart job = delegate { @@ -148,8 +145,6 @@ lc.Run(); }; - lc.GoogleLicenseKey = tbLicenseKey.Text; - m_LyricControllerThread = new Thread(job); m_LyricControllerThread.Start(); } @@ -445,11 +440,9 @@ m_EventStopThread.Reset(); - m_EventThreadStopped.Reset(); + LyricsController lc = new LyricsController(this, m_EventStopThread, Setup.AllSites(), true); - LyricsController lc = new LyricsController(this, m_EventStopThread, m_EventThreadStopped, Setup.AllSites()); - // create worker thread instance ThreadStart job = delegate This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-03-27 19:32:49
|
Revision: 242 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=242&view=rev Author: saamand Date: 2007-03-27 11:44:08 -0700 (Tue, 27 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 17:00:56 UTC (rev 241) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 18:44:08 UTC (rev 242) @@ -46,7 +46,7 @@ <Compile Include="LRC\SimpleLRCTimeAndLineCollection.cs" /> <Compile Include="LyricsDatabase\LyricsDatabase.cs" /> <Compile Include="LyricsDatabase\LyricsItem.cs" /> - <Compile Include="LyricSearch.cs" /> + <Compile Include="LyricsSites\LyricSearch.cs" /> <Compile Include="LyricDiagnostics.cs" /> <Compile Include="LyricsSites\HotLyrics.cs" /> <Compile Include="LyricsSites\EvilLabs.cs" /> Modified: trunk/plugins/MyLyrics/MyLyrics.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-03-29 20:57:47
|
Revision: 258 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=258&view=rev Author: saamand Date: 2007-03-29 13:57:45 -0700 (Thu, 29 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-29 16:15:51 UTC (rev 257) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-29 20:57:45 UTC (rev 258) @@ -125,7 +125,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> <PreBuildEvent> </PreBuildEvent> </PropertyGroup> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-29 16:15:51 UTC (rev 257) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-29 20:57:45 UTC (rev 258) @@ -30,37 +30,15 @@ public class GUIMyLyrics : GUIWindow, ILyricForm, ISetupForm { - #region Fields that is consisted and related to the MP session, and not MyLyrics session + #region Fields related to the MyLyrics in general + public static int WINDOW_MYLYRICS = 90478; - int m_GoogleLicenseKeyIndex = 0; - const int MAX_NO_OF_LICENSE_KEYS = 5; - string[] m_GoogleLicenseKeys = new String[5] { "", "", "", "", "" }; - int startingScrollSpeedVertical = 2; - const int SHIFT_WHEN_HIT = 10; - #endregion - #region Fields related to the skin engine - [SkinControlAttribute(20)] - //protected GUITextScrollUpControl CONTROL_Lyric = null; - protected GUITextControl CONTROL_Lyric = null; - enum Controls - { - CONTROL_BACKGROUND = 1, - CONTROL_LBTrack = 10, - CONTROL_LBStatus = 11, - CONTROL_Lyric = 20 - } - #endregion + private int selectedScreen = 0; + string lyricsScreenXML = ""; - #region Fields related to the MyLyrics, and therefore will be reset after each MyLyrics session bool exitingMyLyrics = false; - LRC.SimpleLRC lrc; - IEnumerator enumerator; - System.Windows.Forms.Timer timer; - Stopwatch stopwatch; - string nextTimeToShow; - string nextLineToShow; - int lineCounter; + bool firstTime = false; // worker thread Thread m_LyricControllerThread; @@ -81,7 +59,6 @@ String[] m_sitesToSearch; - // Database and log settings internal static LyricsDatabase LyricsDB = null; internal static LyricsDatabase LyricsMarkedDB = null; @@ -91,6 +68,74 @@ #endregion + #region Fields related to one of lyrics modes + + enum LyricGUI_Controls + { + CONTROL_BACKGROUND = 1, + CONTROL_LBTrack = 10, + CONTROL_LBStatus = 11, + CONTROL_Lyric = 20 + } + + #endregion + + #region Fields related to LRC mode + const int SHIFT_WHEN_HIT = 10; + + LRC.SimpleLRC lrc; + IEnumerator enumerator; + System.Windows.Forms.Timer timer; + Stopwatch stopwatch; + string nextTimeToShow; + string nextLineToShow; + int lineCounter; + + #endregion + + #region Fields releated to the editor mode + + internal const int TAG_IN_ROUND = 5; + internal int currentLineToTag = 1; + internal int tagRoundFinished = 0; + internal int min = 0; + internal int sec = 0; + internal int msec = 0; + + string[] lines; + + enum EditorGUI_Controls : int + { + CONTROL_BACKGROUND = 1, + CONTROL_LBTrack = 10, + CONTROL_LBStatus = 11, + + CONTROL_TAGBUTTON = 50, + + CONTROL_TIME = 100, + CONTROL_TIME1 = 101, + CONTROL_TIME2 = 102, + CONTROL_TIME3 = 103, + CONTROL_TIME4 = 104, + CONTROL_TIME5 = 105, + + CONTROL_LINE = 200, + CONTROL_LINE1 = 201, + CONTROL_LINE2 = 202, + CONTROL_LINE3 = 203, + CONTROL_LINE4 = 204, + CONTROL_LINE5 = 205, + + CONTROL_LINE_DONE = 300, + CONTROL_LINE1_DONE = 301, + CONTROL_LINE2_DONE = 302, + CONTROL_LINE3_DONE = 303, + CONTROL_LINE4_DONE = 304, + CONTROL_LINE5_DONE = 305 + } + #endregion + + public GUIMyLyrics() { m_EventStopThread = new ManualResetEvent(false); @@ -101,12 +146,37 @@ public override bool Init() { - string lyricsXML = ""; + int lyricsScreen = 0; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { - lyricsXML = (string)xmlreader.GetValueAsString("myLyrics", "myLyricsXml", "myLyrics.xml"); + lyricsScreen = (int)xmlreader.GetValueAsInt("myLyrics", "myLyricsScreen", (int)MyLyricsSettings.Screen.LYRICS_BASIC); } - return Load(GUIGraphicsContext.Skin + @"\" + lyricsXML); + + switch (lyricsScreen) + { + case (int)MyLyricsSettings.Screen.LYRICS_BASIC: + selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_BASIC; + lyricsScreenXML = "MyLyrics.xml"; + break; + case (int)MyLyricsSettings.Screen.LYRICS_WIDE: + selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_WIDE; + lyricsScreenXML = "MyLyricsWide.xml"; + break; + case (int)MyLyricsSettings.Screen.LRC_BASIC: + selectedScreen = (int)MyLyricsSettings.Screen.LRC_BASIC; + lyricsScreenXML = "MyLyricsLRC.xml"; + break; + case (int)MyLyricsSettings.Screen.LRC_EDITOR: + selectedScreen = (int)MyLyricsSettings.Screen.LRC_EDITOR; + lyricsScreenXML = "MyLyricsEditor.xml"; + break; + default: + selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_BASIC; + lyricsScreenXML = "MyLyrics.xml"; + break; + } + + return Load(GUIGraphicsContext.Skin + @"\" + lyricsScreenXML); } public override void OnAction(Action action) @@ -114,49 +184,21 @@ switch (action.wID) { case Action.ActionType.ACTION_PREVIOUS_MENU: - { - GUIWindowManager.ShowPreviousWindow(); - return; - } - case Action.ActionType.ACTION_KEY_PRESSED: - { - //MessageBox.Show(action.m_key.KeyChar.ToString()); - if (action.m_key != null) - { - - // Check key - //if (((action.m_key.KeyChar >= '0') && (action.m_key.KeyChar <= '9'))) - //{ - // GUIGraphicsContext.ScrollSpeedVertical = action.m_key.KeyChar - 48; - // CONTROL_Lyric.Label = m_LyricText; - // return; - //} - - if (action.m_key.KeyChar == (int)Keys.Enter) - { - if (GUIGraphicsContext.ScrollSpeedVertical == 12) - { - GUIGraphicsContext.ScrollSpeedVertical = 1; - } - else if (GUIGraphicsContext.ScrollSpeedVertical == 1) - { - GUIGraphicsContext.ScrollSpeedVertical = 12; - } - return; - } - - if (action.m_key.KeyChar == (int)Keys.Back) - { - } - } - } - break; + { + GUIWindowManager.ShowPreviousWindow(); + return; + } } base.OnAction(action); } private void resetAll() { + + //deregister the handler! + GUIPropertyManager.OnPropertyChanged -= this.trackChangeHandler; + + firstTime = false; exitingMyLyrics = true; m_artist = ""; m_title = ""; @@ -194,45 +236,195 @@ LoadSettings(); - startingScrollSpeedVertical = GUIGraphicsContext.ScrollSpeedVertical; - GUIGraphicsContext.ScrollSpeedVertical = 1; LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); - //LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens"); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens, screen: " + lyricsScreenXML); return true; } + case GUIMessage.MessageType.GUI_MSG_CLICKED: + { + //get sender control + int iControl = message.SenderControlId; + + if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + if (iControl == (int)EditorGUI_Controls.CONTROL_TAGBUTTON) + { + string time = min.ToString() + ":" + sec.ToString() + "." + stopwatch.ElapsedMilliseconds; + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + currentLineToTag, time); + GUIControl.HideControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + currentLineToTag); + + // If a new round has to start + if (++currentLineToTag == TAG_IN_ROUND + 1) + { + currentLineToTag = 1; + ++tagRoundFinished; + + for (int i = 1; i <= TAG_IN_ROUND; i++) + { + GUIControl.ShowControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i); + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + i, ""); + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + } + } + } + } + return true; + } case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: { - SaveSettings(); StopThread(); resetAll(); - GUIGraphicsContext.ScrollSpeedVertical = startingScrollSpeedVertical; - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics closes"); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics closes, screen: " + lyricsScreenXML); + break; } - break; + } + return base.OnMessage(message); + } - //case GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED: - // { + //event driven handler to detect track change + private void trackChangeHandler(string tag2, string value) + { + if (tag2.Equals("#Play.Current.Track") && !exitingMyLyrics) // track has changed + { + if (!value.Equals("")) // additional check + { + lyricsFound = false; + StopThread(); - // } - // break; + MusicTag tag = new MusicTag(); + tag.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist"); + tag.Title = GUIPropertyManager.GetProperty("#Play.Current.Title"); + + findLyric(tag); + } + else + { + m_artist = ""; + m_title = ""; + m_TrackText = ""; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_StatusText); + m_StatusText = "No music file playing"; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); + m_LyricText = ""; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + } } - return base.OnMessage(message); } + //event driven handler to detect track change + private void timeHandler(string tag2, string value) + { + if (tag2.Equals("#currentplaytime") && !exitingMyLyrics) + { + if (stopwatch != null && stopwatch.IsRunning) + { + stopwatch.Stop(); + } + + stopwatch = new Stopwatch(); + stopwatch.Start(); + + string[] timeStrings = value.Split(':'); + min = int.Parse(timeStrings[0]); + sec = int.Parse(timeStrings[1]); + + if (!value.Equals("")) // additional check + { + lyricsFound = false; + StopThread(); + + MusicTag tag = new MusicTag(); + tag.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist"); + tag.Title = GUIPropertyManager.GetProperty("#Play.Current.Title"); + + findLyric(tag); + } + else + { + m_artist = ""; + m_title = ""; + m_TrackText = ""; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_StatusText); + m_StatusText = "No music file playing"; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); + m_LyricText = ""; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + } + } + } + public override void Process() { + if (firstTime && selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + firstTime = false; + + string artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); + string title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); + + string lyric = ""; + + if (DatabaseUtil.IsTrackInLyricsDatabase(LyricsDB, artist, title).Equals(DatabaseUtil.LYRIC_FOUND)) + { + LyricsItem item = LyricsDB[DatabaseUtil.CorrectKeyFormat(artist, title)]; + lyric = item.Lyrics; + + lines = lyric.Split(new string[1] { "\n" }, StringSplitOptions.None); + + for (int i = tagRoundFinished * TAG_IN_ROUND; i < (tagRoundFinished + 1) * TAG_IN_ROUND; i++) + { + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i, lines[i]); + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE_DONE + i, lines[i]); + } + } + } + else if (firstTime && !exitingMyLyrics) //when mylyrics is opened while music is already playing, trackChangeHandler won't be called + { + lyricsFound = false; + StopThread(); + firstTime = false; + + MusicTag tag = new MusicTag(); + tag.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist"); + tag.Title = GUIPropertyManager.GetProperty("#Play.Current.Title"); + + if (!tag.Artist.Equals("")) findLyric(tag); + else + { + m_artist = ""; + m_title = ""; + m_TrackText = ""; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_StatusText); + m_StatusText = "No music file playing"; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); + m_LyricText = ""; + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + } + } + + + /* if (isNewTrack() && exitingMyLyrics == false) { lyricsFound = false; StopThread(); m_Path = g_Player.CurrentFile; MusicTag tag = MediaPortal.TagReader.TagReader.ReadTag(m_Path); - + + + //quick and dirty CDA support hack :) + if (g_Player.IsCDA) + { + tag = new MusicTag(); + tag.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist"); + tag.Title = GUIPropertyManager.GetProperty("#Play.Current.Title"); + } + if (!m_Path.Equals("")) { - findLyric(tag); + //findLyric(tag); } else { @@ -245,7 +437,9 @@ m_LyricText = ""; GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); } - } + }*/ + + base.Process(); } @@ -256,14 +450,25 @@ void LoadSettings() { + firstTime = true; + // Clear and update labels - GUIControl.ClearControl(GetID, (int)Controls.CONTROL_LBStatus); - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); - GUIControl.ClearControl(GetID, (int)Controls.CONTROL_LBTrack); - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBTrack, m_TrackText); - GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); + if (selectedScreen != (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); + GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_TrackText); + GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_Lyric); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + } + else if(selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); + } + bool useLyricWiki, useEvilLabs, useLyrics007, useLyricsOnDemand, useSeekLyrics, useHotLyrics; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) @@ -315,6 +520,7 @@ fs = new FileStream(path, FileMode.Open); LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); + } void SaveSettings() @@ -330,17 +536,17 @@ { m_EventStopThread.Reset(); - GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, ""); + GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_Lyric); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, ""); if (tag != null && tag.Artist != "") { m_artist = tag.Artist.Trim(); m_title = tag.Title.Trim(); m_TrackText = m_artist + " - " + m_title; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBTrack, m_TrackText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_TrackText); m_StatusText = "Searching for a matching lyric. Please wait a moment..."; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "findLyric(" + m_artist + ", " + m_title + ")"); @@ -362,7 +568,7 @@ resetLrcFields(); m_StatusText = ""; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); if (lrc == null) { @@ -386,8 +592,8 @@ { m_StatusText = ""; m_LyricText = ""; - GUIControl.ClearControl(GetID, (int)Controls.CONTROL_LBStatus); - GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); + GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus); + GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_Lyric); // setup timer and stopwatch timer = new System.Windows.Forms.Timer(); @@ -438,9 +644,9 @@ else { m_TrackText = ""; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBTrack, m_StatusText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_StatusText); m_StatusText = "The music tag isn't complete"; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); return; } } @@ -452,10 +658,10 @@ { lineCounter = 0; m_LyricText = ""; - GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); + GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_Lyric); } m_LyricText += (nextLineToShow); - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); calculateNextInterval(); } @@ -467,7 +673,7 @@ while (currentLine.Time == 0) { m_LyricText += (currentLine.Line); - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); ++lineCounter; enumerator.MoveNext(); @@ -477,7 +683,7 @@ nextTimeToShow = currentLine.TimeString; nextLineToShow = currentLine.Line; //MessageBox.Show(g_Player.CurrentPosition.ToString()); - int temp = (int)(currentLine.Time - (int)(g_Player.CurrentPosition*1000)); + int temp = (int)(currentLine.Time - (int)(g_Player.CurrentPosition * 1000)); if (temp > 0) { timer.Interval = temp; @@ -487,7 +693,7 @@ //MessageBox.Show("temp: " + temp); } -// lbTestSecondsLeft.Text = ((long)(stopwatch.ElapsedMilliseconds / 1000)).ToString(); + // lbTestSecondsLeft.Text = ((long)(stopwatch.ElapsedMilliseconds / 1000)).ToString(); } else { @@ -506,8 +712,9 @@ m_LyricText = lyricText; m_StatusText = ""; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); + + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); } private void SaveLyricToDatabase(string site) @@ -567,7 +774,7 @@ string line1 = (string)value[0]; string line2 = (string)value[1]; m_StatusText = line1 + "\r\n" + line2; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); } } @@ -619,7 +826,7 @@ { LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Search terminates: No lyric found..."); m_StatusText = "No lyric found"; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); + GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); } } } @@ -715,4 +922,4 @@ #endregion } -} +} \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-03-29 16:15:51 UTC (rev 257) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-03-29 20:57:45 UTC (rev 258) @@ -5,7 +5,7 @@ <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{BBB2DAE2-0D83-4B4B-85B6-D1B5A7E10039}</ProjectGuid> - <OutputType>WinExe</OutputType> + <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MyLyrics</RootNamespace> <AssemblyName>MyLyrics</AssemblyName> @@ -131,6 +131,6 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal\plugins\windows"</PostBuildEvent> + <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal\plugins\windows"</PostBuildEvent> </PropertyGroup> </Project> \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs 2007-03-29 16:15:51 UTC (rev 257) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs 2007-03-29 20:57:45 UTC (rev 258) @@ -6,6 +6,15 @@ { class MyLyricsSettings { + + internal enum Screen : int + { + LYRICS_BASIC = 0, + LYRICS_WIDE = 1, + LRC_BASIC = 2, + LRC_EDITOR = 3 + } + // Database settings internal static LyricsDatabase LyricsDB = null; internal static LyricsDatabase LyricsMarkedDB = null; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-29 16:15:51 UTC (rev 257) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-29 20:57:45 UTC (rev 258) @@ -32,6 +32,8 @@ this.tabPageLyricsDatabase = new MediaPortal.UserInterface.Controls.MPTabPage(); this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); this.mpGroupBox2 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.comboLyricsPage = new MediaPortal.UserInterface.Controls.MPComboBox(); + this.lbLyricsPage = new MediaPortal.UserInterface.Controls.MPLabel(); this.tbPluginName = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbPluginName = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); @@ -94,8 +96,6 @@ this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); - this.lbLyricsPage = new MediaPortal.UserInterface.Controls.MPLabel(); - this.comboLyricsPage = new MediaPortal.UserInterface.Controls.MPComboBox(); this.tabControl.SuspendLayout(); this.tabPageSetup.SuspendLayout(); this.mpGroupBox2.SuspendLayout(); @@ -160,6 +160,30 @@ this.mpGroupBox2.TabStop = false; this.mpGroupBox2.Text = "Basic settings"; // + // comboLyricsPage + // + this.comboLyricsPage.BorderColor = System.Drawing.Color.Empty; + this.comboLyricsPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboLyricsPage.FormattingEnabled = true; + this.comboLyricsPage.Items.AddRange(new object[] { + "Lyrics page (basic)", + "Lyrics page (wide)", + "LRC page (basic)", + "LRC page (editor)"}); + this.comboLyricsPage.Location = new System.Drawing.Point(96, 58); + this.comboLyricsPage.Name = "comboLyricsPage"; + this.comboLyricsPage.Size = new System.Drawing.Size(144, 21); + this.comboLyricsPage.TabIndex = 16; + // + // lbLyricsPage + // + this.lbLyricsPage.AutoSize = true; + this.lbLyricsPage.Location = new System.Drawing.Point(13, 61); + this.lbLyricsPage.Name = "lbLyricsPage"; + this.lbLyricsPage.Size = new System.Drawing.Size(64, 13); + this.lbLyricsPage.TabIndex = 15; + this.lbLyricsPage.Text = "Lyrics page:"; + // // tbPluginName // this.tbPluginName.BorderColor = System.Drawing.Color.Empty; @@ -821,29 +845,6 @@ this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); // - // lbLyricsPage - // - this.lbLyricsPage.AutoSize = true; - this.lbLyricsPage.Location = new System.Drawing.Point(13, 61); - this.lbLyricsPage.Name = "lbLyricsPage"; - this.lbLyricsPage.Size = new System.Drawing.Size(64, 13); - this.lbLyricsPage.TabIndex = 15; - this.lbLyricsPage.Text = "Lyrics page:"; - // - // comboLyricsPage - // - this.comboLyricsPage.BorderColor = System.Drawing.Color.Empty; - this.comboLyricsPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboLyricsPage.FormattingEnabled = true; - this.comboLyricsPage.Items.AddRange(new object[] { - "Basic lyrics page", - "Wide lyrics page", - "LRC creation page"}); - this.comboLyricsPage.Location = new System.Drawing.Point(96, 58); - this.comboLyricsPage.Name = "comboLyricsPage"; - this.comboLyricsPage.Size = new System.Drawing.Size(144, 21); - this.comboLyricsPage.TabIndex = 16; - // // MyLyricsSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-29 16:15:51 UTC (rev 257) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-29 20:57:45 UTC (rev 258) @@ -132,21 +132,9 @@ { tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString()); tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics"); - - string xmlPage = xmlreader.GetValueAsString("myLyrics", "myLyricsXml", "myLyrics.xml"); - if (xmlPage.Equals("myLyrics.xml")) - { - comboLyricsPage.SelectedIndex = 0; - } - else if (xmlPage.Equals("myLyricsWide.xml")) - { - comboLyricsPage.SelectedIndex = 1; - } - else if (xmlPage.Equals("myLyricsEditor.xml")) - { - comboLyricsPage.SelectedIndex = 2; - } + int xmlScreen = xmlreader.GetValueAsInt("myLyrics", "myLyricsScreen", (int)MyLyricsSettings.Screen.LYRICS_BASIC); + comboLyricsPage.SelectedIndex = xmlScreen; lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)"); @@ -332,21 +320,8 @@ xmlwriter.SetValue("myLyrics", "useSeekLyrics", cbSeekLyrics.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useHotLyrics", cbHotLyrics.Checked.ToString()); - string xmlPage = ""; - if (comboLyricsPage.SelectedIndex == 0) - { - xmlPage = "myLyrics.xml"; - } - else if (comboLyricsPage.SelectedIndex == 1) - { - xmlPage = "myLyricsWide.xml"; - } - else if (comboLyricsPage.SelectedIndex == 2) - { - xmlPage = "myLyricsEditor.xml"; - } - - xmlwriter.SetValue("myLyrics", "myLyricsXml", xmlPage); + int xmlScreen = comboLyricsPage.SelectedIndex; + xmlwriter.SetValue("myLyrics", "myLyricsScreen", xmlScreen); } } Modified: trunk/plugins/MyLyrics/MyLyrics.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-04-14 14:28:18
|
Revision: 328 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=328&view=rev Author: saamand Date: 2007-04-14 07:28:15 -0700 (Sat, 14 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-14 04:44:03 UTC (rev 327) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-14 14:28:15 UTC (rev 328) @@ -7,6 +7,8 @@ using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Text; +using System.Collections.Generic; +using System.Timers; using LyricsEngine; using LyricsEngineConfig; @@ -18,6 +20,8 @@ using MediaPortal.Music.Database; using MediaPortal.Playlists; using MediaPortal.Util; +using MediaPortal.GUI.Music; + using System.Collections; namespace MyLyrics @@ -40,6 +44,19 @@ bool newTrack = false; bool alreadyValidLRC = false; + private string CurrentThumbFileName = string.Empty; + private MusicTag PreviousTrackTag = null; + private MusicTag CurrentTrackTag = null; + private MusicTag NextTrackTag = null; + private bool UseID3 = false; + private List<String> ImagePathContainer = null; + private System.Timers.Timer ImageChangeTimer = null; + private object _imageMutex = null; + private string CurrentTrackFileName = string.Empty; + private string NextTrackFileName = string.Empty; + private PlayListPlayer PlaylistPlayer = null; + + // worker thread Thread m_LyricControllerThread; LyricsController lc; @@ -99,6 +116,12 @@ CONTROL_VIEW_LINE = 400, CONTROL_VIEW_LINE_DONE = 500 } + + [SkinControlAttribute((int)GUI_LRC_Controls.CONTROL_ART_ALBUMART)] + protected GUIImage GUIelement_ImgCoverArt = null; + [SkinControlAttribute((int)GUI_LRC_Controls.CONTROL_ART_PROGRESS)] + protected GUIProgressControl GUIelement_ProgTrack = null; + #endregion #region Fields related to LRC mode @@ -110,6 +133,7 @@ Stopwatch stopwatch; string nextTimeToShow; string nextLineToShow; + bool shiftPageNextTime = false; #endregion @@ -132,6 +156,10 @@ { m_EventStopThread = new ManualResetEvent(false); + ImagePathContainer = new List<string>(); + _imageMutex = new Object(); + PlaylistPlayer = PlayListPlayer.SingletonPlayer; + GetID = (int)GUIMyLyrics.WINDOW_MYLYRICS; } @@ -175,22 +203,23 @@ { alreadyValidLRC = false; + CurrentTrackTag = new MusicTag(); + CurrentTrackTag.Artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); + CurrentTrackTag.Title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); + if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC || selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) { lyricsFound = false; StopThread(); newTrack = false; - MusicTag tag = new MusicTag(); - tag.Artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); - tag.Title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); - m_artist = tag.Artist; - m_title = tag.Title; + m_artist = CurrentTrackTag.Artist; + m_title = CurrentTrackTag.Title; // Get lyric - if (!tag.Artist.Equals("")) + if (!CurrentTrackTag.Artist.Equals("")) { - findLyric(tag); + findLyric(); } else { @@ -202,6 +231,8 @@ m_LyricText = ""; GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); } + + getAlbumArt(); } else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) { @@ -223,23 +254,60 @@ } else if (!exitingMyLyrics) { + getAlbumArt(); startSearch(); } } base.Process(); } + public void getAlbumArt() + { + ImagePathContainer.Clear(); + CurrentTrackFileName = g_Player.CurrentFile; + GetTrackTags(); + + CurrentThumbFileName = GUIMusicFiles.GetCoverArt(false, CurrentTrackFileName, CurrentTrackTag); + if (CurrentThumbFileName.Length > 0) + { + // let us test if there is a larger cover art image + string strLarge = MediaPortal.Util.Utils.ConvertToLargeCoverArt(CurrentThumbFileName); + if (System.IO.File.Exists(strLarge)) + CurrentThumbFileName = strLarge; + AddImageToImagePathContainer(CurrentThumbFileName); + } + + CurrentThumbFileName = GUIMusicFiles.GetArtistCoverArtName(CurrentTrackTag.Artist); + if (CurrentThumbFileName.Length > 0) + { + // let us test if there is a larger cover art image + string strLarge = MediaPortal.Util.Utils.ConvertToLargeCoverArt(CurrentThumbFileName); + if (System.IO.File.Exists(strLarge)) + CurrentThumbFileName = strLarge; + AddImageToImagePathContainer(CurrentThumbFileName); + } + + UpdateImagePathContainer(); + } + + private void UpdateTrackPosition() + { + double trackDuration = g_Player.Duration; + double curTrackPostion = g_Player.CurrentPosition; + + int progPrecent = (int)(curTrackPostion / trackDuration * 100d); + + this.GUIelement_ProgTrack.Percentage = progPrecent; + GUIelement_ProgTrack.Visible = GUIelement_ProgTrack.Percentage > 0; + } + private void startSearch() { lyricsFound = false; StopThread(); newTrack = false; - MusicTag tag = new MusicTag(); - tag.Artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); - tag.Title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); - - if (!tag.Artist.Equals("")) findLyric(tag); + if (!CurrentTrackTag.Artist.Equals("")) findLyric(); else { m_artist = ""; @@ -287,6 +355,7 @@ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { + UseID3 = xmlreader.GetValueAsBool("musicfiles", "showid3", true); useLyricWiki = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; useEvilLabs = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false; useLyrics007 = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false; @@ -367,7 +436,66 @@ return base.OnMessage(message); } + protected override void OnPageLoad() + { + base.OnPageLoad(); + if (ImageChangeTimer == null) + { + ImageChangeTimer = new System.Timers.Timer(); + ImageChangeTimer.Interval = 3600 * 1000; + ImageChangeTimer.Elapsed += new ElapsedEventHandler(OnImageTimerTickEvent); + ImageChangeTimer.Start(); + } + + //if (g_Player.Playing) + //{ + // g_Player_PlayBackStarted(g_Player.MediaType.Music, g_Player.CurrentFile); + + // SetVisualizationWindow(); + //} + } + + private void OnImageTimerTickEvent(object trash_, ElapsedEventArgs args_) + { + FlipPictures(); + } + + private void FlipPictures() + { + //// Check if we should let the visualization window handle image flipping + //if (_usingBassEngine && _showVisualization) + // return; + + if (GUIelement_ImgCoverArt != null) + { + GUIelement_ImgCoverArt.FreeResources(); + if (ImagePathContainer.Count > 0) + { + if (ImagePathContainer.Count > 1) + { + int currentImage = 0; + // get the next image + foreach (string image in ImagePathContainer) + { + currentImage++; + if (GUIelement_ImgCoverArt.FileName == image) + break; + } + if (currentImage < ImagePathContainer.Count) + GUIelement_ImgCoverArt.SetFileName(ImagePathContainer[currentImage]); + else + // start loop again + GUIelement_ImgCoverArt.SetFileName(ImagePathContainer[0]); + } + else + GUIelement_ImgCoverArt.SetFileName(ImagePathContainer[0]); + } + GUIelement_ImgCoverArt.AllocResources(); + } + } + + public override void OnAction(Action action) { switch (action.wID) @@ -430,8 +558,235 @@ GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); } } + else if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_BASIC || selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC) + { + UpdateTrackPosition(); + } } + private void GetTrackTags() + { + bool isCurSongCdTrack = IsCdTrack(CurrentTrackFileName); + bool isNextSongCdTrack = IsCdTrack(NextTrackFileName); + MusicDatabase dbs = new MusicDatabase(); + + if (CurrentTrackTag != null) + PreviousTrackTag = CurrentTrackTag; + + if (!isCurSongCdTrack) + CurrentTrackTag = GetTrackTag(dbs, CurrentTrackFileName, UseID3); + + if (!isNextSongCdTrack) + NextTrackTag = GetTrackTag(dbs, NextTrackFileName, UseID3); + + if (isCurSongCdTrack || isNextSongCdTrack) + { + PlayList curPlaylist = PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC); + + int iCurItemIndex = PlaylistPlayer.CurrentSong; + PlayListItem curPlaylistItem = curPlaylist[iCurItemIndex]; + + if (curPlaylistItem == null) + { + CurrentTrackTag = null; + NextTrackTag = null; + return; + } + + int playListItemCount = curPlaylist.Count; + int nextItemIndex = 0; + + if (iCurItemIndex < playListItemCount - 1) + nextItemIndex = iCurItemIndex + 1; + + PlayListItem nextPlaylistItem = curPlaylist[nextItemIndex]; + + if (isCurSongCdTrack) + CurrentTrackTag = (MusicTag)curPlaylistItem.MusicTag; + + if (isNextSongCdTrack && nextPlaylistItem != null) + NextTrackTag = (MusicTag)nextPlaylistItem.MusicTag; + + // There's no MusicTag info in the Playlist so check is we have a valid + // GUIMusicFiles.MusicCD object + if ((CurrentTrackTag == null || NextTrackTag == null) && GUIMusicFiles.MusicCD != null) + { + int curCDTrackNum = GetCDATrackNumber(CurrentTrackFileName); + int nextCDTrackNum = GetCDATrackNumber(NextTrackFileName); + + if (curCDTrackNum < GUIMusicFiles.MusicCD.Tracks.Length) + { + MediaPortal.Freedb.CDTrackDetail curTrack = GUIMusicFiles.MusicCD.getTrack(curCDTrackNum); + CurrentTrackTag = GetTrackTag(curTrack); + } + if (nextCDTrackNum < GUIMusicFiles.MusicCD.Tracks.Length) + { + MediaPortal.Freedb.CDTrackDetail nextTrack = GUIMusicFiles.MusicCD.getTrack(nextCDTrackNum); + NextTrackTag = GetTrackTag(nextTrack); + } + } + } + } + + private bool IsCdTrack(string fileName) + { + return System.IO.Path.GetExtension(CurrentTrackFileName).ToLower() == ".cda"; + } + + int GetCDATrackNumber(string strFile) + { + string strTrack = string.Empty; + int pos = strFile.IndexOf(".cda"); + if (pos >= 0) + { + pos--; + while (Char.IsDigit(strFile[pos]) && pos > 0) + { + strTrack = strFile[pos] + strTrack; + pos--; + } + } + + try + { + int iTrack = Convert.ToInt32(strTrack); + return iTrack; + } + catch (Exception) + { + } + + return 1; + } + + private MusicTag GetTrackTag(MediaPortal.Freedb.CDTrackDetail cdTrack) + { + if (GUIMusicFiles.MusicCD == null) + return null; + MusicTag tag = new MusicTag(); + tag.Artist = GUIMusicFiles.MusicCD.Artist; + tag.Album = GUIMusicFiles.MusicCD.Title; + tag.Genre = GUIMusicFiles.MusicCD.Genre; + tag.Year = GUIMusicFiles.MusicCD.Year; + tag.Duration = cdTrack.Duration; + tag.Title = cdTrack.Title; + return tag; + } + + private MusicTag GetTrackTag(MusicDatabase dbs, string strFile, bool useID3) + { + MusicTag tag = null; + Song song = new Song(); + bool bFound = dbs.GetSongByFileName(strFile, ref song); + if (!bFound) + { + if (useID3) + tag = TagReader.ReadTag(strFile); + } + else + { + tag = new MusicTag(); + tag = BuildMusicTagFromSong(song); + } + return tag; + } + + private MusicTag BuildMusicTagFromSong(Song Song_) + { + MusicTag tmpTag = new MusicTag(); + + tmpTag.Title = Song_.Title; + tmpTag.Album = Song_.Album; + tmpTag.Artist = Song_.Artist; + tmpTag.Duration = Song_.Duration; + tmpTag.Genre = Song_.Genre; + tmpTag.Track = Song_.Track; + tmpTag.Year = Song_.Year; + tmpTag.Rating = Song_.Rating; + + return tmpTag; + } + + + private void UpdateImagePathContainer() + { + if (ImagePathContainer.Count <= 0) + { + try + { + GUIelement_ImgCoverArt.SetFileName(GUIGraphicsContext.Skin + @"\media\missing_coverart.png"); + } + catch (Exception ex) + { + Log.Debug("GUIMusicPlayingNow: could not set default image - {0}", ex.Message); + } + } + + if (g_Player.Duration > 0 && ImagePathContainer.Count > 1) + // ImageChangeTimer.Interval = (g_Player.Duration * 1000) / (ImagePathContainer.Count * 8); // change each cover 8x + ImageChangeTimer.Interval = 15 * 1000; // change covers every 15 seconds + else + ImageChangeTimer.Interval = 3600 * 1000; + + ImageChangeTimer.Stop(); + ImageChangeTimer.Start(); + } + + private bool AddImageToImagePathContainer(string newImage) + { + lock (_imageMutex) + { + string ImagePath = Convert.ToString(newImage); + if (ImagePath.IndexOf(@"missing_coverart") > 0)// && (ImagePathContainer.Count > 0)) + { + Log.Debug("GUIMusicPlayingNow: Found placeholder - not inserting image {0}", ImagePath); + return false; + } + + bool success = false; + if (ImagePathContainer != null) + { + if (ImagePathContainer.Contains(ImagePath)) + return false; + + //// check for placeholder + //int indexDel = 0; + //bool found = false; + //foreach (string pic in ImagePathContainer) + //{ + // indexDel++; + // if (pic.IndexOf("missing_coverart.png") > 0) + // { + // found = true; + // break; + // } + //} + //if (found) + // ImagePathContainer.RemoveAt(indexDel - 1); + + if (System.IO.File.Exists(ImagePath)) + { + try + { + Log.Debug("GUIMusicPlayingNow: adding image to container - {0}", ImagePath); + ImagePathContainer.Add(ImagePath); + success = true; + } + catch (Exception ex) + { + Log.Error("GUIMusicPlayingNow: error adding image ({0}) - {1}", ImagePath, ex.Message); + } + + // display the first pic automatically + if (ImagePathContainer.Count == 1) + FlipPictures(); + } + } + + return success; + } + } + //event driven handler to detect track change private void timeHandler(string tag2, string value) { @@ -456,17 +811,17 @@ /// </summary> /// <param name="tag"></param> - private void findLyric(MusicTag tag) + private void findLyric() { m_EventStopThread.Reset(); GUIControl.ClearControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, ""); - if (tag != null && tag.Artist != "") + if (CurrentTrackTag != null && CurrentTrackTag.Artist != "") { - m_artist = tag.Artist.Trim(); - m_title = tag.Title.Trim(); + m_artist = CurrentTrackTag.Artist.Trim(); + m_title = CurrentTrackTag.Title.Trim(); m_TrackText = m_artist + " - " + m_title; m_StatusText = "Searching for a matching lyric..."; GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); @@ -484,7 +839,7 @@ // 1) + 2) Check if LRC in music tag or Database string lyricText = MyLyrics.DatabaseUtil.LookUpLyricInDatabase(LyricsDB, m_artist, m_title); - if ((!tag.Lyrics.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, tag.Lyrics)).IsValid) + if ((!CurrentTrackTag.Lyrics.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, CurrentTrackTag.Lyrics)).IsValid) || (!lyricText.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, lyricText)).IsValid)) { resetLrcFields(); @@ -546,9 +901,9 @@ } // 2) Lyric in music tag - else if (!tag.Lyrics.Equals("")) + else if (!CurrentTrackTag.Lyrics.Equals("")) { - ShowLyricOnScreen(tag.Lyrics, tag.FileName); + ShowLyricOnScreen(CurrentTrackTag.Lyrics, CurrentTrackTag.FileName); } // 3) if lyric in music database @@ -604,6 +959,14 @@ currentLRCLine = 0; ++tagRoundFinished; + + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + i, ""); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + i, ""); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE_DONE + i, ""); + } + try { for (int i = 0; i < TAG_IN_ROUND && LRCLinesTotal + i < lines.Length; i++) @@ -619,7 +982,15 @@ } else { - MessageBox.Show("The lyric has now completely been converted into a lrc!"); + GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow( + (int)GUIWindow.Window.WINDOW_DIALOG_OK); + dlg.SetHeading("Creating of LRC"); + dlg.SetLine(1, "The lyric has been converted"); + dlg.SetLine(2, "to a LRC!"); + dlg.SetLine(3, String.Empty); + dlg.DoModal(GUIWindowManager.ActiveWindow); + + StringBuilder lyric = new StringBuilder(); for (int i = 0; i < lines.Length; i++) { @@ -651,6 +1022,22 @@ public void OnTimerEvent(object source, EventArgs e) { + if (shiftPageNextTime) + { + try + { + resetGUI(selectedScreen); + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + } + } + catch { ;}; + } + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + currentLRCLine); GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + currentLRCLine); @@ -663,18 +1050,7 @@ currentLRCLine = 0; ++tagRoundFinished; - try - { - resetGUI(selectedScreen); - for (int i = 0; i < TAG_IN_ROUND; i++) - { - GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i); - GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); - GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); - GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); - } - } - catch {;}; + shiftPageNextTime = true; } } @@ -838,6 +1214,7 @@ private void resetGUI(int screenID) { selectedScreen = screenID; + shiftPageNextTime = false; GUIPropertyManager.OnPropertyChanged -= new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); GUIPropertyManager.OnPropertyChanged -= new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); @@ -975,7 +1352,7 @@ GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUMART); GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESS); GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESSIMAGE); - + // LRC controls GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); @@ -1030,6 +1407,7 @@ } } + #region ILyricForm properties public Object[] UpdateString { Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-14 04:44:03 UTC (rev 327) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-14 14:28:15 UTC (rev 328) @@ -59,6 +59,10 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Utils.DLL</HintPath> </Reference> + <Reference Include="WindowPlugins, Version=0.2.2.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Plugins\Windows\WindowPlugins.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="Convert\ConvertFromXMLtoLyricsDatabase.cs" /> Modified: trunk/plugins/MyLyrics/MyLyrics.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-04-15 14:09:45
|
Revision: 330 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=330&view=rev Author: saamand Date: 2007-04-15 07:09:40 -0700 (Sun, 15 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -121,7 +121,6 @@ sr = new StreamReader(reply); string line = ""; - int noOfLinesCount = 0; while (line.IndexOf("GOOGLE END") == -1) { Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -26,7 +26,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.18")] +[assembly: AssemblyVersion("0.19")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -38,6 +38,7 @@ public static int WINDOW_MYLYRICS = 90478; private int selectedScreen = 0; + private Nullable<bool> basicScreenSelected = null; string lyricsScreenXML = "MyLyrics.xml"; bool exitingMyLyrics = false; @@ -88,12 +89,14 @@ enum GUI_General_Controls { CONTROL_BACKGROUND = 1, + CONTROL_TITLE = 2, CONTROL_LBStatus = 11 } enum GUI_Lyrics_Controls { - CONTROL_Lyric = 20 + CONTROL_Lyric = 20, + CONTROL_LyricWide = 21 } enum GUI_LRC_Controls : int @@ -126,7 +129,7 @@ #region Fields related to LRC mode - internal const int BASIC_WIDE_LIMIT = 40; + internal const int BASIC_WIDE_LIMIT = 45; LRC.SimpleLRC lrc; IEnumerator enumerator; System.Windows.Forms.Timer timer; @@ -148,7 +151,6 @@ internal int msec = 0; string[] lines; - ArrayList times; #endregion @@ -166,33 +168,8 @@ public override bool Init() { - int lyricsScreen = 0; - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) - { - lyricsScreen = (int)xmlreader.GetValueAsInt("myLyrics", "myLyricsScreen", (int)MyLyricsSettings.Screen.LYRICS_BASIC); - } - - switch (lyricsScreen) - { - case (int)MyLyricsSettings.Screen.LYRICS_BASIC: - selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_BASIC; - break; - case (int)MyLyricsSettings.Screen.LYRICS_WIDE: - selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_WIDE; - break; - case (int)MyLyricsSettings.Screen.LRC_BASIC: - selectedScreen = (int)MyLyricsSettings.Screen.LRC_BASIC; - break; - case (int)MyLyricsSettings.Screen.LRC_EDITOR: - selectedScreen = (int)MyLyricsSettings.Screen.LRC_EDITOR; - break; - default: - selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_BASIC; - break; - } - timer = new System.Windows.Forms.Timer(); - + selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_BASIC; return Load(GUIGraphicsContext.Skin + @"\" + lyricsScreenXML); } @@ -226,10 +203,11 @@ m_artist = ""; m_title = ""; m_TrackText = ""; + m_LyricText = ""; m_StatusText = "No music file playing"; + + resetGUI(selectedScreen); GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); - m_LyricText = ""; - GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); } getAlbumArt(); @@ -313,10 +291,11 @@ m_artist = ""; m_title = ""; m_TrackText = ""; + m_LyricText = ""; m_StatusText = "No music file playing"; + + resetGUI(selectedScreen); GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); - m_LyricText = ""; - GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); } } @@ -422,14 +401,14 @@ LoadSettings(); LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens, screen: " + lyricsScreenXML); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens."); return true; } case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: { StopThread(); resetAll(); - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics closes, screen: " + lyricsScreenXML); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics closes."); break; } } @@ -511,7 +490,7 @@ { tagLine(); } - if (action.m_key.KeyChar.Equals(40)) + else if (action.m_key.KeyChar.Equals(40) || action.m_key.KeyChar.Equals(101)) { lyricsFound = false; if (selectedScreen != (int)MyLyricsSettings.Screen.LRC_EDITOR) @@ -528,6 +507,31 @@ newTrack = true; Process(); } + else if (action.m_key.KeyChar.Equals(35) || action.m_key.KeyChar.Equals(119)) + { + if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_BASIC) + { + basicScreenSelected = false; + resetGUI((int)MyLyricsSettings.Screen.LYRICS_WIDE); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide, m_LyricText); + } + else if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_WIDE) + { + basicScreenSelected = true; + resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); + } + else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC) + { + basicScreenSelected = false; + findLyric(); + } + else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) + { + basicScreenSelected = true; + findLyric(); + } + } break; } } @@ -541,6 +545,7 @@ { if (!value.Equals("")) // additional check { + basicScreenSelected = null; resetGUI(selectedScreen); StopThread(); resetAll(); @@ -552,10 +557,11 @@ m_artist = ""; m_title = ""; m_TrackText = ""; + m_LyricText = ""; m_StatusText = "No music file playing"; + + resetGUI(selectedScreen); GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); - m_LyricText = ""; - GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); } } else if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_BASIC || selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC) @@ -817,6 +823,8 @@ GUIControl.ClearControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, ""); + GUIControl.ClearControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide, ""); if (CurrentTrackTag != null && CurrentTrackTag.Artist != "") { @@ -857,13 +865,27 @@ } } - if (aLongLinePresent) + if (basicScreenSelected.HasValue) { - resetGUI((int)MyLyricsSettings.Screen.LRC_WIDE); + if (basicScreenSelected.Value) + { + resetGUI((int)MyLyricsSettings.Screen.LRC_BASIC); + } + else + { + resetGUI((int)MyLyricsSettings.Screen.LRC_WIDE); + } } else { - resetGUI((int)MyLyricsSettings.Screen.LRC_BASIC); + if (aLongLinePresent) + { + resetGUI((int)MyLyricsSettings.Screen.LRC_WIDE); + } + else + { + resetGUI((int)MyLyricsSettings.Screen.LRC_BASIC); + } } m_StatusText = ""; @@ -1067,7 +1089,6 @@ while (currentLine.Time == 0) { m_LyricText += (currentLine.Line); - GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); ++currentLRCLine; enumerator.MoveNext(); @@ -1119,8 +1140,18 @@ } else { - resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); - GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); + if (basicScreenSelected.HasValue == false || basicScreenSelected.Value) + { + resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); + } + else + { + resetGUI((int)MyLyricsSettings.Screen.LYRICS_WIDE); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide, m_LyricText); + } + + } } @@ -1208,7 +1239,6 @@ sec = 0; msec = 0; lines = null; - times = null; } private void resetGUI(int screenID) @@ -1223,12 +1253,16 @@ if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_BASIC) { GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); - times = new ArrayList(); + + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_TITLE, "Lyrics basic"); + // Reset general and lyrics controls GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); GUIControl.ShowControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, ""); + GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide, ""); // album art only visible for basic screen GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); @@ -1257,13 +1291,16 @@ else if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_WIDE) { GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); - times = new ArrayList(); + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_TITLE, "Lyrics wide"); + // Reset general and lyrics controls GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); //GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); - GUIControl.ShowControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, ""); + GUIControl.ShowControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide, ""); // album art only visible for lyrics_basic screen GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); @@ -1291,17 +1328,17 @@ else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC) { - if (alreadyValidLRC == false) - { - GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); - GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); - timer.Tick += new System.EventHandler(OnTimerEvent); - } + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); + timer.Tick += new System.EventHandler(OnTimerEvent); + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_TITLE, "LRC basic"); + // Lyrics controls GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); // album art only visible for basic screen GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); @@ -1331,17 +1368,17 @@ else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) { - if (alreadyValidLRC == false) - { - GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); - GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); - timer.Tick += new System.EventHandler(OnTimerEvent); - } + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); + timer.Tick += new System.EventHandler(OnTimerEvent); + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_TITLE, "LRC wide"); + // Lyrics controls GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); // album art only visible for basic screen GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); @@ -1352,7 +1389,7 @@ GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUMART); GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESS); GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESSIMAGE); - + // LRC controls GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); @@ -1374,10 +1411,13 @@ GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_TITLE, "LRC editor"); + // Lyrics controls GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); // album art only visible for lyrics_basic screen GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -78,8 +78,6 @@ this.cbMoveSongFrom = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbAutoFetch = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.mpGroupBox2 = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.comboLyricsPage = new MediaPortal.UserInterface.Controls.MPComboBox(); - this.lbLyricsPage = new MediaPortal.UserInterface.Controls.MPLabel(); this.tbPluginName = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbPluginName = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); @@ -119,8 +117,8 @@ // tabControl // this.tabControl.Controls.Add(this.tabPageLyricsDatabase); - this.tabControl.Controls.Add(this.tabPageDatabase); this.tabControl.Controls.Add(this.tabPageSetup); + this.tabControl.Controls.Add(this.tabPageDatabase); this.tabControl.Location = new System.Drawing.Point(7, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; @@ -587,7 +585,7 @@ this.mpGroupBox3.Controls.Add(this.cbMoveSongFrom); this.mpGroupBox3.Controls.Add(this.cbAutoFetch); this.mpGroupBox3.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.mpGroupBox3.Location = new System.Drawing.Point(5, 109); + this.mpGroupBox3.Location = new System.Drawing.Point(5, 70); this.mpGroupBox3.Name = "mpGroupBox3"; this.mpGroupBox3.Size = new System.Drawing.Size(538, 92); this.mpGroupBox3.TabIndex = 30; @@ -633,41 +631,16 @@ // // mpGroupBox2 // - this.mpGroupBox2.AutoSize = true; - this.mpGroupBox2.Controls.Add(this.comboLyricsPage); - this.mpGroupBox2.Controls.Add(this.lbLyricsPage); this.mpGroupBox2.Controls.Add(this.tbPluginName); this.mpGroupBox2.Controls.Add(this.lbPluginName); this.mpGroupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.mpGroupBox2.Location = new System.Drawing.Point(5, 5); this.mpGroupBox2.Name = "mpGroupBox2"; - this.mpGroupBox2.Size = new System.Drawing.Size(538, 98); + this.mpGroupBox2.Size = new System.Drawing.Size(538, 59); this.mpGroupBox2.TabIndex = 29; this.mpGroupBox2.TabStop = false; this.mpGroupBox2.Text = "Basic settings"; // - // comboLyricsPage - // - this.comboLyricsPage.BorderColor = System.Drawing.Color.Empty; - this.comboLyricsPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboLyricsPage.FormattingEnabled = true; - this.comboLyricsPage.Items.AddRange(new object[] { - "Lyrics screen (view)", - "Lyrics screen (editor)"}); - this.comboLyricsPage.Location = new System.Drawing.Point(96, 58); - this.comboLyricsPage.Name = "comboLyricsPage"; - this.comboLyricsPage.Size = new System.Drawing.Size(144, 21); - this.comboLyricsPage.TabIndex = 16; - // - // lbLyricsPage - // - this.lbLyricsPage.AutoSize = true; - this.lbLyricsPage.Location = new System.Drawing.Point(13, 61); - this.lbLyricsPage.Name = "lbLyricsPage"; - this.lbLyricsPage.Size = new System.Drawing.Size(72, 13); - this.lbLyricsPage.TabIndex = 15; - this.lbLyricsPage.Text = "Lyrics screen:"; - // // tbPluginName // this.tbPluginName.BorderColor = System.Drawing.Color.Empty; @@ -695,7 +668,7 @@ this.gbLyricSites.Controls.Add(this.rbUserDefined); this.gbLyricSites.Controls.Add(this.tbNote); this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbLyricSites.Location = new System.Drawing.Point(5, 207); + this.gbLyricSites.Location = new System.Drawing.Point(5, 168); this.gbLyricSites.Name = "gbLyricSites"; this.gbLyricSites.Size = new System.Drawing.Size(538, 202); this.gbLyricSites.TabIndex = 28; @@ -927,7 +900,6 @@ this.gbProgress.ResumeLayout(false); this.gbMusicDBSearchStats.ResumeLayout(false); this.tabPageSetup.ResumeLayout(false); - this.tabPageSetup.PerformLayout(); this.mpGroupBox3.ResumeLayout(false); this.mpGroupBox3.PerformLayout(); this.mpGroupBox2.ResumeLayout(false); @@ -1011,8 +983,6 @@ private MediaPortal.UserInterface.Controls.MPCheckBox cbDisregardSongsWithNoLyric; private MediaPortal.UserInterface.Controls.MPCheckBox cbMarkSongsWithNoLyrics; private MediaPortal.UserInterface.Controls.MPCheckBox cbDisconsiderTitlesWithLyrics; - private MediaPortal.UserInterface.Controls.MPLabel lbLyricsPage; - private MediaPortal.UserInterface.Controls.MPComboBox comboLyricsPage; private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox3; internal MediaPortal.UserInterface.Controls.MPCheckBox cbAutoFetch; internal MediaPortal.UserInterface.Controls.MPCheckBox cbMoveSongFrom; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -137,9 +137,6 @@ cbAutomaticUpdate.Checked = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false); cbMoveSongFrom.Checked = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true); - int xmlScreen = xmlreader.GetValueAsInt("myLyrics", "myLyricsScreen", (int)MyLyricsSettings.Screen.LYRICS_BASIC); - comboLyricsPage.SelectedIndex = xmlScreen; - lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)"); rdDefault.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useDefaultSitesMode", "True")).ToString().Equals("True") ? true : false; @@ -157,31 +154,6 @@ cbLyricsOnDemand.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false; cbSeekLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false; cbHotLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false; - - //if (Setup.IsMember("LyricWiki") == false) - //{ - // cbLyricWiki.Visible = false; - //} - //if (Setup.IsMember("EvilLabs") == false) - //{ - // cbEvilLabs.Visible = false; - //} - //if (Setup.IsMember("Lyrics007") == false) - //{ - // cbLyrics007.Visible = false; - //} - //if (Setup.IsMember("LyricsOnDemand") == false) - //{ - // cbLyricsOnDemand.Visible = false; - //} - //if (Setup.IsMember("SeekLyrics") == false) - //{ - // cbSeekLyrics.Visible = false; - //} - //if (Setup.IsMember("HotLyrics") == false) - //{ - // cbHotLyrics.Visible = false; - //} } } catch { @@ -326,9 +298,6 @@ xmlwriter.SetValueAsBool("myLyrics", "automaticFetch", cbAutoFetch.Checked); xmlwriter.SetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", cbAutomaticUpdate.Checked); xmlwriter.SetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", cbMoveSongFrom.Checked); - - int xmlScreen = comboLyricsPage.SelectedIndex; - xmlwriter.SetValue("myLyrics", "myLyricsScreen", xmlScreen); } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -345,7 +345,6 @@ private System.Windows.Forms.Label lbLRCTest; private MediaPortal.UserInterface.Controls.MPLabel lbTitle; private MediaPortal.UserInterface.Controls.MPLabel lbSource; - private System.ComponentModel.IContainer components; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; internal System.Windows.Forms.TreeView treeView; internal MediaPortal.UserInterface.Controls.MPButton btSearchSingle; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -42,8 +42,6 @@ private int currentDBIndex = 0; enum TYPEOFLYRICS : int {NONE, NORMAL, LRC}; - static string lastChosenArtist = ""; - static string lastChosenTitle = ""; public MyLyricsSetup_LyricsLibrary(Form form) { Modified: trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.18")] -[assembly: AssemblyFileVersion("0.18")] +[assembly: AssemblyVersion("0.19")] +[assembly: AssemblyFileVersion("0.19")] Modified: trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs 2007-04-15 13:28:10 UTC (rev 329) +++ trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs 2007-04-15 14:09:40 UTC (rev 330) @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("0.18")] -[assembly: AssemblyFileVersion("0.18")] +[assembly: AssemblyVersion("0.19")] +[assembly: AssemblyFileVersion("0.19")] Modified: trunk/plugins/MyLyrics/MyLyrics.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-04-30 21:00:57
|
Revision: 365 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=365&view=rev Author: saamand Date: 2007-04-30 14:00:23 -0700 (Mon, 30 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/MyLyrics.suo Removed Paths: ------------- trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs Deleted: trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs 2007-04-30 20:05:26 UTC (rev 364) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs 2007-04-30 21:00:23 UTC (rev 365) @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -using LyricsEngine; - -namespace MyLyrics -{ - internal class MyLyricsUtil - { - internal const string MARK = "(no lyric attached)"; - - internal const int LYRIC_NOT_FOUND = -1; - internal const int LYRIC_MARKED = 0; - internal const int LYRIC_FOUND = 1; - - internal static int isTrackInLyricsDatabase(LyricsDatabase lyricDB, string artist, string title) - { - string lyricText = ""; - try - { - string capatalizedArtist = LyricUtil.capatalizeString(artist); - string capatalizedTitle = LyricUtil.capatalizeString(title); - - lyricText = lyricDB[CorrectKeyFormat(capatalizedArtist, capatalizedTitle)].Lyrics; - } - catch - { - return LYRIC_NOT_FOUND; - } - - if (lyricText.Equals(MARK)) - { - return LYRIC_MARKED; - } - else - { - return LYRIC_FOUND; - } - } - - internal static int isTrackInLyricsMarkedDatabase(LyricsDatabase lyricMarkedDB, string artist, string title) - { - string lyricsText = ""; - try - { - lyricsText = lyricMarkedDB[MyLyricsUtil.CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; - } - catch{ - return LYRIC_NOT_FOUND; - } - return LYRIC_MARKED; - } - - - public static string LookUpLyricInDatabase(LyricsDatabase lyricDB, string artist, string title) - { - string lyricText = ""; - try - { - lyricText = lyricDB[CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; - return lyricText.Replace("\n", "\r\n"); - } - catch - { - return lyricText; - } - } - - public static string CorrectKeyFormat(string artist, string title) - { - return artist + "-" + title; - } - } -} Modified: trunk/plugins/MyLyrics/MyLyrics.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-05-04 17:23:59
|
Revision: 376 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=376&view=rev Author: saamand Date: 2007-05-04 10:23:57 -0700 (Fri, 04 May 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-05-04 17:08:44 UTC (rev 375) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-05-04 17:23:57 UTC (rev 376) @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Net; using System.Threading; +using System.Timers; namespace LyricsEngine.LyricSites { @@ -12,14 +13,19 @@ { string lyric = ""; bool complete; + System.Timers.Timer timer; + int timeLimit; public string Lyric { get { return lyric; } } - public EvilLabs(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) + public EvilLabs(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { + this.timeLimit = timeLimit; + timer = new System.Timers.Timer(); + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "EvilLabs(" + artist + ", " + title + ")"); artist = LyricUtil.RemoveFeatComment(artist); @@ -32,6 +38,11 @@ WebClient client = new WebClient(); + timer.Enabled = true; + timer.Interval = timeLimit; + timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); + timer.Start(); + Uri uri = new Uri(urlString); client.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); @@ -109,5 +120,12 @@ complete = true; } } + + void timer_Elapsed(object sender, ElapsedEventArgs e) + { + lyric = "Not found"; + complete = true; + Thread.CurrentThread.Abort(); + } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-05-04 17:08:44 UTC (rev 375) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-05-04 17:23:57 UTC (rev 376) @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Net; using System.Threading; +using System.Timers; namespace LyricsEngine.LyricSites { @@ -12,14 +13,19 @@ { string lyric = ""; private bool complete; + System.Timers.Timer timer; + int timeLimit; public string Lyric { get { return lyric; } } - public HotLyrics(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) + public HotLyrics(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { + this.timeLimit = timeLimit; + timer = new System.Timers.Timer(); + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); artist = LyricUtil.RemoveFeatComment(artist); @@ -96,6 +102,11 @@ WebClient client = new WebClient(); + timer.Enabled = true; + timer.Interval = timeLimit; + timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); + timer.Start(); + Uri uri = new Uri(urlString); client.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); @@ -197,8 +208,21 @@ { reply.Close(); } + + if (timer != null) + { + timer.Stop(); + timer.Close(); + } complete = true; } } + + void timer_Elapsed(object sender, ElapsedEventArgs e) + { + lyric = "Not found"; + complete = true; + Thread.CurrentThread.Abort(); + } } } Modified: trunk/plugins/MyLyrics/MyLyrics.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-05-23 16:46:19
|
Revision: 421 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=421&view=rev Author: saamand Date: 2007-05-23 09:45:51 -0700 (Wed, 23 May 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-05-23 16:10:27 UTC (rev 420) +++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-05-23 16:45:51 UTC (rev 421) @@ -126,7 +126,7 @@ public static void SerializeLyricDB() { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); @@ -138,7 +138,7 @@ public static void SerializeLyricMarkedDB() { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-05-23 16:10:27 UTC (rev 420) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-05-23 16:45:51 UTC (rev 421) @@ -354,13 +354,13 @@ // Deserialize lyrics and marked database, and save references in LyricsDB try { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); FileStream fs = new FileStream(path, FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); LyricsDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); fs = new FileStream(path, FileMode.Open); LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); fs.Close(); @@ -391,7 +391,7 @@ LoadSettings(); - LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, logName)); + LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.ElapsedTimeString() + "MyLyrics opens."); return true; } @@ -757,7 +757,7 @@ LyricsItem item = new LyricsItem(artist, title, lyricAsString, "LRC-editor screen"); LyricsDB[DatabaseUtil.CorrectKeyFormat(artist, title)] = item; - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); @@ -868,7 +868,7 @@ { LyricsDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, m_LyricText, site)); - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); @@ -882,7 +882,7 @@ { LyricsMarkedDB.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)); - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, LyricsMarkedDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-05-23 16:10:27 UTC (rev 420) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-05-23 16:45:51 UTC (rev 421) @@ -105,8 +105,8 @@ public MyLyricsSetup() { - LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, MyLyricsSettings.LogName)); - //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log)); + LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, MyLyricsSettings.LogName)); + //LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log)); #region Initialize GUI and class InitializeComponent(); @@ -162,7 +162,7 @@ #endregion #region Serialzie/deserialize lyricsdatabases - string lyricsXMLpath = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Base, MyLyricsSettings.LyricsXMLName); + string lyricsXMLpath = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Base, MyLyricsSettings.LyricsXMLName); FileInfo lyricsXMLfileInfo = new FileInfo(lyricsXMLpath); @@ -170,7 +170,7 @@ if (lyricsXMLfileInfo.Exists) { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); FileInfo fileInfo = new FileInfo(path); // .. but only if it hasn't already been converted @@ -192,7 +192,7 @@ fs.Close(); // Create likewise a database for the remainingLyrics - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); fs = new FileStream(path, FileMode.Create); MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); @@ -212,13 +212,13 @@ // If no Lyrics.xml present in base, then create new serialized databases else { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); FileInfo fileInfo = new FileInfo(path); // .. but only if the databases hasn't been created if (fileInfo.Exists == false) { - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); // Serialize empty LyricsDatabase if no lyrics.xml present FileStream fs = new FileStream(path, FileMode.Create); @@ -228,7 +228,7 @@ fs.Close(); // Serialize empty LyricsMarkedDatabase - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); fs = new FileStream(path, FileMode.Create); MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); @@ -822,7 +822,7 @@ private void DeserializeBothDB() { - string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); // Open database to read data from FileStream fs = new FileStream(path, FileMode.Open); @@ -835,7 +835,7 @@ fs.Close(); // Deserialize LyricsRemainingDatabase - path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); fs = new FileStream(path, FileMode.Open); MyLyricsSettings.LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-05-23 16:10:27 UTC (rev 420) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-05-23 16:45:51 UTC (rev 421) @@ -628,7 +628,7 @@ { if (MessageBox.Show(this, "Are you sure the Lyrics database should be deleted?", "Delete Lyrics database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - string path = MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsDBName; + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); MyLyricsSettings.LyricsDB = new LyricsDatabase(); @@ -647,7 +647,7 @@ { if (MessageBox.Show(this, "Are you sure you want to delete the database with marked titles?", "Delete title database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { - string path = MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsMarkedDBName; + string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsMarkedDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); Modified: trunk/plugins/MyLyrics/MyLyrics.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-11-07 18:51:33
|
Revision: 1035 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1035&view=rev Author: saamand Date: 2007-11-07 10:51:29 -0800 (Wed, 07 Nov 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj Added Paths: ----------- trunk/plugins/MyLyrics/LyricsEngine/bin/ trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/ trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.dll trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.dll.config trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.pdb trunk/plugins/MyLyrics/LyricsEngine/bin/Release/ trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.XmlSerializers.dll trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.dll trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.dll.config trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.pdb trunk/plugins/MyLyrics/LyricsEngine/obj/ trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/ trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.Properties.Resources.resources trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.csproj.GenerateResource.Cache trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.dll trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.pdb trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/Refactor/ trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/Refactor/LyricsEngine.dll trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/TempPE/ trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/TempPE/Web References.org.lyricwiki.Reference.cs.dll trunk/plugins/MyLyrics/LyricsEngine/obj/LyricsEngine.csproj.FileList.txt trunk/plugins/MyLyrics/LyricsEngine/obj/Release/ trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.Properties.Resources.resources trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.XmlSerializers.dll trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.csproj.GenerateResource.Cache trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.dll trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.pdb trunk/plugins/MyLyrics/LyricsEngine/obj/Release/TempPE/ trunk/plugins/MyLyrics/LyricsEngine/obj/Release/TempPE/Properties.Resources.Designer.cs.dll trunk/plugins/MyLyrics/LyricsEngine/obj/Release/TempPE/Web References.org.lyricwiki.Reference.cs.dll trunk/plugins/MyLyrics/MusicDatabaseV8.db3 trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.resx 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/FindLyric.resx trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/Information.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/Information.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/Information.resx trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.resx trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.resx 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 Configuration/MyLyricsSetup_test.cs trunk/plugins/MyLyrics/My Lyrics/bin/ trunk/plugins/MyLyrics/My Lyrics/bin/Debug/ trunk/plugins/MyLyrics/My Lyrics/bin/Debug/AxInterop.WMPLib.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Bass.Net.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/BassRegistration.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/CSScriptLibrary.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Core.DLL trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Databases.DLL trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Dialogs.DLL trunk/plugins/MyLyrics/My Lyrics/bin/Debug/DirectShowLib.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/ICSharpCode.SharpZipLib.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Interop.WMPLib.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/LyricsEngine.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/LyricsEngine.pdb trunk/plugins/MyLyrics/My Lyrics/bin/Debug/MediaPortal.Support.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/MediaPortal.Support.pdb trunk/plugins/MyLyrics/My Lyrics/bin/Debug/MediaPortal.xml trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Microsoft.DirectX.Direct3D.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Microsoft.DirectX.Direct3DX.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Microsoft.DirectX.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/MyLyrics.exe trunk/plugins/MyLyrics/My Lyrics/bin/Debug/MyLyrics.pdb trunk/plugins/MyLyrics/My Lyrics/bin/Debug/MyLyrics.vshost.exe trunk/plugins/MyLyrics/My Lyrics/bin/Debug/Utils.DLL trunk/plugins/MyLyrics/My Lyrics/bin/Debug/WindowPlugins.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/XihSolutions.DotMSN.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/ trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/FolderDatabase3.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/LyricsDatabaseV2.db trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/LyricsMarkedDatabaseV2.db trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/MusicDatabaseV10.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/MusicVideoDatabaseV3.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/PictureDatabase.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/ProgramDatabaseV4.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/RadioDatabase4.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/TVDatabaseV21.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/TVSeriesDatabase4.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/VideoDatabaseV5.db3 trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/convert/ trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/convert/ConvertMusicDBToV10.cmd trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/convert/MusicDBConvertFrom8To10.sql trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/convert/convertv2v3.cmd trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/convert/sqlite.exe trunk/plugins/MyLyrics/My Lyrics/bin/Debug/database/convert/sqlite3.exe trunk/plugins/MyLyrics/My Lyrics/bin/Debug/edtftpnet-1.2.2.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/log/ trunk/plugins/MyLyrics/My Lyrics/bin/Debug/log/MediaPortal.log trunk/plugins/MyLyrics/My Lyrics/bin/Debug/log/MyLyrics.log trunk/plugins/MyLyrics/My Lyrics/bin/Debug/log/MyLyricsBatch.log trunk/plugins/MyLyrics/My Lyrics/bin/Debug/log/error.log trunk/plugins/MyLyrics/My Lyrics/bin/Debug/sqlite.dll trunk/plugins/MyLyrics/My Lyrics/bin/Debug/taglib-sharp.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/ trunk/plugins/MyLyrics/My Lyrics/bin/Release/AxInterop.WMPLib.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/Bass.Net.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/BassRegistration.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/CSScriptLibrary.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/Core.DLL trunk/plugins/MyLyrics/My Lyrics/bin/Release/Databases.DLL trunk/plugins/MyLyrics/My Lyrics/bin/Release/Dialogs.DLL trunk/plugins/MyLyrics/My Lyrics/bin/Release/DirectShowLib.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/ICSharpCode.SharpZipLib.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/Interop.WMPLib.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/LyricsEngine.XmlSerializers.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/LyricsEngine.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/LyricsEngine.pdb trunk/plugins/MyLyrics/My Lyrics/bin/Release/MediaPortal.Support.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/MediaPortal.Support.pdb trunk/plugins/MyLyrics/My Lyrics/bin/Release/Microsoft.DirectX.Direct3D.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/Microsoft.DirectX.Direct3DX.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/Microsoft.DirectX.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/MyLyrics.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/MyLyrics.pdb trunk/plugins/MyLyrics/My Lyrics/bin/Release/Utils.DLL trunk/plugins/MyLyrics/My Lyrics/bin/Release/WindowPlugins.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/XihSolutions.DotMSN.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/edtftpnet-1.2.2.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/sqlite.dll trunk/plugins/MyLyrics/My Lyrics/bin/Release/taglib-sharp.dll trunk/plugins/MyLyrics/My Lyrics/obj/ trunk/plugins/MyLyrics/My Lyrics/obj/Debug/ trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.AddNewSong.resources trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.FindLyric.resources trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.Information.resources trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.LyricsLibrary.resources trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.MusicDatabaseBrowse.resources trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.MyLyricsSetup.resources trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.Properties.Resources.resources trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.csproj.GenerateResource.Cache trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.exe trunk/plugins/MyLyrics/My Lyrics/obj/Debug/MyLyrics.pdb trunk/plugins/MyLyrics/My Lyrics/obj/Debug/Refactor/ trunk/plugins/MyLyrics/My Lyrics/obj/Debug/ResolveAssemblyReference.cache trunk/plugins/MyLyrics/My Lyrics/obj/Debug/TempPE/ trunk/plugins/MyLyrics/My Lyrics/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll trunk/plugins/MyLyrics/My Lyrics/obj/MyLyrics.csproj.FileList.txt trunk/plugins/MyLyrics/My Lyrics/obj/Release/ trunk/plugins/MyLyrics/My Lyrics/obj/Release/MyLyrics.MyLyricsSetup.resources trunk/plugins/MyLyrics/My Lyrics/obj/Release/MyLyrics.MyLyricsSetup_AddNewSong.resources trunk/plugins/MyLyrics/My Lyrics/obj/Release/MyLyrics.MyLyricsSetup_LyricsLibrary.resources trunk/plugins/MyLyrics/My Lyrics/obj/Release/MyLyrics.MyLyricsSetup_SearchTitleDialog.resources trunk/plugins/MyLyrics/My Lyrics/obj/Release/MyLyrics.Properties.Resources.resources trunk/plugins/MyLyrics/My Lyrics/obj/Release/MyLyrics.csproj.GenerateResource.Cache trunk/plugins/MyLyrics/My Lyrics/obj/Release/MyLyrics.dll trunk/plugins/MyLyrics/My Lyrics/obj/Release/MyLyrics.pdb trunk/plugins/MyLyrics/My Lyrics/obj/Release/ResolveAssemblyReference.cache trunk/plugins/MyLyrics/My Lyrics/obj/Release/TempPE/ trunk/plugins/MyLyrics/My Lyrics/obj/Release/TempPE/Properties.Resources.Designer.cs.dll Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-11-07 15:19:19 UTC (rev 1034) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-11-07 18:51:29 UTC (rev 1035) @@ -115,6 +115,12 @@ break; } } + + if (lyric.Contains("API request randomly") || lyric.Contains("Upgrading right")) + { + lyric = string.Empty; + } + return lyric; } } Added: trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.dll.config =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.dll.config (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.dll.config 2007-11-07 18:51:29 UTC (rev 1035) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <configSections> + <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > + <section name="LyricsEngine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </sectionGroup> + </configSections> + <applicationSettings> + <LyricsEngine.Properties.Settings> + <setting name="Google_GoogleSearchService" serializeAs="String"> + <value>http://api.google.com/search/beta2</value> + </setting> + <setting name="LyricsEngine_org_lyricwiki_LyricWiki" serializeAs="String"> + <value>http://lyricwiki.org/server.php</value> + </setting> + <setting name="MyLyrics_Google_GoogleSearchService" serializeAs="String"> + <value>http://api.google.com/search/beta2</value> + </setting> + </LyricsEngine.Properties.Settings> + </applicationSettings> +</configuration> \ No newline at end of file Added: trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/bin/Debug/LyricsEngine.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.XmlSerializers.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.XmlSerializers.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.dll.config =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.dll.config (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.dll.config 2007-11-07 18:51:29 UTC (rev 1035) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <configSections> + <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > + <section name="LyricsEngine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </sectionGroup> + </configSections> + <applicationSettings> + <LyricsEngine.Properties.Settings> + <setting name="Google_GoogleSearchService" serializeAs="String"> + <value>http://api.google.com/search/beta2</value> + </setting> + <setting name="LyricsEngine_org_lyricwiki_LyricWiki" serializeAs="String"> + <value>http://lyricwiki.org/server.php</value> + </setting> + <setting name="MyLyrics_Google_GoogleSearchService" serializeAs="String"> + <value>http://api.google.com/search/beta2</value> + </setting> + </LyricsEngine.Properties.Settings> + </applicationSettings> +</configuration> \ No newline at end of file Added: trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/bin/Release/LyricsEngine.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.Properties.Resources.resources =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.Properties.Resources.resources ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.csproj.GenerateResource.Cache =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.csproj.GenerateResource.Cache ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/LyricsEngine.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/Refactor/LyricsEngine.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/Refactor/LyricsEngine.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/TempPE/Web References.org.lyricwiki.Reference.cs.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Debug/TempPE/Web References.org.lyricwiki.Reference.cs.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/LyricsEngine.csproj.FileList.txt =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/obj/LyricsEngine.csproj.FileList.txt (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/obj/LyricsEngine.csproj.FileList.txt 2007-11-07 18:51:29 UTC (rev 1035) @@ -0,0 +1,18 @@ +bin\Release\LyricsEngine.dll.config +bin\Release\LyricsEngine.dll +bin\Release\LyricsEngine.XmlSerializers.dll +bin\Release\LyricsEngine.pdb +obj\Release\ResolveAssemblyReference.cache +obj\Release\LyricsEngine.Properties.Resources.resources +obj\Release\LyricsEngine.csproj.GenerateResource.Cache +obj\Release\LyricsEngine.dll +obj\Release\LyricsEngine.pdb +obj\Release\LyricsEngine.XmlSerializers.dll +bin\Debug\LyricsEngine.dll.config +bin\Debug\LyricsEngine.dll +bin\Debug\LyricsEngine.pdb +obj\Debug\ResolveAssemblyReference.cache +obj\Debug\LyricsEngine.Properties.Resources.resources +obj\Debug\LyricsEngine.csproj.GenerateResource.Cache +obj\Debug\LyricsEngine.dll +obj\Debug\LyricsEngine.pdb Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.Properties.Resources.resources =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.Properties.Resources.resources ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.XmlSerializers.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.XmlSerializers.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.csproj.GenerateResource.Cache =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.csproj.GenerateResource.Cache ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/LyricsEngine.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/TempPE/Properties.Resources.Designer.cs.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/TempPE/Properties.Resources.Designer.cs.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/TempPE/Web References.org.lyricwiki.Reference.cs.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/LyricsEngine/obj/Release/TempPE/Web References.org.lyricwiki.Reference.cs.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/MusicDatabaseV8.db3 =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/MusicDatabaseV8.db3 ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.Designer.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.Designer.cs 2007-11-07 18:51:29 UTC (rev 1035) @@ -0,0 +1,170 @@ +namespace MyLyrics +{ + partial class AddNewSong + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.gbAddNew = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.tbLyric = new System.Windows.Forms.TextBox(); + this.lbLyric = new MediaPortal.UserInterface.Controls.MPLabel(); + this.tbTitle = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.lbTitle = new MediaPortal.UserInterface.Controls.MPLabel(); + this.tbArtist = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.lbArtist = new MediaPortal.UserInterface.Controls.MPLabel(); + this.btOK = new MediaPortal.UserInterface.Controls.MPButton(); + this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); + this.gbAddNew.SuspendLayout(); + this.SuspendLayout(); + // + // gbAddNew + // + this.gbAddNew.Controls.Add(this.tbLyric); + this.gbAddNew.Controls.Add(this.lbLyric); + this.gbAddNew.Controls.Add(this.tbTitle); + this.gbAddNew.Controls.Add(this.lbTitle); + this.gbAddNew.Controls.Add(this.tbArtist); + this.gbAddNew.Controls.Add(this.lbArtist); + this.gbAddNew.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbAddNew.Location = new System.Drawing.Point(9, 12); + this.gbAddNew.Name = "gbAddNew"; + this.gbAddNew.Size = new System.Drawing.Size(508, 294); + this.gbAddNew.TabIndex = 3; + this.gbAddNew.TabStop = false; + this.gbAddNew.Text = "Song Info"; + // + // tbLyric + // + this.tbLyric.Location = new System.Drawing.Point(64, 80); + this.tbLyric.Multiline = true; + this.tbLyric.Name = "tbLyric"; + this.tbLyric.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.tbLyric.Size = new System.Drawing.Size(428, 204); + this.tbLyric.TabIndex = 5; + this.tbLyric.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tbLyric_KeyUp); + // + // lbLyric + // + this.lbLyric.AutoSize = true; + this.lbLyric.Location = new System.Drawing.Point(9, 83); + this.lbLyric.Name = "lbLyric"; + this.lbLyric.Size = new System.Drawing.Size(32, 13); + this.lbLyric.TabIndex = 4; + this.lbLyric.Text = "Lyric:"; + // + // tbTitle + // + this.tbTitle.BorderColor = System.Drawing.Color.Empty; + this.tbTitle.Location = new System.Drawing.Point(64, 47); + this.tbTitle.Name = "tbTitle"; + this.tbTitle.Size = new System.Drawing.Size(226, 20); + this.tbTitle.TabIndex = 3; + this.tbTitle.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tbTitle_KeyUp); + // + // lbTitle + // + this.lbTitle.AutoSize = true; + this.lbTitle.Location = new System.Drawing.Point(9, 50); + this.lbTitle.Name = "lbTitle"; + this.lbTitle.Size = new System.Drawing.Size(30, 13); + this.lbTitle.TabIndex = 2; + this.lbTitle.Text = "Title:"; + // + // tbArtist + // + this.tbArtist.BorderColor = System.Drawing.Color.Empty; + this.tbArtist.Location = new System.Drawing.Point(64, 17); + this.tbArtist.Name = "tbArtist"; + this.tbArtist.Size = new System.Drawing.Size(226, 20); + this.tbArtist.TabIndex = 1; + this.tbArtist.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tbArtist_KeyUp); + // + // lbArtist + // + this.lbArtist.AutoSize = true; + this.lbArtist.Location = new System.Drawing.Point(9, 20); + this.lbArtist.Name = "lbArtist"; + this.lbArtist.Size = new System.Drawing.Size(33, 13); + this.lbArtist.TabIndex = 0; + this.lbArtist.Text = "Artist:"; + // + // btOK + // + this.btOK.Enabled = false; + this.btOK.Location = new System.Drawing.Point(377, 312); + this.btOK.Name = "btOK"; + this.btOK.Size = new System.Drawing.Size(59, 23); + this.btOK.TabIndex = 3; + this.btOK.Text = "&OK"; + this.btOK.UseVisualStyleBackColor = true; + this.btOK.Click += new System.EventHandler(this.btOK_Click); + // + // btClose + // + this.btClose.Location = new System.Drawing.Point(442, 312); + this.btClose.Name = "btClose"; + this.btClose.Size = new System.Drawing.Size(59, 23); + this.btClose.TabIndex = 4; + this.btClose.Text = "&Close"; + this.btClose.UseVisualStyleBackColor = true; + this.btClose.Click += new System.EventHandler(this.btClose_Click); + // + // MyLyricsSetup_AddNewSong + // + this.AcceptButton = this.btOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(525, 340); + this.ControlBox = false; + this.Controls.Add(this.btClose); + this.Controls.Add(this.btOK); + this.Controls.Add(this.gbAddNew); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(533, 367); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(533, 367); + this.Name = "MyLyricsSetup_AddNewSong"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Add new lyric"; + this.gbAddNew.ResumeLayout(false); + this.gbAddNew.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private MediaPortal.UserInterface.Controls.MPGroupBox gbAddNew; + private MediaPortal.UserInterface.Controls.MPLabel lbTitle; + private MediaPortal.UserInterface.Controls.MPTextBox tbArtist; + private MediaPortal.UserInterface.Controls.MPLabel lbArtist; + private MediaPortal.UserInterface.Controls.MPButton btOK; + private MediaPortal.UserInterface.Controls.MPTextBox tbTitle; + private System.Windows.Forms.TextBox tbLyric; + private MediaPortal.UserInterface.Controls.MPLabel lbLyric; + private MediaPortal.UserInterface.Controls.MPButton btClose; + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.cs 2007-11-07 18:51:29 UTC (rev 1035) @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace MyLyrics +{ + public partial class AddNewSong : Form + { + + LyricsLibrary parent; + + public AddNewSong(LyricsLibrary parent) + { + InitializeComponent(); + this.parent = parent; + this.ShowDialog(); + } + + private void btOK_Click(object sender, EventArgs e) + { + parent.addNewSongToDatabase(tbArtist.Text, tbTitle.Text, tbLyric.Text); + this.Close(); + } + + private void tbArtist_KeyUp(object sender, KeyEventArgs e) + { + validateText(); + } + + private void tbTitle_KeyUp(object sender, KeyEventArgs e) + { + validateText(); + } + + private void tbLyric_KeyUp(object sender, KeyEventArgs e) + { + validateText(); + } + + private void validateText() + { + if (tbArtist.Text.Length != 0 && tbTitle.Text.Length != 0 && tbLyric.Text.Length != 0) + btOK.Enabled = true; + else + btOK.Enabled = false; + } + + private void btClose_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.resx (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/AddNewSong.resx 2007-11-07 18:51:29 UTC (rev 1035) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.Designer.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.Designer.cs 2007-11-07 18:51:29 UTC (rev 1035) @@ -0,0 +1,359 @@ +namespace MyLyrics +{ + partial class FindLyric + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.gbSearchInfo = new System.Windows.Forms.GroupBox(); + this.tbTitle = new System.Windows.Forms.TextBox(); + this.lbTitle = new System.Windows.Forms.Label(); + this.tbArtist = new System.Windows.Forms.TextBox(); + this.lbArtist = new System.Windows.Forms.Label(); + this.btFind = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lvSearchResults = new System.Windows.Forms.ListView(); + this.cbSite = new System.Windows.Forms.ColumnHeader(); + this.cbResult = new System.Windows.Forms.ColumnHeader(); + this.chLyric = new System.Windows.Forms.ColumnHeader(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.tbLyrics = new System.Windows.Forms.TextBox(); + this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.btCancel = new System.Windows.Forms.Button(); + this.cbHotLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbSeekLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricsOnDemand = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbEvilLabs = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.btClose = new System.Windows.Forms.Button(); + this.btUpdate = new System.Windows.Forms.Button(); + this.gbSearchInfo.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.gbLyricSites.SuspendLayout(); + this.SuspendLayout(); + // + // gbSearchInfo + // + this.gbSearchInfo.Controls.Add(this.tbTitle); + this.gbSearchInfo.Controls.Add(this.lbTitle); + this.gbSearchInfo.Controls.Add(this.tbArtist); + this.gbSearchInfo.Controls.Add(this.lbArtist); + this.gbSearchInfo.Location = new System.Drawing.Point(12, 12); + this.gbSearchInfo.Name = "gbSearchInfo"; + this.gbSearchInfo.Size = new System.Drawing.Size(432, 85); + this.gbSearchInfo.TabIndex = 0; + this.gbSearchInfo.TabStop = false; + this.gbSearchInfo.Text = "Search information"; + // + // tbTitle + // + this.tbTitle.Location = new System.Drawing.Point(73, 53); + this.tbTitle.Name = "tbTitle"; + this.tbTitle.Size = new System.Drawing.Size(344, 20); + this.tbTitle.TabIndex = 2; + // + // lbTitle + // + this.lbTitle.AutoSize = true; + this.lbTitle.Location = new System.Drawing.Point(15, 56); + this.lbTitle.Name = "lbTitle"; + this.lbTitle.Size = new System.Drawing.Size(30, 13); + this.lbTitle.TabIndex = 2; + this.lbTitle.Text = "Title:"; + // + // tbArtist + // + this.tbArtist.Location = new System.Drawing.Point(73, 26); + this.tbArtist.Name = "tbArtist"; + this.tbArtist.Size = new System.Drawing.Size(344, 20); + this.tbArtist.TabIndex = 1; + // + // lbArtist + // + this.lbArtist.AutoSize = true; + this.lbArtist.Location = new System.Drawing.Point(15, 29); + this.lbArtist.Name = "lbArtist"; + this.lbArtist.Size = new System.Drawing.Size(33, 13); + this.lbArtist.TabIndex = 0; + this.lbArtist.Text = "Artist:"; + // + // btFind + // + this.btFind.Location = new System.Drawing.Point(281, 67); + this.btFind.Name = "btFind"; + this.btFind.Size = new System.Drawing.Size(65, 23); + this.btFind.TabIndex = 3; + this.btFind.Text = "&Fetch"; + this.btFind.UseVisualStyleBackColor = true; + this.btFind.Click += new System.EventHandler(this.btFind_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.lvSearchResults); + this.groupBox1.Location = new System.Drawing.Point(13, 207); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(431, 147); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Search results"; + // + // lvSearchResults + // + this.lvSearchResults.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.cbSite, + this.cbResult, + this.chLyric}); + this.lvSearchResults.FullRowSelect = true; + this.lvSearchResults.Location = new System.Drawing.Point(17, 21); + this.lvSearchResults.MultiSelect = false; + this.lvSearchResults.Name = "lvSearchResults"; + this.lvSearchResults.Size = new System.Drawing.Size(399, 111); + this.lvSearchResults.TabIndex = 10; + this.lvSearchResults.UseCompatibleStateImageBehavior = false; + this.lvSearchResults.View = System.Windows.Forms.View.Details; + this.lvSearchResults.DoubleClick += new System.EventHandler(this.lvSearchResults_DoubleClick); + this.lvSearchResults.SelectedIndexChanged += new System.EventHandler(this.lvSearchResults_SelectedIndexChanged); + // + // cbSite + // + this.cbSite.Text = "Site"; + this.cbSite.Width = 113; + // + // cbResult + // + this.cbResult.Text = "Result"; + this.cbResult.Width = 58; + // + // chLyric + // + this.chLyric.Text = "Lyric"; + this.chLyric.Width = 223; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.tbLyrics); + this.groupBox2.Location = new System.Drawing.Point(13, 360); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(431, 183); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Lyric"; + // + // tbLyrics + // + this.tbLyrics.Location = new System.Drawing.Point(17, 19); + this.tbLyrics.Multiline = true; + this.tbLyrics.Name = "tbLyrics"; + this.tbLyrics.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.tbLyrics.Size = new System.Drawing.Size(399, 153); + this.tbLyrics.TabIndex = 0; + // + // gbLyricSites + // + this.gbLyricSites.Controls.Add(this.btCancel); + this.gbLyricSites.Controls.Add(this.btFind); + this.gbLyricSites.Controls.Add(this.cbHotLyrics); + this.gbLyricSites.Controls.Add(this.cbSeekLyrics); + this.gbLyricSites.Controls.Add(this.cbLyricsOnDemand); + this.gbLyricSites.Controls.Add(this.cbLyrics007); + this.gbLyricSites.Controls.Add(this.cbEvilLabs); + this.gbLyricSites.Controls.Add(this.cbLyricWiki); + this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbLyricSites.Location = new System.Drawing.Point(12, 103); + this.gbLyricSites.Name = "gbLyricSites"; + this.gbLyricSites.Size = new System.Drawing.Size(432, 98); + this.gbLyricSites.TabIndex = 29; + this.gbLyricSites.TabStop = false; + this.gbLyricSites.Text = "Lyric sites to search"; + // + // btCancel + // + this.btCancel.Location = new System.Drawing.Point(352, 67); + this.btCancel.Name = "btCancel"; + this.btCancel.Size = new System.Drawing.Size(65, 23); + this.btCancel.TabIndex = 4; + this.btCancel.Text = "&Cancel"; + this.btCancel.UseVisualStyleBackColor = true; + this.btCancel.Click += new System.EventHandler(this.btCancel_Click); + // + // cbHotLyrics + // + this.cbHotLyrics.AutoSize = true; + 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(146, 21); + this.cbHotLyrics.Name = "cbHotLyrics"; + this.cbHotLyrics.Size = new System.Drawing.Size(71, 17); + this.cbHotLyrics.TabIndex = 14; + this.cbHotLyrics.Text = "Hot Lyrics"; + this.cbHotLyrics.UseVisualStyleBackColor = true; + // + // cbSeekLyrics + // + this.cbSeekLyrics.AutoSize = true; + this.cbSeekLyrics.Checked = true; + this.cbSeekLyrics.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbSeekLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbSeekLyrics.Location = new System.Drawing.Point(146, 43); + this.cbSeekLyrics.Name = "cbSeekLyrics"; + this.cbSeekLyrics.Size = new System.Drawing.Size(79, 17); + this.cbSeekLyrics.TabIndex = 15; + this.cbSeekLyrics.Text = "Seek Lyrics"; + this.cbSeekLyrics.UseVisualStyleBackColor = true; + // + // cbLyricsOnDemand + // + this.cbLyricsOnDemand.AutoSize = true; + this.cbLyricsOnDemand.Checked = true; + this.cbLyricsOnDemand.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbLyricsOnDemand.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyricsOnDemand.Location = new System.Drawing.Point(16, 43); + this.cbLyricsOnDemand.Name = "cbLyricsOnDemand"; + this.cbLyricsOnDemand.Size = new System.Drawing.Size(108, 17); + this.cbLyricsOnDemand.TabIndex = 12; + this.cbLyricsOnDemand.Text = "Lyrics OnDemand"; + this.cbLyricsOnDemand.UseVisualStyleBackColor = true; + // + // cbLyrics007 + // + this.cbLyrics007.AutoSize = true; + 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(16, 66); + this.cbLyrics007.Name = "cbLyrics007"; + this.cbLyrics007.Size = new System.Drawing.Size(72, 17); + this.cbLyrics007.TabIndex = 13; + this.cbLyrics007.Text = "Lyrics 007"; + this.cbLyrics007.UseVisualStyleBackColor = true; + // + // cbEvilLabs + // + this.cbEvilLabs.AutoSize = true; + this.cbEvilLabs.Checked = true; + this.cbEvilLabs.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbEvilLabs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbEvilLabs.Location = new System.Drawing.Point(146, 66); + this.cbEvilLabs.Name = "cbEvilLabs"; + this.cbEvilLabs.Size = new System.Drawing.Size(67, 17); + this.cbEvilLabs.TabIndex = 16; + this.cbEvilLabs.Text = "Evil Labs"; + this.cbEvilLabs.UseVisualStyleBackColor = true; + // + // cbLyricWiki + // + this.cbLyricWiki.AutoSize = true; + 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(16, 21); + 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; + // + // btClose + // + this.btClose.Location = new System.Drawing.Point(354, 549); + this.btClose.Name = "btClose"; + this.btClose.Size = new System.Drawing.Size(75, 23); + this.btClose.TabIndex = 30; + this.btClose.Text = "Close"; + this.btClose.UseVisualStyleBackColor = true; + this.btClose.Click += new System.EventHandler(this.btClose_Click); + // + // btUpdate + // + this.btUpdate.Enabled = false; + this.btUpdate.Location = new System.Drawing.Point(273, 549); + this.btUpdate.Name = "btUpdate"; + this.btUpdate.Size = new System.Drawing.Size(75, 23); + this.btUpdate.TabIndex = 11; + this.btUpdate.Text = "Update"; + this.btUpdate.UseVisualStyleBackColor = true; + this.btUpdate.Click += new System.EventHandler(this.btUpdate_Click); + // + // MyLyricsSetup_SearchTitleDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(456, 584); + this.ControlBox = false; + this.Controls.Add(this.btUpdate); + this.Controls.Add(this.btClose); + this.Controls.Add(this.gbLyricSites); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.gbSearchInfo); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(464, 611); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(464, 611); + this.Name = "MyLyricsSetup_SearchTitleDialog"; + this.ShowIcon = false; + this.Text = "Fetch lyric dialog"; + this.gbSearchInfo.ResumeLayout(false); + this.gbSearchInfo.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.gbLyricSites.ResumeLayout(false); + this.gbLyricSites.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox gbSearchInfo; + private System.Windows.Forms.Label lbTitle; + private System.Windows.Forms.TextBox tbArtist; + private System.Windows.Forms.Label lbArtist; + private System.Windows.Forms.TextBox tbTitle; + private System.Windows.Forms.Button btFind; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox tbLyrics; + private MediaPortal.UserInterface.Controls.MPGroupBox gbLyricSites; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbHotLyrics; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbSeekLyrics; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsOnDemand; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyrics007; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbEvilLabs; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricWiki; + private System.Windows.Forms.ListView lvSearchResults; + private System.Windows.Forms.ColumnHeader cbSite; + private System.Windows.Forms.ColumnHeader cbResult; + private System.Windows.Forms.ColumnHeader chLyric; + private System.Windows.Forms.Button btClose; + private System.Windows.Forms.Button btUpdate; + private System.Windows.Forms.Button btCancel; + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2007-11-07 18:51:29 UTC (rev 1035) @@ -0,0 +1,452 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Threading; + +using LyricsEngine; + +namespace MyLyrics +{ + public partial class FindLyric : Form, ILyricForm + { + + public delegate void DelegateStringUpdate(String message, String site); + public DelegateStringUpdate m_DelegateStringUpdate; + public delegate void DelegateStatusUpdate(Int32 noOfLyricsToSearch, Int32 noOfLyricsSearched, Int32 noOfLyricsFound, Int32 noOfLyricsNotFound); + public DelegateStatusUpdate m_DelegateStatusUpdate; + public delegate void DelegateLyricFound(String s, String artist, String track, String site); + public DelegateLyricFound m_DelegateLyricFound; + public delegate void DelegateLyricNotFound(String artist, String title, String message, String site); + public DelegateLyricNotFound m_DelegateLyricNotFound; + public delegate void DelegateThreadFinished(String arist, String title, String message, String site); + public DelegateThreadFinished m_DelegateThreadFinished; + public delegate void DelegateThreadException(Object o); + public DelegateThreadException m_DelegateThreadException; + LyricsController lc; + + // worker thread + Thread m_LyricControllerThread; + + ManualResetEvent m_EventStopThread; + + string originalArtist; + string originalTitle; + int counter; + bool m_automaticFetch = true; + bool m_automaticUpdate = true; + bool m_moveLyricFromMarkedDatabase = true; + bool marked... [truncated message content] |
From: <sa...@us...> - 2007-11-15 16:24:15
|
Revision: 1065 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1065&view=rev Author: saamand Date: 2007-11-15 08:24:06 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.resx 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.csproj Added Paths: ----------- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.resx trunk/plugins/MyLyrics/My Lyrics/TagReaderUtil.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -110,9 +110,6 @@ public void Dispose() { - //m_EventStop_LyricController.Close(); - //m_EventStopped_LyricController.Close(); - // clean-up operations may be placed here for (int i = 0; i < threadList.Count; i++) { @@ -124,10 +121,15 @@ { for (int i = 0; i < threadList.Count; i++) { - stillThreadsAlive = false; ; + stillThreadsAlive = false; if (((Thread)threadList[i]).IsAlive) stillThreadsAlive = true; } + + if (threadList.Count == 0) + { + stillThreadsAlive = false; + } } FinishThread("", "", "The search has ended.", ""); } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -123,6 +123,10 @@ void timer_Elapsed(object sender, ElapsedEventArgs e) { + timer.Stop(); + timer.Close(); + timer.Dispose(); + lyric = "Not found"; complete = true; Thread.CurrentThread.Abort(); Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -220,6 +220,10 @@ void timer_Elapsed(object sender, ElapsedEventArgs e) { + timer.Stop(); + timer.Close(); + timer.Dispose(); + lyric = "Not found"; complete = true; Thread.CurrentThread.Abort(); Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -139,7 +139,7 @@ } } } - catch (System.Reflection.TargetInvocationException) + catch (Exception) { lyric = "Not found"; } @@ -160,6 +160,10 @@ void timer_Elapsed(object sender, ElapsedEventArgs e) { + timer.Stop(); + timer.Close(); + timer.Dispose(); + lyric = "Not found"; complete = true; Thread.CurrentThread.Abort(); Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -187,6 +187,10 @@ void timer_Elapsed(object sender, ElapsedEventArgs e) { + timer.Stop(); + timer.Close(); + timer.Dispose(); + lyric = "Not found"; complete = true; Thread.CurrentThread.Abort(); Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -199,6 +199,10 @@ void timer_Elapsed(object sender, ElapsedEventArgs e) { + timer.Stop(); + timer.Close(); + timer.Dispose(); + lyric = "Not found"; complete = true; Thread.CurrentThread.Abort(); Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -0,0 +1,230 @@ +namespace MyLyrics +{ + partial class Information + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Information)); + this.lbIntro = new System.Windows.Forms.Label(); + this.lbInfo2 = new System.Windows.Forms.Label(); + this.lbInfo1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label3 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.linkLabelForum = new System.Windows.Forms.LinkLabel(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // lbIntro + // + this.lbIntro.AutoSize = true; + this.lbIntro.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lbIntro.Location = new System.Drawing.Point(29, 57); + this.lbIntro.MaximumSize = new System.Drawing.Size(480, 0); + this.lbIntro.MinimumSize = new System.Drawing.Size(480, 67); + this.lbIntro.Name = "lbIntro"; + this.lbIntro.Size = new System.Drawing.Size(480, 80); + this.lbIntro.TabIndex = 0; + this.lbIntro.Text = resources.GetString("lbIntro.Text"); + // + // lbInfo2 + // + this.lbInfo2.AutoSize = true; + this.lbInfo2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbInfo2.ForeColor = System.Drawing.Color.Navy; + this.lbInfo2.Location = new System.Drawing.Point(26, 153); + this.lbInfo2.Name = "lbInfo2"; + this.lbInfo2.Size = new System.Drawing.Size(326, 17); + this.lbInfo2.TabIndex = 2; + this.lbInfo2.Text = "The four tabs of the MyLyrics configuration:"; + // + // lbInfo1 + // + this.lbInfo1.AutoSize = true; + this.lbInfo1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbInfo1.ForeColor = System.Drawing.Color.Navy; + this.lbInfo1.Location = new System.Drawing.Point(26, 30); + this.lbInfo1.Name = "lbInfo1"; + this.lbInfo1.Size = new System.Drawing.Size(225, 17); + this.lbInfo1.TabIndex = 3; + this.lbInfo1.Text = "My Lyrics plugin, version 1.00"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 17); + this.label2.MaximumSize = new System.Drawing.Size(460, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(445, 39); + this.label2.TabIndex = 4; + this.label2.Text = resources.GetString("label2.Text"); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.ForeColor = System.Drawing.Color.Navy; + this.label4.Location = new System.Drawing.Point(3, 4); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(100, 13); + this.label4.TabIndex = 6; + this.label4.Text = "Lyrics database:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(12, 140); + this.label5.MaximumSize = new System.Drawing.Size(460, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(458, 26); + this.label5.TabIndex = 7; + this.label5.Text = "You can perform a search on your whole music database in a single batch search. Y" + + "ou can also choose to select all songs contained in the marked database."; + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel1.Controls.Add(this.label8); + this.panel1.Controls.Add(this.label7); + this.panel1.Controls.Add(this.label6); + this.panel1.Controls.Add(this.label5); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.label3); + this.panel1.Controls.Add(this.label4); + this.panel1.Controls.Add(this.label2); + this.panel1.Location = new System.Drawing.Point(29, 173); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(480, 251); + this.panel1.TabIndex = 8; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(12, 79); + this.label3.MaximumSize = new System.Drawing.Size(460, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(447, 39); + this.label3.TabIndex = 7; + this.label3.Text = resources.GetString("label3.Text"); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.Color.Navy; + this.label1.Location = new System.Drawing.Point(3, 66); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(144, 13); + this.label1.TabIndex = 8; + this.label1.Text = "Music database browse:"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label6.ForeColor = System.Drawing.Color.Navy; + this.label6.Location = new System.Drawing.Point(3, 127); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(136, 13); + this.label6.TabIndex = 9; + this.label6.Text = "Music database batch:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.ForeColor = System.Drawing.Color.Navy; + this.label7.Location = new System.Drawing.Point(3, 176); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(53, 13); + this.label7.TabIndex = 10; + this.label7.Text = "Settings"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(12, 189); + this.label8.MaximumSize = new System.Drawing.Size(460, 0); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(454, 52); + this.label8.TabIndex = 11; + this.label8.Text = resources.GetString("label8.Text"); + // + // linkLabelForum + // + this.linkLabelForum.AutoSize = true; + this.linkLabelForum.LinkColor = System.Drawing.Color.Navy; + this.linkLabelForum.Location = new System.Drawing.Point(364, 436); + this.linkLabelForum.Name = "linkLabelForum"; + this.linkLabelForum.Size = new System.Drawing.Size(145, 13); + this.linkLabelForum.TabIndex = 9; + this.linkLabelForum.TabStop = true; + this.linkLabelForum.Tag = "http://forum.team-mediaportal.com/my_lyrics_plugin-f163.html"; + this.linkLabelForum.Text = "MyLyrics plugin forum section"; + this.linkLabelForum.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelForum_LinkClicked); + // + // Information + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.linkLabelForum); + this.Controls.Add(this.panel1); + this.Controls.Add(this.lbInfo1); + this.Controls.Add(this.lbInfo2); + this.Controls.Add(this.lbIntro); + this.Name = "Information"; + this.Size = new System.Drawing.Size(539, 494); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbIntro; + private System.Windows.Forms.Label lbInfo2; + private System.Windows.Forms.Label lbInfo1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.LinkLabel linkLabelForum; + } +} Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +namespace MyLyrics +{ + public partial class Information : UserControl + { + Form parent; + + public Information(Form parent) + { + this.parent = parent; + InitializeComponent(); + } + + private void linkLabelForum_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + System.Diagnostics.Process proc = new System.Diagnostics.Process(); + proc.StartInfo.FileName = "iexplore"; + proc.StartInfo.Arguments = "http://forum.team-mediaportal.com/my_lyrics_plugin-f163.html"; + proc.Start(); + } + } +} Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.resx (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.resx 2007-11-15 16:24:06 UTC (rev 1065) @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="lbIntro.Text" xml:space="preserve"> + <value>The MyLyrics plugin makes it possible for you to see the lyric for the currently played song in MediaPortal. When playing a song in MediaPortal simple go into MyLyrics and the lyric for the song will be displayed. + +Also when run in configuration mode, you will be able to work on your lyrics database, import and export lyrics from music tags, and perform various types of searches.</value> + </data> + <data name="label2.Text" xml:space="preserve"> + <value>Here you can see your lyrics (containing the songs with a matching lyric) and your marked database (containing the songs that have been searched without any matching lyrics found). You can modify, import, and find an alternative title for a known song amont other things.</value> + </data> + <data name="label3.Text" xml:space="preserve"> + <value>This is where you can browsw your music database and manually select the songs taht you would like to search the Internet for. When a lyric is found it is added to the lyrics database. If not it is added to the marked database.</value> + </data> + <data name="label8.Text" xml:space="preserve"> + <value>Here you can set up the plugin as you prefer. E.g. you can choose the name to be shown for the plugin inside MediaPortal or if a found lyric should be stored in the tag of the music file. You can also tweak the settings regarding the "Find Lyrics" dialog accessable from the "Lyrics database" tab, and choose which sites you want to query in your searches.</value> + </data> +</root> \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -38,7 +38,10 @@ MusicDatabase mDB = MusicDatabase.Instance; artists = new ArrayList(); songs = new List<Song>(); - mDB.GetArtists(0, "", ref artists); + mDB.GetAllArtists(ref artists); + //mDB.GetArtists(0, "", ref artists); + //mDB.Get + artists.Sort(); progressBar.ResetText(); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -38,7 +38,8 @@ tags = new List<MusicTag>(); artists = new ArrayList(); songs = new List<Song>(); - mDB.GetArtists(0, "", ref artists); + //mDB.GetArtists(0, "", ref artists); + mDB.GetAllArtists(ref artists); artists.Sort(); progressBar.ResetText(); @@ -72,7 +73,7 @@ foreach (Song song in songs) { MusicTag tag = TagReader.ReadTag(song.FileName); - if (tag.Lyrics != string.Empty) + if (tag != null && tag.Lyrics != string.Empty) { tags.Add(tag); ++counter; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.Designer.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.Designer.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -340,21 +340,21 @@ // // btResetMarkedLyricsDatabase // - this.btResetMarkedLyricsDatabase.Location = new System.Drawing.Point(426, 18); + this.btResetMarkedLyricsDatabase.Location = new System.Drawing.Point(451, 18); this.btResetMarkedLyricsDatabase.Name = "btResetMarkedLyricsDatabase"; - this.btResetMarkedLyricsDatabase.Size = new System.Drawing.Size(100, 23); + this.btResetMarkedLyricsDatabase.Size = new System.Drawing.Size(75, 23); this.btResetMarkedLyricsDatabase.TabIndex = 11; - this.btResetMarkedLyricsDatabase.Text = "Marked database"; + this.btResetMarkedLyricsDatabase.Text = "MarkedDB"; this.btResetMarkedLyricsDatabase.UseVisualStyleBackColor = true; this.btResetMarkedLyricsDatabase.Click += new System.EventHandler(this.button1_Click); // // btResetLyricsDatabase // - this.btResetLyricsDatabase.Location = new System.Drawing.Point(320, 17); + this.btResetLyricsDatabase.Location = new System.Drawing.Point(370, 18); this.btResetLyricsDatabase.Name = "btResetLyricsDatabase"; - this.btResetLyricsDatabase.Size = new System.Drawing.Size(100, 23); + this.btResetLyricsDatabase.Size = new System.Drawing.Size(75, 23); this.btResetLyricsDatabase.TabIndex = 10; - this.btResetLyricsDatabase.Text = "Lyrics database"; + this.btResetLyricsDatabase.Text = "LyricsDB"; this.btResetLyricsDatabase.UseVisualStyleBackColor = true; this.btResetLyricsDatabase.Click += new System.EventHandler(this.btResetDatabase_Click); // @@ -362,7 +362,7 @@ // this.lbResetDatabase.Location = new System.Drawing.Point(11, 14); this.lbResetDatabase.Name = "lbResetDatabase"; - this.lbResetDatabase.Size = new System.Drawing.Size(303, 30); + this.lbResetDatabase.Size = new System.Drawing.Size(353, 30); this.lbResetDatabase.TabIndex = 9; this.lbResetDatabase.Text = "Reset the lyrics database or the database with\r\nmarked titles. All data in the da" + "tabase will be permanately lost."; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.Designer.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.Designer.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -14,37 +14,39 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MusicDatabaseBrowse)); this.btDeselectAll = new System.Windows.Forms.Button(); this.btSelectAll = new System.Windows.Forms.Button(); - this.listViewSongs = new System.Windows.Forms.ListView(); + this.lvSongs = new System.Windows.Forms.ListView(); this.columnHeaderSong = new System.Windows.Forms.ColumnHeader(); this.columnHeaderDB = new System.Windows.Forms.ColumnHeader(); this.columnHeaderStatus = new System.Windows.Forms.ColumnHeader(); + this.imageList = new System.Windows.Forms.ImageList(this.components); this.lbArtistNumber = new System.Windows.Forms.Label(); - this.listViewSelectedSongs = new System.Windows.Forms.ListView(); + this.lvSelectedSongs = new System.Windows.Forms.ListView(); this.columnHeaderArtist2 = new System.Windows.Forms.ColumnHeader(); this.columnHeaderSong2 = new System.Windows.Forms.ColumnHeader(); this.columnHeaderDatabase2 = new System.Windows.Forms.ColumnHeader(); this.columnHeaderStatus2 = new System.Windows.Forms.ColumnHeader(); this.btAdd = new System.Windows.Forms.Button(); this.gbMusicDatabase = new System.Windows.Forms.GroupBox(); + this.btAddAll = new System.Windows.Forms.Button(); this.lbSelectedArtist = new System.Windows.Forms.Label(); - this.listViewArtists = new System.Windows.Forms.ListView(); + this.lvArtists = new System.Windows.Forms.ListView(); this.columnHeaderArtist = new System.Windows.Forms.ColumnHeader(); this.gbSelected = new System.Windows.Forms.GroupBox(); + this.btCancel = new System.Windows.Forms.Button(); + this.btRemoveAll = new System.Windows.Forms.Button(); this.btDeselectAll2 = new System.Windows.Forms.Button(); this.btSelectAll2 = new System.Windows.Forms.Button(); this.btRemove = new System.Windows.Forms.Button(); this.btSearch = new System.Windows.Forms.Button(); this.bw = new System.ComponentModel.BackgroundWorker(); - this.imageList = new System.Windows.Forms.ImageList(this.components); - this.btAddAll = new System.Windows.Forms.Button(); - this.btRemoveAll = new System.Windows.Forms.Button(); + this.lbStats = new System.Windows.Forms.Label(); this.gbMusicDatabase.SuspendLayout(); this.gbSelected.SuspendLayout(); this.SuspendLayout(); // // btDeselectAll // - this.btDeselectAll.Location = new System.Drawing.Point(437, 208); + this.btDeselectAll.Location = new System.Drawing.Point(437, 219); this.btDeselectAll.Name = "btDeselectAll"; this.btDeselectAll.Size = new System.Drawing.Size(75, 23); this.btDeselectAll.TabIndex = 10; @@ -54,7 +56,7 @@ // // btSelectAll // - this.btSelectAll.Location = new System.Drawing.Point(356, 208); + this.btSelectAll.Location = new System.Drawing.Point(356, 219); this.btSelectAll.Name = "btSelectAll"; this.btSelectAll.Size = new System.Drawing.Size(75, 23); this.btSelectAll.TabIndex = 9; @@ -62,22 +64,22 @@ this.btSelectAll.UseVisualStyleBackColor = true; this.btSelectAll.Click += new System.EventHandler(this.btSelectAll_Click); // - // listViewSongs + // lvSongs // - this.listViewSongs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.lvSongs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeaderSong, this.columnHeaderDB, this.columnHeaderStatus}); - this.listViewSongs.FullRowSelect = true; - this.listViewSongs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listViewSongs.Location = new System.Drawing.Point(189, 38); - this.listViewSongs.Name = "listViewSongs"; - this.listViewSongs.Size = new System.Drawing.Size(332, 164); - this.listViewSongs.SmallImageList = this.imageList; - this.listViewSongs.Sorting = System.Windows.Forms.SortOrder.Ascending; - this.listViewSongs.TabIndex = 8; - this.listViewSongs.UseCompatibleStateImageBehavior = false; - this.listViewSongs.View = System.Windows.Forms.View.Details; + this.lvSongs.FullRowSelect = true; + this.lvSongs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.lvSongs.Location = new System.Drawing.Point(189, 33); + this.lvSongs.Name = "lvSongs"; + this.lvSongs.Size = new System.Drawing.Size(332, 164); + this.lvSongs.SmallImageList = this.imageList; + this.lvSongs.Sorting = System.Windows.Forms.SortOrder.Ascending; + this.lvSongs.TabIndex = 8; + this.lvSongs.UseCompatibleStateImageBehavior = false; + this.lvSongs.View = System.Windows.Forms.View.Details; // // columnHeaderSong // @@ -94,32 +96,38 @@ this.columnHeaderStatus.Text = "Status"; this.columnHeaderStatus.Width = 44; // + // imageList + // + this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); + this.imageList.TransparentColor = System.Drawing.Color.Transparent; + this.imageList.Images.SetKeyName(0, "yes.gif"); + // // lbArtistNumber // this.lbArtistNumber.AutoSize = true; - this.lbArtistNumber.Location = new System.Drawing.Point(11, 21); + this.lbArtistNumber.Location = new System.Drawing.Point(11, 16); this.lbArtistNumber.Name = "lbArtistNumber"; this.lbArtistNumber.Size = new System.Drawing.Size(67, 13); this.lbArtistNumber.TabIndex = 7; this.lbArtistNumber.Text = "[no of artists]"; // - // listViewSelectedSongs + // lvSelectedSongs // - this.listViewSelectedSongs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.lvSelectedSongs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeaderArtist2, this.columnHeaderSong2, this.columnHeaderDatabase2, this.columnHeaderStatus2}); - this.listViewSelectedSongs.FullRowSelect = true; - this.listViewSelectedSongs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listViewSelectedSongs.Location = new System.Drawing.Point(11, 19); - this.listViewSelectedSongs.Name = "listViewSelectedSongs"; - this.listViewSelectedSongs.Size = new System.Drawing.Size(510, 164); - this.listViewSelectedSongs.SmallImageList = this.imageList; - this.listViewSelectedSongs.Sorting = System.Windows.Forms.SortOrder.Ascending; - this.listViewSelectedSongs.TabIndex = 11; - this.listViewSelectedSongs.UseCompatibleStateImageBehavior = false; - this.listViewSelectedSongs.View = System.Windows.Forms.View.Details; + this.lvSelectedSongs.FullRowSelect = true; + this.lvSelectedSongs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.lvSelectedSongs.Location = new System.Drawing.Point(11, 19); + this.lvSelectedSongs.Name = "lvSelectedSongs"; + this.lvSelectedSongs.Size = new System.Drawing.Size(510, 164); + this.lvSelectedSongs.SmallImageList = this.imageList; + this.lvSelectedSongs.Sorting = System.Windows.Forms.SortOrder.Ascending; + this.lvSelectedSongs.TabIndex = 11; + this.lvSelectedSongs.UseCompatibleStateImageBehavior = false; + this.lvSelectedSongs.View = System.Windows.Forms.View.Details; // // columnHeaderArtist2 // @@ -143,7 +151,7 @@ // // btAdd // - this.btAdd.Location = new System.Drawing.Point(275, 208); + this.btAdd.Location = new System.Drawing.Point(275, 219); this.btAdd.Name = "btAdd"; this.btAdd.Size = new System.Drawing.Size(75, 23); this.btAdd.TabIndex = 12; @@ -153,44 +161,55 @@ // // gbMusicDatabase // + this.gbMusicDatabase.Controls.Add(this.lbStats); this.gbMusicDatabase.Controls.Add(this.btAddAll); this.gbMusicDatabase.Controls.Add(this.lbSelectedArtist); - this.gbMusicDatabase.Controls.Add(this.listViewArtists); + this.gbMusicDatabase.Controls.Add(this.lvArtists); this.gbMusicDatabase.Controls.Add(this.btAdd); this.gbMusicDatabase.Controls.Add(this.btDeselectAll); this.gbMusicDatabase.Controls.Add(this.lbArtistNumber); this.gbMusicDatabase.Controls.Add(this.btSelectAll); - this.gbMusicDatabase.Controls.Add(this.listViewSongs); + this.gbMusicDatabase.Controls.Add(this.lvSongs); this.gbMusicDatabase.Location = new System.Drawing.Point(5, 5); this.gbMusicDatabase.Name = "gbMusicDatabase"; - this.gbMusicDatabase.Size = new System.Drawing.Size(538, 237); + this.gbMusicDatabase.Size = new System.Drawing.Size(538, 249); this.gbMusicDatabase.TabIndex = 13; this.gbMusicDatabase.TabStop = false; this.gbMusicDatabase.Text = "Select songs from music database"; // + // btAddAll + // + this.btAddAll.Location = new System.Drawing.Point(194, 219); + this.btAddAll.Name = "btAddAll"; + this.btAddAll.Size = new System.Drawing.Size(75, 23); + this.btAddAll.TabIndex = 15; + this.btAddAll.Text = "Add all"; + this.btAddAll.UseVisualStyleBackColor = true; + this.btAddAll.Click += new System.EventHandler(this.btAddAll_Click); + // // lbSelectedArtist // this.lbSelectedArtist.AutoSize = true; - this.lbSelectedArtist.Location = new System.Drawing.Point(191, 21); + this.lbSelectedArtist.Location = new System.Drawing.Point(191, 16); this.lbSelectedArtist.Name = "lbSelectedArtist"; this.lbSelectedArtist.Size = new System.Drawing.Size(78, 13); this.lbSelectedArtist.TabIndex = 14; this.lbSelectedArtist.Text = "[selected artist]"; // - // listViewArtists + // lvArtists // - this.listViewArtists.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.lvArtists.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeaderArtist}); - this.listViewArtists.FullRowSelect = true; - this.listViewArtists.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listViewArtists.Location = new System.Drawing.Point(11, 38); - this.listViewArtists.MultiSelect = false; - this.listViewArtists.Name = "listViewArtists"; - this.listViewArtists.Size = new System.Drawing.Size(172, 164); - this.listViewArtists.TabIndex = 13; - this.listViewArtists.UseCompatibleStateImageBehavior = false; - this.listViewArtists.View = System.Windows.Forms.View.Details; - this.listViewArtists.SelectedIndexChanged += new System.EventHandler(this.listViewArtists_SelectedIndexChanged); + this.lvArtists.FullRowSelect = true; + this.lvArtists.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.lvArtists.Location = new System.Drawing.Point(11, 33); + this.lvArtists.MultiSelect = false; + this.lvArtists.Name = "lvArtists"; + this.lvArtists.Size = new System.Drawing.Size(172, 164); + this.lvArtists.TabIndex = 13; + this.lvArtists.UseCompatibleStateImageBehavior = false; + this.lvArtists.View = System.Windows.Forms.View.Details; + this.lvArtists.SelectedIndexChanged += new System.EventHandler(this.listViewArtists_SelectedIndexChanged); // // columnHeaderArtist // @@ -199,22 +218,44 @@ // // gbSelected // + this.gbSelected.Controls.Add(this.btCancel); this.gbSelected.Controls.Add(this.btRemoveAll); this.gbSelected.Controls.Add(this.btDeselectAll2); this.gbSelected.Controls.Add(this.btSelectAll2); this.gbSelected.Controls.Add(this.btRemove); this.gbSelected.Controls.Add(this.btSearch); - this.gbSelected.Controls.Add(this.listViewSelectedSongs); - this.gbSelected.Location = new System.Drawing.Point(5, 248); + this.gbSelected.Controls.Add(this.lvSelectedSongs); + this.gbSelected.Location = new System.Drawing.Point(5, 257); this.gbSelected.Name = "gbSelected"; this.gbSelected.Size = new System.Drawing.Size(538, 220); this.gbSelected.TabIndex = 14; this.gbSelected.TabStop = false; this.gbSelected.Text = "Selected songs from music database"; // + // btCancel + // + this.btCancel.Enabled = false; + this.btCancel.Location = new System.Drawing.Point(95, 189); + this.btCancel.Name = "btCancel"; + this.btCancel.Size = new System.Drawing.Size(75, 23); + this.btCancel.TabIndex = 17; + this.btCancel.Text = "Cancel"; + this.btCancel.UseVisualStyleBackColor = true; + this.btCancel.Click += new System.EventHandler(this.btCancel_Click); + // + // btRemoveAll + // + this.btRemoveAll.Location = new System.Drawing.Point(194, 191); + this.btRemoveAll.Name = "btRemoveAll"; + this.btRemoveAll.Size = new System.Drawing.Size(75, 23); + this.btRemoveAll.TabIndex = 16; + this.btRemoveAll.Text = "Remove all"; + this.btRemoveAll.UseVisualStyleBackColor = true; + this.btRemoveAll.Click += new System.EventHandler(this.btRemoveAll_Click); + // // btDeselectAll2 // - this.btDeselectAll2.Location = new System.Drawing.Point(351, 189); + this.btDeselectAll2.Location = new System.Drawing.Point(437, 191); this.btDeselectAll2.Name = "btDeselectAll2"; this.btDeselectAll2.Size = new System.Drawing.Size(75, 23); this.btDeselectAll2.TabIndex = 15; @@ -224,7 +265,7 @@ // // btSelectAll2 // - this.btSelectAll2.Location = new System.Drawing.Point(270, 189); + this.btSelectAll2.Location = new System.Drawing.Point(356, 191); this.btSelectAll2.Name = "btSelectAll2"; this.btSelectAll2.Size = new System.Drawing.Size(75, 23); this.btSelectAll2.TabIndex = 15; @@ -234,7 +275,7 @@ // // btRemove // - this.btRemove.Location = new System.Drawing.Point(189, 189); + this.btRemove.Location = new System.Drawing.Point(275, 191); this.btRemove.Name = "btRemove"; this.btRemove.Size = new System.Drawing.Size(75, 23); this.btRemove.TabIndex = 15; @@ -256,36 +297,21 @@ // bw // this.bw.WorkerReportsProgress = true; + this.bw.WorkerSupportsCancellation = true; this.bw.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bw_DoWork); this.bw.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bw_RunWorkerCompleted); this.bw.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bw_ProgressChanged); // - // imageList + // lbStats // - this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); - this.imageList.TransparentColor = System.Drawing.Color.Transparent; - this.imageList.Images.SetKeyName(0, "yes.gif"); + this.lbStats.AutoSize = true; + this.lbStats.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbStats.Location = new System.Drawing.Point(191, 201); + this.lbStats.Name = "lbStats"; + this.lbStats.Size = new System.Drawing.Size(35, 13); + this.lbStats.TabIndex = 17; + this.lbStats.Text = "[stats]"; // - // btAddAll - // - this.btAddAll.Location = new System.Drawing.Point(194, 208); - this.btAddAll.Name = "btAddAll"; - this.btAddAll.Size = new System.Drawing.Size(75, 23); - this.btAddAll.TabIndex = 15; - this.btAddAll.Text = "Add all"; - this.btAddAll.UseVisualStyleBackColor = true; - this.btAddAll.Click += new System.EventHandler(this.btAddAll_Click); - // - // btRemoveAll - // - this.btRemoveAll.Location = new System.Drawing.Point(108, 189); - this.btRemoveAll.Name = "btRemoveAll"; - this.btRemoveAll.Size = new System.Drawing.Size(75, 23); - this.btRemoveAll.TabIndex = 16; - this.btRemoveAll.Text = "Remove all"; - this.btRemoveAll.UseVisualStyleBackColor = true; - this.btRemoveAll.Click += new System.EventHandler(this.btRemoveAll_Click); - // // MusicDatabaseBrowse // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -306,19 +332,19 @@ private System.Windows.Forms.Button btDeselectAll; private System.Windows.Forms.Button btSelectAll; - private System.Windows.Forms.ListView listViewSongs; + private System.Windows.Forms.ListView lvSongs; private System.Windows.Forms.ColumnHeader columnHeaderSong; private System.Windows.Forms.ColumnHeader columnHeaderDB; private System.Windows.Forms.ColumnHeader columnHeaderStatus; private System.Windows.Forms.Label lbArtistNumber; - private System.Windows.Forms.ListView listViewSelectedSongs; + private System.Windows.Forms.ListView lvSelectedSongs; private System.Windows.Forms.ColumnHeader columnHeaderSong2; private System.Windows.Forms.ColumnHeader columnHeaderDatabase2; private System.Windows.Forms.ColumnHeader columnHeaderStatus2; private System.Windows.Forms.Button btAdd; private System.Windows.Forms.GroupBox gbMusicDatabase; private System.Windows.Forms.GroupBox gbSelected; - private System.Windows.Forms.ListView listViewArtists; + private System.Windows.Forms.ListView lvArtists; private System.Windows.Forms.ColumnHeader columnHeaderArtist; private System.Windows.Forms.Label lbSelectedArtist; private System.Windows.Forms.ColumnHeader columnHeaderArtist2; @@ -331,5 +357,7 @@ private System.ComponentModel.IContainer components; private System.Windows.Forms.Button btAddAll; private System.Windows.Forms.Button btRemoveAll; + private System.Windows.Forms.Button btCancel; + private System.Windows.Forms.Label lbStats; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-15 15:33:55 UTC (rev 1064) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-15 16:24:06 UTC (rev 1065) @@ -36,6 +36,11 @@ int m_noOfSearchesToComplete = 0; int m_noOfSearchesCompleted = 0; + bool m_lockButtons = true; + + Thread m_LyricControllerThread; + ManualResetEvent m_EventStopThread; + Queue<string[]> songs; LyricsController lc; @@ -47,11 +52,12 @@ private void ListboxArtistsUpdate(object sender, EventArgs e) { - MusicDatabase mdb = MusicDatabase.Instance; + MusicDatabase mDB = MusicDatabase.Instance; ArrayList artists = new ArrayList(); - mdb.GetArtists(0, String.Empty, ref artists); + //mdb.GetArtists(0, String.Empty, ref artists); + mDB.GetAllArtists(ref artists); - listViewArtists.Items.Clear(); + lvArtists.Items.Clear(); lbSelectedArtist.Text = String.Empty; m_DelegateStringUpdate = new DelegateStringUpdate(this.updateStringMethod); @@ -64,35 +70,35 @@ foreach (object artist in artists) { ListViewItem lvi = new ListViewItem((string)artist); - listViewArtists.Items.Add(lvi); + lvArtists.Items.Add(lvi); } - listViewArtists.Sorting = SortOrder.Ascending; - listViewSongs.Items.Clear(); - lbArtistNumber.Text = String.Format("{0} artists found", listViewArtists.Items.Count); + lvArtists.Sorting = SortOrder.Ascending; + lvSongs.Items.Clear(); + lbArtistNumber.Text = String.Format("{0} artists found", lvArtists.Items.Count); } private void btSelectAll_Click(object sender, EventArgs e) { - foreach (ListViewItem lvi in listViewSongs.Items) + foreach (ListViewItem lvi in lvSongs.Items) { lvi.Selected = true; } - listViewSongs.Select(); + lvSongs.Select(); } private void btDeselectAll_Click(object sender, EventArgs e) { - foreach (ListViewItem lvi in listViewSongs.Items) + foreach (ListViewItem lvi in lvSongs.Items) { lvi.Selected = false; } - listViewSongs.Select(); + lvSongs.Select(); } private void btAdd_Click(object sender, EventArgs e) { - foreach (ListViewItem lvi in listViewSongs.SelectedItems) + foreach (ListViewItem lvi in lvSongs.SelectedItems) { if (lvi.ImageIndex == -1) { @@ -105,15 +111,15 @@ newLvi.ImageIndex = lvi.ImageIndex; - listViewSelectedSongs.Items.Add(newLvi); + lvSelectedSongs.Items.Add(newLvi); } } - if (listViewSelectedSongs.Items.Count > 0) + if (lvSelectedSongs.Items.Count > 0) { btSearch.Enabled = true; btRemove.Enabled = true; - listViewSelectedSongs.Sort(); + lvSelectedSongs.Sort(); } } @@ -126,7 +132,7 @@ mdb.GetSongsByArtist(selectedArtist, ref songs); lbSelectedArtist.Text = String.Format("Artist: {0}", selectedArtist); - listViewSongs.Items.Clear(); + lvSongs.Items.Clear(); foreach (Song song in songs) { @@ -168,7 +174,7 @@ bool alreadyInCollection = false; - foreach (ListViewItem lviColl in listViewSongs.Items) + foreach (ListViewItem lviColl in lvSongs.Items) { if (lvi.Tag.Equals(lviColl.Tag)) { @@ -179,20 +185,20 @@ if (!alreadyInCollection) { - listViewSongs.Items.Add(lvi); + lvSongs.Items.Add(lvi); } } - + RefreshArtistStats(); } private void btRemove_Click(object sender, EventArgs e) { - foreach (ListViewItem lvi in listViewSelectedSongs.SelectedItems) + foreach (ListViewItem lvi in lvSelectedSongs.SelectedItems) { - listViewSelectedSongs.Items.Remove(lvi); + lvSelectedSongs.Items.Remove(lvi); } - if (listViewSelectedSongs.Items.Count == 0) + if (lvSelectedSongs.Items.Count == 0) { btSearch.Enabled = false; btRemove.Enabled = false; @@ -201,17 +207,21 @@ private void btSearch_Click(object sender, EventArgs e) { + m_lockButtons = false; + if (bw.IsBusy) { Thread.Sleep(2000); } - ((MyLyricsSetup)parent).btClose.Enabled = false; + MyLyricsSetup.UpdateLibraryUI = true; + ChangeButtonsEnableState(); + songs = new Queue<string[]>(); List<ListViewItem> items = new List<ListViewItem>(); - foreach (ListViewItem lvi in listViewSelectedSongs.Items) + foreach (ListViewItem lvi in lvSelectedSongs.Items) { ListViewItem lviClone = (ListViewItem)lvi.Clone(); if (lvi.ImageIndex == -1) @@ -221,8 +231,8 @@ items.Add(lviClone); } } - listViewSelectedSongs.Items.Clear(); - listViewSelectedSongs.Items.AddRange(items.ToArray()); + lvSelectedSongs.Items.Clear(); + lvSelectedSongs.Items.AddRange(items.ToArray()); List<string> sitesToSearch = new List<string>(); @@ -242,8 +252,7 @@ sitesToSearch.Add("SeekLyrics"); } - Thread m_LyricControllerThread; - ManualResetEvent m_EventStopThread = new ManualResetEvent(false); + m_EventStopThread = new ManualResetEvent(false); // If automaticUpdate is set then return after the first positive search lc = new LyricsController(this, m_EventStopThread, (string[])sitesToSearch.ToArray(), false, false); @@ -270,22 +279,73 @@ private void btSelectAll2_Click(object sender, EventArgs e) { - foreach (ListViewItem lvi in listViewSelectedSongs.Items) + foreach (ListViewItem lvi in lvSelectedSongs.Items) { lvi.Selected = true; } - listViewSelectedSongs.Select(); + lvSelectedSongs.Select(); } private void btDeselectAll2_Click(object sender, EventArgs e) { - foreach (ListViewItem lvi in listViewSelectedSongs.Items) + foreach (ListViewItem lvi in lvSelectedSongs.Items) { lvi.Selected = false; } - listViewSelectedSongs.Select(); + lvSelectedSongs.Select(); } + public void RefreshSongsListView() + { + if (lvArtists.SelectedIndices.Count > 0) + { + int index = lvArtists.SelectedIndices[0]; + lvArtists.Items[index].Selected = false; + lvArtists.Items[index].Selected = true; + } + } + + public void RefreshArtistStats() + { + int lyricsInLyricDB = 0; + int lyricsInMarkedDB = 0; + + foreach (ListViewItem lvi in lvSongs.Items) + { + if (lvi.SubItems[1].Text.Equals("LyricsDB")) + { + ++lyricsInLyricDB; + } + else if (lvi.SubItems[1].Text.Equals("MarkedDB")) + { + ++lyricsInMarkedDB; + } + } + lbStats.Text = string.Format("Lyrics: {0} - Lyrics in LyricsDB: {1} - Lyrics in MarkedDB: {2}", lvSongs.Items.Count, lyricsInLyricDB, lyricsInMarkedDB); + } + + private void ChangeSearchingSubI... [truncated message content] |
From: <sa...@us...> - 2007-11-17 12:31:14
|
Revision: 1070 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1070&view=rev Author: saamand Date: 2007-11-17 04:31:11 -0800 (Sat, 17 Nov 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsController.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.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj Added Paths: ----------- trunk/plugins/MyLyrics/My Lyrics/MediaPortalUtil.cs Removed Paths: ------------- trunk/plugins/MyLyrics/My Lyrics/Changelog.txt Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -136,20 +136,20 @@ FinishThread("", "", "The search has ended.", ""); } - public void AddNewLyricSearch(string artist, string title) + public void AddNewLyricSearch(string artist, string title, string strippedArtistName) { ++m_noOfCurrentSearches; if (lyricsSites.Length > 0) { // create worker thread instance - ThreadStart easySitesThreadInstance = delegate + ThreadStart threadInstance = delegate { - LyricSearch lyricSearch_EasySites = new LyricSearch(this, artist, title, m_allowAllToComplete, m_automaticUpdate); - lyricSearch_EasySites.Run(); + LyricSearch lyricSearch = new LyricSearch(this, artist, title, strippedArtistName, m_allowAllToComplete, m_automaticUpdate); + lyricSearch.Run(); }; - Thread lyricSearchThread = new Thread(easySitesThreadInstance); + Thread lyricSearchThread = new Thread(threadInstance); lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; // looks nice in Output window lyricSearchThread.IsBackground = true; lyricSearchThread.Start(); Deleted: trunk/plugins/MyLyrics/My Lyrics/Changelog.txt =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-11-17 12:31:11 UTC (rev 1070) @@ -1,32 +0,0 @@ -Changes from version 0.23 to 0.24: -- Fix: Better for - -Changes from version 0.14 to 0.15: -- Fix: A LOT of performance improvemence issues and code-clean up -- Fix: One lyric site added (HotLyrics), and one removed (SeekLyrics) due to instable server -- Add: Timer on batch search in configuration mode. -- Fix: A special formatting on SeekLyrics sites wasn't handled causing fetched of an incomplete lyrics -- Fix: For some users the tag reader added an additional space causing the search to fail. -- Fix: Various minor fixes on all the formatting on lyrics fetched from SeekLyrics -- Fix: Handling of special German and Danish letters - -Changes from version 0.13 to 0.14: -- Add: Added three new lyrics sites. Now there is a total of four lyrics sites to search from. -- Del: All Google related dependencies have been removed in the plugin. -- Fix: Even if all lyric search threads had ended the complete search wasn't terminated due to bad validation. -- Fix: LRC-text saved in music tags wasn't formatted correctly and accordingly shown as regular lyrics. -- Fix: Fields weren't reset before interpreting a new LRC-fields resulting in wrong timestamps and non-empty status field. -- Fix: Catches error when accessing displosed treeview due to application shutdown -- Fix: An improved configuration setup with various smaller bug fixes. -- Fix: Due to lack of options with the MP scroll-control the default textcontrol is uses once again in the MyLyrics screen. - -Changes from version 0.12 to 0.13: -- Add: Improved log. Logging search information in every session of MyLyric from MP starts to it closes. Saved in log\MyLyrics.log. -- Fix: All threads are now aborted as intended when search finishes. Both in configuration and play mode. -- Fix: Proper cleanup of trace objects and log files when configuration is closed. -- Fix: Lyrics searches optimized in regards to both speed and hit ration. -- Fix: Some threads ended up in deadlock when changing google license key. -- Fix: Sometimes when a lyric was found an unsuccessful, and not the succesful lyric site, was written to the MyLyrics.log. -- Add: MyLyric screen search now only uses lyric sites selected in the configuration. -- Fix: Exception messages (e.g. when license key is announced invalid for the day) is no longer shown on screen. -- Fix: Bad library handling caused the configuration in some circumstances to crash on when trying to access the MyLyricsBatch log-file. Added: trunk/plugins/MyLyrics/My Lyrics/MediaPortalUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MediaPortalUtil.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MediaPortalUtil.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace MyLyrics +{ + class MediaPortalUtil + { + public static string[] GetStrippedPrefixStringArray() + { + string strippedPrefixes = ""; + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + strippedPrefixes = ((string)xmlreader.GetValueAsString("musicfiles", "artistprefixes", "the,les,die")).ToString(); + } + string[] strippedPrefixesArray = (string[])strippedPrefixes.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries); + + for (int i = 0; i < strippedPrefixesArray.Length; i++) + { + string temp = strippedPrefixesArray[i]; + strippedPrefixesArray[i] = LyricsEngine.LyricUtil.CapatalizeString(", " + temp.Trim()); + } + + return strippedPrefixesArray; + } + + public static string GetStrippedPrefixArtist(string artist, string[] strippedPrefixStringArray) + { + foreach (string s in strippedPrefixStringArray) + { + artist = artist.Replace(s, ""); + } + return artist; + } + } +} Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -42,6 +42,8 @@ bool m_automaticWriteToMusicTag = true; bool markedDatabase; + string[] m_strippedPrefixStrings = null; + List<string> sitesToSearch; LyricsLibrary parent = null; @@ -89,6 +91,8 @@ m_automaticWriteToMusicTag = xmlreader.GetValueAsBool("myLyrics", "automaticWriteToMusicTag", true); } + m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); + BeginSearchIfPossible(artist, title); this.ShowDialog(); } @@ -178,7 +182,7 @@ m_LyricControllerThread.Name = "lyricSearch Thread"; // looks nice in Output window m_LyricControllerThread.Start(); - lc.AddNewLyricSearch(artist, title); + lc.AddNewLyricSearch(artist, title, MediaPortalUtil.GetStrippedPrefixArtist(artist, m_strippedPrefixStrings)); } private void stopSearch() Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -36,6 +36,8 @@ int m_noOfSearchesToComplete = 0; int m_noOfSearchesCompleted = 0; + string[] m_strippedPrefixStrings = null; + bool m_lockButtons = true; Thread m_LyricControllerThread; @@ -252,6 +254,8 @@ sitesToSearch.Add("SeekLyrics"); } + m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); + m_EventStopThread = new ManualResetEvent(false); // If automaticUpdate is set then return after the first positive search @@ -561,7 +565,7 @@ m_noOfCurrentlySearches += 1; string[] lyricID = (string[])songs.Dequeue(); bw.ReportProgress(counter++); - lc.AddNewLyricSearch(lyricID[0], lyricID[1]); + lc.AddNewLyricSearch(lyricID[0], lyricID[1], MediaPortalUtil.GetStrippedPrefixArtist(lyricID[0], m_strippedPrefixStrings)); } Thread.Sleep(200); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -81,6 +81,8 @@ bool m_automaticWriteToMusicTag = true; + string[] m_strippedPrefixStrings; + const int m_NoOfCurrentSearchesAllowed = 6; int m_Limit = 100; @@ -183,6 +185,9 @@ MessageBox.Show("Something has gone wrong when reading Mediaportal.xml"); } } + + m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); + #endregion #region Serialzie/deserialize lyricsdatabases @@ -768,7 +773,8 @@ if (lc.NoOfCurrentSearches < m_NoOfCurrentSearchesAllowed && lc.StopSearches == false) { string[] lyricID = (string[])lyricConfigInfosQueue.Dequeue(); - lc.AddNewLyricSearch(lyricID[0], lyricID[1]); + + lc.AddNewLyricSearch(lyricID[0], lyricID[1], MediaPortalUtil.GetStrippedPrefixArtist(lyricID[0], m_strippedPrefixStrings)); } Thread.Sleep(100); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -74,6 +74,8 @@ string m_StatusText = ""; string m_LyricText = ""; + string[] m_strippedPrefixStrings = null; + bool lyricsFound = false; bool m_automaticWriteToMusicTag = true; @@ -328,6 +330,8 @@ skin = ((string)xmlreader.GetValueAsString("skin", "name", "BlueTwo")); } + m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); + ArrayList sitesToSearch = new ArrayList(); if (useLyricWiki && Setup.IsMember("LyricWiki")) { @@ -685,7 +689,7 @@ m_LyricControllerThread.Name = "lyricSearch Thread"; // looks nice in Output window m_LyricControllerThread.Start(); - lc.AddNewLyricSearch(m_artist, m_title); + lc.AddNewLyricSearch(m_artist, m_title, MediaPortalUtil.GetStrippedPrefixArtist(m_artist, m_strippedPrefixStrings)); } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-17 12:31:11 UTC (rev 1070) @@ -5,13 +5,12 @@ <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{BBB2DAE2-0D83-4B4B-85B6-D1B5A7E10039}</ProjectGuid> - <OutputType>Library</OutputType> + <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MyLyrics</RootNamespace> <AssemblyName>MyLyrics</AssemblyName> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> - <StartupObject> - </StartupObject> + <StartupObject>MyLyrics.MyLyricsSetup_test</StartupObject> <SignAssembly>false</SignAssembly> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> @@ -62,6 +61,7 @@ </ItemGroup> <ItemGroup> <Compile Include="Convert\ConvertFromXMLtoLyricsDatabase.cs" /> + <Compile Include="MediaPortalUtil.cs" /> <Compile Include="MyLyrics Configuration\ExportTags.cs"> <SubType>Form</SubType> </Compile> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-01-30 16:49:20
|
Revision: 55 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=55&view=rev Author: saamand Date: 2007-01-30 08:48:31 -0800 (Tue, 30 Jan 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs 2007-01-30 04:17:52 UTC (rev 54) +++ trunk/plugins/MyLyrics/LyricsEngine/Wiki.cs 2007-01-30 16:48:31 UTC (rev 55) @@ -33,7 +33,7 @@ IAsyncResult ar = del.BeginInvoke(this.artist, this.title, null, null); - while (noOfTries < 20) + while (noOfTries < 15) { // If the user has aborted stop the search and return (false) if (Abort) @@ -46,7 +46,8 @@ } else { - Thread.Sleep(500); + // if we don't allow this pause of 2 sec the webservice behaves in a strange maneur + Thread.Sleep(2000); } ++noOfTries; } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-01-30 04:17:52 UTC (rev 54) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-01-30 16:48:31 UTC (rev 55) @@ -152,8 +152,8 @@ startingScrollSpeedVertical = GUIGraphicsContext.ScrollSpeedVertical; GUIGraphicsContext.ScrollSpeedVertical = 1; - //LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Log)); - LyricDiagnostics.OpenLog(@"C:\Program Files\Team Mediaportal\MediaPortal\log"); + LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Log)); + //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Log)); LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens"); return true; } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-01-30 04:17:52 UTC (rev 54) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-01-30 16:48:31 UTC (rev 55) @@ -33,15 +33,15 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Core, Version=1.0.2583.1812, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="Core, Version=1.0.2546.32606, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Core.DLL</HintPath> </Reference> - <Reference Include="Databases, Version=1.0.2583.1816, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="Databases, Version=1.0.2546.32610, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Databases.DLL</HintPath> </Reference> - <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Plugins\Windows\Dialogs.DLL</HintPath> </Reference> @@ -50,7 +50,7 @@ <Reference Include="System.Drawing" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> - <Reference Include="Utils, Version=1.0.2583.1806, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="Utils, Version=1.0.2546.32604, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Utils.DLL</HintPath> </Reference> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-01-30 04:17:52 UTC (rev 54) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-01-30 16:48:31 UTC (rev 55) @@ -101,7 +101,7 @@ InitializeComponent(); LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Log)); - //LyricDiagnostics.OpenLog(@"C:\Program Files\Team Mediaportal\MediaPortal\log"); + //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Log)); lyricUC = new MyLyricsSetup_LyricsLibrary(this); this.tabPageLyricsDatabase.Controls.Add(lyricUC); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-02-04 12:36:30
|
Revision: 92 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=92&view=rev Author: saamand Date: 2007-02-04 04:36:28 -0800 (Sun, 04 Feb 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/LyricsEngine/GetGoogleSearchResult.cs trunk/plugins/MyLyrics/LyricsEngine/LyricConfigInfo.cs trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.Designer.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.settings trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/LyricsEngine/app.config trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricSiteTestUC.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs Modified: trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LRC/Properties/AssemblyInfo.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("0.13")] -[assembly: AssemblyFileVersion("0.13")] +[assembly: AssemblyVersion("0.14")] +[assembly: AssemblyFileVersion("0.14")] Modified: trunk/plugins/MyLyrics/LyricsEngine/GetGoogleSearchResult.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/GetGoogleSearchResult.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/GetGoogleSearchResult.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -9,13 +9,13 @@ { class GetGoogleSearchResult : IDisposable { - private LyricSearch m_LyricSearh; + private LyricSearch_GoogleSites m_LyricSearh; GetGoogleSearchResultsDelegate delSearch; IAsyncResult ar; public static bool Abort = false; // Constructor - public GetGoogleSearchResult(LyricSiteInfo siteInfo, LyricSearch lyricSearch2) + public GetGoogleSearchResult(LyricSiteInfo siteInfo, LyricSearch_GoogleSites lyricSearch2) { Thread.Sleep(1000); @@ -47,9 +47,8 @@ Google.GoogleSearchService s = new Google.GoogleSearchService(); return s.doGoogleSearch(key, q, start, maxResults, filter, restrict, safe, lr, ie, oe); } - catch (System.Net.WebException e) + catch (System.Net.WebException) { - //System.Windows.Forms.MessageBox.Show(e.ToString()); return null; } catch (System.Web.Services.Protocols.SoapException soapException) @@ -68,10 +67,8 @@ //Google.GoogleSearchResult searchResult = delSearch.EndInvoke delSearch = null; } - catch (Exception e) + catch (Exception) { - //System.Console.WriteLine(e.Message); - //delSearch = null; } System.Console.WriteLine("*****************************"); } @@ -106,9 +103,8 @@ m_LyricSearh.validateSearchResult(null, siteInfo); } } - catch (Exception e) + catch (Exception) { - //System.Windows.Forms.MessageBox.Show(e.ToString()); } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricConfigInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricConfigInfo.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricConfigInfo.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -10,15 +10,13 @@ internal string artist; internal string track; internal string extra; - internal string[] sitesToSearch; - public LyricConfigInfo(string licenseKey, string artist, string track, string extraInfo, params string[] sitesToSearch) + public LyricConfigInfo(string licenseKey, string artist, string track, string extraInfo) { this.licenseKey = licenseKey; this.artist = artist; this.track = track; - this.extra = extraInfo; - this.sitesToSearch = sitesToSearch; + this.extra = extraInfo;; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -7,7 +7,6 @@ using System.Threading; using System.IO; using System.Diagnostics; - using LyricsEngineConfig; using LyricsEngine; @@ -25,56 +24,71 @@ public class LyricController : IDisposable { - // form - //private AbstractLyricForm m_Form; private ILyricForm m_Form; - private bool m_MessageMode; - - private string m_GoogleLicenseKey = ""; - private bool m_StopSearches = false; - // status private static int noOfLyricsToSearch; - private static int noOfLyricsSearched; private static int noOfLyricsFound; private static int noOfLyricsNotFound; - // LyricController should control the used google license keys -> make it to an arraylist - private ArrayList m_GoogleLicenseKeysUsed = new ArrayList(); + private bool m_StopSearches = false; + public static event EventHandler StopTheSearchAndAbort = null; - //private Thread[] searchThreads = ArrayList threadList = new ArrayList(); ArrayList suspendedThreadList = new ArrayList(); + // Main thread sets this event to stop LyricController ManualResetEvent m_EventStop_LyricController; - // LyricController sets this event when it is stopped ManualResetEvent m_EventStopped_LyricController; - // Main thread sets this event to pause all LyricSearches public ManualResetEvent m_EventStop_LyricSearches; + // Variables related to GoogleSites + private ArrayList m_GoogleLicenseKeysUsed = new ArrayList(); + private string m_GoogleLicenseKey = ""; + private bool m_noMoreValidLicenseKeys = false; int m_managedThreadId = -1; - public static event EventHandler StopTheSearchAndAbort; - - private bool m_noMoreValidLicenseKeys = false; + // Lyric sites + private string[] lyricSites; + private string[] eastSites; + private string[] googleSites; - - - public LyricController(ILyricForm mainForm, ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped, bool messageMode) + public LyricController(ILyricForm mainForm, + ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped, + string[] lyricSites) { this.m_Form = mainForm; - this.m_MessageMode = messageMode; - // Reset counters - noOfLyricsToSearch = 1; - noOfLyricsSearched = 0; - noOfLyricsFound = 0; - noOfLyricsNotFound = 0; + LyricController.noOfLyricsToSearch = 1; + LyricController.noOfLyricsSearched = 0; + LyricController.noOfLyricsFound = 0; + LyricController.noOfLyricsNotFound = 0; + + this.lyricSites = lyricSites; + + // Sort the sites in easy and google sites + ArrayList easySitesArrayList = new ArrayList(); + ArrayList googleArrayList = new ArrayList(); + foreach (string site in lyricSites) + { + if (Setup.IsMemberOfEasySites(site)) + { + easySitesArrayList.Add(site); + } + if (Setup.IsMemberOfGoogleSites(site)) + { + googleArrayList.Add(site); + } + } + eastSites = (string[])easySitesArrayList.ToArray(typeof(string)); + LyricSearch_EasySites.EasySites = eastSites; + + googleSites = (string[])googleArrayList.ToArray(typeof(string)); + LyricSearch_GoogleSites.GoogleSites = googleSites; // initialize events m_EventStop_LyricController = eventStopThread; @@ -83,10 +97,10 @@ m_EventStop_LyricSearches = new ManualResetEvent(false); m_EventStop_LyricSearches.Set(); - LyricSearch.Abort = false; + LyricSearch_GoogleSites.Abort = false; } - // Function runs in worker thread and emulates long process. + public void Run() { // check if thread is cancelled @@ -115,10 +129,7 @@ } Thread.Sleep(500); - - // inform main thread that this thread stopped m_EventStopped_LyricController.Set(); - //finishThread(artist, title, "The search has ended", site); break; } } @@ -157,22 +168,41 @@ this.m_EventStopped_LyricController = eventThreadStopped; } - - public int addNewLyricSearch(LyricConfigInfo lyricConfigInfo) + public void addNewLyricSearch(LyricConfigInfo lyricConfigInfo) { - // create worker thread instance - ThreadStart job = delegate + if (eastSites.Length > 0) { - LyricSearch lyricSearch = new LyricSearch(m_EventStop_LyricController, m_EventStopped_LyricController, this); - lyricSearch.setLyricInfo(lyricConfigInfo.artist, lyricConfigInfo.track, lyricConfigInfo.extra, lyricConfigInfo.sitesToSearch); - lyricSearch.Run(); - }; - Thread lyricSearchThread = new Thread(job); - lyricSearchThread.Name = "lyricSearch for " + lyricConfigInfo.artist + " - " + lyricConfigInfo.track; // looks nice in Output window - lyricSearchThread.IsBackground = true; - lyricSearchThread.Start(); - threadList.Add(lyricSearchThread); - return noOfLyricsToSearch; + // create worker thread instance + ThreadStart easySitesThreadInstance = delegate + { + + LyricSearch_EasySites lyricSearch_EasySites = new LyricSearch_EasySites(m_EventStop_LyricController, m_EventStopped_LyricController, this); + lyricSearch_EasySites.setLyricInfo(lyricConfigInfo.artist, lyricConfigInfo.track, lyricConfigInfo.extra); + lyricSearch_EasySites.Run(); + }; + + Thread lyricSearchThread = new Thread(easySitesThreadInstance); + lyricSearchThread.Name = "BasicSearch for " + lyricConfigInfo.artist + " - " + lyricConfigInfo.track; // looks nice in Output window + lyricSearchThread.IsBackground = true; + lyricSearchThread.Start(); + threadList.Add(lyricSearchThread); + } + + if (googleSites.Length > 0) + { + ThreadStart googleSitesThreadInstance = delegate + { + LyricSearch_GoogleSites lyricSearch_GoogleSites = new LyricSearch_GoogleSites(m_EventStop_LyricController, m_EventStopped_LyricController, this); + lyricSearch_GoogleSites.setLyricInfo(lyricConfigInfo.artist, lyricConfigInfo.track, lyricConfigInfo.extra); + lyricSearch_GoogleSites.Run(); + }; + + Thread lyricSearchThread = new Thread(googleSitesThreadInstance); + lyricSearchThread.Name = "GoogleSearch for " + lyricConfigInfo.artist + " - " + lyricConfigInfo.track; // looks nice in Output window + lyricSearchThread.IsBackground = true; + lyricSearchThread.Start(); + threadList.Add(lyricSearchThread); + } } public void suspendAllSearchThreadsExceptMe(int managedThreadId) @@ -212,8 +242,6 @@ { return false; } - - return true; } internal void updateString(String message, String site) @@ -233,7 +261,7 @@ m_Form.UpdateStatus = new Object[] { noOfLyricsToSearch, noOfLyricsSearched, noOfLyricsFound, noOfLyricsNotFound }; - if (noOfLyricsSearched >= noOfLyricsToSearch && lyricFound == false) + if (noOfLyricsSearched >= noOfLyricsToSearch) { finishThread(artist, title, "All songs have been searched!", site); } @@ -270,14 +298,6 @@ m_Form.ThreadException = s; } - public bool isMessageMode - { - get - { - return m_MessageMode; - } - } - public string GoogleLicenseKey { get { return m_GoogleLicenseKey; } @@ -292,14 +312,14 @@ { m_StopSearches = true; m_EventStop_LyricSearches.Reset(); - LyricSearch.Abort = true; + LyricSearch_GoogleSites.Abort = true; //StopTheSearchAndAbort.Invoke(this, EventArgs.Empty); } else { m_StopSearches = false; m_EventStop_LyricSearches.Set(); - LyricSearch.Abort = false; + LyricSearch_GoogleSites.Abort = false; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-02-04 12:36:28 UTC (rev 92) @@ -40,6 +40,7 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="LyricSearch_EasySites.cs" /> <Compile Include="LyricDiagnostics.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="GetGoogleSearchResult.cs" /> @@ -53,7 +54,7 @@ <LastGenOutput>Resources.Designer.cs</LastGenOutput> <SubType>Designer</SubType> </EmbeddedResource> - <Compile Include="LyricSearch.cs" /> + <Compile Include="LyricSearch_GoogleSites.cs" /> <Compile Include="LyricUtil.cs" /> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -26,7 +26,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.13")] +[assembly: AssemblyVersion("0.14")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.Designer.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.Designer.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -42,5 +42,15 @@ return ((string)(this["LyricsEngine_org_lyricwiki_LyricWiki"])); } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] + [global::System.Configuration.DefaultSettingValueAttribute("http://api.google.com/search/beta2")] + public string MyLyrics_Google_GoogleSearchService { + get { + return ((string)(this["MyLyrics_Google_GoogleSearchService"])); + } + } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.settings =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.settings 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/Settings.settings 2007-02-04 12:36:28 UTC (rev 92) @@ -8,5 +8,8 @@ <Setting Name="LyricsEngine_org_lyricwiki_LyricWiki" Type="(Web Service URL)" Scope="Application"> <Value Profile="(Default)">http://lyricwiki.org/server.php</Value> </Setting> + <Setting Name="MyLyrics_Google_GoogleSearchService" Type="(Web Service URL)" Scope="Application"> + <Value Profile="(Default)">http://api.google.com/search/beta2</Value> + </Setting> </Settings> </SettingsFile> \ No newline at end of file Modified: trunk/plugins/MyLyrics/LyricsEngine/Setup.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -1,14 +1,19 @@ using System; -using System.Collections.Generic; +using System.Collections; using System.Text; namespace LyricsEngineConfig { public static class Setup { - public static string[] accessibleLyricSites = new string[9-2] + public static string[] EasySites = new string[2] { "LyricWiki", + "EvilLabs" + }; + + public static string[] GoogleSites = new string[8 - 2] + { "Sing365", "LyricsMania", "Lyrics007", @@ -19,19 +24,34 @@ //"MusicMadeMe", }; - public static int GetNoOfAccessibleLyricSites() + public static string[] AllSites() { - return accessibleLyricSites.Length; + ArrayList allSites = new ArrayList(); + allSites.AddRange(EasySites); + allSites.AddRange(GoogleSites); + string[] allSitesArray = (string[])allSites.ToArray(typeof(string)); + return allSitesArray; } - public static int GetIndex(string value) + public static bool IsMember(string value) { - return System.Array.IndexOf(Setup.accessibleLyricSites, value); + return (System.Array.IndexOf(Setup.EasySites, value) != -1 + || System.Array.IndexOf(Setup.GoogleSites, value) != -1); } - public static bool IsMember(string value) + public static bool IsMemberOfEasySites(string value) { - return System.Array.IndexOf(Setup.accessibleLyricSites, value) != -1; + return System.Array.IndexOf(Setup.EasySites, value) != -1; } + + public static bool IsMemberOfGoogleSites(string value) + { + return System.Array.IndexOf(Setup.GoogleSites, value) != -1; + } + + public static int NoOfSites() + { + return EasySites.Length + GoogleSites.Length; + } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/app.config =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/app.config 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/LyricsEngine/app.config 2007-02-04 12:36:28 UTC (rev 92) @@ -13,6 +13,9 @@ <setting name="LyricsEngine_org_lyricwiki_LyricWiki" serializeAs="String"> <value>http://lyricwiki.org/server.php</value> </setting> + <setting name="MyLyrics_Google_GoogleSearchService" serializeAs="String"> + <value>http://api.google.com/search/beta2</value> + </setting> </LyricsEngine.Properties.Settings> </applicationSettings> </configuration> \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -27,24 +27,19 @@ public class GUIMyLyrics : GUIWindow, ILyricForm, ISetupForm { + #region Fields that is consisted and related to the MP session, and not MyLyrics session public static int WINDOW_MYLYRICS = 90478; int m_GoogleLicenseKeyIndex = 0; const int MAX_NO_OF_LICENSE_KEYS = 5; string[] m_GoogleLicenseKeys = new String[5] { "", "", "", "", "" }; int startingScrollSpeedVertical = 2; - - - LRC.SimpleLRC lrc; - IEnumerator enumerator; - System.Windows.Forms.Timer timer; - Stopwatch stopwatch; - string nextTimeToShow; - string nextLineToShow; - int lineCounter; + bool googlePopUpMessageShown = false; const int SHIFT_WHEN_HIT = 10; + #endregion - bool googlePopUpMessageShown = false; - + #region Fields related to the skin engine + [SkinControlAttribute(20)] + protected GUITextScrollUpControl CONTROL_Lyric = null; enum Controls { CONTROL_BACKGROUND = 1, @@ -52,9 +47,17 @@ CONTROL_LBStatus = 11, CONTROL_Lyric = 20 } + #endregion - [SkinControlAttribute(20)] - protected GUITextScrollUpControl CONTROL_Lyric = null; + #region Fields related to the MyLyrics, and therefore will be reset after each MyLyrics session + bool exitingMyLyrics = false; + LRC.SimpleLRC lrc; + IEnumerator enumerator; + System.Windows.Forms.Timer timer; + Stopwatch stopwatch; + string nextTimeToShow; + string nextLineToShow; + int lineCounter; // worker thread Thread m_LyricControllerThread; @@ -63,7 +66,6 @@ // events used to stop worker thread ManualResetEvent m_EventStopThread; ManualResetEvent m_EventThreadStopped; - //bool m_lyricControllerThreadIsReady = true; // Track info string m_artist = ""; @@ -73,11 +75,11 @@ string m_LyricText = ""; string m_Path = ""; - static bool lyricsFound = false; + bool lyricsFound = false; String[] m_sitesToSearch; + #endregion - public GUIMyLyrics() { m_EventStopThread = new ManualResetEvent(false); @@ -138,14 +140,41 @@ base.OnAction(action); } + private void resetAll() + { + exitingMyLyrics = true; + m_artist = ""; + m_title = ""; + m_TrackText = ""; + m_StatusText = ""; + m_LyricText = ""; + m_Path = ""; + lyricsFound = false; + m_LyricControllerThread = null; + lc = null; + m_sitesToSearch = null; + resetLrcFields(); + } + private void resetLrcFields() + { + if (timer != null) + timer.Dispose(); + if (stopwatch != null) + stopwatch.Reset(); + nextTimeToShow = ""; + nextLineToShow = ""; + lineCounter = 0; + } + public override bool OnMessage(GUIMessage message) { switch (message.Message) { case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: { + exitingMyLyrics = false; base.OnMessage(message); LoadSettings(); @@ -162,6 +191,7 @@ { SaveSettings(); StopThread(); + resetAll(); GUIGraphicsContext.ScrollSpeedVertical = startingScrollSpeedVertical; LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics closes"); } @@ -178,7 +208,7 @@ public override void Process() { - if (isNewTrack()) + if (isNewTrack() && exitingMyLyrics == false) { lyricsFound = false; StopThread(); @@ -204,7 +234,7 @@ GUIControl.ClearControl(GetID, (int)Controls.CONTROL_Lyric); GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); - bool useSing365, useLyricsHosting, useLyricsMania, useSongMeanings, useLyricsFreak, useMMMD, useLeosLyrics, useLyrics007, useLyricWiki; + bool useSing365, useLyricsHosting, useLyricsMania, useSongMeanings, useLyricsFreak, useMMMD, useLeosLyrics, useLyrics007, useLyricWiki, useEvilLabs; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { @@ -223,6 +253,7 @@ useLeosLyrics = ((string)xmlreader.GetValueAsString("myLyrics", "useLeosLyrics", "False")).ToString().Equals("True") ? true : false; useLyrics007 = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "False")).ToString().Equals("True") ? true : false; useLyricWiki = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; + useEvilLabs = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false; } ArrayList sitesToSearch = new ArrayList(); @@ -263,6 +294,10 @@ { sitesToSearch.Add("LyricWiki"); } + if (useEvilLabs && Setup.IsMember("EvilLabs")) + { + sitesToSearch.Add("EvilLabs"); + } m_sitesToSearch = (string[])sitesToSearch.ToArray(typeof(string)); } @@ -295,17 +330,25 @@ LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "findLyric(" + m_artist + ", " + m_title + ")"); /* The search order for a lyric of the currently played file is as follows: + 1) LRC in music tag 1) LRC in database 2) Lyric in music tag 3) Lyric in database 4) Search the Internet */ - // 1) Check if LRC in Database + // 1) + 2) Check if LRC in music tag or Database string lyricText = MyLyrics.MyLyricsUtil.LookUpLyricInDatabase(m_artist, m_title); - if (!lyricText.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, lyricText)).IsValid) + if ((!tag.Lyrics.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, tag.Lyrics)).IsValid) + || (!lyricText.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, lyricText)).IsValid)) { + + resetLrcFields(); + + m_StatusText = ""; + GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); + if (lrc == null) { MessageBox.Show("The lrc-file couldn't not be read properly." + Environment.NewLine + "The reading of the files was suspended."); @@ -362,7 +405,7 @@ { lyricsFound = false; - lc = new LyricController(this, m_EventStopThread, m_EventThreadStopped, false); + lc = new LyricController(this, m_EventStopThread, m_EventThreadStopped, m_sitesToSearch); // create worker thread instance ThreadStart job = delegate { @@ -375,7 +418,7 @@ lc.GoogleLicenseKey = m_GoogleLicenseKeys[m_GoogleLicenseKeyIndex]; - LyricConfigInfo lyricConfigInfo = new LyricConfigInfo(lc.GoogleLicenseKey, m_artist, m_title, "lyrics", m_sitesToSearch); + LyricConfigInfo lyricConfigInfo = new LyricConfigInfo(lc.GoogleLicenseKey, m_artist, m_title, "lyrics"); lc.addNewLyricSearch(lyricConfigInfo); } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -92,15 +92,8 @@ this.tbLicenseKey1 = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbGoogleLicenceKey = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.cbLyricsHosting = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLeosLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbEvilLabs = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyricsMania = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbSing365 = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbSongMeaning = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyricsFreak = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbMMMD = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.gbGenerel = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.lbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbSongsLimit = new MediaPortal.UserInterface.Controls.MPLabel(); @@ -112,6 +105,15 @@ this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); this.bgWorkerTestWebservices = new System.ComponentModel.BackgroundWorker(); this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); + this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.cbLyricsHosting = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLeosLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricsMania = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbSing365 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbSongMeaning = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricsFreak = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbMMMD = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.tabControl.SuspendLayout(); this.tabPageDatabase.SuspendLayout(); this.gbGoogleLicKeyStatuses.SuspendLayout(); @@ -124,6 +126,7 @@ this.gbLyricSites.SuspendLayout(); this.gbGenerel.SuspendLayout(); this.gbLicenseKeyHelp.SuspendLayout(); + this.mpGroupBox1.SuspendLayout(); this.SuspendLayout(); // // tabControl @@ -622,6 +625,7 @@ // // tabPageSetup // + this.tabPageSetup.Controls.Add(this.mpGroupBox1); this.tabPageSetup.Controls.Add(this.gbSettings); this.tabPageSetup.Controls.Add(this.gbLyricSites); this.tabPageSetup.Controls.Add(this.gbGenerel); @@ -742,124 +746,42 @@ // gbLyricSites // this.gbLyricSites.AutoSize = true; - this.gbLyricSites.Controls.Add(this.cbLyricsHosting); - this.gbLyricSites.Controls.Add(this.cbLeosLyrics); + this.gbLyricSites.Controls.Add(this.cbEvilLabs); this.gbLyricSites.Controls.Add(this.cbLyricWiki); - this.gbLyricSites.Controls.Add(this.cbLyricsMania); - this.gbLyricSites.Controls.Add(this.cbLyrics007); - this.gbLyricSites.Controls.Add(this.cbSing365); - this.gbLyricSites.Controls.Add(this.cbSongMeaning); - this.gbLyricSites.Controls.Add(this.cbLyricsFreak); - this.gbLyricSites.Controls.Add(this.cbMMMD); this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.gbLyricSites.Location = new System.Drawing.Point(3, 62); this.gbLyricSites.Name = "gbLyricSites"; - this.gbLyricSites.Size = new System.Drawing.Size(517, 101); + this.gbLyricSites.Size = new System.Drawing.Size(124, 102); this.gbLyricSites.TabIndex = 28; this.gbLyricSites.TabStop = false; - this.gbLyricSites.Text = "Lyric sites to search"; + this.gbLyricSites.Text = "Basic lyric sites"; // - // cbLyricsHosting + // cbEvilLabs // - this.cbLyricsHosting.AutoSize = true; - this.cbLyricsHosting.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyricsHosting.Location = new System.Drawing.Point(366, 65); - this.cbLyricsHosting.Name = "cbLyricsHosting"; - this.cbLyricsHosting.Size = new System.Drawing.Size(90, 17); - this.cbLyricsHosting.TabIndex = 10; - this.cbLyricsHosting.Text = "Lyrics Hosting"; - this.cbLyricsHosting.UseVisualStyleBackColor = true; + this.cbEvilLabs.AutoSize = true; + this.cbEvilLabs.Checked = true; + this.cbEvilLabs.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbEvilLabs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbEvilLabs.Location = new System.Drawing.Point(16, 43); + this.cbEvilLabs.Name = "cbEvilLabs"; + this.cbEvilLabs.Size = new System.Drawing.Size(67, 17); + this.cbEvilLabs.TabIndex = 3; + this.cbEvilLabs.Text = "Evil Labs"; + this.cbEvilLabs.UseVisualStyleBackColor = true; // - // cbLeosLyrics - // - this.cbLeosLyrics.AutoSize = true; - this.cbLeosLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLeosLyrics.Location = new System.Drawing.Point(208, 43); - this.cbLeosLyrics.Name = "cbLeosLyrics"; - this.cbLeosLyrics.Size = new System.Drawing.Size(79, 17); - this.cbLeosLyrics.TabIndex = 6; - this.cbLeosLyrics.Text = "Leo\'s Lyrics"; - this.cbLeosLyrics.UseVisualStyleBackColor = true; - // // cbLyricWiki // this.cbLyricWiki.AutoSize = true; 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(49, 21); + this.cbLyricWiki.Location = new System.Drawing.Point(16, 21); this.cbLyricWiki.Name = "cbLyricWiki"; this.cbLyricWiki.Size = new System.Drawing.Size(67, 17); this.cbLyricWiki.TabIndex = 2; this.cbLyricWiki.Text = "LyricWiki"; this.cbLyricWiki.UseVisualStyleBackColor = true; // - // cbLyricsMania - // - this.cbLyricsMania.AutoSize = true; - this.cbLyricsMania.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyricsMania.Location = new System.Drawing.Point(49, 43); - this.cbLyricsMania.Name = "cbLyricsMania"; - this.cbLyricsMania.Size = new System.Drawing.Size(83, 17); - this.cbLyricsMania.TabIndex = 3; - this.cbLyricsMania.Text = "Lyrics Mania"; - this.cbLyricsMania.UseVisualStyleBackColor = true; - // - // cbLyrics007 - // - this.cbLyrics007.AutoSize = true; - this.cbLyrics007.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyrics007.Location = new System.Drawing.Point(208, 21); - this.cbLyrics007.Name = "cbLyrics007"; - this.cbLyrics007.Size = new System.Drawing.Size(69, 17); - this.cbLyrics007.TabIndex = 5; - this.cbLyrics007.Text = "Lyrics007"; - this.cbLyrics007.UseVisualStyleBackColor = true; - // - // cbSing365 - // - this.cbSing365.AutoSize = true; - this.cbSing365.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbSing365.Location = new System.Drawing.Point(49, 65); - this.cbSing365.Name = "cbSing365"; - this.cbSing365.Size = new System.Drawing.Size(63, 17); - this.cbSing365.TabIndex = 4; - this.cbSing365.Text = "Sing365"; - this.cbSing365.UseVisualStyleBackColor = true; - // - // cbSongMeaning - // - this.cbSongMeaning.AutoSize = true; - this.cbSongMeaning.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbSongMeaning.Location = new System.Drawing.Point(366, 21); - this.cbSongMeaning.Name = "cbSongMeaning"; - this.cbSongMeaning.Size = new System.Drawing.Size(93, 17); - this.cbSongMeaning.TabIndex = 8; - this.cbSongMeaning.Text = "Song Meaning"; - this.cbSongMeaning.UseVisualStyleBackColor = true; - // - // cbLyricsFreak - // - this.cbLyricsFreak.AutoSize = true; - this.cbLyricsFreak.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyricsFreak.Location = new System.Drawing.Point(208, 65); - this.cbLyricsFreak.Name = "cbLyricsFreak"; - this.cbLyricsFreak.Size = new System.Drawing.Size(81, 17); - this.cbLyricsFreak.TabIndex = 7; - this.cbLyricsFreak.Text = "Lyrics Freak"; - this.cbLyricsFreak.UseVisualStyleBackColor = true; - // - // cbMMMD - // - this.cbMMMD.AutoSize = true; - this.cbMMMD.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbMMMD.Location = new System.Drawing.Point(366, 43); - this.cbMMMD.Name = "cbMMMD"; - this.cbMMMD.Size = new System.Drawing.Size(94, 17); - this.cbMMMD.TabIndex = 9; - this.cbMMMD.Text = "MusicMadeMe"; - this.cbMMMD.UseVisualStyleBackColor = true; - // // gbGenerel // this.gbGenerel.Controls.Add(this.lbLimit); @@ -885,7 +807,7 @@ // lbSongsLimit // this.lbSongsLimit.AutoSize = true; - this.lbSongsLimit.Location = new System.Drawing.Point(6, 21); + this.lbSongsLimit.Location = new System.Drawing.Point(13, 22); this.lbSongsLimit.Name = "lbSongsLimit"; this.lbSongsLimit.Size = new System.Drawing.Size(340, 13); this.lbSongsLimit.TabIndex = 12; @@ -925,9 +847,9 @@ // // labelPluginBannerHint // - this.labelPluginBannerHint.Location = new System.Drawing.Point(11, 20); + this.labelPluginBannerHint.Location = new System.Drawing.Point(13, 20); this.labelPluginBannerHint.Name = "labelPluginBannerHint"; - this.labelPluginBannerHint.Size = new System.Drawing.Size(489, 43); + this.labelPluginBannerHint.Size = new System.Drawing.Size(484, 43); this.labelPluginBannerHint.TabIndex = 17; this.labelPluginBannerHint.Text = resources.GetString("labelPluginBannerHint.Text"); // @@ -964,11 +886,118 @@ this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); // + // mpGroupBox1 + // + this.mpGroupBox1.AutoSize = true; + this.mpGroupBox1.Controls.Add(this.cbLyricsHosting); + this.mpGroupBox1.Controls.Add(this.cbLeosLyrics); + this.mpGroupBox1.Controls.Add(this.cbLyricsMania); + this.mpGroupBox1.Controls.Add(this.cbLyrics007); + this.mpGroupBox1.Controls.Add(this.cbSing365); + this.mpGroupBox1.Controls.Add(this.cbSongMeaning); + this.mpGroupBox1.Controls.Add(this.cbLyricsFreak); + this.mpGroupBox1.Controls.Add(this.cbMMMD); + this.mpGroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.mpGroupBox1.Location = new System.Drawing.Point(133, 62); + this.mpGroupBox1.Name = "mpGroupBox1"; + this.mpGroupBox1.Size = new System.Drawing.Size(381, 102); + this.mpGroupBox1.TabIndex = 29; + this.mpGroupBox1.TabStop = false; + this.mpGroupBox1.Text = "Lyric sites dependent of Google webservice"; + // + // cbLyricsHosting + // + this.cbLyricsHosting.AutoSize = true; + this.cbLyricsHosting.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyricsHosting.Location = new System.Drawing.Point(250, 44); + this.cbLyricsHosting.Name = "cbLyricsHosting"; + this.cbLyricsHosting.Size = new System.Drawing.Size(90, 17); + this.cbLyricsHosting.TabIndex = 18; + this.cbLyricsHosting.Text = "Lyrics Hosting"; + this.cbLyricsHosting.UseVisualStyleBackColor = true; + // + // cbLeosLyrics + // + this.cbLeosLyrics.AutoSize = true; + this.cbLeosLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLeosLyrics.Location = new System.Drawing.Point(136, 21); + this.cbLeosLyrics.Name = "cbLeosLyrics"; + this.cbLeosLyrics.Size = new System.Drawing.Size(79, 17); + this.cbLeosLyrics.TabIndex = 14; + this.cbLeosLyrics.Text = "Leo\'s Lyrics"; + this.cbLeosLyrics.UseVisualStyleBackColor = true; + // + // cbLyricsMania + // + this.cbLyricsMania.AutoSize = true; + this.cbLyricsMania.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyricsMania.Location = new System.Drawing.Point(16, 21); + this.cbLyricsMania.Name = "cbLyricsMania"; + this.cbLyricsMania.Size = new System.Drawing.Size(83, 17); + this.cbLyricsMania.TabIndex = 11; + this.cbLyricsMania.Text = "Lyrics Mania"; + this.cbLyricsMania.UseVisualStyleBackColor = true; + // + // cbLyrics007 + // + this.cbLyrics007.AutoSize = true; + this.cbLyrics007.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyrics007.Location = new System.Drawing.Point(16, 66); + this.cbLyrics007.Name = "cbLyrics007"; + this.cbLyrics007.Size = new System.Drawing.Size(69, 17); + this.cbLyrics007.TabIndex = 13; + this.cbLyrics007.Text = "Lyrics007"; + this.cbLyrics007.UseVisualStyleBackColor = true; + // + // cbSing365 + // + this.cbSing365.AutoSize = true; + this.cbSing365.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbSing365.Location = new System.Drawing.Point(16, 43); + this.cbSing365.Name = "cbSing365"; + this.cbSing365.Size = new System.Drawing.Size(63, 17); + this.cbSing365.TabIndex = 12; + this.cbSing365.Text = "Sing365"; + this.cbSing365.UseVisualStyleBackColor = true; + // + // cbSongMeaning + // + this.cbSongMeaning.AutoSize = true; + this.cbSongMeaning.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbSongMeaning.Location = new System.Drawing.Point(136, 65); + this.cbSongMeaning.Name = "cbSongMeaning"; + this.cbSongMeaning.Size = new System.Drawing.Size(93, 17); + this.cbSongMeaning.TabIndex = 16; + this.cbSongMeaning.Text = "Song Meaning"; + this.cbSongMeaning.UseVisualStyleBackColor = true; + // + // cbLyricsFreak + // + this.cbLyricsFreak.AutoSize = true; + this.cbLyricsFreak.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyricsFreak.Location = new System.Drawing.Point(136, 44); + this.cbLyricsFreak.Name = "cbLyricsFreak"; + this.cbLyricsFreak.Size = new System.Drawing.Size(81, 17); + this.cbLyricsFreak.TabIndex = 15; + this.cbLyricsFreak.Text = "Lyrics Freak"; + this.cbLyricsFreak.UseVisualStyleBackColor = true; + // + // cbMMMD + // + this.cbMMMD.AutoSize = true; + this.cbMMMD.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbMMMD.Location = new System.Drawing.Point(250, 21); + this.cbMMMD.Name = "cbMMMD"; + this.cbMMMD.Size = new System.Drawing.Size(94, 17); + this.cbMMMD.TabIndex = 17; + this.cbMMMD.Text = "MusicMadeMe"; + this.cbMMMD.UseVisualStyleBackColor = true; + // // MyLyricsSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(530, 562); + this.ClientSize = new System.Drawing.Size(531, 562); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); @@ -997,6 +1026,8 @@ this.gbGenerel.ResumeLayout(false); this.gbGenerel.PerformLayout(); this.gbLicenseKeyHelp.ResumeLayout(false); + this.mpGroupBox1.ResumeLayout(false); + this.mpGroupBox1.PerformLayout(); this.ResumeLayout(false); } @@ -1053,15 +1084,7 @@ private MediaPortal.UserInterface.Controls.MPTextBox lbLimit; private MediaPortal.UserInterface.Controls.MPLabel lbSongsLimit; private MediaPortal.UserInterface.Controls.MPGroupBox gbLyricSites; - internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsHosting; - internal MediaPortal.UserInterface.Controls.MPCheckBox cbLeosLyrics; internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricWiki; - internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsMania; - internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyrics007; - internal MediaPortal.UserInterface.Controls.MPCheckBox cbSing365; - internal MediaPortal.UserInterface.Controls.MPCheckBox cbSongMeaning; - internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsFreak; - internal MediaPortal.UserInterface.Controls.MPCheckBox cbMMMD; private MediaPortal.UserInterface.Controls.MPTabPage tabPageDatabase; private MediaPortal.UserInterface.Controls.MPGroupBox gbMusicDBSearch; private MediaPortal.UserInterface.Controls.MPCheckBox cbDisregardVariousArtist; @@ -1086,5 +1109,15 @@ private MediaPortal.UserInterface.Controls.MPLabel lbGoogleLicenceKey; private MediaPortal.UserInterface.Controls.MPLabel labelPluginBannerHint; private MediaPortal.UserInterface.Controls.MPLabel mpLabel6; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbEvilLabs; + private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox1; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsHosting; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLeosLyrics; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsMania; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyrics007; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbSing365; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbSongMeaning; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsFreak; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbMMMD; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -80,7 +80,7 @@ bool m_DisregardMarkedLyric = true; int m_noOfCurrentlySearches = 0; - const int m_NoOfCurrentSearchesAllowed = 10; + const int m_NoOfCurrentSearchesAllowed = 1; int m_Limit = 100; ArrayList songs = new ArrayList(); @@ -90,8 +90,8 @@ MyLyricsSetup_LyricsLibrary lyricUC; - - + string[] sitesToSearchArray = null; + // worker thread Thread m_LyricControllerThread; @@ -134,6 +134,7 @@ cbLeosLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLeosLyrics", "False")).ToString().Equals("True") ? true : false; cbLyrics007.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "False")).ToString().Equals("True") ? true : false; cbLyricWiki.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; + cbEvilLabs.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false; if (Setup.IsMember("Sing365") == false) { @@ -180,8 +181,11 @@ cbLyricWiki.Checked = false; cbLyricWiki.Enabled = false; } - - + if (Setup.IsMember("EvilLabs") == false) + { + cbEvilLabs.Checked = false; + cbEvilLabs.Enabled = false; + } } catch { MessageBox.Show("Something has gone wrong when reading Mediaportal.xml"); @@ -253,6 +257,7 @@ xmlwriter.SetValue("myLyrics", "useLeosLyrics", cbLeosLyrics.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useLyrics007", cbLyrics007.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useLyricWiki", cbLyricWiki.Checked.ToString()); + xmlwriter.SetValue("myLyrics", "useEvilLabs", cbEvilLabs.Checked.ToString()); xmlwriter.SetValue("myLyrics", "googleLicenseKey1", tbLicenseKey1.Text); xmlwriter.SetValue("myLyrics", "googleLicenseKey2", tbLicenseKey2.Text); xmlwriter.SetValue("myLyrics", "googleLicenseKey3", tbLicenseKey3.Text); @@ -297,6 +302,7 @@ { isSearching(true); lbStep1a.Text = "The collecting of songs has started."; + lbStep2a.Text = ""; MusicDatabase dbs = new MusicDatabase(); m_TotalTitles = dbs.GetNumOfSongs(); @@ -314,6 +320,7 @@ btImportAll.Enabled = false; progressBar.Enabled = true; + progressBar.Value = 0; progressBar.Maximum = m_TotalTitles; logFullFileName = Config.GetFile(Config.Dir.Log, logFileName); @@ -352,6 +359,31 @@ lbLyricsFound2.Text = "-"; lbLyricsNotFound2.Text = "-"; + ArrayList sitesToSearch = new ArrayList(); + + if (cbSing365.Checked) + sitesToSearch.Add("Sing365"); + if (cbLyricsHosting.Checked) + sitesToSearch.Add("LyricsHosting"); + if (cbLyricsMania.Checked) + sitesToSearch.Add("LyricsMania"); + if (cbSongMeaning.Checked) + sitesToSearch.Add("SongMeanings"); + if (cbLyricsFreak.Checked) + sitesToSearch.Add("LyricsFreak"); + if (cbMMMD.Checked) + sitesToSearch.Add("MusicMadeMe"); + if (cbLeosLyrics.Checked) + sitesToSearch.Add("LeosLyrics"); + if (cbLyrics007.Checked) + sitesToSearch.Add("Lyrics007"); + if (cbLyricWiki.Checked) + sitesToSearch.Add("LyricWiki"); + if (cbEvilLabs.Checked) + sitesToSearch.Add("EvilLabs"); + + sitesToSearchArray = (string[])sitesToSearch.ToArray(typeof(string)); + m_EventStopThread.Reset(); m_EventThreadStopped.Reset(); @@ -435,10 +467,14 @@ // Called from worker thread using delegate and Control.Invoke private void ThreadFinishedMethod(String artist, String title, String message, String site) { - lc.StopSearches = true; + if (lc != null) + { + lc.StopSearches = true; + } StopThread(); progressBar.ResetText(); progressBar.Enabled = false; + lbStep1a.Text = "Completed"; lbStep2a.Text = "Completed"; lbMessage.Text = "#" + ((int)(++m_noOfMessages)).ToString() + " - " + message + "\r\n" + lbMessage.Text + "\r\n"; btImportAll.Enabled = true; @@ -558,22 +594,6 @@ } #endregion - private string[] sitesToSearch() - { - ArrayList sitesToSearch = new ArrayList(); - if (cbLyricWiki.Checked) sitesToSearch.Add("LyricWiki"); - if (cbLyricsMania.Checked) sitesToSearch.Add("LyricsMania"); - if (cbSing365.Checked) sitesToSearch.Add("Sing365"); - if (cbLyrics007.Checked) sitesToSearch.Add("Lyrics007"); - if (cbLeosLyrics.Checked) sitesToSearch.Add("LeosLyrics"); - if (cbLyricsFreak.Checked) sitesToSearch.Add("LyricsFreak"); - if (cbSongMeaning.Checked) sitesToSearch.Add("SongMeanings"); - if (cbMMMD.Checked) sitesToSearch.Add("MusicMadeMe"); - if (cbLyricsHosting.Checked) sitesToSearch.Add("LyricsHosting"); - - return (string[])sitesToSearch.ToArray("".GetType()); - } - private void bgrWorkerTestWebservices_DoWork(object sender, DoWorkEventArgs e) { // Thread.CurrentThread.Name = "bgWorker - TestWebservices"; @@ -759,7 +779,7 @@ goto startSearch; } - LyricConfigInfo lyricConfigInfo = new LyricConfigInfo(m_GoogleLicenseKeys[m_GoogleLicenseKeyIndex], song.Artist, song.Title, "lyrics", sitesToSearch()); + LyricConfigInfo lyricConfigInfo = new LyricConfigInfo(m_GoogleLicenseKeys[m_GoogleLicenseKeyIndex], song.Artist, song.Title, "lyrics"); lyricConfigInfosQueue.Enqueue(lyricConfigInfo); } else if (status.Equals(MyLyricsUtil.LYRIC_FOUND)) @@ -776,7 +796,7 @@ } } - startSearch: + startSearch: # endregion @@ -785,9 +805,9 @@ if (lyricConfigInfosQueue.Count > 0) { // start running the lyricController - lc = new LyricController(this, m_EventStopThread, m_EventThreadStopped, false); + lc = new LyricController(this, m_EventStopThread, m_EventThreadStopped, sitesToSearchArray); - lc.NoOfLyricsToSearch = m_Limit; + lc.NoOfLyricsToSearch = lyricConfigInfosQueue.Count; ThreadStart runLyricController = delegate { lc.Run(); @@ -812,6 +832,10 @@ Thread.Sleep(100); } } + else + { + ThreadFinished = new string[] { "", "", "There is no titles to search", "" }; + } #endregion } @@ -820,7 +844,7 @@ lbSongsWithMark2.Text = m_SongsWithMark.ToString(); lbSongsWithLyric2.Text = m_SongsWithLyric.ToString(); lbDisregardedSongs2.Text = m_DisregardedSongs.ToString(); - lbSongsToSearch2.Text = m_SongsNotKnown > 0 ? ((int)(m_SongsNotKnown - 1)).ToString() : "0"; + lbSongsToSearch2.Text = m_SongsNotKnown > 0 ? ((int)(m_SongsNotKnown)).ToString() : "0"; if (e.ProgressPercentage == -1) { @@ -846,6 +870,8 @@ lc.finishThread(m_artist, m_track, "The search has been cancelled by the user.", "none"); lc.Dispose(); lc = null; + progressBar.ResetText(); + progressBar.Value = 0; m_LyricControllerThread = null; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-02-04 12:36:28 UTC (rev 92) @@ -118,7 +118,7 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="labelPluginBannerHint.Text" xml:space="preserve"> - <value>The Google Web service is a free service which offers the users to query billions of web pages directly from their own computer programs. To use a lyric site other than LyricWiki, you have to apply for at least one license key.</value> + <value>The Google Web service is a free service which offers the users to query billions of web pages directly from their own computer programs. If no google license key is applied you won't be able to use the lyric sites that is dependent of the Google webservice.</value> </data> <metadata name="bgWorkerTestWebservices.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-02-04 08:11:20 UTC (rev 91) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-02-04 12:36:28 UTC (rev 92) @@ -36,8 +36,8 @@ LRC.SimpleLRC lrc; IEnumerator enumera... [truncated message content] |
From: <sa...@us...> - 2007-03-11 20:43:21
|
Revision: 183 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=183&view=rev Author: saamand Date: 2007-03-11 13:43:19 -0700 (Sun, 11 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_test.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/LyricsEngine Tester.cs Added Paths: ----------- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs trunk/plugins/MyLyrics/MyLyrics.sln Removed Paths: ------------- trunk/plugins/MyLyrics/LRC/ trunk/plugins/MyLyrics/LyricWiki/ trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs Deleted: trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-03-11 15:18:13 UTC (rev 182) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricController.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -1,305 +0,0 @@ -using System; -using System.Drawing; -using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; -using System.Data; -using System.Threading; -using System.IO; -using System.Diagnostics; -using LyricsEngineConfig; -using LyricsEngine; - -namespace LyricsEngine -{ - - #region Public Delegates - // delegates used to call MainForm functions from worker thread - public delegate void Delegate_LC_updateString(String s); - public delegate void Delegate_LC_UpdateStatus(Boolean b1); - public delegate void Delegate_LC_ErrorLog_LyricNotFound(String s); - public delegate void Delegate_LC_WriteFoundLyric(String[] s, String artist, String track); - public delegate void Delegate_LC_ThreadFinished(); - #endregion - - public class LyricController : IDisposable - { - private ILyricForm m_Form; - - // status - private static int noOfLyricsToSearch; - private static int noOfLyricsSearched; - private static int noOfLyricsFound; - private static int noOfLyricsNotFound; - - private bool m_StopSearches = false; - public static event EventHandler StopTheSearchAndAbort = null; - - ArrayList threadList = new ArrayList(); - ArrayList suspendedThreadList = new ArrayList(); - - - // Main thread sets this event to stop LyricController - ManualResetEvent m_EventStop_LyricController; - // LyricController sets this event when it is stopped - ManualResetEvent m_EventStopped_LyricController; - // Main thread sets this event to pause all LyricSearches - public ManualResetEvent m_EventStop_LyricSearches; - - // Variables related to GoogleSites - private ArrayList m_GoogleLicenseKeysUsed = new ArrayList(); - private string m_GoogleLicenseKey = ""; - private bool m_noMoreValidLicenseKeys = false; - int m_managedThreadId = -1; - - // Lyric sites - private string[] lyricSites; - private string[] eastSites; - - public LyricController(ILyricForm mainForm, - ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped, - string[] lyricSites) - { - this.m_Form = mainForm; - - LyricController.noOfLyricsToSearch = 1; - LyricController.noOfLyricsSearched = 0; - LyricController.noOfLyricsFound = 0; - LyricController.noOfLyricsNotFound = 0; - - this.lyricSites = lyricSites; - - ArrayList easySitesArrayList = new ArrayList(); - - foreach (string site in lyricSites) - { - if (Setup.IsMemberOfEasySites(site)) - { - easySitesArrayList.Add(site); - } - } - eastSites = (string[])easySitesArrayList.ToArray(typeof(string)); - LyricSearch.EasySites = eastSites; - - // initialize events - m_EventStop_LyricController = eventStopThread; - m_EventStopped_LyricController = eventThreadStopped; - - m_EventStop_LyricSearches = new ManualResetEvent(false); - m_EventStop_LyricSearches.Set(); - - LyricSearch.Abort = false; - } - - - public void Run() - { - // check if thread is cancelled - while (true) - { - Thread.Sleep(500); - - // check if thread is cancelled - if (m_EventStop_LyricController.WaitOne(0, true)) - { - // clean-up operations may be placed here - for (int i=0; i<threadList.Count; i++) - { - ((Thread)threadList[i]).Abort(); - } - - bool stillThreadsAlive = true; - while (stillThreadsAlive) - { - for (int i = 0; i < threadList.Count; i++) - { - stillThreadsAlive = false; ; - if (((Thread)threadList[i]).IsAlive) - stillThreadsAlive = true; - } - } - - Thread.Sleep(500); - m_EventStopped_LyricController.Set(); - break; - } - } - } - - - public void Dispose() - { - // clean-up operations may be placed here - for (int i = 0; i < threadList.Count; i++) - { - ((Thread)threadList[i]).Abort(); - } - - bool stillThreadsAlive = true; - while (stillThreadsAlive) - { - for (int i = 0; i < threadList.Count; i++) - { - stillThreadsAlive = false; ; - if (((Thread)threadList[i]).IsAlive) - stillThreadsAlive = true; - } - } - - Thread.Sleep(500); - - // inform main thread that this thread stopped - m_EventStopped_LyricController.Set(); - finishThread("", "", "The search has ended.", ""); - } - - public void updateManualResetEvents(ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped) - { - this.m_EventStop_LyricController = eventStopThread; - this.m_EventStopped_LyricController = eventThreadStopped; - } - - public void addNewLyricSearch(string artist, string title) - { - if (eastSites.Length > 0) - { - // create worker thread instance - ThreadStart easySitesThreadInstance = delegate - { - - LyricSearch lyricSearch_EasySites = new LyricSearch(m_EventStop_LyricController, m_EventStopped_LyricController, this); - lyricSearch_EasySites.setLyricInfo(artist, title); - lyricSearch_EasySites.Run(); - }; - - Thread lyricSearchThread = new Thread(easySitesThreadInstance); - lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; // looks nice in Output window - lyricSearchThread.IsBackground = true; - lyricSearchThread.Start(); - threadList.Add(lyricSearchThread); - } - } - - public void suspendAllSearchThreadsExceptMe(int managedThreadId) - { - //// clean-up operations may be placed here - //for (int i = 0; i < threadList.Count; i++) - //{ - // if (((Thread)threadList[i]).ManagedThreadId != managedThreadId) - // ((Thread)threadList[i]).Suspend(); - //} - - m_managedThreadId = managedThreadId; - m_EventStop_LyricSearches.Reset(); - } - - public void resumeAllSearchThreads() - { - m_EventStop_LyricSearches.Reset(); - } - - internal void updateString(String message, String site) - { - m_Form.UpdateString = new Object[] { message, site }; - } - - internal void statusUpdate(string artist, string title, string site, bool lyricFound) - { - //LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + artist + " - " + title + " - " + site + " - " +lyricFound.ToString() ); - if (lyricFound) - ++noOfLyricsFound; - else - ++noOfLyricsNotFound; - - ++noOfLyricsSearched; - - m_Form.UpdateStatus = new Object[] { noOfLyricsToSearch, noOfLyricsSearched, noOfLyricsFound, noOfLyricsNotFound }; - - if (noOfLyricsSearched >= noOfLyricsToSearch) - { - finishThread(artist, title, "All songs have been searched!", site); - } - } - - - internal void lyricFound(String lyricStrings, String artist, String title, String site) - { - if (m_StopSearches == false) - { - m_Form.LyricFound = new Object[] { lyricStrings, artist, title, site }; - statusUpdate(artist, title, site, true); - } - } - - internal void lyricNotFound(String artist, String title, String message, String site) - { - if (m_StopSearches == false) - { - m_Form.LyricNotFound = new Object[] { artist, title, message, site }; - statusUpdate(artist, title, site, false); - } - } - - public void finishThread(String artist, String title, String message, String site) - { - m_EventStop_LyricController.Set(); - m_EventStopped_LyricController.Set(); - m_Form.ThreadFinished = new Object[] { artist, title, message, site }; - } - - internal void ThreadException(String s) - { - m_Form.ThreadException = s; - } - - public string GoogleLicenseKey - { - get { return m_GoogleLicenseKey; } - set { m_GoogleLicenseKey = value; } - } - - public bool StopSearches - { - get { return m_StopSearches; } - set { - if (value == true) - { - m_StopSearches = true; - m_EventStop_LyricSearches.Reset(); - LyricSearch.Abort = true; - //StopTheSearchAndAbort.Invoke(this, EventArgs.Empty); - } - else - { - m_StopSearches = false; - m_EventStop_LyricSearches.Set(); - LyricSearch.Abort = false; - } - } - } - - public ArrayList GoogleLicenseKeysUsed - { - get { return m_GoogleLicenseKeysUsed; } - } - - public void addToGoogleLicenseKeysUsed(string key) - { - if (!m_GoogleLicenseKeysUsed.Contains(key)) - { - m_GoogleLicenseKeysUsed.Add(key); - } - } - - public int NoOfLyricsToSearch - { - set { LyricController.noOfLyricsToSearch = value; } - } - - public bool NoMoreValidLicenseKeys - { - get { return m_noMoreValidLicenseKeys; } - set { m_noMoreValidLicenseKeys = value; } - } - } -} Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,305 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.Threading; +using System.IO; +using System.Diagnostics; +using LyricsEngineConfig; +using LyricsEngine; + +namespace LyricsEngine +{ + + #region Public Delegates + // delegates used to call MainForm functions from worker thread + public delegate void Delegate_LC_updateString(String s); + public delegate void Delegate_LC_UpdateStatus(Boolean b1); + public delegate void Delegate_LC_ErrorLog_LyricNotFound(String s); + public delegate void Delegate_LC_WriteFoundLyric(String[] s, String artist, String track); + public delegate void Delegate_LC_ThreadFinished(); + #endregion + + public class LyricsController : IDisposable + { + private ILyricForm m_Form; + + // status + private static int noOfLyricsToSearch; + private static int noOfLyricsSearched; + private static int noOfLyricsFound; + private static int noOfLyricsNotFound; + + private bool m_StopSearches = false; + public static event EventHandler StopTheSearchAndAbort = null; + + ArrayList threadList = new ArrayList(); + ArrayList suspendedThreadList = new ArrayList(); + + + // Main thread sets this event to stop LyricController + ManualResetEvent m_EventStop_LyricController; + // LyricController sets this event when it is stopped + ManualResetEvent m_EventStopped_LyricController; + // Main thread sets this event to pause all LyricSearches + public ManualResetEvent m_EventStop_LyricSearches; + + // Variables related to GoogleSites + private ArrayList m_GoogleLicenseKeysUsed = new ArrayList(); + private string m_GoogleLicenseKey = ""; + private bool m_noMoreValidLicenseKeys = false; + int m_managedThreadId = -1; + + // Lyric sites + private string[] lyricSites; + private string[] eastSites; + + public LyricsController(ILyricForm mainForm, + ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped, + string[] lyricSites) + { + this.m_Form = mainForm; + + LyricsController.noOfLyricsToSearch = 1; + LyricsController.noOfLyricsSearched = 0; + LyricsController.noOfLyricsFound = 0; + LyricsController.noOfLyricsNotFound = 0; + + this.lyricSites = lyricSites; + + ArrayList easySitesArrayList = new ArrayList(); + + foreach (string site in lyricSites) + { + if (Setup.IsMemberOfEasySites(site)) + { + easySitesArrayList.Add(site); + } + } + eastSites = (string[])easySitesArrayList.ToArray(typeof(string)); + LyricSearch.EasySites = eastSites; + + // initialize events + m_EventStop_LyricController = eventStopThread; + m_EventStopped_LyricController = eventThreadStopped; + + m_EventStop_LyricSearches = new ManualResetEvent(false); + m_EventStop_LyricSearches.Set(); + + LyricSearch.Abort = false; + } + + + public void Run() + { + // check if thread is cancelled + while (true) + { + Thread.Sleep(500); + + // check if thread is cancelled + if (m_EventStop_LyricController.WaitOne(0, true)) + { + // clean-up operations may be placed here + for (int i=0; i<threadList.Count; i++) + { + ((Thread)threadList[i]).Abort(); + } + + bool stillThreadsAlive = true; + while (stillThreadsAlive) + { + for (int i = 0; i < threadList.Count; i++) + { + stillThreadsAlive = false; ; + if (((Thread)threadList[i]).IsAlive) + stillThreadsAlive = true; + } + } + + Thread.Sleep(500); + m_EventStopped_LyricController.Set(); + break; + } + } + } + + + public void Dispose() + { + // clean-up operations may be placed here + for (int i = 0; i < threadList.Count; i++) + { + ((Thread)threadList[i]).Abort(); + } + + bool stillThreadsAlive = true; + while (stillThreadsAlive) + { + for (int i = 0; i < threadList.Count; i++) + { + stillThreadsAlive = false; ; + if (((Thread)threadList[i]).IsAlive) + stillThreadsAlive = true; + } + } + + Thread.Sleep(500); + + // inform main thread that this thread stopped + m_EventStopped_LyricController.Set(); + finishThread("", "", "The search has ended.", ""); + } + + public void updateManualResetEvents(ManualResetEvent eventStopThread, ManualResetEvent eventThreadStopped) + { + this.m_EventStop_LyricController = eventStopThread; + this.m_EventStopped_LyricController = eventThreadStopped; + } + + public void addNewLyricSearch(string artist, string title) + { + if (eastSites.Length > 0) + { + // create worker thread instance + ThreadStart easySitesThreadInstance = delegate + { + + LyricSearch lyricSearch_EasySites = new LyricSearch(m_EventStop_LyricController, m_EventStopped_LyricController, this); + lyricSearch_EasySites.setLyricInfo(artist, title); + lyricSearch_EasySites.Run(); + }; + + Thread lyricSearchThread = new Thread(easySitesThreadInstance); + lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; // looks nice in Output window + lyricSearchThread.IsBackground = true; + lyricSearchThread.Start(); + threadList.Add(lyricSearchThread); + } + } + + public void suspendAllSearchThreadsExceptMe(int managedThreadId) + { + //// clean-up operations may be placed here + //for (int i = 0; i < threadList.Count; i++) + //{ + // if (((Thread)threadList[i]).ManagedThreadId != managedThreadId) + // ((Thread)threadList[i]).Suspend(); + //} + + m_managedThreadId = managedThreadId; + m_EventStop_LyricSearches.Reset(); + } + + public void resumeAllSearchThreads() + { + m_EventStop_LyricSearches.Reset(); + } + + internal void updateString(String message, String site) + { + m_Form.UpdateString = new Object[] { message, site }; + } + + internal void statusUpdate(string artist, string title, string site, bool lyricFound) + { + //LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + artist + " - " + title + " - " + site + " - " +lyricFound.ToString() ); + if (lyricFound) + ++noOfLyricsFound; + else + ++noOfLyricsNotFound; + + ++noOfLyricsSearched; + + m_Form.UpdateStatus = new Object[] { noOfLyricsToSearch, noOfLyricsSearched, noOfLyricsFound, noOfLyricsNotFound }; + + if (noOfLyricsSearched >= noOfLyricsToSearch) + { + finishThread(artist, title, "All songs have been searched!", site); + } + } + + + internal void lyricFound(String lyricStrings, String artist, String title, String site) + { + if (m_StopSearches == false) + { + m_Form.LyricFound = new Object[] { lyricStrings, artist, title, site }; + statusUpdate(artist, title, site, true); + } + } + + internal void lyricNotFound(String artist, String title, String message, String site) + { + if (m_StopSearches == false) + { + m_Form.LyricNotFound = new Object[] { artist, title, message, site }; + statusUpdate(artist, title, site, false); + } + } + + public void finishThread(String artist, String title, String message, String site) + { + m_EventStop_LyricController.Set(); + m_EventStopped_LyricController.Set(); + m_Form.ThreadFinished = new Object[] { artist, title, message, site }; + } + + internal void ThreadException(String s) + { + m_Form.ThreadException = s; + } + + public string GoogleLicenseKey + { + get { return m_GoogleLicenseKey; } + set { m_GoogleLicenseKey = value; } + } + + public bool StopSearches + { + get { return m_StopSearches; } + set { + if (value == true) + { + m_StopSearches = true; + m_EventStop_LyricSearches.Reset(); + LyricSearch.Abort = true; + //StopTheSearchAndAbort.Invoke(this, EventArgs.Empty); + } + else + { + m_StopSearches = false; + m_EventStop_LyricSearches.Set(); + LyricSearch.Abort = false; + } + } + } + + public ArrayList GoogleLicenseKeysUsed + { + get { return m_GoogleLicenseKeysUsed; } + } + + public void addToGoogleLicenseKeysUsed(string key) + { + if (!m_GoogleLicenseKeysUsed.Contains(key)) + { + m_GoogleLicenseKeysUsed.Add(key); + } + } + + public int NoOfLyricsToSearch + { + set { LyricsController.noOfLyricsToSearch = value; } + } + + public bool NoMoreValidLicenseKeys + { + get { return m_noMoreValidLicenseKeys; } + set { m_noMoreValidLicenseKeys = value; } + } + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,154 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.Serialization; + +namespace MyLyrics +{ + [Serializable] + public class LyricsDatabase : IDictionary<string, LyricsItem>, ISerializable + { + private DateTime created; + private DateTime lastModified; + + private Dictionary<string, LyricsItem> db; + + public LyricsDatabase() + { + created = DateTime.Now; + lastModified = DateTime.Now; + db = new Dictionary<string, LyricsItem>(); + } + + #region Serialization methods + protected LyricsDatabase(SerializationInfo info, StreamingContext context) + { + Dictionary<string, LyricsItem> dbTemp = new Dictionary<string, LyricsItem>(); + db = (Dictionary<string, LyricsItem>)info.GetValue("db", dbTemp.GetType()); + created = info.GetDateTime("created"); + lastModified = info.GetDateTime("lastModified"); + } + + public virtual void GetObjectData(SerializationInfo info, StreamingContext context) + { + info.AddValue("db", db); + info.AddValue("created", created); + info.AddValue("lastModified", lastModified); + } + #endregion + + public void SetLastModified() + { + lastModified = DateTime.Now; + } + + #region IDictionary<string,LyricsItem> Members + + public void Add(string key, LyricsItem value) + { + db.Add(key, value); + } + + public bool ContainsKey(string key) + { + return db.ContainsKey(key); + } + + public ICollection<string> Keys + { + get { return db.Keys; } + } + + public bool Remove(string key) + { + return db.Remove(key); + } + + public bool TryGetValue(string key, out LyricsItem value) + { + return db.TryGetValue(key, out value); + } + + public ICollection<LyricsItem> Values + { + get { return db.Values; } + } + + public LyricsItem this[string key] + { + get + { + return db[key]; + } + set + { + db[key] = value; + } + } + + #endregion + + #region ICollection<KeyValuePair<string,LyricsItem>> Members + + public void Add(KeyValuePair<string, LyricsItem> item) + { + db.Add(item.Key, item.Value); + } + + public void Clear() + { + db.Clear(); + } + + public bool Contains(KeyValuePair<string, LyricsItem> item) + { + return db.ContainsKey(item.Key); + } + + public void CopyTo(KeyValuePair<string, LyricsItem>[] array, int arrayIndex) + { + throw new Exception("The method or operation is not implemented."); + } + + public int Count + { + get { return db.Count; } + } + + public bool IsReadOnly + { + get { return false; } + } + + public bool Remove(KeyValuePair<string, LyricsItem> item) + { + return db.Remove(item.Key); + } + + #endregion + + #region IEnumerable<KeyValuePair<string,LyricsItem>> Members + + public IEnumerator<KeyValuePair<string, LyricsItem>> GetEnumerator() + { + foreach (KeyValuePair<string, LyricsItem> kvp in db) + { + yield return kvp; + } + } + + #endregion + + #region IEnumerable Members + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + foreach (KeyValuePair<string, LyricsItem> kvp in db) + { + yield return kvp; + } + } + + #endregion + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.Serialization; + +namespace MyLyrics +{ + [Serializable] + public class LyricsItem + { + private string artist; + private string title; + private string lyrics; + private string source; + + public LyricsItem(string artist, string title, string lyrics, string source) + { + this.artist = artist; + this.title = title; + this.lyrics = lyrics; + this.source = source; + } + + #region Properties + public string Artist + { + get { return artist; } + set { artist = value; } + } + + public string Title + { + get { return title; } + set { title = value; } + } + + public string Lyrics + { + get { return lyrics; } + set { lyrics = value; } + } + + public string Source + { + get { return source; } + set { source = value; } + } + #endregion + } +} \ No newline at end of file Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-11 15:18:13 UTC (rev 182) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-11 20:43:19 UTC (rev 183) @@ -40,17 +40,23 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="LRC\SimpleLRC.cs" /> + <Compile Include="LRC\SimpleLRCFormat.cs" /> + <Compile Include="LRC\SimpleLRCTimeAndLine.cs" /> + <Compile Include="LRC\SimpleLRCTimeAndLineCollection.cs" /> + <Compile Include="LyricsDatabase\LyricsDatabase.cs" /> + <Compile Include="LyricsDatabase\LyricsItem.cs" /> <Compile Include="LyricSearch.cs" /> <Compile Include="LyricDiagnostics.cs" /> - <Compile Include="LyricSites\HotLyrics.cs" /> - <Compile Include="LyricSites\EvilLabs.cs" /> - <Compile Include="LyricSites\Lyrics007.cs" /> - <Compile Include="LyricSites\LyricsOnDemand.cs" /> - <Compile Include="LyricSites\SeekLyrics.cs" /> + <Compile Include="LyricsSites\HotLyrics.cs" /> + <Compile Include="LyricsSites\EvilLabs.cs" /> + <Compile Include="LyricsSites\Lyrics007.cs" /> + <Compile Include="LyricsSites\LyricsOnDemand.cs" /> + <Compile Include="LyricsSites\SeekLyrics.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="ICommand.cs" /> <Compile Include="ILyricForm.cs" /> - <Compile Include="LyricController.cs" /> + <Compile Include="LyricsController.cs" /> <Compile Include="LyricSiteInfo.cs" /> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> @@ -92,7 +98,7 @@ <DesignTime>True</DesignTime> <DependentUpon>Reference.map</DependentUpon> </Compile> - <Compile Include="LyricSites\Wiki.cs" /> + <Compile Include="LyricsSites\Wiki.cs" /> </ItemGroup> <ItemGroup> <WebReferences Include="Web References\" /> Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Diagnostics; + +namespace LyricsEngine.LyricSites +{ + class EvilLabs + { + string lyric = ""; + LyricSearch lyricSearch = null; + + public string Lyric + { + get { return lyric; } + } + + public EvilLabs(LyricSearch lyricSearch, string artist, string title) + { + this.lyricSearch = lyricSearch; + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "EvilLabs(" + artist + ", " + title + ")"); + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + + string lyricTemp = ""; + + artist = LyricUtil.removeFeatComment(artist); + LyricUtil.trimForParenthesis(ref artist); + artist = artist.Replace(" ", "+"); + title = LyricUtil.removeFeatComment(title); + LyricUtil.trimForParenthesis(ref title); + title = title.Replace(" ", "+"); + string urlString = "http://www.evillabs.sk/lyrics/" + artist + "+-+" + title; + + System.Net.WebClient client = new System.Net.WebClient(); + System.Byte[] bytes = null; + + + try + { + bytes = client.DownloadData(urlString); + } + catch (System.Net.WebException) + { + //return false; + } + finally + { + client.Dispose(); + } + + int byteIndex = 0; + while (byteIndex < bytes.Length && lyricSearch.SearchHasEnded == false) + { + lyricTemp += System.Char.ConvertFromUtf32(bytes[byteIndex]); + ++byteIndex; + } + + MemoryStream memoryStream = new MemoryStream(System.Text.Encoding.Default.GetBytes(lyricTemp)); + + if (memoryStream != null) + { + string line = ""; + int noOfLinesCount = 0; + + System.IO.StreamReader sr = new System.IO.StreamReader(memoryStream); + + while (line.IndexOf("</style>") == -1) + { + if (sr.EndOfStream || ++noOfLinesCount > 300) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine(); + } + } + + if (thisMayBeTheCorrectLyric) + { + line = sr.ReadLine(); + lyric = line.Replace("<br>", "\r\n").Trim(); + + // if warning message from Evil Labs' sql-server, then lyric isn't found + if (lyric.Contains("<b>Warning</b>")) + { + lyric = "Not found"; + } + } + } + } + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Diagnostics; + +namespace LyricsEngine.LyricSites +{ + class HotLyrics + { + string lyric = ""; + LyricSearch lyricSearch = null; + + public string Lyric + { + get { return lyric; } + } + + public HotLyrics(LyricSearch lyricSearch, string artist, string title) + { + this.lyricSearch = lyricSearch; + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + + StringBuilder lyricTemp = new StringBuilder(); + + artist = LyricUtil.removeFeatComment(artist); + LyricUtil.trimForParenthesis(ref artist); + artist = LyricUtil.capatalizeString(artist); + + artist = artist.Replace(" ", "_"); + artist = artist.Replace(",", "_"); + artist = artist.Replace(".", "_"); + artist = artist.Replace("'", "_"); + artist = artist.Replace("(", "%28"); + artist = artist.Replace(")", "%29"); + artist = artist.Replace(",", ""); + artist = artist.Replace("#", ""); + artist = artist.Replace("%", ""); + artist = artist.Replace("+", "%2B"); + artist = artist.Replace("=", "%3D"); + artist = artist.Replace("-", "_"); + + // German letters + artist = artist.Replace("\xFC", "%FC"); + artist = artist.Replace("\xDC", ""); + artist = artist.Replace("\xE4", "%E4"); + artist = artist.Replace("\xC4", ""); + artist = artist.Replace("\xF6", "%E4"); // Not correct!!! + artist = artist.Replace("\xD6", ""); + artist = artist.Replace("\xDF", "%DF"); + + // French letters + artist = artist.Replace("\xE9", "%E9"); + + title = LyricUtil.removeFeatComment(title); + LyricUtil.trimForParenthesis(ref title); + title = LyricUtil.capatalizeString(title); + + title = title.Replace(" ", "_"); + title = title.Replace(",", "_"); + title = title.Replace(".", "_"); + title = title.Replace("'", "_"); + title = title.Replace("(", "%28"); + title = title.Replace(")", "%29"); + title = title.Replace(",", "_"); + title = title.Replace("#", "_"); + title = title.Replace("%", "_"); + title = title.Replace("?", "_"); + title = title.Replace("+", "%2B"); + title = title.Replace("=", "%3D"); + title = title.Replace("-", "_"); + title = title.Replace(":", "_"); + + // German letters + title = title.Replace("\xFC", "%FC"); + title = title.Replace("\xDC", ""); + title = title.Replace("\xE4", "%E4"); + title = title.Replace("\xC4", ""); + title = title.Replace("\xF6", "%E4"); // Not correct!!! + title = title.Replace("\xD6", ""); + title = title.Replace("\xDF", "%DF"); + + // Danish letters + title = title.Replace("\xE5", "%E5"); + title = title.Replace("\xC5", "%C5"); + title = title.Replace("\xE6", "%E6"); + title = title.Replace("\xF8", "%F8"); + + // French letters + title = title.Replace("\xE9", "%E9"); + + string firstLetter = ""; + if (artist.Length > 0) + firstLetter = artist[0].ToString(); + + string urlString = "http://www.hotlyrics.net/lyrics/" + firstLetter + "/" + artist + "/" + title + ".html"; + + System.Net.WebClient client = new System.Net.WebClient(); + Stream stream = null; + + try + { + stream = client.OpenRead(urlString); + } + catch (System.Net.WebException) + { + //return false; + } + finally + { + client.Dispose(); + } + + + if (stream != null) + { + string line = ""; + + System.IO.StreamReader sr = new System.IO.StreamReader(stream); + //sr.BaseStream.Position = 18000; + + while (line.IndexOf("GOOGLE END") == -1) + { + if (sr.EndOfStream) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine(); + } + } + + if (thisMayBeTheCorrectLyric) + { + lyricTemp = new StringBuilder(); + line = sr.ReadLine(); + + while (line.IndexOf("<script type") == -1) + { + lyricTemp.Append(line); + if (sr.EndOfStream) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine(); + } + } + + lyricTemp.Replace("?s", "'s"); + lyricTemp.Replace("?t", "'t"); + lyricTemp.Replace("?m", "'m"); + lyricTemp.Replace("?l", "'l"); + lyricTemp.Replace("?v", "'v"); + lyricTemp.Replace("<br>", "\r\n"); + lyricTemp.Replace("<br />", "\r\n"); + lyricTemp.Replace(""", "\""); + lyricTemp.Replace("</p>", ""); + lyricTemp.Replace("<BR>", ""); + lyricTemp.Replace("<br/>", "\r\n"); + + lyric = lyricTemp.ToString().Trim(); + + // if warning message from Evil Labs' sql-server, then lyric isn't found + if (lyric.Contains("<td")) + { + lyric = "Not found"; + } + } + sr.Close(); + } + } + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Diagnostics; + +namespace LyricsEngine.LyricSites +{ + class Lyrics007 + { + string lyric = ""; + LyricSearch lyricSearch = null; + + public string Lyric + { + get { return lyric; } + } + + public Lyrics007(LyricSearch lyricSearch, string artist, string title) + { + this.lyricSearch = lyricSearch; + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Lyrics007(" + artist + ", " + title + ")"); + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + + StringBuilder lyricTemp = new StringBuilder(); + + artist = LyricUtil.removeFeatComment(artist); + LyricUtil.trimForParenthesis(ref artist); + artist = artist.Replace("#", ""); + title = LyricUtil.removeFeatComment(title); + LyricUtil.trimForParenthesis(ref title); + title = title.Replace("#", ""); + + // Cannot find lyrics contaning non-English letters! + + string urlString = "http://www.lyrics007.com/" + artist + " Lyrics/" + title + " Lyrics.html"; + + System.Net.WebClient client = new System.Net.WebClient(); + Stream stream = null; + + try + { + stream = client.OpenRead(urlString); + } + catch (System.Net.WebException) + { + //return false; + } + finally + { + client.Dispose(); + } + + + if (stream != null) + { + string line = ""; + int noOfLinesCount = 0; + + System.IO.StreamReader sr = new System.IO.StreamReader(stream); + + // 1. Find beginning of lyric + while (line.IndexOf("<td>Song: <strong>") == -1 && line.IndexOf("polyphonic ringtone to your cell phone") == -1) + { + if (sr.EndOfStream || ++noOfLinesCount > 300) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine(); + } + } + + // 2. If start of lyric found, then continue with work + if (thisMayBeTheCorrectLyric) + { + lyricTemp = new StringBuilder(); + string textToCutFrom = @"<tr><td width=10></td><td>"; + int indexToCutFrom = line.LastIndexOf(textToCutFrom) + textToCutFrom.Length; + lyricTemp.Append(line.Substring(indexToCutFrom)); + line = sr.ReadLine(); + + while (line.IndexOf("The hottest songs") == -1 && line.IndexOf("Maybe you are looking for:") == -1) + { + lyricTemp.Append(line); + if (sr.EndOfStream || ++noOfLinesCount > 300) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine(); + } + } + + lyricTemp.Replace("??s", "'s"); + lyricTemp.Replace("??t", "'t"); + lyricTemp.Replace("??m", "'m"); + lyricTemp.Replace("??l", "'l"); + lyricTemp.Replace("??v", "'v"); + lyricTemp.Replace("?s", "'s"); + lyricTemp.Replace("?t", "'t"); + lyricTemp.Replace("?m", "'m"); + lyricTemp.Replace("?l", "'l"); + lyricTemp.Replace("?v", "'v"); + lyricTemp.Replace("<br>", "\r\n"); + lyricTemp.Replace("<br />", "\r\n"); + lyricTemp.Replace("<BR>", "\r\n"); + + lyric = lyricTemp.ToString().Trim(); + + // if warning message from Evil Labs' sql-server, then lyric isn't found + if (lyric.Contains("<td")) + { + lyric = "Not found"; + } + } + sr.Close(); + } + } + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,154 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Diagnostics; + +namespace LyricsEngine.LyricSites +{ + class LyricsOnDemand + { + string lyric = ""; + LyricSearch lyricSearch = null; + + public string Lyric + { + get { return lyric; } + } + + public LyricsOnDemand(LyricSearch lyricSearch, string artist, string title) + { + this.lyricSearch = lyricSearch; + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "LyricsOnDemand(" + artist + ", " + title + ")"); + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + + StringBuilder lyricTemp = new StringBuilder(); + + artist = LyricUtil.removeFeatComment(artist); + LyricUtil.trimForParenthesis(ref artist); + LyricUtil.deleteSpecificChars(ref artist); + artist = artist.Replace(" ", ""); + artist = artist.Replace("The ", ""); + artist = artist.Replace("the ", ""); + artist = artist.Replace("-", ""); + + artist = artist.ToLower(); + + // Cannot find lyrics contaning non-English letters! + + title = LyricUtil.removeFeatComment(title); + LyricUtil.trimForParenthesis(ref title); + LyricUtil.deleteSpecificChars(ref title); + title = title.Replace(" ", ""); + title = title.Replace("#", ""); + artist = artist.Replace("-", ""); + + // Danish letters + title = title.Replace("\xE6", ""); + title = title.Replace("\xF8", ""); + title = title.Replace("\xE5", ""); + title = title.Replace("\xC6", ""); + title = title.Replace("\xD8", ""); + title = title.Replace("\xC5", ""); + + title = title.ToLower(); + + string firstLetter = ""; + if (artist.Length > 0) + firstLetter = artist[0].ToString(); + + try + { + int.Parse(firstLetter); + firstLetter = "0"; + } + catch { ;}; + + string urlString = "http://www.lyricsondemand.com/" + firstLetter + "/" + artist + "lyrics/" + title + "lyrics.html"; + + System.Net.WebClient client = new System.Net.WebClient(); + System.Byte[] bytes = null; + Stream stream = null; + + try + { + stream = client.OpenRead(urlString); + } + catch (System.Net.WebException) + { + //return false; + } + finally + { + client.Dispose(); + } + + if (stream != null) + { + string line = ""; + int noOfLinesCount = 0; + + System.IO.StreamReader sr = new System.IO.StreamReader(stream); + + while (line.IndexOf(@"<font size=""2"" face=""Verdana"">") == -1) + { + if (sr.EndOfStream || ++noOfLinesCount > 300) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine(); + } + } + + if (thisMayBeTheCorrectLyric) + { + lyricTemp = new StringBuilder(); + line = sr.ReadLine().Trim(); + + while (line.IndexOf("<BR><BR>") == -1) + { + lyricTemp.Append(line); + if (sr.EndOfStream || ++noOfLinesCount > 300) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine().Trim(); + } + } + + lyricTemp.Replace("<br>", " \r\n"); + lyricTemp.Replace("</font></p>", " \r\n"); + lyricTemp.Replace("<p><font size=\"2\" face=\"Verdana\">", " \r\n"); + lyricTemp.Replace("<i>", ""); + lyricTemp.Replace("</i>", ""); + lyricTemp.Replace("?s", "'s"); + lyricTemp.Replace("?t", "'t"); + lyricTemp.Replace("?m", "'m"); + lyricTemp.Replace("?l", "'l"); + lyricTemp.Replace("?v", "'v"); + lyricTemp.Replace("<p>", " \r\n"); + lyricTemp.Replace("<BR>", " \r\n"); + + lyric = lyricTemp.ToString().Trim(); + + // if warning message from Evil Labs' sql-server, then lyric isn't found + if (lyric.Contains("<td")) + { + lyric = "Not found"; + } + } + sr.Close(); + } + } + } +} + + + Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,177 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Diagnostics; + +namespace LyricsEngine.LyricSites +{ + class SeekLyrics + { + string lyric = ""; + LyricSearch lyricSearch = null; + + public string Lyric + { + get { return lyric; } + } + + public SeekLyrics(LyricSearch lyricSearch, string artist, string title) + { + this.lyricSearch = lyricSearch; + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + + StringBuilder lyricTemp = new StringBuilder(); + + artist = LyricUtil.removeFeatComment(artist); + LyricUtil.trimForParenthesis(ref artist); + artist = artist.Replace(" ", "-"); + artist = artist.Replace("'", "-"); + artist = artist.Replace("(", ""); + artist = artist.Replace(")", ""); + artist = artist.Replace(",", ""); + artist = artist.Replace("#", ""); + + // German letters + artist = artist.Replace("\xFC", "%FC"); + artist = artist.Replace("\xDC", ""); + artist = artist.Replace("\xE4", "%E4"); + artist = artist.Replace("\xC4", ""); + artist = artist.Replace("\xF6", "%E4"); // Not correct!!! + artist = artist.Replace("\xD6", ""); + artist = artist.Replace("\xDF", "%DF"); + + // French letters + artist = artist.Replace("\xE9", "%E9"); + + title = LyricUtil.removeFeatComment(title); + LyricUtil.trimForParenthesis(ref title); + title = title.Replace(" ", "-"); + title = title.Replace("'", "-"); + title = title.Replace("(", ""); + title = title.Replace(")", ""); + title = title.Replace(",", ""); + title = title.Replace("#", ""); + title = title.Replace("?", ""); + + // German letters + title = title.Replace("\xFC", "%FC"); + title = title.Replace("\xDC", ""); + title = title.Replace("\xE4", "%E4"); + title = title.Replace("\xC4", ""); + title = title.Replace("\xF6", "%E4"); // Not correct!!! + title = title.Replace("\xD6", ""); + title = title.Replace("\xDF", "%DF"); + + // French letters + title = title.Replace("\xE9", "%E9"); + + + string urlString = "http://www.seeklyrics.com/lyrics/" + artist + "/" + title + ".html"; + + System.Net.WebClient client = new System.Net.WebClient(); + System.Byte[] bytes = null; + + try + { + bytes = client.DownloadData(urlString); + } + catch (System.Net.WebException) + { + //return false; + } + finally + { + client.Dispose(); + } + + + + if (bytes != null) + { + int byteIndex = 3900; + + while (byteIndex < bytes.Length && lyricSearch.SearchHasEnded == false) + { + lyricTemp.Append(System.Char.ConvertFromUtf32(bytes[byteIndex])); + ++byteIndex; + } + + MemoryStream memoryStream = new MemoryStream(System.Text.Encoding.Default.GetBytes(lyricTemp.ToString())); + + if (memoryStream != null) + { + string line = ""; + int noOfLinesCount = 0; + + System.IO.StreamReader sr = new System.IO.StreamReader(memoryStream); + + while (line.IndexOf("<pre>") == -1) + { + if (sr.EndOfStream || ++noOfLinesCount > 300) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine(); + } + } + + if (thisMayBeTheCorrectLyric) + { + lyricTemp = new StringBuilder(); + string textToCutFrom = "<pre>"; + int indexToCutFrom = line.LastIndexOf(textToCutFrom) + textToCutFrom.Length; + lyricTemp.Append(line.Substring(indexToCutFrom)); + if (line.Substring(indexToCutFrom).Contains("<F")) + lyricTemp = new StringBuilder(); + + line = sr.ReadLine(); + + while (line.IndexOf("</pre>") == -1) + { + lyricTemp.Append(line); + if (sr.EndOfStream || ++noOfLinesCount > 300) + { + thisMayBeTheCorrectLyric = false; + break; + } + else + { + line = sr.ReadLine(); + } + } + + textToCutFrom = "</pre>"; + indexToCutFrom = line.LastIndexOf(textToCutFrom); + lyricTemp.Append(line.Substring(0, indexToCutFrom)); + + lyricTemp.Replace("?s", "'s"); + lyricTemp.Replace("?t", "'t"); + lyricTemp.Replace("?m", "'m"); + lyricTemp.Replace("?l", "'l"); + lyricTemp.Replace("?v", "'v"); + lyricTemp.Replace("<br>", "\r\n"); + lyricTemp.Replace("<br />", "\r\n"); + lyricTemp.Replace("'", "'"); + lyricTemp.Replace("</p>", ""); + lyricTemp.Replace("<BR>", ""); + lyricTemp.Replace("<br/>", "\r\n"); + + lyric = lyricTemp.ToString().Trim(); + + // if warning message from Evil Labs' sql-server, then lyric isn't found + if (lyric.Contains("<td")) + { + lyric = "Not found"; + } + } + } + } + } + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-03-11 20:43:19 UTC (rev 183) @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using LyricsEngine.org.lyricwiki; +using LyricsEngine; + +namespace MyLyricWiki +{ + public class Wiki + { + + private LyricWiki lyricWiki; + private LyricsResult lyricsResult = null; + private string artist = ""; + private string... [truncated message content] |
From: <sa...@us...> - 2007-03-14 17:01:16
|
Revision: 188 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=188&view=rev Author: saamand Date: 2007-03-14 10:01:09 -0700 (Wed, 14 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.resx trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-03-14 17:01:09 UTC (rev 188) @@ -108,7 +108,7 @@ ((Thread)threadList[i]).Abort(); } - bool stillThreadsAlive = true; + bool stillThreadsAlive = (threadList.Count > 0 ? true : false); while (stillThreadsAlive) { for (int i = 0; i < threadList.Count; i++) @@ -118,8 +118,6 @@ stillThreadsAlive = true; } } - - Thread.Sleep(500); m_EventStopped_LyricController.Set(); break; } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-14 17:01:09 UTC (rev 188) @@ -125,7 +125,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> <PreBuildEvent> </PreBuildEvent> </PropertyGroup> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-14 17:01:09 UTC (rev 188) @@ -517,11 +517,29 @@ if (MyLyricsUtil.isTrackInLyricsDatabase(LyricsDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) { LyricsDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, m_LyricText, site)); + + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); + using (FileStream fs = new FileStream(path, FileMode.Open)) + { + BinaryFormatter bf = new BinaryFormatter(); + LyricsDB.SetLastModified(); + bf.Serialize(fs, LyricsDB); + fs.Close(); + } } if (MyLyricsUtil.isTrackInLyricsMarkedDatabase(LyricsMarkedDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_MARKED)) { LyricsMarkedDB.Remove(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle)); + + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); + using (FileStream fs = new FileStream(path, FileMode.Open)) + { + BinaryFormatter bf = new BinaryFormatter(); + LyricsMarkedDB.SetLastModified(); + bf.Serialize(fs, LyricsMarkedDB); + fs.Close(); + } } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-14 17:01:09 UTC (rev 188) @@ -100,11 +100,12 @@ this.tabControl.Controls.Add(this.tabPageLyricsDatabase); this.tabControl.Controls.Add(this.tabPageSetup); this.tabControl.Controls.Add(this.tabPageDatabase); - this.tabControl.Location = new System.Drawing.Point(12, 12); + this.tabControl.Location = new System.Drawing.Point(7, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; this.tabControl.Size = new System.Drawing.Size(528, 494); this.tabControl.TabIndex = 1; + this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); // // tabPageLyricsDatabase // @@ -123,7 +124,7 @@ this.tabPageSetup.Location = new System.Drawing.Point(4, 22); this.tabPageSetup.Name = "tabPageSetup"; this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSetup.Size = new System.Drawing.Size(520, 454); + this.tabPageSetup.Size = new System.Drawing.Size(520, 468); this.tabPageSetup.TabIndex = 2; this.tabPageSetup.Text = "General setup"; this.tabPageSetup.UseVisualStyleBackColor = true; @@ -242,7 +243,7 @@ this.tabPageDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageDatabase.Name = "tabPageDatabase"; this.tabPageDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDatabase.Size = new System.Drawing.Size(520, 454); + this.tabPageDatabase.Size = new System.Drawing.Size(520, 468); this.tabPageDatabase.TabIndex = 2; this.tabPageDatabase.Text = "Search music database"; this.tabPageDatabase.UseVisualStyleBackColor = true; @@ -400,6 +401,7 @@ // this.lbLimit.BorderColor = System.Drawing.Color.Empty; this.lbLimit.Location = new System.Drawing.Point(158, 19); + this.lbLimit.MaxLength = 6; this.lbLimit.Name = "lbLimit"; this.lbLimit.Size = new System.Drawing.Size(44, 20); this.lbLimit.TabIndex = 1; @@ -684,6 +686,7 @@ // bgWorkerSearch // this.bgWorkerSearch.WorkerReportsProgress = true; + this.bgWorkerSearch.WorkerSupportsCancellation = true; this.bgWorkerSearch.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bgWorkerSearch_DoWork); this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); @@ -692,7 +695,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(538, 543); + this.ClientSize = new System.Drawing.Size(540, 539); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-14 17:01:09 UTC (rev 188) @@ -33,7 +33,7 @@ Thread m_LyricControllerThread; LyricsController lc = null; - MyLyricsSetup_LyricsLibrary lyricUC; + MyLyricsSetup_LyricsLibrary lyricsLibraryUC; // events used to stop worker thread ManualResetEvent m_EventStopThread; @@ -106,13 +106,15 @@ private string logFileName = "MyLyricsBatch.log"; private string logFullFileName = ""; + bool stopCollectingOfTitles = false; + public MyLyricsSetup() { // Initialize GUI InitializeComponent(); - lyricUC = new MyLyricsSetup_LyricsLibrary(this); - this.tabPageLyricsDatabase.Controls.Add(lyricUC); + lyricsLibraryUC = new MyLyricsSetup_LyricsLibrary(this); + this.tabPageLyricsDatabase.Controls.Add(lyricsLibraryUC); // initialize delegates m_DelegateLyricFound = new DelegateLyricFound(this.lyricFoundMethod); @@ -225,7 +227,7 @@ } MyLyricsSetup_LyricsLibrary.CurrentDB = LyricsDB; - lyricUC.updateLyricsTree(); + lyricsLibraryUC.updateLyricsTree(); } @@ -284,30 +286,36 @@ { if (searching) { - lyricUC.btAdd.Enabled = false; - lyricUC.btDelete.Enabled = false; - lyricUC.btImportSingle.Enabled = false; - lyricUC.btImportLRC.Enabled = false; - lyricUC.btResetLyricsDatabase.Enabled = false; - lyricUC.btResetMarkedLyricsDatabase.Enabled = false; - lyricUC.btSave.Enabled = false; + lyricsLibraryUC.btAdd.Enabled = false; + lyricsLibraryUC.btDelete.Enabled = false; + lyricsLibraryUC.btImportFiles.Enabled = false; + lyricsLibraryUC.btImportDirs.Enabled = false; + lyricsLibraryUC.btResetLyricsDatabase.Enabled = false; + lyricsLibraryUC.btResetMarkedLyricsDatabase.Enabled = false; + lyricsLibraryUC.btSave.Enabled = false; btClose.Enabled = false; } else { - lyricUC.btAdd.Enabled = true; - lyricUC.btDelete.Enabled = true; - lyricUC.btImportSingle.Enabled = true; - lyricUC.btImportLRC.Enabled = true; - lyricUC.btResetLyricsDatabase.Enabled = true; - lyricUC.btResetMarkedLyricsDatabase.Enabled = true; - lyricUC.btSave.Enabled = true; + lyricsLibraryUC.btAdd.Enabled = true; + lyricsLibraryUC.btDelete.Enabled = true; + lyricsLibraryUC.btImportFiles.Enabled = true; + lyricsLibraryUC.btImportDirs.Enabled = true; + lyricsLibraryUC.btResetLyricsDatabase.Enabled = true; + lyricsLibraryUC.btResetMarkedLyricsDatabase.Enabled = true; + lyricsLibraryUC.btSave.Enabled = true; btClose.Enabled = true; } } private void btImportAll_Click(object sender, System.EventArgs e) { + + if (bgWorkerSearch.IsBusy) + { + Thread.Sleep(2000); + } + stopwatch.StartZero(); lbTimer.Text = "00:00.00"; timer = new System.Windows.Forms.Timer(); @@ -316,6 +324,7 @@ timer.Tick += new EventHandler(timer_Tick); timer.Start(); + stopCollectingOfTitles = false; isSearching(true); lbStep1a.Text = "The collecting of songs has started."; lbStep2a.Text = ""; @@ -332,9 +341,6 @@ m_noOfCurrentlySearches = 0; btImportAll.Enabled = false; - progressBar.Enabled = true; - progressBar.Value = 0; - progressBar.Maximum = m_TotalTitles; logFullFileName = Config.GetFile(Config.Dir.Log, logFileName); @@ -361,6 +367,18 @@ m_DisregardVariousArtist = cbDisregardVariousArtist.Enabled && cbDisregardVariousArtist.Checked; m_SearchOnlyMarkedSongs = cbSearchOnlyForMarkedSongs.Enabled && cbSearchOnlyForMarkedSongs.Checked; + if (m_SearchOnlyMarkedSongs) + { + progressBar.Maximum = LyricsMarkedDB.Count; + } + else + { + progressBar.Maximum = m_TotalTitles; + } + + progressBar.Enabled = true; + progressBar.Value = 0; + m_SongsNotKnown = 0; m_SongsWithLyric = 0; m_SongsWithMark = 0; @@ -374,6 +392,8 @@ lbSongsWithMark2.Text = "-"; lbLyricsFound2.Text = "-"; lbLyricsNotFound2.Text = "-"; + lbSongsToSearch2.Text = "-"; + lbDisregardedSongs2.Text = "-"; ArrayList sitesToSearch = new ArrayList(); @@ -491,7 +511,12 @@ if (lc != null) { lc.StopSearches = true; + // Save databases to disc + SerializeDB(LyricsDB); + SerializeDB(LyricsMarkedDB); + lyricsLibraryUC.updateLyricsTree(); } + bgWorkerSearch.CancelAsync(); StopThread(); progressBar.ResetText(); progressBar.Enabled = false; @@ -501,12 +526,6 @@ btImportAll.Enabled = true; btCancel.Enabled = false; isSearching(false); - - // Save databases to disc - SerializeDB(LyricsDB); - SerializeDB(LyricsMarkedDB); - - lyricUC.updateLyricsTree(); } // Called from worker thread using delegate and Control.Invoke @@ -582,6 +601,14 @@ for (int albumIndex = 0; albumIndex < artists.Count; albumIndex++) { + + // If the user has cancelled the search => end this + if (stopCollectingOfTitles) + { + bgWorkerSearch.CancelAsync(); + return; + } + string currentArtist = (string)artists[albumIndex]; dbs.GetSongsByArtist(currentArtist, ref songs); @@ -594,16 +621,32 @@ /* Don't include song if one of the following is true * 1. The artist isn't known (MP issue - should be deleted?) * 2. Various artister should not be considered and the artist is "various artist" - * 3. Song with a lyric in the tag should not be considered and the music tag has an lyrictext included */ + * 3. Song with a lyric in the tag should not be considered, but instead include the file to the database right away */ MusicTag tag = null; if (song.Artist.Equals("unknown") - || (m_DisregardVariousArtist && (song.Artist.ToLower().Equals("various artists") || song.Artist.ToLower().Equals("diverse kunstnere"))) - || (m_DisregardSongWithLyricInTag && ((tag = MediaPortal.TagReader.TagReader.ReadTag(song.FileName)) != null) && tag.Lyrics.Equals("") == false)) + || (m_DisregardVariousArtist && (song.Artist.ToLower().Equals("various artists") || song.Artist.ToLower().Equals("diverse kunstnere")))) { m_DisregardedSongs += 1; } + else if ((m_DisregardSongWithLyricInTag && ((tag = MediaPortal.TagReader.TagReader.ReadTag(song.FileName)) != null) && tag.Lyrics.Equals("") == false)) + { + m_SongsWithLyric += 1; + + string capArtist = LyricUtil.capatalizeString(tag.Artist); + string capTitle = LyricUtil.capatalizeString(tag.Title); + + if (MyLyricsUtil.isTrackInLyricsDatabase(LyricsDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) + { + LyricsDB.Add(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, tag.Lyrics, "Tag")); + } + + if (MyLyricsUtil.isTrackInLyricsMarkedDatabase(LyricsMarkedDB, capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_MARKED)) + { + LyricsMarkedDB.Remove(MyLyricsUtil.CorrectKeyFormat(capArtist, capTitle)); + } + } else { int status = MyLyricsUtil.isTrackInLyricsDatabase(LyricsDB, song.Artist, song.Title); @@ -624,6 +667,9 @@ string[] lyricId = new string[2] { song.Artist, song.Title }; lyricConfigInfosQueue.Enqueue(lyricId); + + m_SongsToSearch = lyricConfigInfosQueue.Count; + bgWorkerSearch.ReportProgress(songNotKnown); } else if (status.Equals(MyLyricsUtil.LYRIC_FOUND)) { @@ -634,7 +680,6 @@ m_SongsWithMark += 1; } } - m_SongsToSearch = lyricConfigInfosQueue.Count; bgWorkerSearch.ReportProgress(songNotKnown); } } @@ -643,17 +688,18 @@ { foreach (KeyValuePair<string, LyricsItem> kvp in LyricsMarkedDB) { + int songNotKnown = 1; if (++m_SongsNotKnown > m_Limit) { + songNotKnown = 0; bgWorkerSearch.ReportProgress(-1); goto startSearch; } string[] lyricId = new string[2] { kvp.Value.Artist, kvp.Value.Title }; lyricConfigInfosQueue.Enqueue(lyricId); + m_SongsToSearch = lyricConfigInfosQueue.Count; + bgWorkerSearch.ReportProgress(songNotKnown); } - - m_SongsToSearch = lyricConfigInfosQueue.Count; - //bgWorkerSearch.ReportProgress(songNotKnown); } startSearch: @@ -679,10 +725,17 @@ lc.StopSearches = false; + while (lyricConfigInfosQueue.Count != 0) { - if (lc == null) + // If the user has cancelled the search => end this + if (stopCollectingOfTitles && lc != null) + { + bgWorkerSearch.CancelAsync(); return; + } + else if (lc == null) + return; if (m_noOfCurrentlySearches < m_NoOfCurrentSearchesAllowed && lc.StopSearches == false) { @@ -690,6 +743,7 @@ string[] lyricID = (string[])lyricConfigInfosQueue.Dequeue(); lc.addNewLyricSearch(lyricID[0], lyricID[1]); } + Thread.Sleep(100); } } @@ -725,19 +779,24 @@ private void btCancel_Click(object sender, EventArgs e) { + stopCollectingOfTitles = true; + if (lc != null) { lc.finishThread(m_artist, m_track, "The search has been cancelled by the user.", "none"); lc.Dispose(); lc = null; - progressBar.ResetText(); - progressBar.Value = 0; + } + else + { + m_EventStopThread.Set(); + ThreadFinishedMethod(m_artist, m_track, "The search has been cancelled by the user.", "none"); + } - m_LyricControllerThread = null; - - //bgWorkerSearch.Dispose(); - //bgWorkerSearch = null; - } + bgWorkerSearch.CancelAsync(); + progressBar.ResetText(); + progressBar.Value = 0; + m_LyricControllerThread = null; } internal static void SerializeDB(LyricsDatabase ldb) @@ -811,5 +870,13 @@ cbMarkSongsWithNoLyrics.Enabled = true; } } + + private void tabControl_SelectedIndexChanged(object sender, EventArgs e) + { + if (tabControl.SelectedIndex == 0) + { + lyricsLibraryUC.treeView.Select(); + } + } } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-03-14 17:01:09 UTC (rev 188) @@ -22,12 +22,12 @@ this.lbSource = new MediaPortal.UserInterface.Controls.MPLabel(); this.comboDatabase = new MediaPortal.UserInterface.Controls.MPComboBox(); this.lbDatabase = new MediaPortal.UserInterface.Controls.MPLabel(); - this.lbTestSecondsLeft = new System.Windows.Forms.Label(); - this.btImportLRC = new MediaPortal.UserInterface.Controls.MPButton(); + this.lbLRCTest = new System.Windows.Forms.Label(); + this.btImportDirs = new MediaPortal.UserInterface.Controls.MPButton(); this.lbSongs2 = new MediaPortal.UserInterface.Controls.MPLabel(); this.tbLyrics = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbSongs = new MediaPortal.UserInterface.Controls.MPLabel(); - this.btImportSingle = new MediaPortal.UserInterface.Controls.MPButton(); + this.btImportFiles = new MediaPortal.UserInterface.Controls.MPButton(); this.lbArtists2 = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbTitle = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbArtists = new MediaPortal.UserInterface.Controls.MPLabel(); @@ -36,7 +36,7 @@ this.btResetMarkedLyricsDatabase = new System.Windows.Forms.Button(); this.btResetLyricsDatabase = new System.Windows.Forms.Button(); this.lbResetDatabase = new MediaPortal.UserInterface.Controls.MPLabel(); - this.openFileDialog2 = new System.Windows.Forms.OpenFileDialog(); + this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.gbLibrary.SuspendLayout(); this.gbResetDatabase.SuspendLayout(); this.SuspendLayout(); @@ -54,11 +54,12 @@ // // openFileDialog1 // - this.openFileDialog1.FileName = "ARTIST - TITLE.txt"; - this.openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; + this.openFileDialog1.Filter = "Text and LRC files|*-*.txt;*.lrc|Text files|*-*.txt|LRC files|*.lrc|All files|*.*" + + ""; this.openFileDialog1.InitialDirectory = "c:\\\\"; this.openFileDialog1.Multiselect = true; this.openFileDialog1.RestoreDirectory = true; + this.openFileDialog1.Title = "Select lyrics files to include"; // // btDelete // @@ -85,12 +86,12 @@ this.gbLibrary.Controls.Add(this.lbSource); this.gbLibrary.Controls.Add(this.comboDatabase); this.gbLibrary.Controls.Add(this.lbDatabase); - this.gbLibrary.Controls.Add(this.lbTestSecondsLeft); - this.gbLibrary.Controls.Add(this.btImportLRC); + this.gbLibrary.Controls.Add(this.lbLRCTest); + this.gbLibrary.Controls.Add(this.btImportDirs); this.gbLibrary.Controls.Add(this.lbSongs2); this.gbLibrary.Controls.Add(this.tbLyrics); this.gbLibrary.Controls.Add(this.lbSongs); - this.gbLibrary.Controls.Add(this.btImportSingle); + this.gbLibrary.Controls.Add(this.btImportFiles); this.gbLibrary.Controls.Add(this.lbArtists2); this.gbLibrary.Controls.Add(this.lbTitle); this.gbLibrary.Controls.Add(this.lbArtists); @@ -99,6 +100,7 @@ this.gbLibrary.Controls.Add(this.btDelete); this.gbLibrary.Controls.Add(this.btSave); this.gbLibrary.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbLibrary.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gbLibrary.Location = new System.Drawing.Point(3, 3); this.gbLibrary.Name = "gbLibrary"; this.gbLibrary.Size = new System.Drawing.Size(515, 362); @@ -137,25 +139,27 @@ this.lbDatabase.TabIndex = 26; this.lbDatabase.Text = "Database:"; // - // lbTestSecondsLeft + // lbLRCTest // - this.lbTestSecondsLeft.AutoSize = true; - this.lbTestSecondsLeft.Location = new System.Drawing.Point(215, 335); - this.lbTestSecondsLeft.Name = "lbTestSecondsLeft"; - this.lbTestSecondsLeft.Size = new System.Drawing.Size(93, 13); - this.lbTestSecondsLeft.TabIndex = 25; - this.lbTestSecondsLeft.Text = "SecondsLeftLabel"; - this.lbTestSecondsLeft.Visible = false; + this.lbLRCTest.AutoSize = true; + this.lbLRCTest.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbLRCTest.Location = new System.Drawing.Point(440, 313); + this.lbLRCTest.MaximumSize = new System.Drawing.Size(60, 13); + this.lbLRCTest.MinimumSize = new System.Drawing.Size(60, 13); + this.lbLRCTest.Name = "lbLRCTest"; + this.lbLRCTest.Size = new System.Drawing.Size(60, 13); + this.lbLRCTest.TabIndex = 25; + this.lbLRCTest.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // btImportLRC + // btImportDirs // - this.btImportLRC.Location = new System.Drawing.Point(95, 330); - this.btImportLRC.Name = "btImportLRC"; - this.btImportLRC.Size = new System.Drawing.Size(75, 23); - this.btImportLRC.TabIndex = 24; - this.btImportLRC.Text = "Import &lrc"; - this.btImportLRC.UseVisualStyleBackColor = true; - this.btImportLRC.Click += new System.EventHandler(this.btImportLRC_Click); + this.btImportDirs.Location = new System.Drawing.Point(95, 330); + this.btImportDirs.Name = "btImportDirs"; + this.btImportDirs.Size = new System.Drawing.Size(75, 23); + this.btImportDirs.TabIndex = 24; + this.btImportDirs.Text = "Import &dirs"; + this.btImportDirs.UseVisualStyleBackColor = true; + this.btImportDirs.Click += new System.EventHandler(this.btImportDIRS_Click); // // lbSongs2 // @@ -186,15 +190,15 @@ this.lbSongs.TabIndex = 22; this.lbSongs.Text = "Songs:"; // - // btImportSingle + // btImportFiles // - this.btImportSingle.Location = new System.Drawing.Point(14, 330); - this.btImportSingle.Name = "btImportSingle"; - this.btImportSingle.Size = new System.Drawing.Size(75, 23); - this.btImportSingle.TabIndex = 4; - this.btImportSingle.Text = "Import &files"; - this.btImportSingle.UseVisualStyleBackColor = true; - this.btImportSingle.Click += new System.EventHandler(this.btImportSingle_Click); + this.btImportFiles.Location = new System.Drawing.Point(14, 330); + this.btImportFiles.Name = "btImportFiles"; + this.btImportFiles.Size = new System.Drawing.Size(75, 23); + this.btImportFiles.TabIndex = 4; + this.btImportFiles.Text = "Import &files"; + this.btImportFiles.UseVisualStyleBackColor = true; + this.btImportFiles.Click += new System.EventHandler(this.btImportSingle_Click); // // lbArtists2 // @@ -270,15 +274,14 @@ this.lbResetDatabase.Name = "lbResetDatabase"; this.lbResetDatabase.Size = new System.Drawing.Size(320, 41); this.lbResetDatabase.TabIndex = 9; - this.lbResetDatabase.Text = "Reset the lyrics database or the database with marked titles.\r\n\r\nAll data in each" + - " database that is reset is lost for ever"; + this.lbResetDatabase.Text = "Reset the lyrics database or the database with marked titles.\r\n\r\nAll data in a re" + + "set database is lost forever."; // - // openFileDialog2 + // folderBrowserDialog1 // - this.openFileDialog2.Filter = "lrc files (*.lrc)|*.lrc|All files (*.*)|*.*"; - this.openFileDialog2.InitialDirectory = "c:\\\\"; - this.openFileDialog2.Multiselect = true; - this.openFileDialog2.RestoreDirectory = true; + this.folderBrowserDialog1.Description = "Select a directory to search for lyrics or lrc-files. All files matching the patt" + + "erns [Artist]-[Title].txt and *.lrc will be included to the lyrics database."; + this.folderBrowserDialog1.ShowNewFolderButton = false; // // MyLyricsSetup_LyricsLibrary // @@ -300,7 +303,6 @@ private System.Windows.Forms.OpenFileDialog openFileDialog1; private MediaPortal.UserInterface.Controls.MPGroupBox gbLibrary; private MediaPortal.UserInterface.Controls.MPTextBox tbLyrics; - private System.Windows.Forms.TreeView treeView; private MediaPortal.UserInterface.Controls.MPGroupBox gbResetDatabase; private MediaPortal.UserInterface.Controls.MPLabel lbSongs; private MediaPortal.UserInterface.Controls.MPLabel lbArtists; @@ -309,17 +311,18 @@ internal MediaPortal.UserInterface.Controls.MPButton btSave; internal System.Windows.Forms.Button btDelete; internal System.Windows.Forms.Button btAdd; - internal MediaPortal.UserInterface.Controls.MPButton btImportSingle; - internal MediaPortal.UserInterface.Controls.MPButton btImportLRC; - private System.Windows.Forms.OpenFileDialog openFileDialog2; + internal MediaPortal.UserInterface.Controls.MPButton btImportFiles; + internal MediaPortal.UserInterface.Controls.MPButton btImportDirs; private MediaPortal.UserInterface.Controls.MPLabel lbDatabase; internal System.Windows.Forms.Button btResetMarkedLyricsDatabase; internal System.Windows.Forms.Button btResetLyricsDatabase; private MediaPortal.UserInterface.Controls.MPLabel lbResetDatabase; private MediaPortal.UserInterface.Controls.MPComboBox comboDatabase; - private System.Windows.Forms.Label lbTestSecondsLeft; + private System.Windows.Forms.Label lbLRCTest; private MediaPortal.UserInterface.Controls.MPLabel lbTitle; private MediaPortal.UserInterface.Controls.MPLabel lbSource; private System.ComponentModel.IContainer components; + private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; + internal System.Windows.Forms.TreeView treeView; } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-14 17:01:09 UTC (rev 188) @@ -27,16 +27,16 @@ public partial class MyLyricsSetup_LyricsLibrary : UserControl { + static string m_CurrentArtist = ""; + static string m_CurrentTitle = ""; string m_OriginalLyric = ""; - string m_CurrentArtist = ""; - string m_CurrentTitle = ""; + Form m_Form = null; int m_NoOfArtists; int m_NoOfTitles; LRC.SimpleLRC lrc; - IEnumerator enumerator; System.Windows.Forms.Timer timer = null; Stopwatch stopwatch = null; string nextTimeToShow; @@ -45,7 +45,11 @@ const int SHIFT_WHEN_HIT = 15; internal static LyricsDatabase CurrentDB; private int currentDBIndex = 0; + enum TYPEOFLYRICS : int {NONE, NORMAL, LRC}; + static string lastChosenArtist = ""; + static string lastChosenTitle = ""; + public MyLyricsSetup_LyricsLibrary(Form form) { this.m_Form = form; @@ -84,6 +88,16 @@ lbSongs2.Text = m_NoOfTitles.ToString(); } + private void resetFields() + { + lbArtists2.Text = ""; + lbTitle.Text = ""; + lbLRCTest.Text = ""; + lbSongs2.Text = ""; + lbSource.Text = ""; + tbLyrics.Text = ""; + } + private ArrayList getTitlesByArtist(string artist) { ArrayList titles = new ArrayList(); @@ -131,13 +145,22 @@ /// <param name="artist"></param> /// <param name="title"></param> /// <param name="lyric"></param> - private void AddSong(string artist, string title, string lyrics, string site) + private bool AddSong(string artist, string title, string lyrics, string site) { LyricsItem item = new LyricsItem(artist, title, lyrics, site); - CurrentDB.Add(MyLyricsUtil.CorrectKeyFormat(artist, title), item); - AddSong(item); - treeView.Update(); - MyLyricsSetup.SerializeDB(CurrentDB); + + if (MyLyricsUtil.isTrackInLyricsDatabase(CurrentDB, artist, title).Equals(MyLyricsUtil.LYRIC_NOT_FOUND)) + { + CurrentDB.Add(MyLyricsUtil.CorrectKeyFormat(artist, title), item); + AddSong(item); + treeView.Update(); + MyLyricsSetup.SerializeDB(CurrentDB); + return true; + } + else + { + return false; + } } private void RemoveArtist(string artist) @@ -198,7 +221,7 @@ return false; } - private void updateInfo() + internal void updateInfo() { m_CurrentArtist = ""; m_CurrentTitle = ""; @@ -316,7 +339,14 @@ private void treeView_AfterSelect(object sender, TreeViewEventArgs e) { updateInfo(); - lbTestSecondsLeft.Text = "The selected lyric is " + (isSelectedLyricALRC() ? "" : "NOT ") + "a valid LRC-file." ; + if (isSelectedLyricALRC()) + { + lbLRCTest.Text = "(valid LRC)"; + } + else + { + lbLRCTest.Text = ""; + } } private void btAdd_Click(object sender, EventArgs e) @@ -330,12 +360,18 @@ m_CurrentArtist = LyricUtil.capatalizeString(artist); m_CurrentTitle = LyricUtil.capatalizeString(title); - AddSong(m_CurrentArtist, m_CurrentTitle, lyrics, "Manual added"); - highlightSong(m_CurrentArtist, m_CurrentTitle, false); - updateLyricDatabaseStats(); + if (AddSong(m_CurrentArtist, m_CurrentTitle, lyrics, "Manual added")) + { + highlightSong(m_CurrentArtist, m_CurrentTitle, false); + updateLyricDatabaseStats(); + } + else + { + MessageBox.Show("The title \"" + artist + " - " + title + "\" is already in the database"); + } } - private void highlightSong(string artist, string title, bool previousSong) + internal void highlightSong(string artist, string title, bool previousSong) { if (artist.Equals("") || title.Equals("")) { @@ -367,48 +403,29 @@ private void btImportSingle_Click(object sender, EventArgs e) { - TextReader textReader = null; - if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { - string[] files = openFileDialog1.FileNames; for (int i = 0; i < files.Length; i++) { - FileInfo fileInfo = new FileInfo(files[i]); - string fileStringArtist = ""; - string fileStringTitle = ""; - string fileName = fileInfo.Name; + string fileName = new FileInfo(files[i]).Name; if (fileName.Contains("-")) { - int index = fileName.IndexOf("-"); - fileStringArtist = fileName.Substring(0, index); - fileStringTitle = fileName.Substring(index + 1); - fileStringArtist = fileStringArtist.Trim(); - fileStringTitle = fileStringTitle.Trim(); - fileStringTitle = fileStringTitle.Replace(".txt", ""); - textReader = new StreamReader(files[i]); - string line = ""; - string lyrics = ""; - - while ((line = textReader.ReadLine()) != null) + if (inspectFileNameAndAddToDatabaseIfValidLyrics(files[i]) != (int)TYPEOFLYRICS.NONE) { - lyrics += line + Environment.NewLine; + updateLyricDatabaseStats(); } - lyrics = lyrics.Trim(); - textReader.Close(); - - string capArtist = LyricUtil.capatalizeString(fileStringArtist); - string capTitle = LyricUtil.capatalizeString(fileStringTitle); - - AddSong(capArtist, capTitle, lyrics, "Text file"); - updateLyricDatabaseStats(); + else + { + MessageBox.Show("The title is already in the database"); + } + } else { - MessageBox.Show("The file \"" + fileName + "\" do not have a valid filename (ARTIST - TITLE.txt)."); + MessageBox.Show("The file \"" + fileName + "\" does not have a valid filename ([Artist]-[Title].txt or *.lrc)."); } } } @@ -419,7 +436,77 @@ } } + private int inspectFileNameAndAddToDatabaseIfValidLyrics(string filePath) + { + TextReader textReader = null; + + FileInfo fileInfo = new FileInfo(filePath); + + + if (fileInfo.Extension.Equals(".txt")) + { + + string fileStringArtist = ""; + string fileStringTitle = ""; + string fileName = fileInfo.Name; + + + int index = fileName.IndexOf("-"); + fileStringArtist = fileName.Substring(0, index); + fileStringTitle = fileName.Substring(index + 1); + fileStringArtist = fileStringArtist.Trim(); + fileStringTitle = fileStringTitle.Trim(); + + index = fileStringTitle.LastIndexOf('.'); + fileStringTitle = fileStringTitle.Substring(0, index); + + textReader = new StreamReader(filePath); + string line = ""; + string lyrics = ""; + + while ((line = textReader.ReadLine()) != null) + { + lyrics += line + Environment.NewLine; + } + lyrics = lyrics.Trim(); + textReader.Close(); + + string capArtist = LyricUtil.capatalizeString(fileStringArtist); + string capTitle = LyricUtil.capatalizeString(fileStringTitle); + + if (AddSong(capArtist, capTitle, lyrics, "Text file")) + { + return (int)TYPEOFLYRICS.NORMAL; + } + else + { + return (int)TYPEOFLYRICS.NONE; + } + } + else + { + lrc = new LRC.SimpleLRC(filePath); + + if (lrc.IsValid && !lrc.Artist.Equals("") && !lrc.Title.Equals("")) + { + if (AddSong(lrc.Artist, lrc.Title, lrc.Lyric.Trim(), "LRC-file")) + { + return (int)TYPEOFLYRICS.LRC; + } + else + { + return (int)TYPEOFLYRICS.NONE; + } + } + else + { + return (int)TYPEOFLYRICS.NONE; + } + } + } + + private void btUpgradeDatabase_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "Are you sure the lyrics database should be upgraded?", "Upgrade lyrics database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) @@ -428,119 +515,94 @@ } } - private void btImportLRC_Click(object sender, EventArgs e) + private void btImportDIRS_Click(object sender, EventArgs e) { - if (openFileDialog2.ShowDialog() == DialogResult.OK) + if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { try { - string[] files = openFileDialog2.FileNames; - for (int i = 0; i < files.Length; i++) + string path = folderBrowserDialog1.SelectedPath; + + int numberOfLyrics = 0; + int numberOfLRCS = 0; + int numberOfExisting = 0; + + DirectoryInfo dirInfo = new DirectoryInfo(path); + FileInfo[] fileInfos = dirInfo.GetFiles("*-*.txt", SearchOption.AllDirectories); + + foreach (FileInfo fileInfo in fileInfos) { - lrc = new LRC.SimpleLRC(files[i]); - - if (lrc == null) + int typeAdded; + if ((typeAdded = inspectFileNameAndAddToDatabaseIfValidLyrics(fileInfo.FullName)) == (int)TYPEOFLYRICS.NORMAL) { - MessageBox.Show("The lrc-file couldn't not be read properly." + Environment.NewLine + "The reading of the files was suspended."); - return; + ++numberOfLyrics; } - else if (lrc.IsValid == false) + else if (typeAdded == (int)TYPEOFLYRICS.LRC) { - MessageBox.Show("The selected file is not a valid lrc-file."); - return; + ++numberOfLRCS; } - else if (lrc.Lyric.Equals("")) + else { - MessageBox.Show("The lrc-file couldn't not be read properly." + Environment.NewLine + "It seemed to be empty."); - return; + ++numberOfExisting; } + } - enumerator = lrc.SimpleLRCTimeAndLineCollection.GetEnumerator(); + dirInfo = new DirectoryInfo(path); + fileInfos = dirInfo.GetFiles("*.lrc", SearchOption.AllDirectories); - if (!lrc.Artist.Equals("") && !lrc.Title.Equals("")) + foreach (FileInfo fileInfo in fileInfos) + { + int typeAdded; + if ((typeAdded = inspectFileNameAndAddToDatabaseIfValidLyrics(fileInfo.FullName)) == (int)TYPEOFLYRICS.NORMAL) { - AddSong(LyricUtil.capatalizeString(lrc.Artist), LyricUtil.capatalizeString(lrc.Title), lrc.Lyric.Trim(), "LRC-file"); + ++numberOfLyrics; } + else if (typeAdded == (int)TYPEOFLYRICS.LRC) + { + ++numberOfLRCS; + } + else + { + ++numberOfExisting; + } + } - updateLyricDatabaseStats(); - } + + updateLyricDatabaseStats(); + + MessageBox.Show("Number of lyris added :" + (numberOfLRCS + numberOfLyrics + numberOfExisting) + Environment.NewLine + + "Number of basic lyrics added:" + numberOfLyrics + Environment.NewLine + + "Number of LRCs added: " + numberOfLRCS + Environment.NewLine + + "Number of lyrics already in database: " + numberOfExisting); + } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } } - - //DialogResult result = MessageBox.Show("Vil du teste?", "Test af lrc-file", MessageBoxButtons.YesNo); - - //if (result == System.Windows.Forms.DialogResult.Yes) - //{ - // tbLyrics.Enabled = true; - // tbLyrics.Text = ""; - // // setup timer and stopwatch - // timer = new System.Windows.Forms.Timer(); - // stopwatch = new Stopwatch(); - - // calculateNextInterval(); - - // timer.Enabled = true; - // timer.Tick += new System.EventHandler(OnTimerEvent); - - // timer.Start(); - // stopwatch.Start(); - //} } - public void OnTimerEvent(object source, EventArgs e) - { - if (++lineCounter > SHIFT_WHEN_HIT) - { - lineCounter = 0; - tbLyrics.Text = ""; - } - tbLyrics.Text += (nextTimeToShow + " - " + nextLineToShow); - calculateNextInterval(); - } - private void calculateNextInterval() - { - if (enumerator.MoveNext()) - { - LRC.SimpleLRCTimeAndLine currentLine = (LRC.SimpleLRCTimeAndLine)enumerator.Current; - while (currentLine.Time == 0) - { - tbLyrics.Text += (currentLine.TimeString + " - " + currentLine.Line); - ++lineCounter; - enumerator.MoveNext(); - currentLine = (LRC.SimpleLRCTimeAndLine)enumerator.Current; - } - - nextTimeToShow = currentLine.TimeString; - nextLineToShow = currentLine.Line; - timer.Interval = (int)(currentLine.Time - stopwatch.ElapsedMilliseconds); - lbTestSecondsLeft.Text = ((long)(stopwatch.ElapsedMilliseconds/1000)).ToString(); - } - else - { - timer.Stop(); - stopwatch.Stop(); - timer.Dispose(); - } - } - private void comboDatabase_SelectedIndexChanged(object sender, EventArgs e) { if (comboDatabase.SelectedIndex == 0 && currentDBIndex != 0) { + resetFields(); currentDBIndex = 0; CurrentDB = MyLyricsSetup.LyricsDB; + btImportFiles.Enabled = true; + btImportDirs.Enabled = true; updateLyricsTree(); } else if (comboDatabase.SelectedIndex == 1 && currentDBIndex != 1) { + resetFields(); currentDBIndex = 1; CurrentDB = MyLyricsSetup.LyricsMarkedDB; + btImportFiles.Enabled = false; + btImportDirs.Enabled = false; updateLyricsTree(); } } @@ -552,7 +614,8 @@ string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); - bf.Serialize(fs, new LyricsDatabase()); + MyLyricsSetup.LyricsDB = new LyricsDatabase(); + bf.Serialize(fs, MyLyricsSetup.LyricsDB); fs.Close(); CurrentDB = MyLyricsSetup.LyricsDB; @@ -570,10 +633,11 @@ string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSetup.LyricsMarkedDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); - bf.Serialize(fs, new LyricsDatabase()); + MyLyricsSetup.LyricsMarkedDB = new LyricsDatabase(); + bf.Serialize(fs, MyLyricsSetup.LyricsMarkedDB); fs.Close(); - CurrentDB = MyLyricsSetup.LyricsDB; + CurrentDB = MyLyricsSetup.LyricsMarkedDB; comboDatabase.SelectedIndex = 1; updateLyricsTree(); updateInfo(); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.resx 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.resx 2007-03-14 17:01:09 UTC (rev 188) @@ -120,7 +120,7 @@ <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> - <metadata name="openFileDialog2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>147, 17</value> </metadata> </root> \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs 2007-03-14 13:51:47 UTC (rev 187) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs 2007-03-14 17:01:09 UTC (rev 188) @@ -23,17 +23,20 @@ string capatalizedTitle = LyricUtil.capatalizeString(title); lyricText = lyricDB[CorrectKeyFormat(capatalizedArtist, capatalizedTitle)].Lyrics; - } catch { return LYRIC_NOT_FOUND; } - if (lyricText.Equals("")) - return LYRIC_NOT_FOUND; - else if (lyricText.Equals(MARK)) + + if (lyricText.Equals(MARK)) + { return LYRIC_MARKED; - return LYRIC_FOUND; + } + else + { + return LYRIC_FOUND; + } } internal static int isTrackInLyricsMarkedDatabase(LyricsDatabase lyricMarkedDB, string artist, string title) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-03-24 10:39:57
|
Revision: 216 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=216&view=rev Author: saamand Date: 2007-03-24 03:39:53 -0700 (Sat, 24 Mar 2007) Log Message: ----------- Version 0.18 Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/MyLyric Windows Application/MyLyric Windows Application/Properties/AssemblyInfo.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -33,19 +33,24 @@ private int noOfLyricsNotFound; private bool m_StopSearches = false; - public static event EventHandler StopTheSearchAndAbort = null; ArrayList threadList = new ArrayList(); + ArrayList suspendedThreadList = new ArrayList(); // Main thread sets this event to stop LyricController ManualResetEvent m_EventStop_LyricController; + // The LyricController sets this when all lyricSearch threads have been aborted + ManualResetEvent m_EventStopped_LyricController; + private string[] lyricsSites; internal static bool ALLOW_ALL_TO_SEARCH = false; + + public LyricsController(ILyricForm mainForm, ManualResetEvent eventStopThread, string[] lyricSites, bool allowAllToSearch) @@ -59,6 +64,8 @@ ALLOW_ALL_TO_SEARCH = allowAllToSearch; + ArrayList easySitesArrayList = new ArrayList(); + // If search all, then include all if (allowAllToSearch) { @@ -66,20 +73,20 @@ } else { - ArrayList tempArrayList = new ArrayList(); foreach (string site in lyricSites) { if (Setup.IsMember(site)) { - tempArrayList.Add(site); + easySitesArrayList.Add(site); } } - this.lyricsSites = (string[])tempArrayList.ToArray(typeof(string)); + this.lyricsSites = (string[])easySitesArrayList.ToArray(typeof(string)); } LyricSearch.LyricsSites = lyricsSites; m_EventStop_LyricController = eventStopThread; + m_EventStopped_LyricController = new ManualResetEvent(false); LyricSearch.Abort = false; } @@ -90,10 +97,10 @@ // check if thread is cancelled while (true) { - Thread.Sleep(500); + Thread.Sleep(100); // check if thread is cancelled - if (m_EventStop_LyricController.WaitOne(0, true)) + if (m_EventStop_LyricController.WaitOne()) { // clean-up operations may be placed here for (int i=0; i<threadList.Count; i++) @@ -111,6 +118,8 @@ stillThreadsAlive = true; } } + + m_EventStopped_LyricController.Set(); break; } } @@ -135,9 +144,6 @@ stillThreadsAlive = true; } } - - Thread.Sleep(100); - finishThread("", "", "The search has ended.", ""); } @@ -146,15 +152,14 @@ if (lyricsSites.Length > 0) { // create worker thread instance - ThreadStart siteThreadInstance = delegate + ThreadStart easySitesThreadInstance = delegate { - LyricSearch lyricSearch = new LyricSearch(this); - lyricSearch.setLyricInfo(artist, title); - lyricSearch.Run(); + LyricSearch lyricSearch_EasySites = new LyricSearch(this, artist, title); + lyricSearch_EasySites.Run(); }; - Thread lyricSearchThread = new Thread(siteThreadInstance); - lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; + Thread lyricSearchThread = new Thread(easySitesThreadInstance); + lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; // looks nice in Output window lyricSearchThread.IsBackground = true; lyricSearchThread.Start(); threadList.Add(lyricSearchThread); @@ -170,6 +175,7 @@ internal void statusUpdate(string artist, string title, string site, bool lyricFound) { + //LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + artist + " - " + title + " - " + site + " - " +lyricFound.ToString() ); if (lyricFound) ++noOfLyricsFound; else @@ -206,7 +212,13 @@ public void finishThread(String artist, String title, String message, String site) { + m_StopSearches = true; m_EventStop_LyricController.Set(); + + while (!m_EventStopped_LyricController.WaitOne(Timeout.Infinite, true)) + { + Thread.Sleep(50); + } m_Form.ThreadFinished = new Object[] { artist, title, message, site }; } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-24 10:39:53 UTC (rev 216) @@ -125,7 +125,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> <PreBuildEvent> </PreBuildEvent> </PropertyGroup> Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -3,28 +3,24 @@ using System.Text; using System.IO; using System.Diagnostics; +using System.Net; namespace LyricsEngine.LyricSites { class EvilLabs { string lyric = ""; - LyricSearch lyricSearch = null; + bool complete = false; public string Lyric { get { return lyric; } } - public EvilLabs(LyricSearch lyricSearch, string artist, string title) + public EvilLabs(string artist, string title) { - this.lyricSearch = lyricSearch; if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "EvilLabs(" + artist + ", " + title + ")"); - bool thisMayBeTheCorrectLyric = true; - System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); - string lyricTemp = ""; - artist = LyricUtil.removeFeatComment(artist); LyricUtil.trimForParenthesis(ref artist); artist = artist.Replace(" ", "+"); @@ -33,39 +29,36 @@ title = title.Replace(" ", "+"); string urlString = "http://www.evillabs.sk/lyrics/" + artist + "+-+" + title; - System.Net.WebClient client = new System.Net.WebClient(); - System.Byte[] bytes = null; + WebClient client = new WebClient(); + Uri uri = new Uri(urlString); + client.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(callbackMethod); + client.OpenReadAsync(uri); - try + while (complete == false) { - bytes = client.DownloadData(urlString); + System.Threading.Thread.Sleep(100); } - catch (System.Net.WebException) - { - //return false; - } - finally - { - client.Dispose(); - } + } - int byteIndex = 0; - while (byteIndex < bytes.Length && lyricSearch.SearchHasEnded == false) + private void callbackMethod(object sender, OpenReadCompletedEventArgs e) + { + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + StringBuilder lyricTemp = new StringBuilder(); + + WebClient client = (WebClient)sender; + Stream reply = null; + StreamReader sr = null; + + try { - lyricTemp += System.Char.ConvertFromUtf32(bytes[byteIndex]); - ++byteIndex; - } + reply = (Stream)e.Result; + sr = new StreamReader(reply); - MemoryStream memoryStream = new MemoryStream(System.Text.Encoding.Default.GetBytes(lyricTemp)); - - if (memoryStream != null) - { string line = ""; int noOfLinesCount = 0; - System.IO.StreamReader sr = new System.IO.StreamReader(memoryStream); - while (line.IndexOf("</style>") == -1) { if (sr.EndOfStream || ++noOfLinesCount > 300) @@ -91,6 +84,23 @@ } } } + catch (System.Reflection.TargetInvocationException) + { + lyric = "Not found"; + } + finally + { + if (sr != null) + { + sr.Close(); + } + + if (reply != null) + { + reply.Close(); + } + } + complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -3,28 +3,24 @@ using System.Text; using System.IO; using System.Diagnostics; +using System.Net; namespace LyricsEngine.LyricSites { class HotLyrics { string lyric = ""; - LyricSearch lyricSearch = null; + bool complete = false; public string Lyric { get { return lyric; } } - public HotLyrics(LyricSearch lyricSearch, string artist, string title) + public HotLyrics(string artist, string title) { - this.lyricSearch = lyricSearch; if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); - bool thisMayBeTheCorrectLyric = true; - System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); - StringBuilder lyricTemp = new StringBuilder(); - artist = LyricUtil.removeFeatComment(artist); LyricUtil.trimForParenthesis(ref artist); artist = LyricUtil.capatalizeString(artist); @@ -97,30 +93,36 @@ string urlString = "http://www.hotlyrics.net/lyrics/" + firstLetter + "/" + artist + "/" + title + ".html"; - System.Net.WebClient client = new System.Net.WebClient(); - Stream stream = null; + WebClient client = new WebClient(); - try + Uri uri = new Uri(urlString); + client.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(callbackMethod); + client.OpenReadAsync(uri); + + while (complete == false) { - stream = client.OpenRead(urlString); + System.Threading.Thread.Sleep(100); } - catch (System.Net.WebException) - { - //return false; - } - finally - { - client.Dispose(); - } + } + private void callbackMethod(object sender, OpenReadCompletedEventArgs e) + { + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + StringBuilder lyricTemp = new StringBuilder(); - if (stream != null) + WebClient client = (WebClient)sender; + Stream reply = null; + StreamReader sr = null; + + try { + reply = (Stream)e.Result; + sr = new StreamReader(reply); + string line = ""; + int noOfLinesCount = 0; - System.IO.StreamReader sr = new System.IO.StreamReader(stream); - //sr.BaseStream.Position = 18000; - while (line.IndexOf("GOOGLE END") == -1) { if (sr.EndOfStream) @@ -173,8 +175,24 @@ lyric = "Not found"; } } - sr.Close(); } + catch (System.Reflection.TargetInvocationException) + { + lyric = "Not found"; + } + finally + { + if (sr != null) + { + sr.Close(); + } + + if (reply != null) + { + reply.Close(); + } + } + complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -3,28 +3,24 @@ using System.Text; using System.IO; using System.Diagnostics; +using System.Net; namespace LyricsEngine.LyricSites { class Lyrics007 { string lyric = ""; - LyricSearch lyricSearch = null; + bool complete = false; public string Lyric { get { return lyric; } } - public Lyrics007(LyricSearch lyricSearch, string artist, string title) + public Lyrics007(string artist, string title) { - this.lyricSearch = lyricSearch; if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Lyrics007(" + artist + ", " + title + ")"); - bool thisMayBeTheCorrectLyric = true; - System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); - StringBuilder lyricTemp = new StringBuilder(); - artist = LyricUtil.removeFeatComment(artist); LyricUtil.trimForParenthesis(ref artist); artist = artist.Replace("#", ""); @@ -36,31 +32,37 @@ string urlString = "http://www.lyrics007.com/" + artist + " Lyrics/" + title + " Lyrics.html"; - System.Net.WebClient client = new System.Net.WebClient(); - Stream stream = null; + WebClient client = new WebClient(); - try + Uri uri = new Uri(urlString); + client.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(callbackMethod); + client.OpenReadAsync(uri); + + while (complete == false) { - stream = client.OpenRead(urlString); + System.Threading.Thread.Sleep(100); } - catch (System.Net.WebException) - { - //return false; - } - finally - { - client.Dispose(); - } + } - if (stream != null) + private void callbackMethod(object sender, OpenReadCompletedEventArgs e) + { + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + StringBuilder lyricTemp = new StringBuilder(); + + WebClient client = (WebClient)sender; + Stream reply = null; + StreamReader sr = null; + + try { + reply = (Stream)e.Result; + sr = new StreamReader(reply); + string line = ""; int noOfLinesCount = 0; - System.IO.StreamReader sr = new System.IO.StreamReader(stream); - - // 1. Find beginning of lyric while (line.IndexOf("<td>Song: <strong>") == -1 && line.IndexOf("polyphonic ringtone to your cell phone") == -1) { if (sr.EndOfStream || ++noOfLinesCount > 300) @@ -74,7 +76,6 @@ } } - // 2. If start of lyric found, then continue with work if (thisMayBeTheCorrectLyric) { lyricTemp = new StringBuilder(); @@ -119,8 +120,24 @@ lyric = "Not found"; } } - sr.Close(); } + catch (System.Reflection.TargetInvocationException) + { + lyric = "Not found"; + } + finally + { + if (sr != null) + { + sr.Close(); + } + + if (reply != null) + { + reply.Close(); + } + } + complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -3,28 +3,24 @@ using System.Text; using System.IO; using System.Diagnostics; +using System.Net; namespace LyricsEngine.LyricSites { class LyricsOnDemand { string lyric = ""; - LyricSearch lyricSearch = null; + bool complete = false; public string Lyric { get { return lyric; } } - public LyricsOnDemand(LyricSearch lyricSearch, string artist, string title) + public LyricsOnDemand(string artist, string title) { - this.lyricSearch = lyricSearch; if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "LyricsOnDemand(" + artist + ", " + title + ")"); - bool thisMayBeTheCorrectLyric = true; - System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); - StringBuilder lyricTemp = new StringBuilder(); - artist = LyricUtil.removeFeatComment(artist); LyricUtil.trimForParenthesis(ref artist); LyricUtil.deleteSpecificChars(ref artist); @@ -67,30 +63,36 @@ string urlString = "http://www.lyricsondemand.com/" + firstLetter + "/" + artist + "lyrics/" + title + "lyrics.html"; - System.Net.WebClient client = new System.Net.WebClient(); - System.Byte[] bytes = null; - Stream stream = null; + WebClient client = new WebClient(); - try + Uri uri = new Uri(urlString); + client.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(callbackMethod); + client.OpenReadAsync(uri); + + while (complete == false) { - stream = client.OpenRead(urlString); + System.Threading.Thread.Sleep(100); } - catch (System.Net.WebException) + } + + private void callbackMethod(object sender, OpenReadCompletedEventArgs e) + { + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + StringBuilder lyricTemp = new StringBuilder(); + + WebClient client = (WebClient)sender; + Stream reply = null; + StreamReader sr = null; + + try { - //return false; - } - finally - { - client.Dispose(); - } + reply = (Stream)e.Result; + sr = new StreamReader(reply); - if (stream != null) - { string line = ""; int noOfLinesCount = 0; - System.IO.StreamReader sr = new System.IO.StreamReader(stream); - while (line.IndexOf(@"<font size=""2"" face=""Verdana"">") == -1) { if (sr.EndOfStream || ++noOfLinesCount > 300) @@ -144,8 +146,24 @@ lyric = "Not found"; } } - sr.Close(); } + catch (System.Reflection.TargetInvocationException) + { + lyric = "Not found"; + } + finally + { + if (sr != null) + { + sr.Close(); + } + + if (reply != null) + { + reply.Close(); + } + } + complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -3,28 +3,24 @@ using System.Text; using System.IO; using System.Diagnostics; +using System.Net; namespace LyricsEngine.LyricSites { class SeekLyrics { string lyric = ""; - LyricSearch lyricSearch = null; + bool complete = false; public string Lyric { get { return lyric; } } - public SeekLyrics(LyricSearch lyricSearch, string artist, string title) + public SeekLyrics(string artist, string title) { - this.lyricSearch = lyricSearch; if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); - bool thisMayBeTheCorrectLyric = true; - System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); - StringBuilder lyricTemp = new StringBuilder(); - artist = LyricUtil.removeFeatComment(artist); LyricUtil.trimForParenthesis(ref artist); artist = artist.Replace(" ", "-"); @@ -71,43 +67,36 @@ string urlString = "http://www.seeklyrics.com/lyrics/" + artist + "/" + title + ".html"; - System.Net.WebClient client = new System.Net.WebClient(); - System.Byte[] bytes = null; + WebClient client = new WebClient(); - try + Uri uri = new Uri(urlString); + client.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(callbackMethod); + client.OpenReadAsync(uri); + + while (complete == false) { - bytes = client.DownloadData(urlString); + System.Threading.Thread.Sleep(100); } - catch (System.Net.WebException) - { - //return false; - } - finally - { - client.Dispose(); - } + } + private void callbackMethod(object sender, OpenReadCompletedEventArgs e) + { + bool thisMayBeTheCorrectLyric = true; + System.Collections.ArrayList strLyric = new System.Collections.ArrayList(); + StringBuilder lyricTemp = new StringBuilder(); + + WebClient client = (WebClient)sender; + Stream reply = null; + StreamReader sr = null; - - if (bytes != null) + try { - int byteIndex = 3900; + reply = (Stream)e.Result; + sr = new StreamReader(reply); - while (byteIndex < bytes.Length && lyricSearch.SearchHasEnded == false) - { - lyricTemp.Append(System.Char.ConvertFromUtf32(bytes[byteIndex])); - ++byteIndex; - } + string line = ""; + int noOfLinesCount = 0; - MemoryStream memoryStream = new MemoryStream(System.Text.Encoding.Default.GetBytes(lyricTemp.ToString())); - - if (memoryStream != null) - { - string line = ""; - int noOfLinesCount = 0; - - System.IO.StreamReader sr = new System.IO.StreamReader(memoryStream); - while (line.IndexOf("<pre>") == -1) { if (sr.EndOfStream || ++noOfLinesCount > 300) @@ -170,8 +159,24 @@ lyric = "Not found"; } } + } + catch (System.Reflection.TargetInvocationException) + { + lyric = "Not found"; + } + finally + { + if (sr != null) + { + sr.Close(); } + + if (reply != null) + { + reply.Close(); + } } + complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -26,7 +26,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.17")] +[assembly: AssemblyVersion("0.18")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/LyricsEngine/Setup.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -9,11 +9,11 @@ public static string[] BatchSearchSites = new string[4] { "LyricWiki", - //"EvilLabs", "Lyrics007", "LyricsOnDemand", - "HotLyrics" - //"SeekLyrics" + "HotLyrics"/*, + "EvilLabs", + "SeekLyrics"*/ }; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-24 03:36:12 UTC (rev 215) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-24 10:39:53 UTC (rev 216) @@ -35,28 +35,35 @@ this.tbPluginName = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lbPluginName = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbEvilLabs = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbLyricsOnDemand = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbHotLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbSeekLyrics = 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(); + this.lbSpeed = new MediaPortal.UserInterface.Controls.MPLabel(); + this.rdDefault = new System.Windows.Forms.RadioButton(); + this.rbUserDefined = new System.Windows.Forms.RadioButton(); this.tbNote = new MediaPortal.UserInterface.Controls.MPLabel(); - this.cbSeekLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyricsOnDemand = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyrics007 = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbEvilLabs = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.tabPageDatabase = new MediaPortal.UserInterface.Controls.MPTabPage(); - this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.btImportAll = new MediaPortal.UserInterface.Controls.MPButton(); - this.btCancel = new MediaPortal.UserInterface.Controls.MPButton(); - this.mpLabel3 = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbGenerel = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.tbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.lbSongsLimit = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbSongsLimitNote = new MediaPortal.UserInterface.Controls.MPLabel(); this.cbSearchOnlyForMarkedSongs = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbDisregardSongWithLyricInTag = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbDisregardVariousArtist = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbDisregardSongsWithNoLyric = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbMarkSongsWithNoLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbDisconsiderTitlesWithLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.lbSongsLimitNote = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.lbSongsLimit = new MediaPortal.UserInterface.Controls.MPLabel(); + this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.btImportAll = new MediaPortal.UserInterface.Controls.MPButton(); + this.btCancel = new MediaPortal.UserInterface.Controls.MPButton(); + this.mpLabel3 = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbMessages = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.lbMessage = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbProgress = new MediaPortal.UserInterface.Controls.MPGroupBox(); @@ -91,9 +98,12 @@ this.tabPageSetup.SuspendLayout(); this.mpGroupBox2.SuspendLayout(); this.gbLyricSites.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit(); this.tabPageDatabase.SuspendLayout(); + this.gbGenerel.SuspendLayout(); this.mpGroupBox1.SuspendLayout(); - this.gbGenerel.SuspendLayout(); this.gbMessages.SuspendLayout(); this.gbProgress.SuspendLayout(); this.gbMusicDBSearchStats.SuspendLayout(); @@ -107,7 +117,7 @@ this.tabControl.Location = new System.Drawing.Point(7, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(534, 494); + this.tabControl.Size = new System.Drawing.Size(557, 494); this.tabControl.TabIndex = 1; this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); // @@ -116,7 +126,7 @@ this.tabPageLyricsDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageLyricsDatabase.Name = "tabPageLyricsDatabase"; this.tabPageLyricsDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageLyricsDatabase.Size = new System.Drawing.Size(526, 468); + this.tabPageLyricsDatabase.Size = new System.Drawing.Size(549, 468); this.tabPageLyricsDatabase.TabIndex = 1; this.tabPageLyricsDatabase.Text = "Lyrics database"; this.tabPageLyricsDatabase.UseVisualStyleBackColor = true; @@ -128,9 +138,9 @@ this.tabPageSetup.Location = new System.Drawing.Point(4, 22); this.tabPageSetup.Name = "tabPageSetup"; this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSetup.Size = new System.Drawing.Size(526, 468); + this.tabPageSetup.Size = new System.Drawing.Size(549, 468); this.tabPageSetup.TabIndex = 2; - this.tabPageSetup.Text = "General setup"; + this.tabPageSetup.Text = "Settings"; this.tabPageSetup.UseVisualStyleBackColor = true; // // mpGroupBox2 @@ -139,12 +149,12 @@ this.mpGroupBox2.Controls.Add(this.tbPluginName); this.mpGroupBox2.Controls.Add(this.lbPluginName); this.mpGroupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.mpGroupBox2.Location = new System.Drawing.Point(4, 6); + this.mpGroupBox2.Location = new System.Drawing.Point(5, 5); this.mpGroupBox2.Name = "mpGroupBox2"; - this.mpGroupBox2.Size = new System.Drawing.Size(510, 63); + this.mpGroupBox2.Size = new System.Drawing.Size(538, 63); this.mpGroupBox2.TabIndex = 29; this.mpGroupBox2.TabStop = false; - this.mpGroupBox2.Text = "Lyric sites to search"; + this.mpGroupBox2.Text = "Basic settings"; // // tbPluginName // @@ -167,192 +177,256 @@ // // gbLyricSites // - this.gbLyricSites.AutoSize = true; - this.gbLyricSites.Controls.Add(this.cbHotLyrics); + this.gbLyricSites.Controls.Add(this.groupBox2); + this.gbLyricSites.Controls.Add(this.groupBox1); + this.gbLyricSites.Controls.Add(this.rdDefault); + this.gbLyricSites.Controls.Add(this.rbUserDefined); this.gbLyricSites.Controls.Add(this.tbNote); - this.gbLyricSites.Controls.Add(this.cbSeekLyrics); - this.gbLyricSites.Controls.Add(this.cbLyricsOnDemand); - this.gbLyricSites.Controls.Add(this.cbLyrics007); - this.gbLyricSites.Controls.Add(this.cbEvilLabs); - this.gbLyricSites.Controls.Add(this.cbLyricWiki); this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbLyricSites.Location = new System.Drawing.Point(4, 75); + this.gbLyricSites.Location = new System.Drawing.Point(5, 74); this.gbLyricSites.Name = "gbLyricSites"; - this.gbLyricSites.Size = new System.Drawing.Size(510, 125); + this.gbLyricSites.Size = new System.Drawing.Size(538, 202); this.gbLyricSites.TabIndex = 28; this.gbLyricSites.TabStop = false; - this.gbLyricSites.Text = "Lyric sites to search"; + this.gbLyricSites.Text = "Lyrics sites settings"; // + // groupBox2 + // + this.groupBox2.Controls.Add(this.cbLyrics007); + this.groupBox2.Controls.Add(this.cbLyricWiki); + this.groupBox2.Controls.Add(this.cbEvilLabs); + this.groupBox2.Controls.Add(this.cbLyricsOnDemand); + this.groupBox2.Controls.Add(this.cbHotLyrics); + this.groupBox2.Controls.Add(this.cbSeekLyrics); + this.groupBox2.Location = new System.Drawing.Point(272, 72); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(258, 100); + this.groupBox2.TabIndex = 28; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "User specific mode"; + // + // cbLyrics007 + // + this.cbLyrics007.AutoSize = true; + 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(17, 48); + this.cbLyrics007.Name = "cbLyrics007"; + this.cbLyrics007.Size = new System.Drawing.Size(72, 17); + this.cbLyrics007.TabIndex = 4; + this.cbLyrics007.Text = "Lyrics 007"; + this.cbLyrics007.UseVisualStyleBackColor = true; + // + // cbLyricWiki + // + this.cbLyricWiki.AutoSize = true; + 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(17, 71); + this.cbLyricWiki.Name = "cbLyricWiki"; + this.cbLyricWiki.Size = new System.Drawing.Size(67, 17); + this.cbLyricWiki.TabIndex = 2; + this.cbLyricWiki.Text = "LyricWiki"; + this.cbLyricWiki.UseVisualStyleBackColor = true; + // + // cbEvilLabs + // + this.cbEvilLabs.AutoSize = true; + this.cbEvilLabs.Checked = true; + this.cbEvilLabs.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbEvilLabs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbEvilLabs.Location = new System.Drawing.Point(145, 71); + this.cbEvilLabs.Name = "cbEvilLabs"; + this.cbEvilLabs.Size = new System.Drawing.Size(67, 17); + this.cbEvilLabs.TabIndex = 3; + this.cbEvilLabs.Text = "Evil Labs"; + this.cbEvilLabs.UseVisualStyleBackColor = true; + // + // cbLyricsOnDemand + // + this.cbLyricsOnDemand.AutoSize = true; + this.cbLyricsOnDemand.Checked = true; + this.cbLyricsOnDemand.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbLyricsOnDemand.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbLyricsOnDemand.Location = new System.Drawing.Point(17, 26); + this.cbLyricsOnDemand.Name = "cbLyricsOnDemand"; + this.cbLyricsOnDemand.Size = new System.Drawing.Size(108, 17); + this.cbLyricsOnDemand.TabIndex = 5; + this.cbLyricsOnDemand.Text = "Lyrics OnDemand"; + this.cbLyricsOnDemand.UseVisualStyleBackColor = true; + // // cbHotLyrics // this.cbHotLyrics.AutoSize = true; 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(148, 21); + this.cbHotLyrics.Location = new System.Drawing.Point(145, 26); this.cbHotLyrics.Name = "cbHotLyrics"; this.cbHotLyrics.Size = new System.Drawing.Size(71, 17); this.cbHotLyrics.TabIndex = 7; this.cbHotLyrics.Text = "Hot Lyrics"; this.cbHotLyrics.UseVisualStyleBackColor = true; // - // tbNote - // - this.tbNote.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.tbNote.Location = new System.Drawing.Point(13, 91); - this.tbNote.Name = "tbNote"; - this.tbNote.Size = new System.Drawing.Size(377, 18); - this.tbNote.TabIndex = 19; - this.tbNote.Text = "(Seek Lyrics and Evil Labs are currently disabled due to instable servers)"; - // // cbSeekLyrics // this.cbSeekLyrics.AutoSize = true; this.cbSeekLyrics.Checked = true; this.cbSeekLyrics.CheckState = System.Windows.Forms.CheckState.Checked; this.cbSeekLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbSeekLyrics.Location = new System.Drawing.Point(148, 43); + this.cbSeekLyrics.Location = new System.Drawing.Point(145, 48); this.cbSeekLyrics.Name = "cbSeekLyrics"; this.cbSeekLyrics.Size = new System.Drawing.Size(79, 17); this.cbSeekLyrics.TabIndex = 6; this.cbSeekLyrics.Text = "Seek Lyrics"; this.cbSeekLyrics.UseVisualStyleBackColor = true; // - // cbLyricsOnDemand + // groupBox1 // - this.cbLyricsOnDemand.AutoSize = true; - this.cbLyricsOnDemand.Checked = true; - this.cbLyricsOnDemand.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbLyricsOnDemand.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbLyricsOnDemand.Location = new System.Drawing.Point(16, 43); - this.cbLyricsOnDemand.Name = "cbLyricsOnDemand"; - this.cbLyricsOnDemand.Size = new System.Drawing.Size(108, 17); - this.cbLyricsOnDemand.TabIndex = 5; - this.cbLyricsOnDemand.Text = "Lyrics OnDemand"; - this.cbLyricsOnDemand.UseVisualStyleBackColor = true; + this.groupBox1.Controls.Add(this.mpLabel2); + this.groupBox1.Controls.Add(this.trackBar); + this.groupBox1.Controls.Add(this.lbSpeed); + this.groupBox1.Location = new System.Drawing.Point(6, 72); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(260, 100); + this.groupBox1.TabIndex = 27; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Default mode"; // - // cbLyrics007 + // mpLabel2 // - this.cbLyrics007.AutoSize = true; - 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(16, 66); - this.cbLyrics007.Name = "cbLyrics007"; - this.cbLyrics007.Size = new System.Drawing.Size(72, 17); - this.cbLyrics007.TabIndex = 4; - this.cbLyrics007.Text = "Lyrics 007"; - this.cbLyrics007.UseVisualStyleBackColor = true; + this.mpLabel2.AutoSize = true; + this.mpLabel2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.mpLabel2.Location = new System.Drawing.Point(187, 25); + this.mpLabel2.Name = "mpLabel2"; + this.mpLabel2.Size = new System.Drawing.Size(43, 13); + this.mpLabel2.TabIndex = 26; + this.mpLabel2.Text = "Hit ratio"; // - // cbEvilLabs + // trackBar // - this.cbEvilLabs.AutoSize = true; - this.cbEvilLabs.Checked = true; - this.cbEvilLabs.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbEvilLabs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbEvilLabs.Location = new System.Drawing.Point(148, 66); - this.cbEvilLabs.Name = "cbEvilLabs"; - this.cbEvilLabs.Size = new System.Drawing.Size(67, 17); - this.cbEvilLabs.TabIndex = 3; - this.cbEvilLabs.Text = "Evil Labs"; - this.cbEvilLabs.UseVisualStyleBackColor = true; + this.trackBar.BackColor = System.Drawing.SystemColors.Control; + this.trackBar.LargeChange = 3; + this.trackBar.Location = new System.Drawing.Point(36, 42); + this.trackBar.Maximum = 3; + this.trackBar.Name = "trackBar"; + this.trackBar.Size = new System.Drawing.Size(185, 45); + this.trackBar.TabIndex = 25; + this.trackBar.TickStyle = System.Windows.Forms.TickStyle.Both; + this.trackBar.Value = 2; + this.trackBar.Scroll += new System.EventHandler(this.trackBar_Scroll); // - // cbLyricWiki + // lbSpeed // - this.cbLyricWiki.AutoSize = true; - 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(16, 21); - this.cbLyricWiki.Name = "cbLyricWiki"; - this.cbLyricWiki.Size = new System.Drawing.Size(67, 17); - this.cbLyricWiki.TabIndex = 2; - this.cbLyricWiki.Text = "LyricWiki"; - this.cbLyricWiki.UseVisualStyleBackColor = true; + this.lbSpeed.AutoSize = true; + this.lbSpeed.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbSpeed.Location = new System.Drawing.Point(29, 25); + this.lbSpeed.Name = "lbSpeed"; + this.lbSpeed.Size = new System.Drawing.Size(38, 13); + this.lbSpeed.TabIndex = 24; + this.lbSpeed.Text = "Speed"; // + // rdDefault + // + this.rdDefault.AutoSize = true; + this.rdDefault.Location = new System.Drawing.Point(16, 23); + this.rdDefault.Name = "rdDefault"; + this.rdDefault.Size = new System.Drawing.Size(88, 17); + this.rdDefault.TabIndex = 23; + this.rdDefault.Text = "Default mode"; + this.rdDefault.UseVisualStyleBackColor = true; + this.rdDefault.CheckedChanged += new System.EventHandler(this.rdTrackBar_CheckedChanged); + // + // rbUserDefined + // + this.rbUserDefined.AutoSize = true; + this.rbUserDefined.Location = new System.Drawing.Point(16, 46); + this.rbUserDefined.Name = "rbUserDefined"; + this.rbUserDefined.Size = new System.Drawing.Size(115, 17); + this.rbUserDefined.TabIndex = 22; + this.rbUserDefined.Text = "User specific mode"; + this.rbUserDefined.UseVisualStyleBackColor = true; + // + // tbNote + // + this.tbNote.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tbNote.Location = new System.Drawing.Point(13, 178); + this.tbNote.Margin = new System.Windows.Forms.Padding(0); + this.tbNote.Name = "tbNote"; + this.tbNote.Size = new System.Drawing.Size(377, 18); + this.tbNote.TabIndex = 19; + this.tbNote.Text = "Seek Lyrics and Evil Labs should currently not be used due to instable servers"; + // // tabPageDatabase // + this.tabPageDatabase.Controls.Add(this.gbGenerel); this.tabPageDatabase.Controls.Add(this.mpGroupBox1); - this.tabPageDatabase.Controls.Add(this.gbGenerel); this.tabPageDatabase.Controls.Add(this.gbMessages); this.tabPageDatabase.Controls.Add(this.gbProgress); this.tabPageDatabase.Controls.Add(this.gbMusicDBSearchStats); this.tabPageDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageDatabase.Name = "tabPageDatabase"; this.tabPageDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDatabase.Size = new System.Drawing.Size(526, 468); + this.tabPageDatabase.Size = new System.Drawing.Size(549, 468); this.tabPageDatabase.TabIndex = 2; - this.tabPageDatabase.Text = "Search music database"; + this.tabPageDatabase.Text = "Music database search"; this.tabPageDatabase.UseVisualStyleBackColor = true; // - // mpGroupBox1 - // - this.mpGroupBox1.Controls.Add(this.btImportAll); - this.mpGroupBox1.Controls.Add(this.btCancel); - this.mpGroupBox1.Controls.Add(this.mpLabel3); - this.mpGroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.mpGroupBox1.Location = new System.Drawing.Point(2, 133); - this.mpGroupBox1.Name = "mpGroupBox1"; - this.mpGroupBox1.Size = new System.Drawing.Size(509, 53); - this.mpGroupBox1.TabIndex = 32; - this.mpGroupBox1.TabStop = false; - this.mpGroupBox1.Text = "Search music database"; - // - // btImportAll - // - this.btImportAll.Location = new System.Drawing.Point(338, 19); - this.btImportAll.Name = "btImportAll"; - this.btImportAll.Size = new System.Drawing.Size(78, 23); - this.btImportAll.TabIndex = 32; - this.btImportAll.Text = "Start"; - this.btImportAll.UseVisualStyleBackColor = true; - this.btImportAll.Click += new System.EventHandler(this.btImportAll_Click); - // - // btCancel - // - this.btCancel.Enabled = false; - this.btCancel.Location = new System.Drawing.Point(422, 19); - this.btCancel.Name = "btCancel"; - this.btCancel.Size = new System.Drawing.Size(78, 23); - this.btCancel.TabIndex = 33; - this.btCancel.Text = "Stop"; - this.btCancel.UseVisualStyleBackColor = true; - this.btCancel.Click += new System.EventHandler(this.btCancel_Click); - // - // mpLabel3 - // - this.mpLabel3.AutoSize = true; - this.mpLabel3.Location = new System.Drawing.Point(12, 16); - this.mpLabel3.Name = "mpLabel3"; - this.mpLabel3.Size = new System.Drawing.Size(304, 26); - this.mpLabel3.TabIndex = 12; - this.mpLabel3.Text = "Press \'Start\' to fetch lyrics matching content of music database.\r\nPress \'Stop\' t" + - "o stop an ongoing lyrics search."; - // // gbGenerel // + this.gbGenerel.Controls.Add(this.tbLimit); + this.gbGenerel.Controls.Add(this.lbSongsLimit); + this.gbGenerel.Controls.Add(this.lbSongsLimitNote); this.gbGenerel.Controls.Add(this.cbSearchOnlyForMarkedSongs); this.gbGenerel.Controls.Add(this.cbDisregardSongWithLyricInTag); this.gbGenerel.Controls.Add(this.cbDisregardVariousArtist); this.gbGenerel.Controls.Add(this.cbDisregardSongsWithNoLyric); this.gbGenerel.Controls.Add(this.cbMarkSongsWithNoLyrics); this.gbGenerel.Controls.Add(this.cbDisconsiderTitlesWithLyrics); - this.gbGenerel.Controls.Add(this.lbSongsLimitNote); - this.gbGenerel.Controls.Add(this.tbLimit); - this.gbGenerel.Controls.Add(this.lbSongsLimit); this.gbGenerel.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbGenerel.Location = new System.Drawing.Point(3, 6); + this.gbGenerel.Location = new System.Drawing.Point(5, 5); this.gbGenerel.Name = "gbGenerel"; - this.gbGenerel.Size = new System.Drawing.Size(509, 121); - this.gbGenerel.TabIndex = 32; + this.gbGenerel.Size = new System.Drawing.Size(538, 121); + this.gbGenerel.TabIndex = 35; this.gbGenerel.TabStop = false; this.gbGenerel.Text = "Music database search setup"; // + // tbLimit + // + this.tbLimit.BorderColor = System.Drawing.Color.Empty; + this.tbLimit.Location = new System.Drawing.Point(162, 21); + this.tbLimit.MaxLength = 6; + this.tbLimit.Name = "tbLimit"; + this.tbLimit.Size = new System.Drawing.Size(44, 20); + this.tbLimit.TabIndex = 37; + this.tbLimit.Text = "1000"; + this.tbLimit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // lbSongsLimit + // + this.lbSongsLimit.AutoSize = true; + this.lbSongsLimit.Location = new System.Drawing.Point(16, 24); + this.lbSongsLimit.Name = "lbSongsLimit"; + this.lbSongsLimit.Size = new System.Drawing.Size(139, 13); + this.lbSongsLimit.TabIndex = 38; + this.lbSongsLimit.Text = "Top limit of songs to search:"; + // + // lbSongsLimitNote + // + this.lbSongsLimitNote.AutoSize = true; + this.lbSongsLimitNote.Location = new System.Drawing.Point(212, 24); + this.lbSongsLimitNote.Name = "lbSongsLimitNote"; + this.lbSongsLimitNote.Size = new System.Drawing.Size(82, 13); + this.lbSongsLimitNote.TabIndex = 39; + this.lbSongsLimitNote.Text = "(1000 is default)"; + // // cbSearchOnlyForMarkedSongs // this.cbSearchOnlyForMarkedSongs.AutoSize = true; this.cbSearchOnlyForMarkedSongs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbSearchOnlyForMarkedSongs.Location = new System.Drawing.Point(245, 91); + this.cbSearchOnlyForMarkedSongs.Location = new System.Drawing.Point(270, 97); this.cbSearchOnlyForMarkedSongs.Name = "cbSearchOnlyForMarkedSongs"; this.cbSearchOnlyForMarkedSongs.Size = new System.Drawing.Size(232, 17); this.cbSearchOnlyForMarkedSongs.TabIndex = 19; @@ -366,7 +440,7 @@ this.cbDisregardSongWithLyricInTag.Checked = true; this.cbDisregardSongWithLyricInTag.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDisregardSongWithLyricInTag.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbDisregardSongWithLyricInTag.Location = new System.Drawing.Point(15, 68); + this.cbDisregardSongWithLyricInTag.Location = new System.Drawing.Point(15, 74); this.cbDisregardSongWithLyricInTag.Name = "cbDisregardSongWithLyricInTag"; this.cbDisregardSongWithLyricInTag.Size = new System.Drawing.Size(202, 17); this.cbDisregardSongWithLyricInTag.TabIndex = 18; @@ -379,7 +453,7 @@ this.cbDisregardVariousArtist.Checked = true; this.cbDisregardVariousArtist.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDisregardVariousArtist.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbDisregardVariousArtist.Location = new System.Drawing.Point(15, 91); + this.cbDisregardVariousArtist.Location = new System.Drawing.Point(15, 97); this.cbDisregardVariousArtist.Name = "cbDisregardVariousArtist"; this.cbDisregardVariousArtist.Size = new System.Drawing.Size(191, 17); this.cbDisregardVariousArtist.TabIndex = 17; @@ -392,7 +466,7 @@ this.cbDisregardSongsWithNoLyric.Checked = true; this.cbDisregardSongsWithNoLyric.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDisregardSongsWithNoLyric.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbDisregardSongsWithNoLyric.Location = new System.Drawing.Point(245, 68); + this.cbDisregardSongsWithNoLyric.Location = new System.Drawing.Point(270, 74); this.cbDisregardSongsWithNoLyric.Name = "cbDisregardSongsWithNoLyric"; this.cbDisregardSongsWithNoLyric.Size = new System.Drawing.Size(246, 17); this.cbDisregardSongsWithNoLyric.TabIndex = 16; @@ -405,7 +479,7 @@ this.cbMarkSongsWithNoLyrics.Checked = true; this.cbMarkSongsWithNoLyrics.CheckState = System.Windows.Forms.CheckState.Checked; this.cbMarkSongsWithNoLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbMarkSongsWithNoLyrics.Location = new System.Drawing.Point(245, 45); + this.cbMarkSongsWithNoLyrics.Location = new System.Drawing.Point(270, 51); this.cbMarkSongsWithNoLyrics.Name = "cbMarkSongsWithNoLyrics"; this.cbMarkSongsWithNoLyrics.Size = new System.Drawing.Size(224, 17); this.cbMarkSongsWithNoLyrics.TabIndex = 15; @@ -418,58 +492,73 @@ this.cbDisconsiderTitlesWithLyrics.Checked = true; this.cbDisconsiderTitlesWithLyrics.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDisconsiderTitlesWithLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbDisconsiderTitlesWithLyrics.Location = new System.Drawing.Point(15, 45); + this.cbDisconsiderTitlesWithLyrics.Location = new System.Drawing.Point(15, 51); this.cbDisconsiderTitlesWithLyrics.Name = "cbDisconsiderTitlesWithLyrics"; this.cbDisconsiderTitlesWithLyrics.Size = new System.Drawing.Size(201, 17); this.cbDisconsiderTitlesWithLyrics.TabIndex... [truncated message content] |
From: <sa...@us...> - 2007-03-27 16:52:44
|
Revision: 240 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=240&view=rev Author: saamand Date: 2007-03-27 09:52:34 -0700 (Tue, 27 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs Added Paths: ----------- trunk/plugins/MyLyrics/Lyrics.suo trunk/plugins/MyLyrics/LyricsEngine/LRC/ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs trunk/plugins/MyLyrics/My Lyrics/Changelog.txt trunk/plugins/MyLyrics/My Lyrics/Convert/ trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/Refactor/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/TempPE/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.resx trunk/plugins/MyLyrics/MyLyrics.suo Added: trunk/plugins/MyLyrics/Lyrics.suo =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/Lyrics.suo ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,219 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace LRC +{ + public class SimpleLRC + { + string artist; + string title; + string album; + string lyric; + bool isValid; + + System.Collections.ArrayList lyricLines; + System.Collections.ArrayList simpleLRCTimeAndLineArray; + SimpleLRCTimeAndLineCollection simpleLRCTimeAndLineCollection; + + public SimpleLRC(string file) + { + FileInfo fileInfo = new FileInfo(file); + TextReader textReader = new StreamReader(file); + + string line = ""; + lyricLines = new System.Collections.ArrayList(); + simpleLRCTimeAndLineArray = new System.Collections.ArrayList(); + + while ((line = textReader.ReadLine()) != null) + { + bool done = false; + bool originalLine = true; + while (done == false) + { + done = getLRCinfoFromFile(ref line, originalLine); + originalLine = false; + } + } + + if (simpleLRCTimeAndLineArray.Count > 0) + { + simpleLRCTimeAndLineCollection = new SimpleLRCTimeAndLineCollection((SimpleLRCTimeAndLine[])simpleLRCTimeAndLineArray.ToArray(typeof(SimpleLRCTimeAndLine))); + isValid = true; + } + + textReader.Close(); + } + + + public SimpleLRC(string artist, string title, string lyric) + { + this.artist = artist; + this.title = title; + + string[] separators = new string[1]{"\n"}; + string[] lines = lyric.Split(separators, StringSplitOptions.None); + string line = ""; + lyricLines = new System.Collections.ArrayList(); + simpleLRCTimeAndLineArray = new System.Collections.ArrayList(); + + for (int i = 0; i < lines.Length; i++) + { + bool done = false; + bool originalLine = true; + line = lines[i]; + while (done == false) + { + done = getLRCinfoFromFile(ref line, originalLine); + originalLine = false; + } + } + + if (simpleLRCTimeAndLineArray.Count > 0) + { + simpleLRCTimeAndLineCollection = new SimpleLRCTimeAndLineCollection((SimpleLRCTimeAndLine[])simpleLRCTimeAndLineArray.ToArray(typeof(SimpleLRCTimeAndLine))); + isValid = true; + } + } + + private bool getLRCinfoFromFile(ref string line, bool originalLine) + { + System.Text.RegularExpressions.Match m; + + if ((m = LRC.SimpleLRCFormat.Line_Line_Regex.Match(line)).Success) + { + line = line.Trim(); + int index; + if ((index = m.Value.IndexOf("[")) > 0) + { + line = line.Substring(index); + } + + string lineWithTimeAndNewLine = line + Environment.NewLine; + + // if a line with multiple timetags, only add the first which is the complete with all tags. + if (originalLine) + { + lyric += lineWithTimeAndNewLine; + } + + // we update the line for potential further time-tags. This will natural not be regarded as an original line + // and will therefore not be added to the lyric. It will however be added to the LRC-object just as every other line + line = line.Replace(m.Value, ""); + + string lineWithNewLine = line + Environment.NewLine; + lyricLines.Add(lineWithNewLine); + + int NEXT = 1; + int minStart, minLength, secStart, secLength, msecStart, msecLength = 0; + long min, sec, msec = 0; + sec = 0; + + minStart = NEXT; + minLength = m.Value.IndexOf(":") - minStart; + min = long.Parse(m.Value.Substring(minStart, minLength)); + + secStart = minStart + minLength + NEXT; + + if (m.Value.IndexOf(".") != -1 && m.Value.IndexOf(".") < m.Value.IndexOf("]")) + { + secLength = m.Value.IndexOf(".") - secStart; + sec = long.Parse(m.Value.Substring(secStart, secLength)); + + msecStart = secStart + secLength + NEXT; + msecLength = m.Value.IndexOf("]") - msecStart; + msec = long.Parse(m.Value.Substring(msecStart, msecLength)); + } + else + { + secLength = m.Value.IndexOf("]") - secStart; + sec = long.Parse(m.Value.Substring(secStart, secLength)); + } + + string lineTemp = lineWithNewLine; + bool done = true; + + while ((m = LRC.SimpleLRCFormat.Line_Line_Regex.Match(lineTemp)).Success) + { + lineTemp = lineTemp.Replace(m.Value, ""); + done = false; + } + + //System.Text.RegularExpressions.Match firstMatch; + //while ((firstMatch = LRC.SimpleLRCFormat.Line_Line_Regex.Match(lineTemp)).Success) + //{ + // System.Text.RegularExpressions.Match lastMatch = firstMatch; + // while (lastMatch.NextMatch().Length > 0) + // { + // lastMatch = (System.Text.RegularExpressions.Match)lastMatch.NextMatch(); + // } + + // lineTemp = lineTemp.Replace(lastMatch.Value, ""); + // done = false; + //} + + simpleLRCTimeAndLineArray.Add(new SimpleLRCTimeAndLine(min, sec, msec, lineTemp)); + + return done; + } + + else if ((m = LRC.SimpleLRCFormat.Artist_LineStart_Regex.Match(line)).Success) + { + artist = line.Substring(m.Index + m.Length); + artist = LyricsEngine.LyricUtil.capatalizeString(artist.Substring(0, artist.LastIndexOf("]"))); + return true; + } + + else if ((m = LRC.SimpleLRCFormat.Title_LineStart_Regex.Match(line)).Success) + { + title = line.Substring(m.Index + m.Length); + title = LyricsEngine.LyricUtil.capatalizeString(title.Substring(0, title.LastIndexOf("]"))); + return true; + } + + else if ((m = LRC.SimpleLRCFormat.Album_LineStart_Regex.Match(line)).Success) + { + album = line.Substring(m.Index + m.Length); + album = LyricsEngine.LyricUtil.capatalizeString((album.Substring(0, album.LastIndexOf("]")))); + return true; + } + else + { + return true; + } + } + + #region properties + public string Artist + { + get { return artist; } + } + + public string Title + { + get { return title; } + } + + public string Album + { + get { return album; } + } + + public string Lyric + { + get { return lyric; } + } + + public bool IsValid + { + get { return isValid; } + } + + public SimpleLRCTimeAndLineCollection SimpleLRCTimeAndLineCollection + { + get { return simpleLRCTimeAndLineCollection; } + } + #endregion + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using System.Text.RegularExpressions; + +namespace LRC +{ + public static class SimpleLRCFormat + { + public static Regex Artist_LineStart_Regex; + public static Regex Title_LineStart_Regex; + public static Regex Album_LineStart_Regex; + public static Regex Line_Line_Regex; + + static SimpleLRCFormat() + { + Artist_LineStart_Regex = new Regex(@"\[ar\w*\:", RegexOptions.IgnoreCase); + Title_LineStart_Regex = new Regex(@"\[ti\w*\:", RegexOptions.IgnoreCase); + Album_LineStart_Regex = new Regex(@"\[al\w*\:", RegexOptions.IgnoreCase); + Line_Line_Regex = new Regex(@"\[\d+:\d+\.*\d*\]"); + } + } + + +} \ No newline at end of file Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LRC +{ + public class SimpleLRCTimeAndLine : IComparable + { + long min, sec, msec; + string line; + + public SimpleLRCTimeAndLine(long min, long sec, long msec, string line) + { + this.min = min; + this.sec = sec; + this.msec = msec; + this.line = line; + } + + public long Time + { + get { return min * 60 * 1000 + sec * 1000 + msec; } + } + + public string TimeString + { + get { return min.ToString() + ":" + sec.ToString() + "." + msec.ToString(); } + } + + public string Line + { + get { return line; } + } + + public int CompareTo(object obj) + { + SimpleLRCTimeAndLine objSLRC = (SimpleLRCTimeAndLine)obj; + long thisTime = this.min * 60 * 1000 + this.sec * 1000 + this.msec; + long objTime = objSLRC.min * 60 * 1000 + objSLRC.sec * 1000 + objSLRC.msec; + + if (thisTime > objTime) + return -1; + else if (thisTime < objTime) + return 1; + else + return 0; + } + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,85 @@ +using System; +using System.Collections; +using System.Text; + +namespace LRC +{ + public class SimpleLRCTimeAndLineCollection : IEnumerable + { + + private object[] items = null; + + public SimpleLRCTimeAndLineCollection(object[] array) + { + items = array; + Sort(items); + } + + public IEnumerator GetEnumerator() + { + return new Enumerator(items); + } + + private class Enumerator : IEnumerator + { + private int cursor; + private object[] elements = null; + + public Enumerator(object[] items) + { + elements = new object[items.Length]; + Array.Copy(items, elements, items.Length); + cursor = -1; + } + + public bool MoveNext() + { + ++cursor; + if (cursor > (elements.Length - 1)) + { + return false; + } + return true; + } + + public void Reset() + { + cursor = -1; + } + + public object Current + { + get + { + if (cursor > (elements.Length - 1)) + { + throw new InvalidOperationException("Enumration already finished"); + } + if (cursor == -1) + { + throw new InvalidOperationException("Enumeration not started"); + } + return elements[cursor]; + } + } + } + + + private void Sort(object obj) + { + IComparer myComparer = new SortAfterTimeClass(); + Array.Sort(items, myComparer); + } + + public class SortAfterTimeClass : IComparer + { + // Calls CaseInsensitiveComparer.Compare with the parameters reversed. + int IComparer.Compare(Object x, Object y) + { + return ((new CaseInsensitiveComparer()).Compare(y, x)); + } + + } + } +} + Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -78,7 +78,7 @@ { get { - return db[key]; + return db[key]; } set { Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 16:52:34 UTC (rev 240) @@ -125,7 +125,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> <PreBuildEvent> </PreBuildEvent> </PropertyGroup> Added: trunk/plugins/MyLyrics/My Lyrics/Changelog.txt =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Changelog.txt (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,29 @@ +Changes from version 0.14 to 0.15: +- Fix: A LOT of performance improvemence issues and code-clean up +- Fix: One lyric site added (HotLyrics), and one removed (SeekLyrics) due to instable server +- Add: Timer on batch search in configuration mode. +- Fix: A special formatting on SeekLyrics sites wasn't handled causing fetched of an incomplete lyrics +- Fix: For some users the tag reader added an additional space causing the search to fail. +- Fix: Various minor fixes on all the formatting on lyrics fetched from SeekLyrics +- Fix: Handling of special German and Danish letters + +Changes from version 0.13 to 0.14: +- Add: Added three new lyrics sites. Now there is a total of four lyrics sites to search from. +- Del: All Google related dependencies have been removed in the plugin. +- Fix: Even if all lyric search threads had ended the complete search wasn't terminated due to bad validation. +- Fix: LRC-text saved in music tags wasn't formatted correctly and accordingly shown as regular lyrics. +- Fix: Fields weren't reset before interpreting a new LRC-fields resulting in wrong timestamps and non-empty status field. +- Fix: Catches error when accessing displosed treeview due to application shutdown +- Fix: An improved configuration setup with various smaller bug fixes. +- Fix: Due to lack of options with the MP scroll-control the default textcontrol is uses once again in the MyLyrics screen. + +Changes from version 0.12 to 0.13: +- Add: Improved log. Logging search information in every session of MyLyric from MP starts to it closes. Saved in log\MyLyrics.log. +- Fix: All threads are now aborted as intended when search finishes. Both in configuration and play mode. +- Fix: Proper cleanup of trace objects and log files when configuration is closed. +- Fix: Lyrics searches optimized in regards to both speed and hit ration. +- Fix: Some threads ended up in deadlock when changing google license key. +- Fix: Sometimes when a lyric was found an unsuccessful, and not the succesful lyric site, was written to the MyLyrics.log. +- Add: MyLyric screen search now only uses lyric sites selected in the configuration. +- Fix: Exception messages (e.g. when license key is announced invalid for the day) is no longer shown on screen. +- Fix: Bad library handling caused the configuration in some circumstances to crash on when trying to access the MyLyricsBatch log-file. Added: trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; + +namespace MyLyrics +{ + class ConvertFromXMLtoLyricsDatabase + { + public ConvertFromXMLtoLyricsDatabase() + { + } + + public LyricsDatabase Convert(string path) + { + LyricsDatabase db = new LyricsDatabase(); + XmlTextReader tr = new XmlTextReader(path); + + string currentArtist = ""; + string currentTitle = ""; + while (tr.Read()) + { + switch (tr.Name) + { + case "section": + if (tr.AttributeCount == 1) + { + currentArtist = tr.GetAttribute(0); + } + break; + case "entry": + if (tr.AttributeCount == 1) + { + currentTitle = tr.GetAttribute(0); + LyricsItem item = new LyricsItem(currentArtist, currentTitle, "", ""); + db.Add(DatabaseUtil.CorrectKeyFormat(currentArtist, currentTitle), item); + } + break; + } + } + tr.Close(); + + LyricsDatabase lyricsDatabase = new LyricsDatabase(); + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(path, false)) + { + string lyrics; + foreach (KeyValuePair<string, LyricsItem> kvp in db) + { + lyrics = xmlreader.GetValueAsString(kvp.Value.Artist, kvp.Value.Title, ""); + lyricsDatabase.Add(DatabaseUtil.CorrectKeyFormat(kvp.Value.Artist, kvp.Value.Title), new LyricsItem(kvp.Value.Artist, kvp.Value.Title, lyrics, "old database entry")); + } + } + + return lyricsDatabase; + } + } +} Added: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,163 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; + +using LyricsEngine; + +namespace MyLyrics +{ + internal class DatabaseUtil + { + internal const string MARK = "(no lyric attached)"; + + internal const int LYRIC_NOT_FOUND = -1; + internal const int LYRIC_MARKED = 0; + internal const int LYRIC_FOUND = 1; + + internal static int IsTrackInLyricsDatabase(LyricsDatabase lyricDB, string artist, string title) + { + string lyricText = ""; + try + { + string capatalizedArtist = LyricUtil.capatalizeString(artist); + string capatalizedTitle = LyricUtil.capatalizeString(title); + + lyricText = lyricDB[CorrectKeyFormat(capatalizedArtist, capatalizedTitle)].Lyrics; + } + catch + { + return LYRIC_NOT_FOUND; + } + + if (lyricText.Equals(MARK)) + { + return LYRIC_MARKED; + } + else + { + return LYRIC_FOUND; + } + } + + internal static int IsTrackInLyricsMarkedDatabase(LyricsDatabase lyricMarkedDB, string artist, string title) + { + string lyricsText = ""; + try + { + lyricsText = lyricMarkedDB[DatabaseUtil.CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; + } + catch + { + return LYRIC_NOT_FOUND; + } + return LYRIC_MARKED; + } + + + public static string LookUpLyricInDatabase(LyricsDatabase lyricDB, string artist, string title) + { + string lyricText = ""; + try + { + lyricText = lyricDB[CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; + return lyricText.Replace("\n", "\r\n"); + } + catch + { + return lyricText; + } + } + + public static string CorrectKeyFormat(string artist, string title) + { + return artist + "-" + title; + } + + public static void WriteToLyricsDatabase(LyricsDatabase lyricsDB, LyricsDatabase lyricsMarkedDB, string capArtist, string capTitle, string lyric, string site) + { + if (DatabaseUtil.IsTrackInLyricsDatabase(lyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) + { + lyricsDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, lyric, site)); + } + + if (DatabaseUtil.IsTrackInLyricsMarkedDatabase(lyricsMarkedDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_MARKED)) + { + lyricsMarkedDB.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)); + } + } + + public static void ReplaceInLyricsDatabase(LyricsDatabase currentLyricsDB, string capArtist, string capTitle, string lyric, string site) + { + LyricsDatabase otherDatabase = GetOtherLyricsDatabase(currentLyricsDB); + + string key = DatabaseUtil.CorrectKeyFormat(capArtist, capTitle); + if (DatabaseUtil.IsTrackInLyricsDatabase(currentLyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND) == false) + { + currentLyricsDB.Remove(key); + } + + currentLyricsDB.Add(key, new LyricsItem(capArtist, capTitle, lyric, site)); + + if (DatabaseUtil.IsTrackInLyricsMarkedDatabase(otherDatabase, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_MARKED)) + { + otherDatabase.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)); + } + } + + public static void SerializeDB(LyricsDatabase lyricsDatabase) + { + if (lyricsDatabase == MyLyricsSettings.LyricsDB) + { + SerializeLyricDB(); + } + else + { + SerializeLyricMarkedDB(); + } + } + + public static void SerializeDBs() + { + SerializeLyricDB(); + SerializeLyricMarkedDB(); + } + + public static void SerializeLyricDB() + { + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + using (FileStream fs = new FileStream(path, FileMode.Open)) + { + BinaryFormatter bf = new BinaryFormatter(); + MyLyricsSettings.LyricsDB.SetLastModified(); + bf.Serialize(fs, MyLyricsSettings.LyricsDB); + fs.Close(); + } + } + + public static void SerializeLyricMarkedDB() + { + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + using (FileStream fs = new FileStream(path, FileMode.Open)) + { + BinaryFormatter bf = new BinaryFormatter(); + MyLyricsSettings.LyricsMarkedDB.SetLastModified(); + bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); + fs.Close(); + } + } + + public static LyricsDatabase GetOtherLyricsDatabase(LyricsDatabase currentDatabase) + { + if (currentDatabase.Equals(MyLyricsSettings.LyricsDB)) + { + return MyLyricsSettings.LyricsMarkedDB; + } + else + { + return MyLyricsSettings.LyricsDB; + } + } + } +} Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.Serialization; + +namespace MyLyrics +{ + [Serializable] + public class LyricsDatabase : IDictionary<string, LyricsItem>, ISerializable + { + private DateTime created; + private DateTime lastModified; + private Dictionary<string, LyricsItem> db; + + public LyricsDatabase() + { + created = DateTime.Now; + lastModified = DateTime.Now; + db = new Dictionary<string, LyricsItem>(); + } + + #region Serialization methods + + [OnDeserializing] + protected void test(StreamingContext sc) + { + Console.WriteLine(sc.Context + " - " + sc.State); + } + + protected LyricsDatabase(SerializationInfo info, StreamingContext context) + { + try + { + Dictionary<string, LyricsItem> dbTemp = new Dictionary<string, LyricsItem>(); + db = (Dictionary<string, LyricsItem>)info.GetValue("db", dbTemp.GetType()); + } + catch (System.Runtime.Serialization.SerializationException serExc) + { + } + + } + + public virtual void GetObjectData(SerializationInfo info, StreamingContext context) + { + Dictionary<string, LyricsItem> dbTemp = new Dictionary<string, LyricsItem>(); + info.AddValue("db", db, dbTemp.GetType()); + } + #endregion + + #region IDictionary<string,LyricsItem> Members + + public void Add(string key, LyricsItem value) + { + db.Add(key, value); + } + + public bool ContainsKey(string key) + { + return db.ContainsKey(key); + } + + public ICollection<string> Keys + { + get { return db.Keys; } + } + + public bool Remove(string key) + { + return db.Remove(key); + } + + public bool TryGetValue(string key, out LyricsItem value) + { + return db.TryGetValue(key, out value); + } + + public ICollection<LyricsItem> Values + { + get { return db.Values; } + } + + public LyricsItem this[string key] + { + get + { + return db[key]; + } + set + { + db[key] = value; + } + } + + #endregion + + #region ICollection<KeyValuePair<string,LyricsItem>> Members + + public void Add(KeyValuePair<string, LyricsItem> item) + { + db.Add(item.Key, item.Value); + } + + public void Clear() + { + db.Clear(); + } + + public bool Contains(KeyValuePair<string, LyricsItem> item) + { + return db.ContainsKey(item.Key); + } + + public void CopyTo(KeyValuePair<string, LyricsItem>[] array, int arrayIndex) + { + throw new Exception("The method or operation is not implemented."); + } + + public int Count + { + get { return db.Count; } + } + + public bool IsReadOnly + { + get { return false; } + } + + public bool Remove(KeyValuePair<string, LyricsItem> item) + { + return db.Remove(item.Key); + } + + #endregion + + #region IEnumerable<KeyValuePair<string,LyricsItem>> Members + + public IEnumerator<KeyValuePair<string, LyricsItem>> GetEnumerator() + { + foreach (KeyValuePair<string, LyricsItem> kvp in db) + { + yield return kvp; + } + } + + #endregion + + #region IEnumerable Members + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + foreach (KeyValuePair<string, LyricsItem> kvp in db) + { + yield return kvp; + } + } + + #endregion + } +} Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,51 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{F5789699-28EB-4E09-BD52-3BE057D38005}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>LyricsDatabase</RootNamespace> + <AssemblyName>LyricsDatabase</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="LyricsDatabase.cs" /> + <Compile Include="LyricsItem.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.Serialization; + +namespace MyLyrics +{ + [Serializable] + public class LyricsItem + { + private string artist; + private string title; + private string lyrics; + private string source; + + public LyricsItem(string artist, string title, string lyrics, string source) + { + this.artist = artist; + this.title = title; + this.lyrics = lyrics; + this.source = source; + } + + #region Properties + public string Artist + { + get { return artist; } + set { artist = value; } + } + + public string Title + { + get { return title; } + set { title = value; } + } + + public string Lyrics + { + get { return lyrics; } + set { lyrics = value; } + } + + public string Source + { + get { return source; } + set { source = value; } + } + #endregion + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LyricsDatabase")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LyricsDatabase")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("228d90d2-d845-468a-a6c1-89499e6f0c55")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,5 @@ +obj\Debug\ResolveAssemblyReference.cache +bin\Debug\LyricsDatabase.dll +bin\Debug\LyricsDatabase.pdb +obj\Debug\LyricsDatabase.dll +obj\Debug\LyricsDatabase.pdb Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -101,7 +101,12 @@ public override bool Init() { - return Load(GUIGraphicsContext.Skin + @"\myLyrics.xml"); + string lyricsXML = ""; + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + lyricsXML = (string)xmlreader.GetValueAsString("myLyrics", "myLyricsXml", "myLyrics.xml"); + } + return Load(GUIGraphicsContext.Skin + @"\" + lyricsXML); } public override void OnAction(Action action) @@ -705,7 +710,7 @@ public void ShowPlugin() { MyLyricsSetup dlg = new MyLyricsSetup(); - dlg.Show(); + dlg.ShowDialog(); } #endregion Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,136 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{BBB2DAE2-0D83-4B4B-85B6-D1B5A7E10039}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>MyLyrics</RootNamespace> + <AssemblyName>MyLyrics</AssemblyName> + <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> + <StartupObject> + </StartupObject> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <NoWarn> + </NoWarn> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Core, Version=1.0.2546.32606, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Core.DLL</HintPath> + </Reference> + <Reference Include="Databases, Version=1.0.2546.32610, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Databases.DLL</HintPath> + </Reference> + <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Plugins\Windows\Dialogs.DLL</HintPath> + </Reference> + <Reference Include="LyricsEngine, Version=0.13.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\LyricsEngine\bin\Debug\LyricsEngine.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=1.0.2546.32604, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Utils.DLL</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Convert\ConvertFromXMLtoLyricsDatabase.cs" /> + <Compile Include="MyLyricsSettings.cs" /> + <Compile Include="MyLyricsSetup_test.cs" /> + <Compile Include="DatabaseUtil.cs" /> + <Compile Include="MyLyrics.cs" /> + <Compile Include="MyLyricsSetup.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MyLyricsSetup.Designer.cs"> + <DependentUpon>MyLyricsSetup.cs</DependentUpon> + </Compile> + <Compile Include="MyLyricsSetup_AddNewSong.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MyLyricsSetup_AddNewSong.Designer.cs"> + <DependentUpon>MyLyricsSetup_AddNewSong.cs</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="MyLyricsSetup_LyricsLibrary.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="MyLyricsSetup_LyricsLibrary.Designer.cs"> + <DependentUpon>MyLyricsSetup_LyricsLibrary.cs</DependentUpon> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="MyLyricsSetup_SearchTitleDialog.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MyLyricsSetup_SearchTitleDialog.Designer.cs"> + <DependentUpon>MyLyricsSetup_SearchTitleDialog.cs</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="MyLyricsSetup_LyricsLibrary.resx"> + <SubType>Designer</SubType> + <DependentUpon>MyLyricsSetup_LyricsLibrary.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="MyLyricsSetup.resx"> + <SubType>Designer</SubType> + <DependentUpon>MyLyricsSetup.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="MyLyricsSetup_AddNewSong.resx"> + <SubType>Designer</SubType> + <DependentUpon>MyLyricsSetup_AddNewSong.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="Properties\Resources.resx"> + <SubType>Designer</SubType> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <EmbeddedResource Include="MyLyricsSetup_SearchTitleDialog.resx"> + <SubType>Designer</SubType> + <DependentUpon>MyLyricsSetup_SearchTitleDialog.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <Content Include="Changelog.txt" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal\plugins\windows"</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace MyLyrics +{ + class MyLyricsSettings + { + // Database settings + internal static LyricsDatabase LyricsDB = null; + internal static LyricsDatabase LyricsMarkedDB = null; + internal static string LyricsDBName = "LyricsDatabaseV2.db"; + internal static string LyricsMarkedDBName = "LyricsMarkedDatabaseV2.db"; + internal static string LyricsXMLName = "Lyrics.xml"; + + // log information + internal static string LogName = "MyLyrics.log"; + internal static string LogBatchFileName = "MyLyricsBatch.log"; + } +} Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -94,6 +94,8 @@ this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); + this.lbLyricsPage = new MediaPortal.UserInterface.Controls.MPLabel(); + this.comboLyricsPage = new MediaPortal.UserInterface.Controls.MPComboBox(); this.tabControl.SuspendLayout(); this.tabPageSetup.SuspendLayout(); this.mpGroupBox2.SuspendLayout(); @@ -146,12 +148,14 @@ // mpGroupBox2 // this.mpGroupBox2.AutoSize = true; + this.mpGroupBox2.Controls.Add(this.comboLyricsPage); + this.mpGroupBox2.Controls.Add(this.lbLyricsPage); this.mpGroupBox2.Controls.Add(this.tbPluginName); this.mpGroupBox2.Controls.Add(this.lbPluginName); this.mpGroupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.mpGroupBox2.Location = new System.Drawing.Point(5, 5); this.mpGroupBox2.Name = "mpGroupBox2"; - this.mpGroupBox2.Size = new System.Drawing.Size(538, 63); + this.mpGroupBox2.Size = new System.Drawing.Size(538, 98); this.mpGroupBox2.TabIndex = 29; this.mpGroupBox2.TabStop = false; this.mpGroupBox2.Text = "Basic settings"; @@ -159,10 +163,10 @@ // tbPluginName // this.tbPluginName.BorderColor = System.Drawing.Color.Empty; - this.tbPluginName.Location = new System.Drawing.Point(87, 24); + this.tbPluginName.Location = new System.Drawing.Point(96, 24); this.tbPluginName.MaxLength = 30; this.tbPluginName.Name = "tbPluginName"; - this.tbPluginName.Size = new System.Drawing.Size(154, 20); + this.tbPluginName.Size = new System.Drawing.Size(144, 20); this.tbPluginName.TabIndex = 13; this.tbPluginName.Text = "My Lyrics"; // @@ -183,7 +187,7 @@ this.gbLyricSites.Controls.Add(this.rbUserDefined); this.gbLyricSites.Controls.Add(this.tbNote); this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbLyricSites.Location = new System.Drawing.Point(5, 74); + this.gbLyricSites.Location = new System.Drawing.Point(5, 109); this.gbLyricSites.Name = "gbLyricSites"; this.gbLyricSites.Size = new System.Drawing.Size(538, 202); this.gbLyricSites.TabIndex = 28; @@ -817,18 +821,43 @@ this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); // + // lbLyricsPage + // + this.lbLyricsPage.AutoSize = true; + this.lbLyricsPage.Location = new System.Drawing.Point(13, 61); + this.lbLyricsPage.Name = "lbLyricsPage"; + this.lbLyricsPage.Size = new System.Drawing.Size(64, 13); + this.lbLyricsPage.TabIndex = 15; + this.lbLyricsPage.Text = "Lyrics page:"; + // + // comboLyricsPage + // + this.comboLyricsPage.BorderColor = System.Drawing.Color.Empty; + this.comboLyricsPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboLyricsPage.FormattingEnabled = true; + this.comboLyricsPage.Items.AddRange(new object[] { + "Basic lyrics page", + "Wide lyrics page", + "LRC creation page"}); + this.comboLyricsPage.Location = new System.Drawing.Point(96, 58); + this.comboLyricsPage.Name = "comboLyricsPage"; + this.comboLyricsPage.Size = new System.Drawing.Size(144, 21); + this.comboLyricsPage.TabIndex = 16; + // // MyLyricsSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(569, 537); + this.ClientSize = new System.Drawing.Size(566, 536); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); this.Controls.Add(this.btSave); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(576, 572); this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(576, 572); this.Name = "MyLyricsSetup"; this.ShowIcon = false; this.Text = "My Lyrics Configuration"; @@ -925,5 +954,7 @@ private MediaPortal.UserInterface.Controls.MPCheckBox cbDisregardSongsWithNoLyric; private MediaPortal.UserInterface.Controls.MPCheckBox cbMarkSongsWithNoLyrics; private MediaPortal.UserInterface.Controls.MPCheckBox cbDisconsiderTitlesWithLyrics; + private MediaPortal.UserInterface.Controls.MPLabel lbLyricsPage; + private MediaPortal.UserInterface.Controls.MPComboBox comboLyricsPage; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -120,7 +120,6 @@ m_DelegateThreadFinished = new DelegateThreadFinished(this.ThreadFinishedMethod); m_DelegateThreadException = new DelegateThreadException(this.ThreadExceptionMethod); - // Grab music database MusicDatabase dbs = new MusicDatabase(); m_TotalTitles = dbs.GetNumOfSongs(); @@ -133,6 +132,22 @@ { tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString()); tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics"); + + string xmlPage = xmlreader.GetValueAsString("myLyrics", "myLyricsXml", "myLyrics.xml"); + if (xmlPage.Equals("myLyrics.xml")) + { + comboLyricsPage.SelectedIndex = 0; + } + else if (xmlPage.Equals("myLyricsWide.xml")) + { + comboLyricsPage.SelectedIndex = 1; + } + else if (xmlPage.Equals("myLyricsEditor.xml")) + { + comboLyricsPage.SelectedIndex = 2; + } + + lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)"); rdDefault.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useDefaultSitesMode", "True")).ToString().Equals("True") ? true : false; @@ -316,6 +331,22 @@ xmlwriter.SetValue("myLyrics", "useLyricsOnDemand", cbLyricsOnDemand.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useSeekLyrics", cbSeekLyrics.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useHotLyrics", cbHotLyrics.Checked.ToString()); + + string xmlPage = ""; + if (comboLyricsPage.SelectedIndex == 0) + { + xmlPage = "myLyrics.xml"; + } + else if (comboLyricsPage.SelectedIndex == 1) + { + xmlPage = "myLyricsWide.xml"; + } + else if (comboLyricsPage.SelectedIndex == 2) + { + xmlPage = "myLyricsEditor.xml"; + } + + xmlwriter.SetValue("myLyrics", "myLyricsXml", xmlPage); } } Added: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,344 @@ +namespace MyLyrics +{ + partial class MyLyricsSetup_SearchTitleDialog + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.gbSearchInfo = new System.Windows.Forms.GroupBox(); + this.tbTitle = new System.Windows.Forms.TextBox(); + this.lbTitle = new System.Windows.Forms.Label(); + this.tbArtist = new System.Windows.Forms.TextBox(); + this.lbArtist = new System.Windows.Forms.Label(); + this.btFind = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lvSearchResults = new System.Windows.Forms.ListView(); + this.cbSite = new System.Windows.Forms.ColumnHeader(); + this.cbResu... [truncated message content] |
From: <sa...@us...> - 2007-04-01 16:15:29
|
Revision: 272 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=272&view=rev Author: saamand Date: 2007-04-01 09:15:16 -0700 (Sun, 01 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-01 16:15:16 UTC (rev 272) @@ -8,6 +8,7 @@ using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; +using System.Text; using LyricsEngine; using LyricsEngineConfig; @@ -96,13 +97,15 @@ #region Fields releated to the editor mode internal const int TAG_IN_ROUND = 5; - internal int currentLineToTag = 1; + internal int currentLineToTagIndex = 1; + internal int currentLineToTag_Total = 0; internal int tagRoundFinished = 0; internal int min = 0; internal int sec = 0; internal int msec = 0; string[] lines; + ArrayList times; enum EditorGUI_Controls : int { @@ -250,24 +253,59 @@ { if (iControl == (int)EditorGUI_Controls.CONTROL_TAGBUTTON) { - string time = min.ToString() + ":" + sec.ToString() + "." + stopwatch.ElapsedMilliseconds; - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + currentLineToTag, time); - GUIControl.HideControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + currentLineToTag); + string time = "[" + min.ToString() + ":" + (sec.ToString().Length == 2 ? sec.ToString() : "0" + sec.ToString()) + "." + (stopwatch.ElapsedMilliseconds.ToString().Length == 3 ? stopwatch.ElapsedMilliseconds.ToString() : stopwatch.ElapsedMilliseconds.ToString() + "0") + "]"; + lines[currentLineToTag_Total] = time + lines[currentLineToTag_Total]; + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + currentLineToTagIndex, time); + GUIControl.HideControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + currentLineToTagIndex); - // If a new round has to start - if (++currentLineToTag == TAG_IN_ROUND + 1) + if (++currentLineToTag_Total < lines.Length) { - currentLineToTag = 1; - ++tagRoundFinished; - for (int i = 1; i <= TAG_IN_ROUND; i++) + // If a new round has to start + if (++currentLineToTagIndex == TAG_IN_ROUND + 1) { - GUIControl.ShowControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i); - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + i, ""); - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + currentLineToTagIndex = 1; + ++tagRoundFinished; + + for (int i = 1; i <= TAG_IN_ROUND && currentLineToTag_Total + i < lines.Length ; i++) + { + GUIControl.ShowControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i); + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + i, ""); + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + } } } + else + { + MessageBox.Show("The lyric has now completely been converted into a lrc!"); + StringBuilder lyric = new StringBuilder(); + for (int i = 0; i < lines.Length; i++) + { + lyric.Append(lines[i] + "\n"); + } + lyric.Replace("\r", ""); + + string artist = LyricUtil.capatalizeString(m_artist); + string title = LyricUtil.capatalizeString(m_title); + string lyricAsString = lyric.ToString(); + + int lastLineShift = lyricAsString.LastIndexOf("\n"); + lyricAsString = lyricAsString.Substring(0, lastLineShift); + + LyricsItem item = new LyricsItem(artist, title, lyricAsString, "MP LRC-editor"); + LyricsDB[DatabaseUtil.CorrectKeyFormat(artist, title)] = item; + + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); + using (FileStream fs = new FileStream(path, FileMode.Open)) + { + BinaryFormatter bf = new BinaryFormatter(); + LyricsDB.SetLastModified(); + bf.Serialize(fs, LyricsDB); + fs.Close(); + } + } + } } return true; @@ -463,6 +501,8 @@ GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + + times = new ArrayList(); } else if(selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) { Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-01 16:15:16 UTC (rev 272) @@ -5,7 +5,7 @@ <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{BBB2DAE2-0D83-4B4B-85B6-D1B5A7E10039}</ProjectGuid> - <OutputType>Library</OutputType> + <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MyLyrics</RootNamespace> <AssemblyName>MyLyrics</AssemblyName> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-04-01 16:15:16 UTC (rev 272) @@ -96,6 +96,10 @@ this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); + this.mpGroupBox3 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.cbAutoFetch = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbMoveSongFrom = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbAutomaticUpdate = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.tabControl.SuspendLayout(); this.tabPageSetup.SuspendLayout(); this.mpGroupBox2.SuspendLayout(); @@ -109,13 +113,14 @@ this.gbMessages.SuspendLayout(); this.gbProgress.SuspendLayout(); this.gbMusicDBSearchStats.SuspendLayout(); + this.mpGroupBox3.SuspendLayout(); this.SuspendLayout(); // // tabControl // this.tabControl.Controls.Add(this.tabPageLyricsDatabase); + this.tabControl.Controls.Add(this.tabPageDatabase); this.tabControl.Controls.Add(this.tabPageSetup); - this.tabControl.Controls.Add(this.tabPageDatabase); this.tabControl.Location = new System.Drawing.Point(7, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; @@ -135,6 +140,7 @@ // // tabPageSetup // + this.tabPageSetup.Controls.Add(this.mpGroupBox3); this.tabPageSetup.Controls.Add(this.mpGroupBox2); this.tabPageSetup.Controls.Add(this.gbLyricSites); this.tabPageSetup.Location = new System.Drawing.Point(4, 22); @@ -166,10 +172,10 @@ this.comboLyricsPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboLyricsPage.FormattingEnabled = true; this.comboLyricsPage.Items.AddRange(new object[] { - "Lyrics page (basic)", - "Lyrics page (wide)", - "LRC page (basic)", - "LRC page (editor)"}); + "Lyrics screen (basic)", + "Lyrics screen (wide)", + "LRC screen (basic)", + "LRC screen (editor)"}); this.comboLyricsPage.Location = new System.Drawing.Point(96, 58); this.comboLyricsPage.Name = "comboLyricsPage"; this.comboLyricsPage.Size = new System.Drawing.Size(144, 21); @@ -180,9 +186,9 @@ this.lbLyricsPage.AutoSize = true; this.lbLyricsPage.Location = new System.Drawing.Point(13, 61); this.lbLyricsPage.Name = "lbLyricsPage"; - this.lbLyricsPage.Size = new System.Drawing.Size(64, 13); + this.lbLyricsPage.Size = new System.Drawing.Size(72, 13); this.lbLyricsPage.TabIndex = 15; - this.lbLyricsPage.Text = "Lyrics page:"; + this.lbLyricsPage.Text = "Lyrics screen:"; // // tbPluginName // @@ -211,7 +217,7 @@ this.gbLyricSites.Controls.Add(this.rbUserDefined); this.gbLyricSites.Controls.Add(this.tbNote); this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbLyricSites.Location = new System.Drawing.Point(5, 109); + this.gbLyricSites.Location = new System.Drawing.Point(5, 207); this.gbLyricSites.Name = "gbLyricSites"; this.gbLyricSites.Size = new System.Drawing.Size(538, 202); this.gbLyricSites.TabIndex = 28; @@ -845,6 +851,56 @@ this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); // + // mpGroupBox3 + // + this.mpGroupBox3.Controls.Add(this.cbAutomaticUpdate); + this.mpGroupBox3.Controls.Add(this.cbMoveSongFrom); + this.mpGroupBox3.Controls.Add(this.cbAutoFetch); + this.mpGroupBox3.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.mpGroupBox3.Location = new System.Drawing.Point(5, 109); + this.mpGroupBox3.Name = "mpGroupBox3"; + this.mpGroupBox3.Size = new System.Drawing.Size(538, 92); + this.mpGroupBox3.TabIndex = 30; + this.mpGroupBox3.TabStop = false; + this.mpGroupBox3.Text = "Fetch lyric dialog settings"; + // + // cbAutoFetch + // + this.cbAutoFetch.AutoSize = true; + this.cbAutoFetch.Checked = true; + this.cbAutoFetch.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbAutoFetch.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbAutoFetch.Location = new System.Drawing.Point(16, 23); + this.cbAutoFetch.Name = "cbAutoFetch"; + this.cbAutoFetch.Size = new System.Drawing.Size(119, 17); + this.cbAutoFetch.TabIndex = 6; + this.cbAutoFetch.Text = "Automatic fetch lyric"; + this.cbAutoFetch.UseVisualStyleBackColor = true; + // + // cbMoveSongFrom + // + this.cbMoveSongFrom.AutoSize = true; + this.cbMoveSongFrom.Checked = true; + this.cbMoveSongFrom.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbMoveSongFrom.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbMoveSongFrom.Location = new System.Drawing.Point(16, 68); + this.cbMoveSongFrom.Name = "cbMoveSongFrom"; + this.cbMoveSongFrom.Size = new System.Drawing.Size(341, 17); + this.cbMoveSongFrom.TabIndex = 7; + this.cbMoveSongFrom.Text = "Move lyrics from marked database to lyrics database when updated"; + this.cbMoveSongFrom.UseVisualStyleBackColor = true; + // + // cbAutomaticUpdate + // + this.cbAutomaticUpdate.AutoSize = true; + this.cbAutomaticUpdate.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbAutomaticUpdate.Location = new System.Drawing.Point(16, 45); + this.cbAutomaticUpdate.Name = "cbAutomaticUpdate"; + this.cbAutomaticUpdate.Size = new System.Drawing.Size(206, 17); + this.cbAutomaticUpdate.TabIndex = 8; + this.cbAutomaticUpdate.Text = "Automatic update when first lyric found"; + this.cbAutomaticUpdate.UseVisualStyleBackColor = true; + // // MyLyricsSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -883,6 +939,8 @@ this.gbMessages.ResumeLayout(false); this.gbProgress.ResumeLayout(false); this.gbMusicDBSearchStats.ResumeLayout(false); + this.mpGroupBox3.ResumeLayout(false); + this.mpGroupBox3.PerformLayout(); this.ResumeLayout(false); } @@ -957,5 +1015,9 @@ private MediaPortal.UserInterface.Controls.MPCheckBox cbDisconsiderTitlesWithLyrics; private MediaPortal.UserInterface.Controls.MPLabel lbLyricsPage; private MediaPortal.UserInterface.Controls.MPComboBox comboLyricsPage; + private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox3; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbAutoFetch; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbMoveSongFrom; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbAutomaticUpdate; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-01 16:15:16 UTC (rev 272) @@ -133,6 +133,10 @@ tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString()); tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics"); + cbAutoFetch.Checked = xmlreader.GetValueAsBool("myLyrics", "automaticFetch", true); + cbAutomaticUpdate.Checked = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false); + cbMoveSongFrom.Checked = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true); + int xmlScreen = xmlreader.GetValueAsInt("myLyrics", "myLyricsScreen", (int)MyLyricsSettings.Screen.LYRICS_BASIC); comboLyricsPage.SelectedIndex = xmlScreen; @@ -319,6 +323,9 @@ xmlwriter.SetValue("myLyrics", "useLyricsOnDemand", cbLyricsOnDemand.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useSeekLyrics", cbSeekLyrics.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useHotLyrics", cbHotLyrics.Checked.ToString()); + xmlwriter.SetValueAsBool("myLyrics", "automaticFetch", cbAutoFetch.Checked); + xmlwriter.SetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", cbAutomaticUpdate.Checked); + xmlwriter.SetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", cbMoveSongFrom.Checked); int xmlScreen = comboLyricsPage.SelectedIndex; xmlwriter.SetValue("myLyrics", "myLyricsScreen", xmlScreen); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-04-01 16:15:16 UTC (rev 272) @@ -118,9 +118,9 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <metadata name="bgWorkerSearch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>94, 17</value> + <value>6, 4</value> </metadata> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>51</value> + <value>27</value> </metadata> </root> \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-04-01 16:15:16 UTC (rev 272) @@ -135,7 +135,7 @@ // lbSource // this.lbSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbSource.Location = new System.Drawing.Point(386, 297); + this.lbSource.Location = new System.Drawing.Point(400, 297); this.lbSource.Name = "lbSource"; this.lbSource.Size = new System.Drawing.Size(113, 15); this.lbSource.TabIndex = 28; @@ -167,7 +167,7 @@ // this.lbLRCTest.AutoSize = true; this.lbLRCTest.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbLRCTest.Location = new System.Drawing.Point(440, 313); + this.lbLRCTest.Location = new System.Drawing.Point(453, 313); this.lbLRCTest.MaximumSize = new System.Drawing.Size(60, 13); this.lbLRCTest.MinimumSize = new System.Drawing.Size(60, 13); this.lbLRCTest.Name = "lbLRCTest"; @@ -235,7 +235,7 @@ // lbTitle // this.lbTitle.AutoSize = true; - this.lbTitle.Location = new System.Drawing.Point(221, 53); + this.lbTitle.Location = new System.Drawing.Point(238, 53); this.lbTitle.MaximumSize = new System.Drawing.Size(290, 26); this.lbTitle.MinimumSize = new System.Drawing.Size(290, 26); this.lbTitle.Name = "lbTitle"; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-04-01 16:15:16 UTC (rev 272) @@ -167,7 +167,7 @@ treeView.Update(); } - private void RemoveSong(string artist, string title) + public void RemoveSong(string artist, string title) { int artistIndex = treeView.Nodes.IndexOfKey(artist); int titleIndex = treeView.Nodes[artistIndex].Nodes.IndexOfKey(title); @@ -238,17 +238,20 @@ m_CurrentArtist = LyricUtil.capatalizeString(artist); m_CurrentTitle = LyricUtil.capatalizeString(title); - LyricsItem item = CurrentDB[DatabaseUtil.CorrectKeyFormat(m_CurrentArtist, m_CurrentTitle)]; - string lyricsText = item.Lyrics; + if (DatabaseUtil.IsTrackInLyricsDatabase(CurrentDB, m_CurrentArtist, m_CurrentTitle).Equals(DatabaseUtil.LYRIC_FOUND)) + { + LyricsItem item = CurrentDB[DatabaseUtil.CorrectKeyFormat(m_CurrentArtist, m_CurrentTitle)]; + string lyricsText = item.Lyrics; - lyricsText = LyricsEngine.LyricUtil.ReturnEnvironmentNewLine(lyricsText); + lyricsText = LyricsEngine.LyricUtil.ReturnEnvironmentNewLine(lyricsText); - m_OriginalLyric = lyricsText; - tbLyrics.Text = m_OriginalLyric; - tbLyrics.Enabled = true; + m_OriginalLyric = lyricsText; + tbLyrics.Text = m_OriginalLyric; + tbLyrics.Enabled = true; - lbTitle.Text = "\"" + m_CurrentArtist + " - " + m_CurrentTitle + "\""; - lbSource.Text = "(" + item.Source + ")"; + lbTitle.Text = "\"" + m_CurrentArtist + " - " + m_CurrentTitle + "\""; + lbSource.Text = "(" + item.Source + ")"; + } } } // Selected an artist @@ -662,7 +665,8 @@ } } - MyLyricsSetup_SearchTitleDialog std = new MyLyricsSetup_SearchTitleDialog(this, artist, title); + + MyLyricsSetup_SearchTitleDialog std = new MyLyricsSetup_SearchTitleDialog(this, artist, title, CurrentDB.Equals(MyLyricsSettings.LyricsMarkedDB)); } private void btSwitch_Click(object sender, EventArgs e) Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs 2007-04-01 16:15:16 UTC (rev 272) @@ -50,6 +50,7 @@ this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.btClose = new System.Windows.Forms.Button(); this.btUpdate = new System.Windows.Forms.Button(); + this.btCancel = new System.Windows.Forms.Button(); this.gbSearchInfo.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -74,7 +75,7 @@ this.tbTitle.Location = new System.Drawing.Point(73, 53); this.tbTitle.Name = "tbTitle"; this.tbTitle.Size = new System.Drawing.Size(344, 20); - this.tbTitle.TabIndex = 3; + this.tbTitle.TabIndex = 2; // // lbTitle // @@ -103,10 +104,10 @@ // // btFind // - this.btFind.Location = new System.Drawing.Point(342, 69); + this.btFind.Location = new System.Drawing.Point(281, 67); this.btFind.Name = "btFind"; - this.btFind.Size = new System.Drawing.Size(75, 23); - this.btFind.TabIndex = 4; + this.btFind.Size = new System.Drawing.Size(65, 23); + this.btFind.TabIndex = 3; this.btFind.Text = "&Fetch"; this.btFind.UseVisualStyleBackColor = true; this.btFind.Click += new System.EventHandler(this.btFind_Click); @@ -174,6 +175,7 @@ // // gbLyricSites // + this.gbLyricSites.Controls.Add(this.btCancel); this.gbLyricSites.Controls.Add(this.btFind); this.gbLyricSites.Controls.Add(this.cbHotLyrics); this.gbLyricSites.Controls.Add(this.cbSeekLyrics); @@ -195,10 +197,10 @@ 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(148, 21); + this.cbHotLyrics.Location = new System.Drawing.Point(146, 21); this.cbHotLyrics.Name = "cbHotLyrics"; this.cbHotLyrics.Size = new System.Drawing.Size(71, 17); - this.cbHotLyrics.TabIndex = 7; + this.cbHotLyrics.TabIndex = 14; this.cbHotLyrics.Text = "Hot Lyrics"; this.cbHotLyrics.UseVisualStyleBackColor = true; // @@ -208,10 +210,10 @@ this.cbSeekLyrics.Checked = true; this.cbSeekLyrics.CheckState = System.Windows.Forms.CheckState.Checked; this.cbSeekLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbSeekLyrics.Location = new System.Drawing.Point(148, 43); + this.cbSeekLyrics.Location = new System.Drawing.Point(146, 43); this.cbSeekLyrics.Name = "cbSeekLyrics"; this.cbSeekLyrics.Size = new System.Drawing.Size(79, 17); - this.cbSeekLyrics.TabIndex = 6; + this.cbSeekLyrics.TabIndex = 15; this.cbSeekLyrics.Text = "Seek Lyrics"; this.cbSeekLyrics.UseVisualStyleBackColor = true; // @@ -224,7 +226,7 @@ this.cbLyricsOnDemand.Location = new System.Drawing.Point(16, 43); this.cbLyricsOnDemand.Name = "cbLyricsOnDemand"; this.cbLyricsOnDemand.Size = new System.Drawing.Size(108, 17); - this.cbLyricsOnDemand.TabIndex = 5; + this.cbLyricsOnDemand.TabIndex = 12; this.cbLyricsOnDemand.Text = "Lyrics OnDemand"; this.cbLyricsOnDemand.UseVisualStyleBackColor = true; // @@ -237,7 +239,7 @@ this.cbLyrics007.Location = new System.Drawing.Point(16, 66); this.cbLyrics007.Name = "cbLyrics007"; this.cbLyrics007.Size = new System.Drawing.Size(72, 17); - this.cbLyrics007.TabIndex = 4; + this.cbLyrics007.TabIndex = 13; this.cbLyrics007.Text = "Lyrics 007"; this.cbLyrics007.UseVisualStyleBackColor = true; // @@ -247,10 +249,10 @@ this.cbEvilLabs.Checked = true; this.cbEvilLabs.CheckState = System.Windows.Forms.CheckState.Checked; this.cbEvilLabs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.cbEvilLabs.Location = new System.Drawing.Point(148, 66); + this.cbEvilLabs.Location = new System.Drawing.Point(146, 66); this.cbEvilLabs.Name = "cbEvilLabs"; this.cbEvilLabs.Size = new System.Drawing.Size(67, 17); - this.cbEvilLabs.TabIndex = 3; + this.cbEvilLabs.TabIndex = 16; this.cbEvilLabs.Text = "Evil Labs"; this.cbEvilLabs.UseVisualStyleBackColor = true; // @@ -263,7 +265,7 @@ this.cbLyricWiki.Location = new System.Drawing.Point(16, 21); this.cbLyricWiki.Name = "cbLyricWiki"; this.cbLyricWiki.Size = new System.Drawing.Size(67, 17); - this.cbLyricWiki.TabIndex = 2; + this.cbLyricWiki.TabIndex = 11; this.cbLyricWiki.Text = "LyricWiki"; this.cbLyricWiki.UseVisualStyleBackColor = true; // @@ -288,6 +290,16 @@ this.btUpdate.UseVisualStyleBackColor = true; this.btUpdate.Click += new System.EventHandler(this.btUpdate_Click); // + // btCancel + // + this.btCancel.Location = new System.Drawing.Point(352, 67); + this.btCancel.Name = "btCancel"; + this.btCancel.Size = new System.Drawing.Size(65, 23); + this.btCancel.TabIndex = 4; + this.btCancel.Text = "&Cancel"; + this.btCancel.UseVisualStyleBackColor = true; + this.btCancel.Click += new System.EventHandler(this.btCancel_Click); + // // MyLyricsSetup_SearchTitleDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -340,5 +352,6 @@ private System.Windows.Forms.ColumnHeader chLyric; private System.Windows.Forms.Button btClose; private System.Windows.Forms.Button btUpdate; + private System.Windows.Forms.Button btCancel; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs 2007-04-01 08:44:30 UTC (rev 271) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs 2007-04-01 16:15:16 UTC (rev 272) @@ -36,16 +36,21 @@ string originalArtist; string originalTitle; int counter; + bool automaticFetch = true; + bool automaticUpdate = true; + bool moveLyricFromMarkedDatabase = true; + bool markedDatabase; List<string> sitesToSearch; MyLyricsSetup_LyricsLibrary parent = null; - public MyLyricsSetup_SearchTitleDialog(MyLyricsSetup_LyricsLibrary form, string artist, string title) + public MyLyricsSetup_SearchTitleDialog(MyLyricsSetup_LyricsLibrary form, string artist, string title, bool markedDatabase) { InitializeComponent(); this.parent = form; + this.markedDatabase = markedDatabase; // initialize delegates m_DelegateStringUpdate = new DelegateStringUpdate(this.updateStringMethod); @@ -64,12 +69,32 @@ originalArtist = artist; originalTitle = title; + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + cbLyricWiki.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; + cbEvilLabs.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false; + cbLyrics007.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false; + cbLyricsOnDemand.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false; + cbSeekLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false; + cbHotLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false; + automaticFetch = xmlreader.GetValueAsBool("myLyrics", "automaticFetch", true); + automaticUpdate = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false); + moveLyricFromMarkedDatabase = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true); + } + this.Show(); if (!artist.Equals("") && !title.Equals("")) { - fetchLyric(originalArtist, originalTitle); - lvSearchResults.Focus(); + if (automaticFetch) + { + fetchLyric(originalArtist, originalTitle); + lvSearchResults.Focus(); + } + else + { + btFind.Focus(); + } } else if (!artist.Equals("")) { @@ -84,11 +109,13 @@ private void lockGUI() { btFind.Enabled = false; + btCancel.Enabled = true; } private void openGUI() { btFind.Enabled = true; + btCancel.Enabled = false; } private void fetchLyric(string artist, string title) @@ -126,7 +153,6 @@ sitesToSearch.Add("SeekLyrics"); } - lc = new LyricsController(this, m_EventStopThread, (string[])sitesToSearch.ToArray(), true); ThreadStart job = delegate @@ -143,19 +169,27 @@ private void stopSearch() { - if (lc != null) + Monitor.Enter(this); + try { - lc.finishThread(originalArtist, originalTitle, "", ""); - lc.Dispose(); - lc = null; + if (lc != null) + { + lc.finishThread(originalArtist, originalTitle, "", ""); + lc.Dispose(); + lc = null; + } + else + { + m_EventStopThread.Set(); + ThreadFinishedMethod(originalArtist, originalTitle, "", ""); + } + + m_LyricControllerThread = null; } - else + finally { - m_EventStopThread.Set(); - ThreadFinishedMethod(originalArtist, originalTitle, "", ""); + Monitor.Exit(this); } - - m_LyricControllerThread = null; } private void btFind_Click(object sender, EventArgs e) @@ -200,14 +234,17 @@ item.SubItems.Add("yes"); item.SubItems.Add(lyricStrings); lvSearchResults.Items.Add(item); + lvSearchResults.Items[lvSearchResults.Items.Count - 1].Selected = true; - if (++counter == sitesToSearch.Count) + if (automaticUpdate) { + btUpdate_Click(null, null); + } + else if (++counter == sitesToSearch.Count) + { stopSearch(); openGUI(); } - - lvSearchResults.Items[lvSearchResults.Items.Count - 1].Selected = true; } private void lyricNotFoundMethod(String artist, String title, String message, String site) @@ -249,7 +286,7 @@ { set { - this.Invoke(m_DelegateStatusUpdate, value); + //this.Invoke(m_DelegateStatusUpdate, value); } } public Object[] LyricFound @@ -317,11 +354,30 @@ ListViewItem item = lvSearchResults.Items[0]; string site = lvSearchResults.SelectedItems[0].Text; string lyric = tbLyrics.Text; - DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSetup_LyricsLibrary.CurrentDB, originalArtist, originalTitle, lyric, site); - DatabaseUtil.SerializeDBs(); - parent.updateInfo(); + + if (markedDatabase && moveLyricFromMarkedDatabase) + { + parent.RemoveSong(originalArtist, originalTitle); + string key = DatabaseUtil.CorrectKeyFormat(originalArtist, originalTitle); + MyLyricsSettings.LyricsDB[key] = new LyricsItem(originalArtist, originalTitle, lyric, site); + DatabaseUtil.SerializeLyricDB(); + parent.updateInfo(); + } + else if (markedDatabase) + { + DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsMarkedDB, originalArtist, originalTitle, lyric, site); + DatabaseUtil.SerializeDBs(); + parent.updateInfo(); + parent.highlightSong(originalArtist, originalTitle, false); + } + else + { + DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsDB, originalArtist, originalTitle, lyric, site); + DatabaseUtil.SerializeDBs(); + parent.updateInfo(); + parent.highlightSong(originalArtist, originalTitle, false); + } this.Close(); - parent.highlightSong(originalArtist, originalTitle, false); } } @@ -329,5 +385,11 @@ { btUpdate.PerformClick(); } + + private void btCancel_Click(object sender, EventArgs e) + { + stopSearch(); + openGUI(); + } } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/MyLyrics.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-04-12 18:17:37
|
Revision: 316 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=316&view=rev Author: saamand Date: 2007-04-12 11:16:51 -0700 (Thu, 12 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj.user trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-04-12 07:54:06 UTC (rev 315) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-04-12 18:16:51 UTC (rev 316) @@ -4,7 +4,7 @@ namespace LRC { - public class SimpleLRCTimeAndLineCollection : IEnumerable + public class SimpleLRCTimeAndLineCollection : IEnumerable, ICollection { private object[] items = null; @@ -15,11 +15,36 @@ Sort(items); } + #region IEnumerable implementation public IEnumerator GetEnumerator() { return new Enumerator(items); } + #endregion + #region ICollection implementation + public int Count + { + get { return items.Length; } + } + + public bool IsSynchronized + { + get { throw new Exception("The method or operation is not implemented."); } + } + + public object SyncRoot + { + get { throw new Exception("The method or operation is not implemented."); } + } + + public void CopyTo(Array array, int index) + { + throw new Exception("The method or operation is not implemented."); + } + #endregion + + #region Enumerator class, IEnumerator implementation private class Enumerator : IEnumerator { private int cursor; @@ -63,14 +88,9 @@ } } } + #endregion - - private void Sort(object obj) - { - IComparer myComparer = new SortAfterTimeClass(); - Array.Sort(items, myComparer); - } - + #region SortAfterTimeClass class, IComparer implementation public class SortAfterTimeClass : IComparer { // Calls CaseInsensitiveComparer.Compare with the parameters reversed. @@ -80,6 +100,24 @@ } } + #endregion + + public string[] Copy() + { + string[] array = new string[this.Count]; + for (int i = 0; i < this.Count; i++) + { + SimpleLRCTimeAndLine timeLine = (SimpleLRCTimeAndLine)items[i]; + array.SetValue(timeLine.Line, i); + } + return array; + } + + private void Sort(object obj) + { + IComparer myComparer = new SortAfterTimeClass(); + Array.Sort(items, myComparer); + } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-04-12 07:54:06 UTC (rev 315) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-04-12 18:16:51 UTC (rev 316) @@ -69,6 +69,8 @@ <DependentUpon>Resources.resx</DependentUpon> <DesignTime>True</DesignTime> </Compile> + <None Include="app.config" /> + <None Include="ClassDiagram1.cd" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-12 07:54:06 UTC (rev 315) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-12 18:16:51 UTC (rev 316) @@ -1,6 +1,4 @@ -#define DEBUGGING - -using System; +using System; using System.Windows.Forms; using System.Threading; using System.Diagnostics; @@ -36,10 +34,11 @@ public static int WINDOW_MYLYRICS = 90478; private int selectedScreen = 0; - string lyricsScreenXML = ""; + string lyricsScreenXML = "MyLyrics.xml"; bool exitingMyLyrics = false; - bool firstTime = false; + bool newTrack = false; + bool alreadyValidLRC = false; // worker thread Thread m_LyricControllerThread; @@ -54,7 +53,6 @@ string m_TrackText = ""; string m_StatusText = ""; string m_LyricText = ""; - string m_Path = ""; bool lyricsFound = false; @@ -69,36 +67,57 @@ #endregion - #region Fields related to one of lyrics modes + #region GUI enums + enum GUI_General_Controls + { + CONTROL_BACKGROUND = 1, + CONTROL_LBStatus = 11 + } - enum LyricGUI_Controls + enum GUI_Lyrics_Controls { - CONTROL_BACKGROUND = 1, - CONTROL_LBTrack = 10, - CONTROL_LBStatus = 11, CONTROL_Lyric = 20 } + enum GUI_LRC_Controls : int + { + CONTROL_ART_CURRENTLY = 24, + CONTROL_ART_DURATION = 25, + CONTROL_ART_ALBUM = 26, + CONTROL_ART_YEAR = 27, + CONTROL_ART_NOWPLAYINGBACK = 31, + CONTROL_ART_ALBUMART = 112, + CONTROL_ART_PROGRESS = 118, + CONTROL_ART_PROGRESSIMAGE = 117, + + CONTROL_TAGBUTTON = 50, + + CONTROL_EDIT_TIME = 600, + CONTROL_EDIT_LINE = 200, + CONTROL_EDIT_LINE_DONE = 300, + + CONTROL_VIEW_LINE = 400, + CONTROL_VIEW_LINE_DONE = 500 + } #endregion #region Fields related to LRC mode - const int SHIFT_WHEN_HIT = 10; + internal const int BASIC_WIDE_LIMIT = 40; LRC.SimpleLRC lrc; IEnumerator enumerator; System.Windows.Forms.Timer timer; Stopwatch stopwatch; string nextTimeToShow; string nextLineToShow; - int lineCounter; #endregion #region Fields releated to the editor mode - internal const int TAG_IN_ROUND = 5; - internal int currentLineToTagIndex = 1; - internal int currentLineToTag_Total = 0; + internal const int TAG_IN_ROUND = 13; + internal int currentLRCLine = 0; + internal int LRCLinesTotal = 0; internal int tagRoundFinished = 0; internal int min = 0; internal int sec = 0; @@ -106,36 +125,6 @@ string[] lines; ArrayList times; - - enum EditorGUI_Controls : int - { - CONTROL_BACKGROUND = 1, - CONTROL_LBTrack = 10, - CONTROL_LBStatus = 11, - - CONTROL_TAGBUTTON = 50, - - CONTROL_TIME = 100, - CONTROL_TIME1 = 101, - CONTROL_TIME2 = 102, - CONTROL_TIME3 = 103, - CONTROL_TIME4 = 104, - CONTROL_TIME5 = 105, - - CONTROL_LINE = 200, - CONTROL_LINE1 = 201, - CONTROL_LINE2 = 202, - CONTROL_LINE3 = 203, - CONTROL_LINE4 = 204, - CONTROL_LINE5 = 205, - - CONTROL_LINE_DONE = 300, - CONTROL_LINE1_DONE = 301, - CONTROL_LINE2_DONE = 302, - CONTROL_LINE3_DONE = 303, - CONTROL_LINE4_DONE = 304, - CONTROL_LINE5_DONE = 305 - } #endregion @@ -159,356 +148,141 @@ { case (int)MyLyricsSettings.Screen.LYRICS_BASIC: selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_BASIC; - lyricsScreenXML = "MyLyrics.xml"; break; case (int)MyLyricsSettings.Screen.LYRICS_WIDE: selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_WIDE; - lyricsScreenXML = "MyLyricsWide.xml"; break; case (int)MyLyricsSettings.Screen.LRC_BASIC: selectedScreen = (int)MyLyricsSettings.Screen.LRC_BASIC; - lyricsScreenXML = "MyLyricsLRC.xml"; break; case (int)MyLyricsSettings.Screen.LRC_EDITOR: selectedScreen = (int)MyLyricsSettings.Screen.LRC_EDITOR; - lyricsScreenXML = "MyLyricsEditor.xml"; break; default: selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_BASIC; - lyricsScreenXML = "MyLyrics.xml"; break; } + timer = new System.Windows.Forms.Timer(); + return Load(GUIGraphicsContext.Skin + @"\" + lyricsScreenXML); } - public override void OnAction(Action action) + + public override void Process() { - switch (action.wID) + if (newTrack) { - case Action.ActionType.ACTION_PREVIOUS_MENU: + alreadyValidLRC = false; + + if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC || selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) { - GUIWindowManager.ShowPreviousWindow(); - return; - } - } - base.OnAction(action); - } + lyricsFound = false; + StopThread(); + newTrack = false; - private void resetAll() - { + MusicTag tag = new MusicTag(); + tag.Artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); + tag.Title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); + m_artist = tag.Artist; + m_title = tag.Title; - //deregister the handler! - GUIPropertyManager.OnPropertyChanged -= this.trackChangeHandler; - - firstTime = false; - exitingMyLyrics = true; - m_artist = ""; - m_title = ""; - m_TrackText = ""; - m_StatusText = ""; - m_LyricText = ""; - m_Path = ""; - lyricsFound = false; - m_LyricControllerThread = null; - lc = null; - m_sitesToSearch = null; - - resetLrcFields(); - } - - private void resetLrcFields() - { - if (timer != null) - timer.Dispose(); - if (stopwatch != null) - stopwatch.Reset(); - nextTimeToShow = ""; - nextLineToShow = ""; - lineCounter = 0; - } - - public override bool OnMessage(GUIMessage message) - { - switch (message.Message) - { - case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: + // Get lyric + if (!tag.Artist.Equals("")) { - exitingMyLyrics = false; - base.OnMessage(message); - - LoadSettings(); - - LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens, screen: " + lyricsScreenXML); - return true; + findLyric(tag); } - case GUIMessage.MessageType.GUI_MSG_CLICKED: + else { + m_artist = ""; + m_title = ""; + m_TrackText = ""; + m_StatusText = "No music file playing"; + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); + m_LyricText = ""; + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); + } + } + else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + newTrack = false; - //get sender control - int iControl = message.SenderControlId; + m_artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); + m_title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); - if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) - { - if (iControl == (int)EditorGUI_Controls.CONTROL_TAGBUTTON) - { - string time = "[" + min.ToString() + ":" + (sec.ToString().Length == 2 ? sec.ToString() : "0" + sec.ToString()) + "." + (stopwatch.ElapsedMilliseconds.ToString().Length == 3 ? stopwatch.ElapsedMilliseconds.ToString() : stopwatch.ElapsedMilliseconds.ToString() + "0") + "]"; - lines[currentLineToTag_Total] = time + lines[currentLineToTag_Total]; - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + currentLineToTagIndex, time); - GUIControl.HideControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + currentLineToTagIndex); - - if (++currentLineToTag_Total < lines.Length) - { - - // If a new round has to start - if (++currentLineToTagIndex == TAG_IN_ROUND + 1) - { - currentLineToTagIndex = 1; - ++tagRoundFinished; - - for (int i = 1; i <= TAG_IN_ROUND && currentLineToTag_Total + i < lines.Length ; i++) - { - GUIControl.ShowControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i); - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + i, ""); - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); - } - } - } - else - { - MessageBox.Show("The lyric has now completely been converted into a lrc!"); - StringBuilder lyric = new StringBuilder(); - for (int i = 0; i < lines.Length; i++) - { - lyric.Append(lines[i] + "\n"); - } - lyric.Replace("\r", ""); - - string artist = LyricUtil.capatalizeString(m_artist); - string title = LyricUtil.capatalizeString(m_title); - string lyricAsString = lyric.ToString(); - - int lastLineShift = lyricAsString.LastIndexOf("\n"); - lyricAsString = lyricAsString.Substring(0, lastLineShift); - - LyricsItem item = new LyricsItem(artist, title, lyricAsString, "MP LRC-editor"); - LyricsDB[DatabaseUtil.CorrectKeyFormat(artist, title)] = item; - - string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); - using (FileStream fs = new FileStream(path, FileMode.Open)) - { - BinaryFormatter bf = new BinaryFormatter(); - LyricsDB.SetLastModified(); - bf.Serialize(fs, LyricsDB); - fs.Close(); - } - } - - } - } - return true; + if (DatabaseUtil.IsTrackInLyricsDatabase(LyricsDB, m_artist, m_title).Equals(DatabaseUtil.LYRIC_FOUND)) + { + LyricsItem item = LyricsDB[DatabaseUtil.CorrectKeyFormat(m_artist, m_title)]; + m_LyricText = item.Lyrics; + showLRCtoEdit(); } - case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: + else { - StopThread(); - resetAll(); - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics closes, screen: " + lyricsScreenXML); - break; + startSearch(); } - } - return base.OnMessage(message); - } - - //event driven handler to detect track change - private void trackChangeHandler(string tag2, string value) - { - if (tag2.Equals("#Play.Current.Track") && !exitingMyLyrics) // track has changed - { - if (!value.Equals("")) // additional check - { - lyricsFound = false; - StopThread(); - - MusicTag tag = new MusicTag(); - tag.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist"); - tag.Title = GUIPropertyManager.GetProperty("#Play.Current.Title"); - - findLyric(tag); } - else + else if (!exitingMyLyrics) { - m_artist = ""; - m_title = ""; - m_TrackText = ""; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_StatusText); - m_StatusText = "No music file playing"; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); - m_LyricText = ""; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + startSearch(); } } + base.Process(); } - //event driven handler to detect track change - private void timeHandler(string tag2, string value) + private void startSearch() { - if (tag2.Equals("#currentplaytime") && !exitingMyLyrics) - { - if (stopwatch != null && stopwatch.IsRunning) - { - stopwatch.Stop(); - } + lyricsFound = false; + StopThread(); + newTrack = false; - stopwatch = new Stopwatch(); - stopwatch.Start(); + MusicTag tag = new MusicTag(); + tag.Artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); + tag.Title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); - string[] timeStrings = value.Split(':'); - min = int.Parse(timeStrings[0]); - sec = int.Parse(timeStrings[1]); - - if (!value.Equals("")) // additional check - { - lyricsFound = false; - StopThread(); - - MusicTag tag = new MusicTag(); - tag.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist"); - tag.Title = GUIPropertyManager.GetProperty("#Play.Current.Title"); - - findLyric(tag); - } - else - { - m_artist = ""; - m_title = ""; - m_TrackText = ""; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_StatusText); - m_StatusText = "No music file playing"; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); - m_LyricText = ""; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); - } + if (!tag.Artist.Equals("")) findLyric(tag); + else + { + m_artist = ""; + m_title = ""; + m_TrackText = ""; + m_StatusText = "No music file playing"; + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); + m_LyricText = ""; + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); } } - public override void Process() + private void showLRCtoEdit() { - if (firstTime && selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) + LRC.SimpleLRC lrc = new LRC.SimpleLRC(m_artist, m_title, m_LyricText); + + if (lrc.IsValid) { - firstTime = false; - - string artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); - string title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); - - string lyric = ""; - - if (DatabaseUtil.IsTrackInLyricsDatabase(LyricsDB, artist, title).Equals(DatabaseUtil.LYRIC_FOUND)) - { - LyricsItem item = LyricsDB[DatabaseUtil.CorrectKeyFormat(artist, title)]; - lyric = item.Lyrics; - - lines = lyric.Split(new string[1] { "\n" }, StringSplitOptions.None); - - for (int i = tagRoundFinished * TAG_IN_ROUND; i < (tagRoundFinished + 1) * TAG_IN_ROUND; i++) - { - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i, lines[i]); - GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE_DONE + i, lines[i]); - } - } + alreadyValidLRC = true; + lines = new string[1] { "This track already has a valid LRC!" }; } - else if (firstTime && !exitingMyLyrics) //when mylyrics is opened while music is already playing, trackChangeHandler won't be called + else { - lyricsFound = false; - StopThread(); - firstTime = false; - - MusicTag tag = new MusicTag(); - tag.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist"); - tag.Title = GUIPropertyManager.GetProperty("#Play.Current.Title"); - - if (!tag.Artist.Equals("")) findLyric(tag); - else - { - m_artist = ""; - m_title = ""; - m_TrackText = ""; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_StatusText); - m_StatusText = "No music file playing"; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); - m_LyricText = ""; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); - } + lines = m_LyricText.Split(new string[1] { "\n" }, StringSplitOptions.None); } - - /* - if (isNewTrack() && exitingMyLyrics == false) + try { - lyricsFound = false; - StopThread(); - m_Path = g_Player.CurrentFile; - MusicTag tag = MediaPortal.TagReader.TagReader.ReadTag(m_Path); - - - //quick and dirty CDA support hack :) - if (g_Player.IsCDA) - { - tag = new MusicTag(); - tag.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist"); - tag.Title = GUIPropertyManager.GetProperty("#Play.Current.Title"); - } - - if (!m_Path.Equals("")) + for (int i = tagRoundFinished * TAG_IN_ROUND; i < (tagRoundFinished + 1) * TAG_IN_ROUND; i++) { - //findLyric(tag); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + i, lines[i]); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE_DONE + i, lines[i]); } - else - { - m_artist = ""; - m_title = ""; - m_TrackText = ""; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBTrack, m_StatusText); - m_StatusText = "No music file playing"; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); - m_LyricText = ""; - GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_Lyric, m_LyricText); - } - }*/ - - - base.Process(); + } + catch { ;} } - private bool isNewTrack() - { - return !m_Path.Equals(g_Player.CurrentFile); - } - void LoadSettings() { - firstTime = true; + newTrack = true; - // Clear and update labels - if (selectedScreen != (int)MyLyricsSettings.Screen.LRC_EDITOR) - { - GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus); - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); - GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack); - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_TrackText); - GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_Lyric); - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + resetGUI(selectedScreen); - GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); - - times = new ArrayList(); - } - else if(selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) - { - GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); - } - bool useLyricWiki, useEvilLabs, useLyrics007, useLyricsOnDemand, useSeekLyrics, useHotLyrics; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) @@ -567,6 +341,116 @@ { } + public override bool OnMessage(GUIMessage message) + { + switch (message.Message) + { + case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: + { + exitingMyLyrics = false; + base.OnMessage(message); + + LoadSettings(); + + LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Start, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics opens, screen: " + lyricsScreenXML); + return true; + } + case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: + { + StopThread(); + resetAll(); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics closes, screen: " + lyricsScreenXML); + break; + } + } + return base.OnMessage(message); + } + + + public override void OnAction(Action action) + { + switch (action.wID) + { + case Action.ActionType.ACTION_PREVIOUS_MENU: + { + GUIWindowManager.ShowPreviousWindow(); + break; + } + case Action.ActionType.ACTION_KEY_PRESSED: + { + if (action.m_key.KeyChar.Equals(13)) + { + tagLine(); + } + if (action.m_key.KeyChar.Equals(40)) + { + lyricsFound = false; + if (selectedScreen != (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + resetGUI((int)MyLyricsSettings.Screen.LRC_EDITOR); + + } + else + { + // parameter could be anything but LRC_EDITOR. Will find correct type when running findLyric(). + resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); + } + + newTrack = true; + Process(); + } + break; + } + } + base.OnAction(action); + } + + //event driven handler to detect track change + private void trackChangeHandler(string tag2, string value) + { + if (tag2.Equals("#Play.Current.Track") && !exitingMyLyrics) // track has changed + { + if (!value.Equals("")) // additional check + { + resetGUI(selectedScreen); + StopThread(); + resetAll(); + newTrack = true; + Process(); + } + else + { + m_artist = ""; + m_title = ""; + m_TrackText = ""; + m_StatusText = "No music file playing"; + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); + m_LyricText = ""; + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); + } + } + } + + //event driven handler to detect track change + private void timeHandler(string tag2, string value) + { + if (tag2.Equals("#currentplaytime") && !exitingMyLyrics) + { + if (stopwatch != null && stopwatch.IsRunning) + { + stopwatch.Stop(); + } + + stopwatch = new Stopwatch(); + stopwatch.Start(); + + string[] timeStrings = value.Split(':'); + min = int.Parse(timeStrings[0]); + sec = int.Parse(timeStrings[1]); + } + } + /// <summary> /// findLyric searches for a lyric related to the given tag. /// </summary> @@ -576,17 +460,16 @@ { m_EventStopThread.Reset(); - GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_Lyric); - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, ""); + GUIControl.ClearControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, ""); if (tag != null && tag.Artist != "") { m_artist = tag.Artist.Trim(); m_title = tag.Title.Trim(); m_TrackText = m_artist + " - " + m_title; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_TrackText); - m_StatusText = "Searching for a matching lyric. Please wait a moment..."; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); + m_StatusText = "Searching for a matching lyric..."; + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "findLyric(" + m_artist + ", " + m_title + ")"); @@ -604,36 +487,39 @@ if ((!tag.Lyrics.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, tag.Lyrics)).IsValid) || (!lyricText.Equals("") && (lrc = new LRC.SimpleLRC(m_artist, m_title, lyricText)).IsValid)) { - resetLrcFields(); - m_StatusText = ""; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); + lines = lrc.SimpleLRCTimeAndLineCollection.Copy(); - if (lrc == null) + //Let's see if the basic or wide version of the LRC-screen should be shown + bool aLongLinePresent = false; + for (int i = 0; i < lines.Length; i++) { - MessageBox.Show("The lrc-file couldn't not be read properly." + Environment.NewLine + "The reading of the files was suspended."); - return; + if (lines[i].Length > BASIC_WIDE_LIMIT) + { + aLongLinePresent = true; + break; + } } - else if (lrc.IsValid == false) + + if (aLongLinePresent) { - MessageBox.Show("The selected file is not a valid lrc-file."); - return; + resetGUI((int)MyLyricsSettings.Screen.LRC_WIDE); } - else if (lrc.Lyric.Equals("")) + else { - MessageBox.Show("The lrc-file couldn't not be read properly." + Environment.NewLine + "It seemed to be empty."); - return; + resetGUI((int)MyLyricsSettings.Screen.LRC_BASIC); } + m_StatusText = ""; + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); + enumerator = lrc.SimpleLRCTimeAndLineCollection.GetEnumerator(); if (!lrc.Artist.Equals("") && !lrc.Title.Equals("")) { m_StatusText = ""; m_LyricText = ""; - GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus); - GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_Lyric); // setup timer and stopwatch timer = new System.Windows.Forms.Timer(); @@ -647,6 +533,16 @@ timer.Start(); stopwatch.Start(); } + + try + { + for (int i = tagRoundFinished * TAG_IN_ROUND; i < (tagRoundFinished + 1) * TAG_IN_ROUND; i++) + { + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i, lines[i]); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i, lines[i]); + } + } + catch { ;} } // 2) Lyric in music tag @@ -658,7 +554,7 @@ // 3) if lyric in music database else if (!lyricText.Equals("")) { - LyricFound = new Object[] { lyricText, m_artist, m_title, "lyric database" }; + LyricFound = new Object[] { lyricText, m_artist, m_title, "lyrics database" }; } // 4) if no lyric found, search the Internet for it using the LyricEngine @@ -684,56 +580,143 @@ else { m_TrackText = ""; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBTrack, m_StatusText); m_StatusText = "The music tag isn't complete"; - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); return; } } + private void tagLine() + { + if (alreadyValidLRC == false && selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + string time = "[" + min.ToString() + ":" + (sec.ToString().Length == 2 ? sec.ToString() : "0" + sec.ToString()) + "." + (stopwatch.ElapsedMilliseconds.ToString().Length == 3 ? stopwatch.ElapsedMilliseconds.ToString() : stopwatch.ElapsedMilliseconds.ToString() + "0") + "]"; + lines[LRCLinesTotal] = time + lines[LRCLinesTotal]; + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + currentLRCLine, time); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + currentLRCLine); + + if (++LRCLinesTotal < lines.Length) + { + + // If a new round has to start + if (++currentLRCLine == TAG_IN_ROUND) + { + currentLRCLine = 0; + ++tagRoundFinished; + + try + { + for (int i = 0; i < TAG_IN_ROUND && LRCLinesTotal + i < lines.Length; i++) + { + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + i); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + i, ""); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + } + } + catch { ;} + } + } + else + { + MessageBox.Show("The lyric has now completely been converted into a lrc!"); + StringBuilder lyric = new StringBuilder(); + for (int i = 0; i < lines.Length; i++) + { + lyric.Append(lines[i] + "\n"); + } + lyric.Replace("\r", ""); + + string artist = LyricUtil.capatalizeString(m_artist); + string title = LyricUtil.capatalizeString(m_title); + string lyricAsString = lyric.ToString(); + + int lastLineShift = lyricAsString.LastIndexOf("\n"); + lyricAsString = lyricAsString.Substring(0, lastLineShift); + + LyricsItem item = new LyricsItem(artist, title, lyricAsString, "LRC-editor screen"); + LyricsDB[DatabaseUtil.CorrectKeyFormat(artist, title)] = item; + + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName); + using (FileStream fs = new FileStream(path, FileMode.Open)) + { + BinaryFormatter bf = new BinaryFormatter(); + LyricsDB.SetLastModified(); + bf.Serialize(fs, LyricsDB); + fs.Close(); + } + } + } + } + public void OnTimerEvent(object source, EventArgs e) { - // If the max number of lyrics on screen has been added, then reset the counter and start over again - if (++lineCounter > SHIFT_WHEN_HIT) + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + currentLRCLine); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + currentLRCLine); + + if (++LRCLinesTotal < lines.Length) { - lineCounter = 0; - m_LyricText = ""; - GUIControl.ClearControl(GetID, (int)LyricGUI_Controls.CONTROL_Lyric); + + // If a new round has to start + if (++currentLRCLine == TAG_IN_ROUND) + { + currentLRCLine = 0; + ++tagRoundFinished; + + try + { + resetGUI(selectedScreen); + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]); + } + } + catch {;}; + } } - m_LyricText += (nextLineToShow); - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + calculateNextInterval(); } private void calculateNextInterval() { - if (enumerator.MoveNext()) + if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC || selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) { - LRC.SimpleLRCTimeAndLine currentLine = (LRC.SimpleLRCTimeAndLine)enumerator.Current; - while (currentLine.Time == 0) + if (enumerator.MoveNext()) { - m_LyricText += (currentLine.Line); - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + LRC.SimpleLRCTimeAndLine currentLine = (LRC.SimpleLRCTimeAndLine)enumerator.Current; + while (currentLine.Time == 0) + { + m_LyricText += (currentLine.Line); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); - ++lineCounter; - enumerator.MoveNext(); - currentLine = (LRC.SimpleLRCTimeAndLine)enumerator.Current; - } + ++currentLRCLine; + enumerator.MoveNext(); + currentLine = (LRC.SimpleLRCTimeAndLine)enumerator.Current; + } - nextTimeToShow = currentLine.TimeString; - nextLineToShow = currentLine.Line; - //MessageBox.Show(g_Player.CurrentPosition.ToString()); - int temp = (int)(currentLine.Time - (int)(g_Player.CurrentPosition * 1000)); - if (temp > 0) - { - timer.Interval = temp; + nextTimeToShow = currentLine.TimeString; + nextLineToShow = currentLine.Line; + + int temp = (int)(currentLine.Time - (int)(g_Player.CurrentPosition * 1000)); + if (temp > 0) + { + timer.Interval = temp; + } + else + { + //MessageBox.Show("temp: " + temp); + } } else { - //MessageBox.Show("temp: " + temp); + timer.Stop(); + stopwatch.Stop(); + timer.Dispose(); } - - // lbTestSecondsLeft.Text = ((long)(stopwatch.ElapsedMilliseconds / 1000)).ToString(); } else { @@ -752,9 +735,17 @@ m_LyricText = lyricText; m_StatusText = ""; + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_LBStatus, m_StatusText); - GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText); + if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + showLRCtoEdit(); + } + else + { + resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); + } } private void SaveLyricToDatabase(string site) @@ -797,7 +788,6 @@ { if (m_LyricControllerThread != null && m_LyricControllerThread.IsAlive) // thread is active { - //GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LBStatus, m_StatusText); // set event "Stop" m_EventStopThread.Set(); @@ -806,6 +796,240 @@ } } + + private void resetAll() + { + + //deregister the handler! + //GUIPropertyManager.OnPropertyChanged -= this.trackChangeHandler; + + newTrack = false; + exitingMyLyrics = false; + m_artist = ""; + m_title = ""; + m_TrackText = ""; + m_StatusText = ""; + m_LyricText = ""; + lyricsFound = false; + m_LyricControllerThread = null; + lc = null; + + resetLrcFields(); + } + + private void resetLrcFields() + { + if (timer != null) + timer.Dispose(); + if (stopwatch != null) + stopwatch.Reset(); + nextTimeToShow = ""; + nextLineToShow = ""; + currentLRCLine = 0; + LRCLinesTotal = 0; + tagRoundFinished = 0; + min = 0; + sec = 0; + msec = 0; + lines = null; + times = null; + } + + private void resetGUI(int screenID) + { + selectedScreen = screenID; + + GUIPropertyManager.OnPropertyChanged -= new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + GUIPropertyManager.OnPropertyChanged -= new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); + timer.Tick -= new System.EventHandler(OnTimerEvent); + + if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_BASIC) + { + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + times = new ArrayList(); + + // Reset general and lyrics controls + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); + GUIControl.ShowControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, ""); + + // album art only visible for basic screen + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_DURATION); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUM); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_YEAR); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_NOWPLAYINGBACK); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUMART); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESS); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESSIMAGE); + + // Hide LRC controls + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); + + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE_DONE + i); + + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); + } + } + + else if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_WIDE) + { + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + times = new ArrayList(); + + // Reset general and lyrics controls + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); + //GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); + GUIControl.ShowControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, ""); + + // album art only visible for lyrics_basic screen + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_DURATION); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUM); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_YEAR); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_NOWPLAYINGBACK); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUMART); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESS); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESSIMAGE); + + // Hide LRC controls + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); + + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE_DONE + i); + + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); + } + } + + else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC) + { + if (alreadyValidLRC == false) + { + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); + timer.Tick += new System.EventHandler(OnTimerEvent); + } + + // Lyrics controls + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); + GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + + // album art only visible for basic screen + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_DURATION); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUM); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_YEAR); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_NOWPLAYINGBACK); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUMART); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESS); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESSIMAGE); + + // LRC controls + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); + + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE_DONE + i); + + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i, ""); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i, ""); + } + } + + else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) + { + if (alreadyValidLRC == false) + { + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); + timer.Tick += new System.EventHandler(OnTimerEvent); + } + + // Lyrics controls + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); + GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + + // album art only visible for basic screen + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_DURATION); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUM); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_YEAR); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_NOWPLAYINGBACK); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUMART); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESS); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESSIMAGE); + + // LRC controls + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); + + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + i); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE_DONE + i); + + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i, ""); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i, ""); + } + } + + else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); + + // Lyrics controls + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); + GUIControl.HideControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + + // album art only visible for lyrics_basic screen + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_CURRENTLY); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_DURATION); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUM); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_YEAR); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_NOWPLAYINGBACK); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_ALBUMART); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESS); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_ART_PROGRESSIMAGE); + + // LRC controls + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); + + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + i); +... [truncated message content] |