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