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