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] |