From: <sa...@us...> - 2007-04-16 22:15:32
|
Revision: 336 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=336&view=rev Author: saamand Date: 2007-04-16 15:15:24 -0700 (Mon, 16 Apr 2007) Log Message: ----------- Modified Paths: -------------- 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/LyricsEngine/LyricDiagnostics.cs trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.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/LyricsSites/Wiki.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 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.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_AddNewSong.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.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.sln trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -3,7 +3,7 @@ using System.Text; using System.IO; -namespace LRC +namespace LyricsEngine.LRC { public class SimpleLRC { @@ -161,21 +161,21 @@ 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("]"))); + 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("]"))); + 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("]")))); + album = LyricsEngine.LyricUtil.CapatalizeString((album.Substring(0, album.LastIndexOf("]")))); return true; } else Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -3,7 +3,7 @@ using System.Windows.Forms; using System.Text.RegularExpressions; -namespace LRC +namespace LyricsEngine.LRC { public static class SimpleLRCFormat { Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace LRC +namespace LyricsEngine.LRC { public class SimpleLRCTimeAndLine : IComparable { Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -2,12 +2,12 @@ using System.Collections; using System.Text; -namespace LRC +namespace LyricsEngine.LRC { public class SimpleLRCTimeAndLineCollection : IEnumerable, ICollection { - private object[] items = null; + private object[] items; public SimpleLRCTimeAndLineCollection(object[] array) { Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricDiagnostics.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -37,7 +37,7 @@ objTraceListener = new TextWriterTraceListener(objStream); objTraceListener.Filter = new EventTypeFilter(SourceLevels.All); ts.Listeners.Add(objTraceListener); - startTimer(); + StartTimer(); } } @@ -47,7 +47,7 @@ { ts.Flush(); ts.Close(); - stopTimer(); + StopTimer(); objStream.Close(); objStream.Dispose(); @@ -78,18 +78,18 @@ } } - private static void startTimer() + private static void StartTimer() { stopWatch = new Stopwatch(); stopWatch.Start(); } - private static void stopTimer() + private static void StopTimer() { stopWatch.Stop(); } - public static string elapsedTimeString() + public static string ElapsedTimeString() { long time = stopWatch.ElapsedMilliseconds; long sec = time / 1000; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -6,32 +6,26 @@ { public class LyricUtil { - static string[] parenthesesAndAlike = new string[6] { "(album", "(acoustic", "(live", "(radio", "[", "{" }; static string[] charsToDelete = new string[11] { ".", ",", "&", "'", "!", "\"", "&", "?", "(", ")", "+" /*, "ä", "ö", "ü", "Ä", "Ö", "Ü", "ß" */ }; - // capatalize string and make ready for XML - public static string capatalizeString(string s) + public static string CapatalizeString(string s) { - string[] strings = new String[1] {"\""}; + s = s.Replace("\"", ""); - for (int i = 0; i < strings.Length; i += 1) - { - s = s.Replace(strings[i], ""); - } - - char[] space = new char[] { ' ' }; + char[] space = new char[1] { ' ' }; string[] words = s.Split(space, StringSplitOptions.RemoveEmptyEntries); - string capatalizedTitle = ""; + + StringBuilder result = new StringBuilder(); for (int i = 0; i < words.Length; i++) { - capatalizedTitle += words[i].Substring(0, 1).ToUpper() + (words[i].Length > 1 ? words[i].Substring(1, words[i].Length - 1).ToLower() : "") + " "; + result.Append(words[i].Substring(0, 1).ToUpper() + (words[i].Length > 1 ? words[i].Substring(1, words[i].Length - 1).ToLower() : "") + " "); } - return capatalizedTitle.Trim(); + return result.ToString().Trim(); } - public static string removeFeatComment(string str) + public static string RemoveFeatComment(string str) { int index = str.IndexOf("(Feat"); if (index != -1) @@ -39,7 +33,7 @@ return str; } - public static void trimForParenthesis(ref string str) + public static string TrimForParenthesis(string str) { for (int i = 0; i < parenthesesAndAlike.Length; i++) { @@ -49,17 +43,19 @@ str = str.Substring(0, index).Trim(); } } + return str; } - public static void deleteSpecificChars(ref string str) + public static string DeleteSpecificChars(string str) { for (int i = 0; i < charsToDelete.Length; i++) { str = str.Replace(charsToDelete[i], ""); } + return str; } - public static string changeAnd_and_and(string str) + public static string ChangeAnd_and_and(string str) { string strTemp = str; if (str.Contains("&")) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -7,21 +7,10 @@ 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; @@ -32,10 +21,9 @@ private int noOfLyricsFound; private int noOfLyricsNotFound; - private bool m_StopSearches = false; + private bool m_StopSearches; ArrayList threadList = new ArrayList(); - ArrayList suspendedThreadList = new ArrayList(); // Main thread sets this event to stop LyricController ManualResetEvent m_EventStop_LyricController; @@ -44,13 +32,8 @@ ManualResetEvent m_EventStopped_LyricController; private string[] lyricsSites; + internal static bool ALLOW_ALL_TO_SEARCH; - internal static bool ALLOW_ALL_TO_SEARCH = false; - - - - - public LyricsController(ILyricForm mainForm, ManualResetEvent eventStopThread, string[] lyricSites, bool allowAllToSearch) @@ -128,6 +111,9 @@ 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++) { @@ -144,10 +130,10 @@ stillThreadsAlive = true; } } - finishThread("", "", "The search has ended.", ""); + FinishThread("", "", "The search has ended.", ""); } - public void addNewLyricSearch(string artist, string title) + public void AddNewLyricSearch(string artist, string title) { if (lyricsSites.Length > 0) { @@ -168,12 +154,12 @@ - internal void updateString(String message, String site) + 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) + 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) @@ -187,30 +173,30 @@ if ((noOfLyricsSearched >= noOfLyricsToSearch) && ALLOW_ALL_TO_SEARCH == false) { - finishThread(artist, title, "All songs have been searched!", site); + FinishThread(artist, title, "All songs have been searched!", site); } } - internal void lyricFound(String lyricStrings, String artist, String title, String 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); + StatusUpdate(artist, title, site, true); } } - internal void lyricNotFound(String artist, String title, String message, String site) + 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); + StatusUpdate(artist, title, site, false); } } - public void finishThread(String artist, String title, String message, String site) + public void FinishThread(String artist, String title, String message, String site) { m_StopSearches = true; m_EventStop_LyricController.Set(); Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -3,7 +3,7 @@ using System.Text; using System.Runtime.Serialization; -namespace MyLyrics +namespace LyricsEngine.Database { [Serializable] public class LyricsDatabase : IDictionary<string, LyricsItem>, ISerializable Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -3,7 +3,7 @@ using System.Text; using System.Runtime.Serialization; -namespace MyLyrics +namespace LyricsEngine.Database { [Serializable] public class LyricsItem Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-04-16 22:15:24 UTC (rev 336) @@ -46,7 +46,7 @@ <Compile Include="LRC\SimpleLRCTimeAndLineCollection.cs" /> <Compile Include="LyricsDatabase\LyricsDatabase.cs" /> <Compile Include="LyricsDatabase\LyricsItem.cs" /> - <Compile Include="LyricsSites\LyricSearch.cs" /> + <Compile Include="LyricSearch.cs" /> <Compile Include="LyricDiagnostics.cs" /> <Compile Include="LyricsSites\HotLyrics.cs" /> <Compile Include="LyricsSites\EvilLabs.cs" /> @@ -57,7 +57,6 @@ <Compile Include="ICommand.cs" /> <Compile Include="ILyricForm.cs" /> <Compile Include="LyricsController.cs" /> - <Compile Include="LyricSiteInfo.cs" /> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> @@ -70,7 +69,6 @@ <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/LyricsEngine/LyricsSites/EvilLabs.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -10,7 +10,7 @@ class EvilLabs { string lyric = ""; - bool complete = false; + bool complete; public string Lyric { @@ -19,13 +19,13 @@ public EvilLabs(string artist, string title) { - if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "EvilLabs(" + artist + ", " + title + ")"); + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "EvilLabs(" + artist + ", " + title + ")"); - artist = LyricUtil.removeFeatComment(artist); - LyricUtil.trimForParenthesis(ref artist); + artist = LyricUtil.RemoveFeatComment(artist); + artist = LyricUtil.TrimForParenthesis(artist); artist = artist.Replace(" ", "+"); - title = LyricUtil.removeFeatComment(title); - LyricUtil.trimForParenthesis(ref title); + title = LyricUtil.RemoveFeatComment(title); + title = LyricUtil.TrimForParenthesis(title); title = title.Replace(" ", "+"); string urlString = "http://www.evillabs.sk/lyrics/" + artist + "+-+" + title; @@ -44,7 +44,6 @@ 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; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -10,7 +10,7 @@ class HotLyrics { string lyric = ""; - bool complete = false; + bool complete; public string Lyric { @@ -19,11 +19,11 @@ public HotLyrics(string artist, string title) { - if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); - artist = LyricUtil.removeFeatComment(artist); - LyricUtil.trimForParenthesis(ref artist); - artist = LyricUtil.capatalizeString(artist); + artist = LyricUtil.RemoveFeatComment(artist); + artist = LyricUtil.TrimForParenthesis(artist); + artist = LyricUtil.CapatalizeString(artist); artist = artist.Replace(" ", "_"); artist = artist.Replace(",", "_"); @@ -50,9 +50,9 @@ // French letters artist = artist.Replace("\xE9", "%E9"); - title = LyricUtil.removeFeatComment(title); - LyricUtil.trimForParenthesis(ref title); - title = LyricUtil.capatalizeString(title); + title = LyricUtil.RemoveFeatComment(title); + title = LyricUtil.TrimForParenthesis(title); + title = LyricUtil.CapatalizeString(title); title = title.Replace(" ", "_"); title = title.Replace(",", "_"); @@ -108,7 +108,6 @@ 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; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -10,7 +10,7 @@ class Lyrics007 { string lyric = ""; - bool complete = false; + bool complete; public string Lyric { @@ -19,13 +19,13 @@ public Lyrics007(string artist, string title) { - if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Lyrics007(" + artist + ", " + title + ")"); + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "Lyrics007(" + artist + ", " + title + ")"); - artist = LyricUtil.removeFeatComment(artist); - LyricUtil.trimForParenthesis(ref artist); + artist = LyricUtil.RemoveFeatComment(artist); + artist = LyricUtil.TrimForParenthesis(artist); artist = artist.Replace("#", ""); - title = LyricUtil.removeFeatComment(title); - LyricUtil.trimForParenthesis(ref title); + title = LyricUtil.RemoveFeatComment(title); + title = LyricUtil.TrimForParenthesis(title); title = title.Replace("#", ""); // Cannot find lyrics contaning non-English letters! @@ -48,7 +48,6 @@ 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; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -10,7 +10,7 @@ class LyricsOnDemand { string lyric = ""; - bool complete = false; + bool complete; public string Lyric { @@ -19,11 +19,11 @@ public LyricsOnDemand(string artist, string title) { - if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "LyricsOnDemand(" + artist + ", " + title + ")"); + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "LyricsOnDemand(" + artist + ", " + title + ")"); - artist = LyricUtil.removeFeatComment(artist); - LyricUtil.trimForParenthesis(ref artist); - LyricUtil.deleteSpecificChars(ref artist); + artist = LyricUtil.RemoveFeatComment(artist); + artist = LyricUtil.TrimForParenthesis(artist); + artist = LyricUtil.DeleteSpecificChars(artist); artist = artist.Replace(" ", ""); artist = artist.Replace("The ", ""); artist = artist.Replace("the ", ""); @@ -33,9 +33,9 @@ // Cannot find lyrics contaning non-English letters! - title = LyricUtil.removeFeatComment(title); - LyricUtil.trimForParenthesis(ref title); - LyricUtil.deleteSpecificChars(ref title); + title = LyricUtil.RemoveFeatComment(title); + title = LyricUtil.TrimForParenthesis(title); + title = LyricUtil.DeleteSpecificChars(title); title = title.Replace(" ", ""); title = title.Replace("#", ""); artist = artist.Replace("-", ""); @@ -54,12 +54,11 @@ if (artist.Length > 0) firstLetter = artist[0].ToString(); - try + int firstNumber = 0; + if (int.TryParse(firstLetter, out firstNumber)) { - int.Parse(firstLetter); firstLetter = "0"; } - catch { ;}; string urlString = "http://www.lyricsondemand.com/" + firstLetter + "/" + artist + "lyrics/" + title + "lyrics.html"; @@ -78,7 +77,6 @@ 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; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -10,7 +10,7 @@ class SeekLyrics { string lyric = ""; - bool complete = false; + bool complete; public string Lyric { @@ -19,10 +19,10 @@ public SeekLyrics(string artist, string title) { - if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); + if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); - artist = LyricUtil.removeFeatComment(artist); - LyricUtil.trimForParenthesis(ref artist); + artist = LyricUtil.RemoveFeatComment(artist); + artist = LyricUtil.TrimForParenthesis(artist); artist = artist.Replace(" ", "-"); artist = artist.Replace("'", "-"); artist = artist.Replace("(", ""); @@ -42,8 +42,8 @@ // French letters artist = artist.Replace("\xE9", "%E9"); - title = LyricUtil.removeFeatComment(title); - LyricUtil.trimForParenthesis(ref title); + title = LyricUtil.RemoveFeatComment(title); + title = LyricUtil.TrimForParenthesis(title); title = title.Replace(" ", "-"); title = title.Replace("'", "-"); title = title.Replace("(", ""); @@ -82,7 +82,6 @@ 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; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -5,18 +5,17 @@ using LyricsEngine.org.lyricwiki; using LyricsEngine; -namespace MyLyricWiki +namespace LyricsEngine.LyricSites { public class Wiki { - private LyricWiki lyricWiki; - private LyricsResult lyricsResult = null; + private LyricsResult lyricsResult; private string artist = ""; private string title = ""; - private int noOfTries = 0; - public static bool Abort = false; - LyricSearch lyricSearch = null; + private int noOfTries; + public static bool Abort; + LyricSearch lyricSearch ; 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" }; @@ -29,7 +28,7 @@ delegate LyricsResult DelegateClass(string artist, string title); - private bool searchForWiki(string artist, string title) + private bool SearchForWiki() { DelegateClass del = lyricWiki.getSong; @@ -53,7 +52,7 @@ ++noOfTries; } - if (lyricsResult != null && isLyric(lyricsResult.lyrics)) + if (lyricsResult != null && IsLyric(lyricsResult.lyrics)) { return true; } @@ -62,64 +61,45 @@ noOfTries = 0; return false; } - } - public string getLyricAsynch(string artist, string title) + public string GetLyricAsynch(string artist, string title) { this.artist = artist; this.title = title; try { - // Step 1: search title as it is - //if (Abort == false && searchForWiki(this.artist, this.title)) - //{ - // return makeLyricFit(lyricsResult.lyrics); - //} - - // Step 2: search with parentheses and other disturbance removed - optimizeString(ref this.artist, ref this.title); - if (Abort == false && searchForWiki(this.artist, this.title)) + // search with parentheses and other disturbance removed + OptimizeString(ref this.artist, ref this.title); + if (Abort == false && SearchForWiki()) { - return (lyricsResult.lyrics); + return MakeLyricFit(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); - //if (Abort == false && searchForWiki(this.artist, this.title)) - //{ - // return (lyricsResult.lyrics); - //} - - // final step: return "Not found" if no lyric found return "Not found"; } - catch (Exception e) + catch (Exception) { - //System.Windows.Forms.MessageBox.Show(e.ToString()); - //System.Windows.Forms.MessageBox.Show(lyricsResult.); - Console.Write(e.Message); return ""; } } - private bool isLyric(string lyric) + private bool IsLyric(string lyric) { - if (lyricsResult != null && !lyricsResult.lyrics.Equals("Not found") && !lyricsResult.lyrics.Equals("")) + if (lyricsResult != null && !lyricsResult.lyrics.Equals("Not found") && lyricsResult.lyrics.Length != 0) return true; else return false; } - private void optimizeString(ref string artist, ref string title) + private void OptimizeString(ref string artist, ref string title) { - LyricUtil.trimForParenthesis(ref artist); - LyricUtil.trimForParenthesis(ref title); + artist = LyricUtil.TrimForParenthesis(artist); + title = LyricUtil.TrimForParenthesis(title); } - private string makeLyricFit(string lyric) + private string MakeLyricFit(string lyric) { for (int i = 0; i < commonReplacementsLyricWiki.Length; i = i + 2) { @@ -135,7 +115,6 @@ break; } } - return lyric; } } Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -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.19")] +[assembly: AssemblyVersion("0.20")] // // 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-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -2,7 +2,7 @@ using System.Collections; using System.Text; -namespace LyricsEngineConfig +namespace LyricsEngine { public static class Setup { Modified: trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -4,6 +4,8 @@ using System.IO; using System.Xml; +using LyricsEngine.Database; + namespace MyLyrics { class ConvertFromXMLtoLyricsDatabase Modified: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -5,6 +5,7 @@ using System.Runtime.Serialization.Formatters.Binary; using LyricsEngine; +using LyricsEngine.Database; namespace MyLyrics { @@ -21,8 +22,8 @@ string lyricText = ""; try { - string capatalizedArtist = LyricUtil.capatalizeString(artist); - string capatalizedTitle = LyricUtil.capatalizeString(title); + string capatalizedArtist = LyricUtil.CapatalizeString(artist); + string capatalizedTitle = LyricUtil.CapatalizeString(title); lyricText = lyricDB[CorrectKeyFormat(capatalizedArtist, capatalizedTitle)].Lyrics; } @@ -46,7 +47,7 @@ string lyricsText = ""; try { - lyricsText = lyricMarkedDB[DatabaseUtil.CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; + lyricsText = lyricMarkedDB[DatabaseUtil.CorrectKeyFormat(LyricUtil.CapatalizeString(artist), LyricUtil.CapatalizeString(title))].Lyrics; } catch { @@ -61,7 +62,7 @@ string lyricText = ""; try { - lyricText = lyricDB[CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; + lyricText = lyricDB[CorrectKeyFormat(LyricUtil.CapatalizeString(artist), LyricUtil.CapatalizeString(title))].Lyrics; return lyricText.Replace("\n", "\r\n"); } catch Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-16 22:06:02 UTC (rev 335) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-16 22:15:24 UTC (rev 336) @@ -11,7 +11,8 @@ using System.Timers; using LyricsEngine; -using LyricsEngineConfig; +using LyricsEngine.Database; +using LyricsEngine.LRC; using MediaPortal.GUI.Library; using MediaPortal.Dialogs; @@ -30,7 +31,7 @@ /// Summary description for Class1. /// </summary> - public class GUIMyLyrics : GUIWindow, ILyricForm, ISetupForm + public partial class GUIMyLyrics : GUIWindow, ILyricForm, ISetupForm { #region Fields related to the MyLyrics in general @@ -130,7 +131,7 @@ #region Fields related to LRC mode internal const int BASIC_WIDE_LIMIT = 45; - LRC.SimpleLRC lrc; + SimpleLRC lrc; IEnumerator enumerator; System.Windows.Forms.Timer timer; Stopwatch stopwatch; @@ -181,8 +182,8 @@ alreadyValidLRC = false; CurrentTrackTag = new MusicTag(); - CurrentTrackTag.Artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); - CurrentTrackTag.Title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); + 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) { @@ -194,7 +195,7 @@ m_title = CurrentTrackTag.Title; // Get lyric - if (!CurrentTrackTag.Artist.Equals("")) + if (CurrentTrackTag.Artist.Length != 0) { findLyric(); } @@ -216,8 +217,8 @@ { newTrack = false; - m_artist = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); - m_title = LyricUtil.capatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); + m_artist = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); + m_title = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); if (DatabaseUtil.IsTrackInLyricsDatabase(LyricsDB, m_artist, m_title).Equals(DatabaseUtil.LYRIC_FOUND)) { @@ -239,53 +240,14 @@ 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; - if (!CurrentTrackTag.Artist.Equals("")) findLyric(); + if (CurrentTrackTag.Artist.Length != 0) findLyric(); else { m_artist = ""; @@ -301,7 +263,7 @@ private void showLRCtoEdit() { - LRC.SimpleLRC lrc = new LRC.SimpleLRC(m_artist, m_title, m_LyricText); + SimpleLRC lrc = new SimpleLRC(m_artist, m_title, m_LyricText); if (lrc.IsValid) { @@ -401,14 +363,14 @@ LoadSettings(); 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."); return true; } case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: { StopThread(); resetAll(); - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.elapsedTimeString() + "MyLyrics closes."); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.ElapsedTimeString() + "MyLyrics closes."); break; } } @@ -435,46 +397,7 @@ //} } - 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) @@ -543,7 +466,7 @@ { if (tag2.Equals("#Play.Current.Track") && !exitingMyLyrics) // track has changed { - if (!value.Equals("")) // additional check + if (value.Length != 0) // additional check { basicScreenSelected = null; resetGUI(selectedScreen); @@ -570,229 +493,7 @@ } } - 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) { @@ -834,7 +535,7 @@ 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 + ")"); + 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 @@ -847,8 +548,8 @@ // 1) + 2) Check if LRC in music tag or Database string lyricText = MyLyrics.DatabaseUtil.LookUpLyricInDatabase(LyricsDB, m_artist, m_title); - 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)) + if ((CurrentTrackTag.Lyrics.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, CurrentTrackTag.Lyrics)).IsValid) + || (lyricText.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, lyricText)).IsValid)) { resetLrcFields(); @@ -893,7 +594,7 @@ enumerator = lrc.SimpleLRCTimeAndLineCollection.GetEnumerator(); - if (!lrc.Artist.Equals("") && !lrc.Title.Equals("")) + if (lrc.Artist.Length != 0 && lrc.Title.Length != 0) { m_StatusText = ""; m_LyricText = ""; @@ -923,13 +624,13 @@ } // 2) Lyric in music tag - else if (!CurrentTrackTag.Lyrics.Equals("")) + else if (CurrentTrackTag.Lyrics.Length != 0) { ShowLyricOnScreen(CurrentTrackTag.Lyrics, CurrentTrackTag.FileName); } // 3) if lyric in music database - else if (!lyricText.Equals("")) + else if (lyricText.Length != 0) { LyricFound = new Object[] { lyricText, m_artist, m_title, "lyrics database" }; } @@ -950,7 +651,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); } } @@ -1020,8 +721,8 @@ } lyric.Replace("\r", ""); - string artist = LyricUtil.capatalizeString(m_artist); - string title = LyricUtil.capatalizeString(m_title); + string artist = LyricUtil.CapatalizeString(m_artist); + string title = LyricUtil.CapatalizeString(m_title); string lyricAsString = lyric.ToString(); int lastLineShift = lyricAsString.LastIndexOf("\n"); @@ -1085,14 +786,14 @@ { if (enumerator.MoveNext()) { - LRC.SimpleLRCTimeAndLine currentLine = (LRC.SimpleLRCTimeAndLine)enumerator.Current; + SimpleLRCTimeAndLine currentLine = (SimpleLRCTimeAndLine)enumerator.Current; while (currentLine.Time == 0) { m_LyricText += (currentLine.Line); ++currentLRCLine; enumerator.MoveNext(); - currentLine = (LRC.SimpleLRCTimeAndLine)enumerator.Current; + currentLine = (SimpleLRCTimeAndLine)enumerator.Current; } nextTimeToShow = currentLine.TimeString; @@ -1126,7 +827,7 @@ private void ShowLyricOnScreen(string lyricText, string source) { - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Lyric found: " + m_artist + " - " + m_title + ". Place: " + source); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "Lyric found: " + m_artist + " - " + m_title + ". Place: " + source); lyricsFound = true; m_LyricText = lyricText; @@ -1157,8 +858,8 @@ private void SaveLyricToDatabase(string site) { - string capArtist = LyricUtil.capatalizeString(m_artist); - string capTitle = LyricUtil.capatalizeString(m_title); + string capArtist = LyricUtil.CapatalizeString(m_artist); + string capTitle = LyricUtil.CapatalizeString(m_title); if (DatabaseUtil.IsTrackInLyricsDatabase(LyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) { @@ -1506,7 +1207,7 @@ if (!lyricsFound && m_artist.Equals(artist) && m_title.Equals(title)) { - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + "Search terminates: No lyric found..."); + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "Search terminates: No lyric found..."); m_StatusText = "No lyric found"; GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); } @@ -1518,7 +1219,7 @@ set ... [truncated message content] |
From: <sa...@us...> - 2007-04-27 16:26:28
|
Revision: 347 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=347&view=rev Author: saamand Date: 2007-04-27 09:26:25 -0700 (Fri, 27 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs 2007-04-26 15:16:31 UTC (rev 346) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs 2007-04-27 16:26:25 UTC (rev 347) @@ -81,7 +81,7 @@ { System.Text.RegularExpressions.Match m; - if ((m = LRC.SimpleLRCFormat.Line_Line_Regex.Match(line)).Success) + if ((m = LRC.SimpleLRCFormat.LineLineRegex.Match(line)).Success) { line = line.Trim(); int index; @@ -134,45 +134,32 @@ string lineTemp = lineWithNewLine; bool done = true; - while ((m = LRC.SimpleLRCFormat.Line_Line_Regex.Match(lineTemp)).Success) + while ((m = LRC.SimpleLRCFormat.LineLineRegex.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) + else if ((m = LRC.SimpleLRCFormat.ArtistLineStartRegex.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) + else if ((m = LRC.SimpleLRCFormat.TitleLineStartRegex.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) + else if ((m = LRC.SimpleLRCFormat.AlbumLineStartRegex.Match(line)).Success) { album = line.Substring(m.Index + m.Length); album = LyricsEngine.LyricUtil.CapatalizeString((album.Substring(0, album.LastIndexOf("]")))); Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs 2007-04-26 15:16:31 UTC (rev 346) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs 2007-04-27 16:26:25 UTC (rev 347) @@ -7,19 +7,9 @@ { 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*\]"); - } + public static Regex ArtistLineStartRegex = new Regex(@"\[ar\w*\:", RegexOptions.IgnoreCase); + public static Regex TitleLineStartRegex = new Regex(@"\[ti\w*\:", RegexOptions.IgnoreCase); + public static Regex AlbumLineStartRegex = new Regex(@"\[al\w*\:", RegexOptions.IgnoreCase); + public static Regex LineLineRegex = new Regex(@"\[\d+:\d+\.*\d*\]"); } - - } \ No newline at end of file Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-04-26 15:16:31 UTC (rev 346) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-04-27 16:26:25 UTC (rev 347) @@ -15,6 +15,44 @@ Sort(items); } + public int GetSimpleLRCTimeAndLineIndex(long time) + { + if (time < ((SimpleLRCTimeAndLine)items[0]).Time) + { + return 0; + } + + for (int i = 1; i < items.Length; i++) + { + if (((SimpleLRCTimeAndLine)items[i - 1]).Time < time && time <= ((SimpleLRCTimeAndLine)items[i]).Time) + { + return i; + } + } + + if (time > ((SimpleLRCTimeAndLine)items[items.Length - 1]).Time) + { + return items.Length - 1; + } + else + { + throw (new IndexOutOfRangeException("IndexOutOfRangeException in GetSimpleLRCTimeAndLineIndex")); + } + } + + public SimpleLRCTimeAndLine this[int index] + { + get + { + if (index < items.Length) + { + return (SimpleLRCTimeAndLine)items[index]; + } + else + return null; + } + } + #region IEnumerable implementation public IEnumerator GetEnumerator() { @@ -48,7 +86,7 @@ private class Enumerator : IEnumerator { private int cursor; - private object[] elements = null; + private object[] elements; public Enumerator(object[] items) { @@ -91,7 +129,7 @@ #endregion #region SortAfterTimeClass class, IComparer implementation - public class SortAfterTimeClass : IComparer + private class SortAfterTimeClass : IComparer { // Calls CaseInsensitiveComparer.Compare with the parameters reversed. int IComparer.Compare(Object x, Object y) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2007-04-26 15:16:31 UTC (rev 346) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2007-04-27 16:26:25 UTC (rev 347) @@ -55,7 +55,7 @@ return str; } - public static string ChangeAnd_and_and(string str) + public static string ChangeAnds(string str) { string strTemp = str; if (str.Contains("&")) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-04-26 15:16:31 UTC (rev 346) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-04-27 16:26:25 UTC (rev 347) @@ -9,6 +9,7 @@ using System.Diagnostics; using LyricsEngine; +[assembly: CLSCompliant(true)] namespace LyricsEngine { public class LyricsController : IDisposable Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-26 15:16:31 UTC (rev 346) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-27 16:26:25 UTC (rev 347) @@ -132,19 +132,15 @@ internal const int BASIC_WIDE_LIMIT = 45; SimpleLRC lrc; - IEnumerator enumerator; - System.Windows.Forms.Timer timer; + SimpleLRCTimeAndLineCollection lrcTimeCollection; Stopwatch stopwatch; - string nextTimeToShow; - string nextLineToShow; - bool shiftPageNextTime = false; #endregion #region Fields releated to the editor mode internal const int TAG_IN_ROUND = 13; - internal int currentLRCLine = 0; + internal int currentLRCLineIndex = 0; internal int LRCLinesTotal = 0; internal int tagRoundFinished = 0; internal int min = 0; @@ -169,7 +165,6 @@ public override bool Init() { - timer = new System.Windows.Forms.Timer(); selectedScreen = (int)MyLyricsSettings.Screen.LYRICS_BASIC; return Load(GUIGraphicsContext.Skin + @"\" + lyricsScreenXML); } @@ -216,6 +211,9 @@ else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR) { newTrack = false; + currentLRCLineIndex = 0; + LRCLinesTotal = 0; + tagRoundFinished = 0; m_artist = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); m_title = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); @@ -237,6 +235,12 @@ startSearch(); } } + + if (lyricsFound) + { + CalculateNextInterval(); + } + base.Process(); } @@ -269,21 +273,24 @@ { alreadyValidLRC = true; lines = new string[1] { "This track already has a valid LRC!" }; + + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + 0, lines[0]); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE_DONE + 0, lines[0]); } else { lines = m_LyricText.Split(new string[1] { "\n" }, StringSplitOptions.None); - } - try - { - for (int i = tagRoundFinished * TAG_IN_ROUND; i < (tagRoundFinished + 1) * TAG_IN_ROUND; i++) + try { - 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]); + for (int i = tagRoundFinished * TAG_IN_ROUND; i < (tagRoundFinished + 1) * TAG_IN_ROUND; i++) + { + 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]); + } } + catch { ;} } - catch { ;} } void LoadSettings() @@ -405,6 +412,7 @@ case Action.ActionType.ACTION_PREVIOUS_MENU: { GUIWindowManager.ShowPreviousWindow(); + base.OnAction(action); break; } case Action.ActionType.ACTION_KEY_PRESSED: @@ -426,7 +434,7 @@ // parameter could be anything but LRC_EDITOR. Will find correct type when running findLyric(). resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); } - + newTrack = true; Process(); } @@ -437,12 +445,14 @@ basicScreenSelected = false; resetGUI((int)MyLyricsSettings.Screen.LYRICS_WIDE); GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide, m_LyricText); + GUIControl.FocusControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); } 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); + GUIControl.FocusControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); } else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC) { @@ -457,6 +467,16 @@ } break; } + case Action.ActionType.ACTION_REWIND: + case Action.ActionType.ACTION_FORWARD: + case Action.ActionType.ACTION_MUSIC_FORWARD: + case Action.ActionType.ACTION_MUSIC_PLAY: + case Action.ActionType.ACTION_MUSIC_REWIND: + case Action.ActionType.ACTION_PAUSE: + case Action.ActionType.ACTION_PLAY: + { + break; + } } base.OnAction(action); } @@ -469,6 +489,7 @@ if (value.Length != 0) // additional check { basicScreenSelected = null; + resetLrcFields(); resetGUI(selectedScreen); StopThread(); resetAll(); @@ -494,7 +515,7 @@ } - //event driven handler to detect track change + //event driven handler to detect track change. Only used in LRC_Editor mode. private void timeHandler(string tag2, string value) { if (tag2.Equals("#currentplaytime") && !exitingMyLyrics) @@ -503,7 +524,6 @@ { stopwatch.Stop(); } - stopwatch = new Stopwatch(); stopwatch.Start(); @@ -551,9 +571,10 @@ if ((CurrentTrackTag.Lyrics.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, CurrentTrackTag.Lyrics)).IsValid) || (lyricText.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, lyricText)).IsValid)) { - resetLrcFields(); + lyricsFound = true; - lines = lrc.SimpleLRCTimeAndLineCollection.Copy(); + lrcTimeCollection = lrc.SimpleLRCTimeAndLineCollection; + lines = lrcTimeCollection.Copy(); //Let's see if the basic or wide version of the LRC-screen should be shown bool aLongLinePresent = false; @@ -592,26 +613,9 @@ m_StatusText = ""; GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, m_StatusText); - enumerator = lrc.SimpleLRCTimeAndLineCollection.GetEnumerator(); + m_StatusText = ""; + m_LyricText = ""; - if (lrc.Artist.Length != 0 && lrc.Title.Length != 0) - { - m_StatusText = ""; - m_LyricText = ""; - - // 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(); - } - try { for (int i = tagRoundFinished * TAG_IN_ROUND; i < (tagRoundFinished + 1) * TAG_IN_ROUND; i++) @@ -670,16 +674,16 @@ { 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); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_TIME + currentLRCLineIndex, time); + GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_EDIT_LINE + currentLRCLineIndex); if (++LRCLinesTotal < lines.Length) { // If a new round has to start - if (++currentLRCLine == TAG_IN_ROUND) + if (++currentLRCLineIndex == TAG_IN_ROUND) { - currentLRCLine = 0; + currentLRCLineIndex = 0; ++tagRoundFinished; @@ -707,9 +711,9 @@ { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow( (int)GUIWindow.Window.WINDOW_DIALOG_OK); - dlg.SetHeading("Creating of LRC"); + dlg.SetHeading("LRC creation completed!"); dlg.SetLine(1, "The lyric has been converted"); - dlg.SetLine(2, "to a LRC!"); + dlg.SetLine(2, "to a LRC."); dlg.SetLine(3, String.Empty); dlg.DoModal(GUIWindowManager.ActiveWindow); @@ -743,85 +747,60 @@ } } - public void OnTimerEvent(object source, EventArgs e) + + private void CalculateNextInterval() { - if (shiftPageNextTime) + if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC || selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) { - try + int trackTime = (int)(g_Player.CurrentPosition * 1000); + currentLRCLineIndex = lrcTimeCollection.GetSimpleLRCTimeAndLineIndex(trackTime); + + SimpleLRCTimeAndLine currentLine = lrcTimeCollection[currentLRCLineIndex]; + + tagRoundFinished = currentLRCLineIndex / TAG_IN_ROUND; + int localIndex = (currentLRCLineIndex % TAG_IN_ROUND); + + if (currentLRCLineIndex == lrcTimeCollection.Count - 1) { - resetGUI(selectedScreen); - for (int i = 0; i < TAG_IN_ROUND; i++) + if (currentLine.Time - trackTime < 500) { - 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]); + ++localIndex; } } - catch { ;}; - } - 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) - { - - // If a new round has to start - if (++currentLRCLine == TAG_IN_ROUND) + if (tagRoundFinished > 0 && localIndex == 0) { - currentLRCLine = 0; - ++tagRoundFinished; - - shiftPageNextTime = true; + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); + } } - } - - calculateNextInterval(); - } - - private void calculateNextInterval() - { - if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC || selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) - { - if (enumerator.MoveNext()) + else { - SimpleLRCTimeAndLine currentLine = (SimpleLRCTimeAndLine)enumerator.Current; - while (currentLine.Time == 0) + for (int i = 0; i < TAG_IN_ROUND; i++) { - m_LyricText += (currentLine.Line); - - ++currentLRCLine; - enumerator.MoveNext(); - currentLine = (SimpleLRCTimeAndLine)enumerator.Current; + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i, ""); + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i, ""); } - nextTimeToShow = currentLine.TimeString; - nextLineToShow = currentLine.Line; - - int temp = (int)(currentLine.Time - (int)(g_Player.CurrentPosition * 1000)); - if (temp > 0) + try { - timer.Interval = temp; + for (int i = 0; i < TAG_IN_ROUND; i++) + { + GUIControl.SetControlLabel(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + 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, lines[tagRoundFinished * TAG_IN_ROUND + i]); + } } - else + catch { ;}; + + // Highlight the lines that have been passed in the current interval + for (int i = 0; i < localIndex; i++) { - //MessageBox.Show("temp: " + temp); + GUIControl.ShowControl(GetID, (int)GUI_LRC_Controls.CONTROL_VIEW_LINE_DONE + i); } } - else - { - timer.Stop(); - stopwatch.Stop(); - timer.Dispose(); - } } - else - { - timer.Stop(); - stopwatch.Stop(); - timer.Dispose(); - } } @@ -845,11 +824,13 @@ { resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric, m_LyricText); + GUIControl.FocusControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); } else { resetGUI((int)MyLyricsSettings.Screen.LYRICS_WIDE); GUIControl.SetControlLabel(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide, m_LyricText); + GUIControl.FocusControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); } @@ -927,13 +908,9 @@ private void resetLrcFields() { - if (timer != null) - timer.Dispose(); if (stopwatch != null) stopwatch.Reset(); - nextTimeToShow = ""; - nextLineToShow = ""; - currentLRCLine = 0; + currentLRCLineIndex = 0; LRCLinesTotal = 0; tagRoundFinished = 0; min = 0; @@ -944,20 +921,22 @@ private void resetGUI(int screenID) { + int prevSelectedScreen = selectedScreen; selectedScreen = screenID; - shiftPageNextTime = false; GUIPropertyManager.OnPropertyChanged -= new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); GUIPropertyManager.OnPropertyChanged -= new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); - timer.Tick -= new System.EventHandler(OnTimerEvent); + //timer.Tick -= new System.EventHandler(OnTimerEvent); if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_BASIC) { GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); - - + GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_TITLE, "Lyrics basic"); + GUIControl.ClearControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + GUIControl.FocusControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); + // Reset general and lyrics controls GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); GUIControl.ShowControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_Lyric); @@ -995,6 +974,9 @@ GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_TITLE, "Lyrics wide"); + GUIControl.ClearControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); + GUIControl.FocusControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); + // Reset general and lyrics controls GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); //GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); @@ -1030,8 +1012,6 @@ else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC) { 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"); @@ -1054,24 +1034,25 @@ // LRC controls GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); - for (int i = 0; i < TAG_IN_ROUND; i++) + if (prevSelectedScreen != (int)MyLyricsSettings.Screen.LRC_WIDE) { - 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); + 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, ""); + 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) { 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"); @@ -1094,26 +1075,33 @@ // LRC controls GUIControl.HideControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); - for (int i = 0; i < TAG_IN_ROUND; i++) + if (prevSelectedScreen != (int)MyLyricsSettings.Screen.LRC_BASIC) { - 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); + 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, ""); + 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) { + resetLrcFields(); + GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(timeHandler); GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_TITLE, "LRC editor"); + GUIControl.FocusControl(GetID, (int)GUI_LRC_Controls.CONTROL_TAGBUTTON); + // Lyrics controls GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_LBStatus); GUIControl.SetControlLabel(GetID, (int)GUI_General_Controls.CONTROL_LBStatus, ""); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-04-26 15:16:31 UTC (rev 346) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-04-27 16:26:25 UTC (rev 347) @@ -30,6 +30,29 @@ { this.tabControl = new MediaPortal.UserInterface.Controls.MPTabControl(); this.tabPageLyricsDatabase = new MediaPortal.UserInterface.Controls.MPTabPage(); + this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); + this.mpGroupBox3 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.cbAutomaticUpdate = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbMoveSongFrom = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.cbAutoFetch = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.mpGroupBox2 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + 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.tabPageDatabase = new MediaPortal.UserInterface.Controls.MPTabPage(); this.gbGenerel = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.tbLimit = new MediaPortal.UserInterface.Controls.MPTextBox(); @@ -72,39 +95,10 @@ this.lbTotalSongs = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbLyricsFound2 = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbLyricsFound = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); - this.mpGroupBox3 = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.cbAutomaticUpdate = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbMoveSongFrom = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.cbAutoFetch = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.mpGroupBox2 = new MediaPortal.UserInterface.Controls.MPGroupBox(); - 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.btSave = new MediaPortal.UserInterface.Controls.MPButton(); this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); this.tabControl.SuspendLayout(); - this.tabPageDatabase.SuspendLayout(); - this.gbGenerel.SuspendLayout(); - this.mpGroupBox1.SuspendLayout(); - this.gbMessages.SuspendLayout(); - this.gbProgress.SuspendLayout(); - this.gbMusicDBSearchStats.SuspendLayout(); this.tabPageSetup.SuspendLayout(); this.mpGroupBox3.SuspendLayout(); this.mpGroupBox2.SuspendLayout(); @@ -112,6 +106,12 @@ this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit(); + this.tabPageDatabase.SuspendLayout(); + this.gbGenerel.SuspendLayout(); + this.mpGroupBox1.SuspendLayout(); + this.gbMessages.SuspendLayout(); + this.gbProgress.SuspendLayout(); + this.gbMusicDBSearchStats.SuspendLayout(); this.SuspendLayout(); // // tabControl @@ -136,6 +136,284 @@ this.tabPageLyricsDatabase.Text = "Lyrics database"; this.tabPageLyricsDatabase.UseVisualStyleBackColor = true; // + // 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); + this.tabPageSetup.Name = "tabPageSetup"; + this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); + this.tabPageSetup.Size = new System.Drawing.Size(549, 468); + this.tabPageSetup.TabIndex = 2; + this.tabPageSetup.Text = "Settings"; + this.tabPageSetup.UseVisualStyleBackColor = true; + // + // 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, 70); + 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"; + // + // 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; + // + // 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; + // + // 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; + // + // mpGroupBox2 + // + 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, 59); + this.mpGroupBox2.TabIndex = 29; + this.mpGroupBox2.TabStop = false; + this.mpGroupBox2.Text = "Basic settings"; + // + // tbPluginName + // + this.tbPluginName.BorderColor = System.Drawing.Color.Empty; + this.tbPluginName.Location = new System.Drawing.Point(96, 24); + this.tbPluginName.MaxLength = 30; + this.tbPluginName.Name = "tbPluginName"; + this.tbPluginName.Size = new System.Drawing.Size(144, 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:"; + // + // gbLyricSites + // + 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.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + 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; + this.gbLyricSites.TabStop = false; + 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 select 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(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; + // + // 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(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; + // + // groupBox1 + // + 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 select mode"; + // + // mpLabel2 + // + 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"; + // + // trackBar + // + 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); + // + // lbSpeed + // + 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(119, 17); + this.rdDefault.TabIndex = 23; + this.rdDefault.Text = "Default select 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(107, 17); + this.rbUserDefined.TabIndex = 22; + this.rbUserDefined.Text = "User select 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); @@ -566,284 +844,6 @@ this.lbLyricsFound.TabIndex = 14; this.lbLyricsFound.Text = "Lyrics found (during search):"; // - // 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); - this.tabPageSetup.Name = "tabPageSetup"; - this.tabPageSetup.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSetup.Size = new System.Drawing.Size(549, 468); - this.tabPageSetup.TabIndex = 2; - this.tabPageSetup.Text = "Settings"; - this.tabPageSetup.UseVisualStyleBackColor = true; - // - // 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, 70); - 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"; - // - // 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; - // - // 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; - // - // 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; - // - // mpGroupBox2 - // - 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, 59); - this.mpGroupBox2.TabIndex = 29; - this.mpGroupBox2.TabStop = false; - this.mpGroupBox2.Text = "Basic settings"; - // - // tbPluginName - // - this.tbPluginName.BorderColor = System.Drawing.Color.Empty; - this.tbPluginName.Location = new System.Drawing.Point(96, 24); - this.tbPluginName.MaxLength = 30; - this.tbPluginName.Name = "tbPluginName"; - this.tbPluginName.Size = new System.Drawing.Size(144, 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:"; - // - // gbLyricSites - // - 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.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - 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; - this.gbLyricSites.TabStop = false; - 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 select mode"; - // - // cbLyrics007 - // - this.cbLyrics007.AutoSize = true; - this.cbLyr... [truncated message content] |
From: <sa...@us...> - 2007-04-30 18:55:06
|
Revision: 360 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=360&view=rev Author: saamand Date: 2007-04-30 11:55:03 -0700 (Mon, 30 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 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.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -112,8 +112,8 @@ public void Dispose() { - m_EventStop_LyricController.Close(); - m_EventStopped_LyricController.Close(); + //m_EventStop_LyricController.Close(); + //m_EventStopped_LyricController.Close(); // clean-up operations may be placed here for (int i = 0; i < threadList.Count; i++) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -3,7 +3,7 @@ using System.Text; using System.Runtime.Serialization; -namespace LyricsEngine.Database +namespace MyLyrics { [Serializable] public class LyricsDatabase : IDictionary<string, LyricsItem>, ISerializable Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsItem.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -3,7 +3,7 @@ using System.Text; using System.Runtime.Serialization; -namespace LyricsEngine.Database +namespace MyLyrics { [Serializable] public class LyricsItem Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -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.20")] +[assembly: AssemblyVersion("0.21")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -4,8 +4,6 @@ using System.IO; using System.Xml; -using LyricsEngine.Database; - namespace MyLyrics { class ConvertFromXMLtoLyricsDatabase Modified: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -5,7 +5,6 @@ using System.Runtime.Serialization.Formatters.Binary; using LyricsEngine; -using LyricsEngine.Database; namespace MyLyrics { Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -11,7 +11,6 @@ using System.Timers; using LyricsEngine; -using LyricsEngine.Database; using LyricsEngine.LRC; using MediaPortal.GUI.Library; @@ -341,17 +340,28 @@ 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); - FileStream fs = new FileStream(path, FileMode.Open); - BinaryFormatter bf = new BinaryFormatter(); - LyricsDB = (LyricsDatabase)bf.Deserialize(fs); - fs.Close(); + try + { + 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.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); - fs = new FileStream(path, FileMode.Open); - LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); - fs.Close(); - + path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsMarkedDBName); + fs = new FileStream(path, FileMode.Open); + LyricsMarkedDB = (LyricsDatabase)bf.Deserialize(fs); + fs.Close(); + } + catch + { + GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + dlg.SetHeading("No lyric database found"); + dlg.SetLine(1, "Please run the MyLyrics configuration"); + dlg.SetLine(2, "before running the plugin."); + dlg.SetLine(3, String.Empty); + dlg.DoModal(GUIWindowManager.ActiveWindow); + } } void SaveSettings() Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-30 18:55:03 UTC (rev 360) @@ -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' "> @@ -46,10 +45,6 @@ <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" /> @@ -128,6 +123,12 @@ <ItemGroup> <Content Include="Changelog.txt" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\LyricsEngine\LyricsEngine.csproj"> + <Project>{B0760CE8-086F-4301-9091-C9BE54F261FD}</Project> + <Name>LyricsEngine</Name> + </ProjectReference> + </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. Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Text; -using LyricsEngine.Database; - namespace MyLyrics { class MyLyricsSettings Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -23,7 +23,6 @@ using MediaPortal.Profile; using LyricsEngine; -using LyricsEngine.Database; namespace MyLyrics { @@ -835,9 +834,6 @@ private void MyLyricsSetup_FormClosing(object sender, FormClosingEventArgs e) { - - - LyricDiagnostics.Dispose(); } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -22,7 +22,6 @@ using LyricsEngine; using LyricsEngine.LRC; -using LyricsEngine.Database; namespace MyLyrics Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -8,7 +8,6 @@ using System.Threading; using LyricsEngine; -using LyricsEngine.Database; namespace MyLyrics { Modified: trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-04-30 18:53:08 UTC (rev 359) +++ trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-04-30 18:55:03 UTC (rev 360) @@ -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.20")] -[assembly: AssemblyFileVersion("0.20")] +[assembly: AssemblyVersion("0.21")] +[assembly: AssemblyFileVersion("0.21")] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-04-30 19:49:35
|
Revision: 361 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=361&view=rev Author: saamand Date: 2007-04-30 12:49:34 -0700 (Mon, 30 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-30 18:55:03 UTC (rev 360) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-30 19:49:34 UTC (rev 361) @@ -5,12 +5,13 @@ <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> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> - <StartupObject>MyLyrics.MyLyricsSetup_test</StartupObject> + <StartupObject> + </StartupObject> <SignAssembly>false</SignAssembly> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-30 18:55:03 UTC (rev 360) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-30 19:49:34 UTC (rev 361) @@ -450,6 +450,9 @@ m_LyricText = lyricStrings; m_artist = artist; m_track = track; + + --m_SongsToSearch; + lbSongsToSearch2.Text = m_SongsToSearch.ToString(); m_SongsWithLyric += 1; m_LyricsFound += 1; @@ -481,6 +484,9 @@ { m_LyricsNotFound += 1; + --m_SongsToSearch; + lbSongsToSearch2.Text = m_SongsToSearch.ToString(); + lbLyricsNotFound2.Text = m_LyricsNotFound.ToString(); string capArtist = LyricUtil.CapatalizeString(artist); @@ -641,7 +647,7 @@ { m_DisregardedSongs += 1; } - else if ((m_DisregardSongWithLyricInTag && ((tag = MediaPortal.TagReader.TagReader.ReadTag(song.FileName)) != null) && tag.Lyrics.Length == 0)) + else if ((m_DisregardSongWithLyricInTag == false && ((tag = MediaPortal.TagReader.TagReader.ReadTag(song.FileName)) != null) && tag.Lyrics.Length > 0)) { m_SongsWithLyric += 1; 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-01 15:59:20
|
Revision: 368 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=368&view=rev Author: saamand Date: 2007-05-01 08:59:15 -0700 (Tue, 01 May 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs 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/LyricsEngine/LyricsSites/Wiki.cs trunk/plugins/MyLyrics/LyricsEngine/Setup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_test.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -33,7 +33,6 @@ ManualResetEvent m_EventStopped_LyricController; private string[] lyricsSites; - internal static bool ALLOW_ALL_TO_SEARCH; public LyricsController(ILyricForm mainForm, ManualResetEvent eventStopThread, @@ -46,29 +45,22 @@ noOfLyricsFound = 0; noOfLyricsNotFound = 0; - ALLOW_ALL_TO_SEARCH = allowAllToSearch; ArrayList easySitesArrayList = new ArrayList(); // If search all, then include all - if (allowAllToSearch) + foreach (string site in lyricSites) { - this.lyricsSites = lyricSites; - } - else - { - foreach (string site in lyricSites) + if (Setup.IsMember(site)) { - if (Setup.IsMember(site)) - { - easySitesArrayList.Add(site); - } + easySitesArrayList.Add(site); } - this.lyricsSites = (string[])easySitesArrayList.ToArray(typeof(string)); } + this.lyricsSites = (string[])easySitesArrayList.ToArray(typeof(string)); + LyricSearch.LyricsSites = lyricsSites; - + m_EventStop_LyricController = eventStopThread; m_EventStopped_LyricController = new ManualResetEvent(false); @@ -172,7 +164,7 @@ m_Form.UpdateStatus = new Object[] { noOfLyricsToSearch, noOfLyricsSearched, noOfLyricsFound, noOfLyricsNotFound }; - if ((noOfLyricsSearched >= noOfLyricsToSearch) && ALLOW_ALL_TO_SEARCH == false) + if ((noOfLyricsSearched >= noOfLyricsToSearch)) { FinishThread(artist, title, "All songs have been searched!", site); } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -4,6 +4,7 @@ using System.IO; using System.Diagnostics; using System.Net; +using System.Threading; namespace LyricsEngine.LyricSites { @@ -17,7 +18,7 @@ get { return lyric; } } - public EvilLabs(string artist, string title) + public EvilLabs(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) { if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "EvilLabs(" + artist + ", " + title + ")"); @@ -37,7 +38,14 @@ while (complete == false) { - System.Threading.Thread.Sleep(100); + if (m_EventStop_SiteSearches.WaitOne(1, true)) + { + complete = true; + } + else + { + System.Threading.Thread.Sleep(100); + } } } @@ -98,8 +106,8 @@ { reply.Close(); } + complete = true; } - complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/HotLyrics.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -4,20 +4,21 @@ using System.IO; using System.Diagnostics; using System.Net; +using System.Threading; namespace LyricsEngine.LyricSites { class HotLyrics { string lyric = ""; - bool complete; + private bool complete; public string Lyric { get { return lyric; } } - public HotLyrics(string artist, string title) + public HotLyrics(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) { if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); @@ -101,7 +102,14 @@ while (complete == false) { - System.Threading.Thread.Sleep(100); + if (m_EventStop_SiteSearches.WaitOne(1, true)) + { + complete = true; + } + else + { + System.Threading.Thread.Sleep(100); + } } } @@ -189,8 +197,8 @@ { reply.Close(); } + complete = true; } - complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -4,6 +4,7 @@ using System.IO; using System.Diagnostics; using System.Net; +using System.Threading; namespace LyricsEngine.LyricSites { @@ -17,7 +18,7 @@ get { return lyric; } } - public Lyrics007(string artist, string title) + public Lyrics007(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) { if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "Lyrics007(" + artist + ", " + title + ")"); @@ -40,7 +41,14 @@ while (complete == false) { - System.Threading.Thread.Sleep(100); + if (m_EventStop_SiteSearches.WaitOne(1, true)) + { + complete = true; + } + else + { + System.Threading.Thread.Sleep(100); + } } } @@ -135,8 +143,8 @@ { reply.Close(); } + complete = true; } - complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -4,6 +4,7 @@ using System.IO; using System.Diagnostics; using System.Net; +using System.Threading; namespace LyricsEngine.LyricSites { @@ -17,7 +18,7 @@ get { return lyric; } } - public LyricsOnDemand(string artist, string title) + public LyricsOnDemand(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) { if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "LyricsOnDemand(" + artist + ", " + title + ")"); @@ -70,7 +71,14 @@ while (complete == false) { - System.Threading.Thread.Sleep(100); + if (m_EventStop_SiteSearches.WaitOne(1, true)) + { + complete = true; + } + else + { + System.Threading.Thread.Sleep(100); + } } } @@ -160,8 +168,8 @@ { reply.Close(); } + complete = true; } - complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -4,6 +4,7 @@ using System.IO; using System.Diagnostics; using System.Net; +using System.Threading; namespace LyricsEngine.LyricSites { @@ -17,7 +18,7 @@ get { return lyric; } } - public SeekLyrics(string artist, string title) + public SeekLyrics(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) { if (LyricDiagnostics.TraceSource != null) LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "SeekLyrics(" + artist + ", " + title + ")"); @@ -75,7 +76,14 @@ while (complete == false) { - System.Threading.Thread.Sleep(100); + if (m_EventStop_SiteSearches.WaitOne(1, true)) + { + complete = true; + } + else + { + System.Threading.Thread.Sleep(100); + } } } @@ -174,8 +182,8 @@ { reply.Close(); } + complete = true; } - complete = true; } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -47,7 +47,7 @@ else { // if we don't allow this pause of 2 sec the webservice behaves in a strange maneur - Thread.Sleep(1500); + Thread.Sleep(2000); } ++noOfTries; } Modified: trunk/plugins/MyLyrics/LyricsEngine/Setup.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/LyricsEngine/Setup.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -6,14 +6,14 @@ { public static class Setup { - public static string[] BatchSearchSites = new string[4] + public static string[] BatchSearchSites = new string[6] { "LyricWiki", "Lyrics007", "LyricsOnDemand", - "HotLyrics"/*, + "HotLyrics", "EvilLabs", - "SeekLyrics"*/ + "SeekLyrics" }; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -610,6 +610,10 @@ if (m_SearchOnlyMarkedSongs == false) { + + //System.IO.Directory.SetCurrentDirectory(@"C:\Program Files\Team MediaPortal\MediaPortal"); + //string test = System.IO.Directory.GetCurrentDirectory(); + MusicDatabase dbs = new MusicDatabase(); dbs.GetArtists(ref artists); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_test.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_test.cs 2007-05-01 14:40:37 UTC (rev 367) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_test.cs 2007-05-01 15:59:15 UTC (rev 368) @@ -15,7 +15,7 @@ static void Main() { //Config.Dir.Config = @"C:\Program Files\Team MediaPortal\MediaPortal"; - System.IO.Directory.SetCurrentDirectory(@"C:\Program Files\Team MediaPortal\MediaPortal"); + System.IO.Directory.SetCurrentDirectory(@"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\MP-plugins\MyLyrics\My Lyrics\bin\Debug"); System.Windows.Forms.Application.Run(new MyLyricsSetup()); //System.Windows.Forms.Application.Run(new MySeriaTest()); } 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-06 12:25:29
|
Revision: 380 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=380&view=rev Author: saamand Date: 2007-05-06 05:25:27 -0700 (Sun, 06 May 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-05-06 11:37:38 UTC (rev 379) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-05-06 12:25:27 UTC (rev 380) @@ -41,6 +41,8 @@ private Nullable<bool> basicScreenSelected = null; string lyricsScreenXML = "MyLyrics.xml"; + string skin = ""; + bool exitingMyLyrics = false; bool newTrack = false; bool alreadyValidLRC = false; @@ -90,7 +92,15 @@ { CONTROL_BACKGROUND = 1, CONTROL_TITLE = 2, - CONTROL_LBStatus = 11 + CONTROL_LBStatus = 11, + CONTROL_UPNEXT = 22, + CONTROL_ALBUM = 26, + CONTROL_YEAR = 27, + CONTROL_TRACKTITLE = 30, + CONTROL_TRACKARTIST = 32, + CONTROL_NUMBERDURATION = 33, + CONTROL_NEXTTRACK = 121, + CONTROL_NEXTARTIST = 123, } enum GUI_Lyrics_Controls @@ -309,6 +319,8 @@ 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; + + skin = ((string)xmlreader.GetValueAsString("skin", "name", "BlueTwo")); } ArrayList sitesToSearch = new ArrayList(); @@ -931,6 +943,29 @@ private void resetGUI(int screenID) { + if (skin.Equals("ReVision") && (screenID == (int)MyLyricsSettings.Screen.LYRICS_WIDE || screenID == (int)MyLyricsSettings.Screen.LRC_WIDE || screenID == (int)MyLyricsSettings.Screen.LRC_EDITOR)) + { + GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_UPNEXT); + GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_ALBUM); + GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_YEAR); + GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_TRACKTITLE); + GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_TRACKARTIST); + GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_NUMBERDURATION); + GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_NEXTTRACK); + GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_NEXTARTIST); + } + else + { + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_UPNEXT); + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_ALBUM); + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_YEAR); + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_TRACKTITLE); + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_TRACKARTIST); + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_NUMBERDURATION); + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_NEXTTRACK); + GUIControl.ShowControl(GetID, (int)GUI_General_Controls.CONTROL_NEXTARTIST); + } + int prevSelectedScreen = selectedScreen; selectedScreen = screenID; 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 14:58:32
|
Revision: 414 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=414&view=rev Author: saamand Date: 2007-05-23 07:58:29 -0700 (Wed, 23 May 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 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/My Lyrics/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/MyLyrics.suo Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-05-22 06:29:24 UTC (rev 413) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-05-23 14:58:29 UTC (rev 414) @@ -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.21")] +[assembly: AssemblyVersion("0.22")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-05-22 06:29:24 UTC (rev 413) +++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-05-23 14:58:29 UTC (rev 414) @@ -126,7 +126,7 @@ public static void SerializeLyricDB() { - string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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-22 06:29:24 UTC (rev 413) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-05-23 14:58:29 UTC (rev 414) @@ -354,13 +354,13 @@ // Deserialize lyrics and marked database, and save references in LyricsDB try { - 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(); @@ -391,7 +391,7 @@ LoadSettings(); - LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.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; } @@ -757,7 +757,7 @@ 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); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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.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(); @@ -882,7 +882,7 @@ { LyricsMarkedDB.Remove(DatabaseUtil.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(); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-05-22 06:29:24 UTC (rev 413) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-05-23 14:58:29 UTC (rev 414) @@ -105,8 +105,8 @@ public MyLyricsSetup() { - LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, MyLyricsSettings.LogName)); - //LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log)); + LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log, MyLyricsSettings.LogName)); + //LyricDiagnostics.OpenLog(MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Log)); #region Initialize GUI and class InitializeComponent(); @@ -162,7 +162,7 @@ #endregion #region Serialzie/deserialize lyricsdatabases - string lyricsXMLpath = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Base, MyLyricsSettings.LyricsXMLName); + string lyricsXMLpath = MediaPortal.Util.Config.GetFile(MediaPortal.Util.Config.Dir.Base, MyLyricsSettings.LyricsXMLName); FileInfo lyricsXMLfileInfo = new FileInfo(lyricsXMLpath); @@ -170,7 +170,7 @@ if (lyricsXMLfileInfo.Exists) { - string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + string path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + path = MediaPortal.Util.Config.GetFile(MediaPortal.Util.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-22 06:29:24 UTC (rev 413) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-05-23 14:58:29 UTC (rev 414) @@ -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.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsDBName; + string path = MediaPortal.Util.Config.GetFolder(MediaPortal.Util.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.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsMarkedDBName; + string path = MediaPortal.Util.Config.GetFolder(MediaPortal.Util.Config.Dir.Database) + "\\" + MyLyricsSettings.LyricsMarkedDBName; FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); Modified: trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-05-22 06:29:24 UTC (rev 413) +++ trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-05-23 14:58:29 UTC (rev 414) @@ -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.21")] -[assembly: AssemblyFileVersion("0.21")] +[assembly: AssemblyVersion("0.22")] +[assembly: AssemblyFileVersion("0.22")] 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-10-29 20:30:30
|
Revision: 1014 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1014&view=rev Author: saamand Date: 2007-10-29 13:30:27 -0700 (Mon, 29 Oct 2007) Log Message: ----------- Version 1.0 beta 1 Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/My Lyrics/Changelog.txt trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyricsExternCode.cs trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-10-29 20:30:27 UTC (rev 1014) @@ -1,6 +1,8 @@ using System; using System.Collections; using System.Text; +using System.IO; +using System.IO.IsolatedStorage; namespace LyricsEngine.LRC { Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-10-29 20:30:27 UTC (rev 1014) @@ -24,6 +24,9 @@ private bool m_StopSearches; + private bool m_allowAllToComplete; + private bool m_automaticUpdate; + ArrayList threadList = new ArrayList(); // Main thread sets this event to stop LyricController @@ -36,9 +39,12 @@ public LyricsController(ILyricForm mainForm, ManualResetEvent eventStopThread, - string[] lyricSites, bool allowAllToSearch) + string[] lyricSites, + bool allowAllToSearch, bool automaticUpdate) { this.m_Form = mainForm; + this.m_allowAllToComplete = allowAllToSearch; + this.m_automaticUpdate = automaticUpdate; noOfLyricsToSearch = 1; noOfLyricsSearched = 0; @@ -133,7 +139,7 @@ // create worker thread instance ThreadStart easySitesThreadInstance = delegate { - LyricSearch lyricSearch_EasySites = new LyricSearch(this, artist, title); + LyricSearch lyricSearch_EasySites = new LyricSearch(this, artist, title, m_allowAllToComplete, m_automaticUpdate); lyricSearch_EasySites.Run(); }; @@ -173,7 +179,7 @@ internal void LyricFound(String lyricStrings, String artist, String title, String site) { - if (m_StopSearches == false) + if (m_allowAllToComplete || m_StopSearches == false) { m_Form.LyricFound = new Object[] { lyricStrings, artist, title, site }; StatusUpdate(artist, title, site, true); @@ -182,7 +188,7 @@ internal void LyricNotFound(String artist, String title, String message, String site) { - if (m_StopSearches == false) + if (m_allowAllToComplete || m_StopSearches == false) { m_Form.LyricNotFound = new Object[] { artist, title, message, site }; StatusUpdate(artist, title, site, false); Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-10-29 20:30:27 UTC (rev 1014) @@ -11,6 +11,7 @@ { class EvilLabs { + string lyric = ""; bool complete; System.Timers.Timer timer; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-10-29 20:30:27 UTC (rev 1014) @@ -143,6 +143,7 @@ lyricTemp.Replace("?v", "'v"); lyricTemp.Replace("<p>", " \r\n"); lyricTemp.Replace("<BR>", " \r\n"); + lyricTemp.Replace("<br />", " \r\n"); lyric = lyricTemp.ToString().Trim(); Modified: trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/LyricsEngine/Properties/AssemblyInfo.cs 2007-10-29 20:30:27 UTC (rev 1014) @@ -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.22")] +[assembly: AssemblyVersion("0.23")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/MyLyrics/My Lyrics/Changelog.txt =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-10-29 20:30:27 UTC (rev 1014) @@ -1,3 +1,6 @@ +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 Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-10-29 20:30:27 UTC (rev 1014) @@ -666,7 +666,7 @@ { lyricsFound = false; - lc = new LyricsController(this, m_EventStopThread, m_sitesToSearch, false); + lc = new LyricsController(this, m_EventStopThread, m_sitesToSearch, false, false); // create worker thread instance ThreadStart job = delegate { Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-10-29 20:30:27 UTC (rev 1014) @@ -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> @@ -64,61 +64,61 @@ <Compile Include="Convert\ConvertFromXMLtoLyricsDatabase.cs" /> <Compile Include="MyLyricsExternCode.cs" /> <Compile Include="MyLyricsSettings.cs" /> - <Compile Include="MyLyricsSetup_test.cs" /> + <Compile Include="MyLyrics Configuration\MyLyricsSetup_test.cs" /> <Compile Include="DatabaseUtil.cs" /> <Compile Include="MyLyrics.cs" /> - <Compile Include="MyLyricsSetup.cs"> + <Compile Include="MyLyrics Configuration\MyLyricsSetup.cs"> <SubType>Form</SubType> </Compile> - <Compile Include="MyLyricsSetup.Designer.cs"> + <Compile Include="MyLyrics Configuration\MyLyricsSetup.Designer.cs"> <DependentUpon>MyLyricsSetup.cs</DependentUpon> </Compile> - <Compile Include="MyLyricsSetup_AddNewSong.cs"> + <Compile Include="MyLyrics Configuration\AddNewSong.cs"> <SubType>Form</SubType> </Compile> - <Compile Include="MyLyricsSetup_AddNewSong.Designer.cs"> - <DependentUpon>MyLyricsSetup_AddNewSong.cs</DependentUpon> + <Compile Include="MyLyrics Configuration\AddNewSong.Designer.cs"> + <DependentUpon>AddNewSong.cs</DependentUpon> </Compile> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="MyLyricsSetup_LyricsLibrary.cs"> + <Compile Include="MyLyrics Configuration\LyricsLibrary.cs"> <SubType>UserControl</SubType> </Compile> - <Compile Include="MyLyricsSetup_LyricsLibrary.Designer.cs"> - <DependentUpon>MyLyricsSetup_LyricsLibrary.cs</DependentUpon> + <Compile Include="MyLyrics Configuration\LyricsLibrary.Designer.cs"> + <DependentUpon>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"> + <Compile Include="MyLyrics Configuration\FindLyric.cs"> <SubType>Form</SubType> </Compile> - <Compile Include="MyLyricsSetup_SearchTitleDialog.Designer.cs"> - <DependentUpon>MyLyricsSetup_SearchTitleDialog.cs</DependentUpon> + <Compile Include="MyLyrics Configuration\FindLyric.Designer.cs"> + <DependentUpon>FindLyric.cs</DependentUpon> </Compile> </ItemGroup> <ItemGroup> - <EmbeddedResource Include="MyLyricsSetup_LyricsLibrary.resx"> + <EmbeddedResource Include="MyLyrics Configuration\LyricsLibrary.resx"> <SubType>Designer</SubType> - <DependentUpon>MyLyricsSetup_LyricsLibrary.cs</DependentUpon> + <DependentUpon>LyricsLibrary.cs</DependentUpon> </EmbeddedResource> - <EmbeddedResource Include="MyLyricsSetup.resx"> + <EmbeddedResource Include="MyLyrics Configuration\MyLyricsSetup.resx"> <SubType>Designer</SubType> <DependentUpon>MyLyricsSetup.cs</DependentUpon> </EmbeddedResource> - <EmbeddedResource Include="MyLyricsSetup_AddNewSong.resx"> + <EmbeddedResource Include="MyLyrics Configuration\AddNewSong.resx"> <SubType>Designer</SubType> - <DependentUpon>MyLyricsSetup_AddNewSong.cs</DependentUpon> + <DependentUpon>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"> + <EmbeddedResource Include="MyLyrics Configuration\FindLyric.resx"> <SubType>Designer</SubType> - <DependentUpon>MyLyricsSetup_SearchTitleDialog.cs</DependentUpon> + <DependentUpon>FindLyric.cs</DependentUpon> </EmbeddedResource> </ItemGroup> <ItemGroup> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsExternCode.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsExternCode.cs 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsExternCode.cs 2007-10-29 20:30:27 UTC (rev 1014) @@ -34,13 +34,6 @@ GetTrackTags(); CurrentThumbFileName = GUIMusicFiles.GetCoverArt(false, CurrentTrackFileName, CurrentTrackTag); - - if (CurrentThumbFileName.Length < 1) // no ThumbFile currently -> check if there is a folder.jpg - { - CurrentThumbFileName = String.Format(@"{0}\folder.jpg", MediaPortal.Util.Utils.RemoveTrailingSlash(System.IO.Path.GetDirectoryName(CurrentTrackFileName))); - if (!System.IO.File.Exists(CurrentThumbFileName)) CurrentThumbFileName = string.Empty; - } - if (CurrentThumbFileName.Length > 0) { // let us test if there is a larger cover art image @@ -118,7 +111,7 @@ { bool isCurSongCdTrack = IsCdTrack(CurrentTrackFileName); bool isNextSongCdTrack = IsCdTrack(NextTrackFileName); - MusicDatabase dbs = new MusicDatabase(); + MusicDatabase dbs = MusicDatabase.Instance; if (CurrentTrackTag != null) PreviousTrackTag = CurrentTrackTag; Modified: trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-10-29 14:04:34 UTC (rev 1013) +++ trunk/plugins/MyLyrics/My Lyrics/Properties/AssemblyInfo.cs 2007-10-29 20:30:27 UTC (rev 1014) @@ -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.22")] -[assembly: AssemblyFileVersion("0.22")] +[assembly: AssemblyVersion("0.23")] +[assembly: AssemblyFileVersion("0.23")] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-11-08 15:09:54
|
Revision: 1040 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1040&view=rev Author: saamand Date: 2007-11-08 07:09:51 -0800 (Thu, 08 Nov 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs Added Paths: ----------- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.resx trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.resx Removed Paths: ------------- trunk/plugins/MyLyrics/LyricsEngine/bin/ trunk/plugins/MyLyrics/LyricsEngine/obj/ trunk/plugins/MyLyrics/MusicDatabaseV8.db3 trunk/plugins/MyLyrics/MyLyric Windows Application/ Deleted: trunk/plugins/MyLyrics/MusicDatabaseV8.db3 =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-11-08 11:02:03 UTC (rev 1039) +++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-11-08 15:09:51 UTC (rev 1040) @@ -56,20 +56,6 @@ } - 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; Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.Designer.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.Designer.cs 2007-11-08 15:09:51 UTC (rev 1040) @@ -0,0 +1,221 @@ +namespace MyLyrics +{ + partial class ExportTags + { + /// <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.lbInfo = new System.Windows.Forms.Label(); + this.progressBar = new System.Windows.Forms.ProgressBar(); + this.bw = new System.ComponentModel.BackgroundWorker(); + this.btStart = new System.Windows.Forms.Button(); + this.gbMusicDBSearchStats = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.lbSongsToSearch2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbSongsToSearch = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbTotalSongs2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbTotalSongs = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbLyricsFound2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbLyricsFound = new MediaPortal.UserInterface.Controls.MPLabel(); + this.btCancel = new System.Windows.Forms.Button(); + this.btClose = new System.Windows.Forms.Button(); + this.lbCurrentArtist = new System.Windows.Forms.Label(); + this.gbMusicDBSearchStats.SuspendLayout(); + this.SuspendLayout(); + // + // lbInfo + // + this.lbInfo.AutoSize = true; + this.lbInfo.Location = new System.Drawing.Point(10, 12); + this.lbInfo.Name = "lbInfo"; + this.lbInfo.Size = new System.Drawing.Size(30, 13); + this.lbInfo.TabIndex = 0; + this.lbInfo.Text = "[text]"; + // + // progressBar + // + this.progressBar.Location = new System.Drawing.Point(13, 53); + this.progressBar.Maximum = 1000; + this.progressBar.Name = "progressBar"; + this.progressBar.Size = new System.Drawing.Size(249, 23); + this.progressBar.Step = 1; + this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; + this.progressBar.TabIndex = 1; + // + // 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); + // + // btStart + // + this.btStart.Location = new System.Drawing.Point(13, 166); + this.btStart.Name = "btStart"; + this.btStart.Size = new System.Drawing.Size(66, 23); + this.btStart.TabIndex = 2; + this.btStart.Text = "Start"; + this.btStart.UseVisualStyleBackColor = true; + this.btStart.Click += new System.EventHandler(this.btStart_Click); + // + // gbMusicDBSearchStats + // + this.gbMusicDBSearchStats.Controls.Add(this.lbSongsToSearch2); + this.gbMusicDBSearchStats.Controls.Add(this.lbSongsToSearch); + this.gbMusicDBSearchStats.Controls.Add(this.lbTotalSongs2); + this.gbMusicDBSearchStats.Controls.Add(this.lbTotalSongs); + 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(13, 86); + this.gbMusicDBSearchStats.Name = "gbMusicDBSearchStats"; + this.gbMusicDBSearchStats.Size = new System.Drawing.Size(249, 71); + this.gbMusicDBSearchStats.TabIndex = 13; + this.gbMusicDBSearchStats.TabStop = false; + this.gbMusicDBSearchStats.Text = "Search stats"; + // + // lbSongsToSearch2 + // + this.lbSongsToSearch2.Location = new System.Drawing.Point(173, 31); + this.lbSongsToSearch2.Name = "lbSongsToSearch2"; + this.lbSongsToSearch2.Size = new System.Drawing.Size(65, 15); + this.lbSongsToSearch2.TabIndex = 33; + this.lbSongsToSearch2.Text = "-"; + // + // lbSongsToSearch + // + this.lbSongsToSearch.Location = new System.Drawing.Point(5, 30); + this.lbSongsToSearch.Name = "lbSongsToSearch"; + this.lbSongsToSearch.Size = new System.Drawing.Size(140, 16); + this.lbSongsToSearch.TabIndex = 32; + this.lbSongsToSearch.Text = "Songs left to search:"; + // + // lbTotalSongs2 + // + this.lbTotalSongs2.Location = new System.Drawing.Point(172, 15); + this.lbTotalSongs2.Name = "lbTotalSongs2"; + this.lbTotalSongs2.Size = new System.Drawing.Size(65, 15); + this.lbTotalSongs2.TabIndex = 21; + this.lbTotalSongs2.Text = "-"; + // + // lbTotalSongs + // + this.lbTotalSongs.Location = new System.Drawing.Point(4, 15); + this.lbTotalSongs.Name = "lbTotalSongs"; + this.lbTotalSongs.Size = new System.Drawing.Size(91, 15); + this.lbTotalSongs.TabIndex = 20; + this.lbTotalSongs.Text = "Total songs:"; + // + // lbLyricsFound2 + // + this.lbLyricsFound2.Location = new System.Drawing.Point(173, 46); + this.lbLyricsFound2.Name = "lbLyricsFound2"; + this.lbLyricsFound2.Size = new System.Drawing.Size(65, 15); + this.lbLyricsFound2.TabIndex = 15; + this.lbLyricsFound2.Text = "-"; + // + // lbLyricsFound + // + this.lbLyricsFound.Location = new System.Drawing.Point(5, 46); + this.lbLyricsFound.Name = "lbLyricsFound"; + this.lbLyricsFound.Size = new System.Drawing.Size(162, 15); + this.lbLyricsFound.TabIndex = 14; + this.lbLyricsFound.Text = "Lyrics exported:"; + // + // btCancel + // + this.btCancel.Location = new System.Drawing.Point(85, 166); + this.btCancel.Name = "btCancel"; + this.btCancel.Size = new System.Drawing.Size(66, 23); + this.btCancel.TabIndex = 14; + this.btCancel.Text = "Cancel"; + this.btCancel.UseVisualStyleBackColor = true; + this.btCancel.Click += new System.EventHandler(this.btCancel_Click); + // + // btClose + // + this.btClose.Location = new System.Drawing.Point(196, 166); + this.btClose.Name = "btClose"; + this.btClose.Size = new System.Drawing.Size(66, 23); + this.btClose.TabIndex = 15; + this.btClose.Text = "Close"; + this.btClose.UseVisualStyleBackColor = true; + this.btClose.Click += new System.EventHandler(this.btClose_Click); + // + // lbCurrentArtist + // + this.lbCurrentArtist.AutoSize = true; + this.lbCurrentArtist.Location = new System.Drawing.Point(10, 25); + this.lbCurrentArtist.Name = "lbCurrentArtist"; + this.lbCurrentArtist.Size = new System.Drawing.Size(71, 13); + this.lbCurrentArtist.TabIndex = 16; + this.lbCurrentArtist.Text = "[current artist]"; + // + // ExportTags + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(272, 193); + this.ControlBox = false; + this.Controls.Add(this.lbCurrentArtist); + this.Controls.Add(this.btClose); + this.Controls.Add(this.btCancel); + this.Controls.Add(this.gbMusicDBSearchStats); + this.Controls.Add(this.btStart); + this.Controls.Add(this.progressBar); + this.Controls.Add(this.lbInfo); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ExportTags"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "Export lyrics to music tags"; + this.gbMusicDBSearchStats.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbInfo; + private System.Windows.Forms.ProgressBar progressBar; + private System.ComponentModel.BackgroundWorker bw; + private System.Windows.Forms.Button btStart; + private MediaPortal.UserInterface.Controls.MPGroupBox gbMusicDBSearchStats; + private MediaPortal.UserInterface.Controls.MPLabel lbSongsToSearch2; + private MediaPortal.UserInterface.Controls.MPLabel lbSongsToSearch; + private MediaPortal.UserInterface.Controls.MPLabel lbTotalSongs2; + private MediaPortal.UserInterface.Controls.MPLabel lbTotalSongs; + private MediaPortal.UserInterface.Controls.MPLabel lbLyricsFound2; + private MediaPortal.UserInterface.Controls.MPLabel lbLyricsFound; + private System.Windows.Forms.Button btCancel; + private System.Windows.Forms.Button btClose; + private System.Windows.Forms.Label lbCurrentArtist; + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs 2007-11-08 15:09:51 UTC (rev 1040) @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using MediaPortal.Music.Database; +using MediaPortal.TagReader; +using System.Collections; +using System.Threading; +using System.IO; + +namespace MyLyrics +{ + public partial class ExportTags : Form + { + ArrayList artists; + List<Song> songs; + int totalSongsToSearch; + int totalSongsSearched; + + public ExportTags() + { + InitializeComponent(); + this.lbInfo.Text = "Press the 'Start'-button to begin the export"; + this.lbCurrentArtist.Text = "Note that the export cannot be undone"; + } + + private void btStart_Click(object sender, EventArgs e) + { + lbInfo.Text = string.Format("Currently exporting tags to the tracks of:"); + + btStart.Enabled = false; + btCancel.Enabled = true; + btClose.Enabled = false; + + MusicDatabase mDB = MusicDatabase.Instance; + artists = new ArrayList(); + songs = new List<Song>(); + mDB.GetArtists(0, "", ref artists); + artists.Sort(); + + progressBar.ResetText(); + progressBar.Enabled = true; + progressBar.Value = 0; + progressBar.Maximum = artists.Count; + totalSongsToSearch = mDB.GetTotalSongs(); + lbTotalSongs2.Text = totalSongsToSearch.ToString(); + + bw.RunWorkerAsync(); + } + + private void bw_DoWork(object sender, DoWorkEventArgs e) + { + MusicDatabase mDB = MusicDatabase.Instance; + int counter = 0; + + for (int i = 0; i < artists.Count; i++) + { + if (bw.CancellationPending) + { + return; + } + + string artist = (string)artists[i]; + Thread.Sleep(100); // Give the GUI thread some time to update + bw.ReportProgress(counter, artist); + try + { + mDB.GetSongsByArtist(artist, ref songs); + + foreach (Song song in songs) + { + string capArtist = LyricsEngine.LyricUtil.CapatalizeString(song.Artist); + string capTitle = LyricsEngine.LyricUtil.CapatalizeString(song.Title); + + if (DatabaseUtil.IsTrackInLyricsDatabase(MyLyricsSettings.LyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_FOUND)) + { + if (!Path.GetExtension(song.FileName).Equals(".wma", StringComparison.InvariantCultureIgnoreCase)) + { + string lyric = MyLyricsSettings.LyricsDB[DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)].Lyrics; + bool test = TagReader.WriteLyrics(song.FileName, lyric); + ++counter; + } + } + } + } + catch (Exception e2) + { + string s = e2.Message; + } + } + } + + private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + MusicDatabase mDB = MusicDatabase.Instance; + string artist = e.UserState as string; + List<Song> songs = new List<Song>(); + mDB.GetSongsByArtist(artist, ref songs); + totalSongsSearched += songs.Count; + lbCurrentArtist.Text = artist; + progressBar.PerformStep(); + lbLyricsFound2.Text = e.ProgressPercentage.ToString(); + lbSongsToSearch2.Text = string.Format("{0}", totalSongsToSearch - totalSongsSearched); + } + + + private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + lbSongsToSearch2.Text = "0"; + + lbInfo.Text = "The export has ended."; + lbCurrentArtist.Text = string.Empty; + + btStart.Enabled = true; + btCancel.Enabled = false; + btClose.Enabled = true; + } + + private void btCancel_Click(object sender, EventArgs e) + { + bw.CancelAsync(); + progressBar.ResetText(); + progressBar.Value = 0; + } + + private void btClose_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.resx (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.resx 2007-11-08 15:09:51 UTC (rev 1040) @@ -0,0 +1,123 @@ +<?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> + <metadata name="bw.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>24, -1</value> + </metadata> +</root> \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.Designer.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.Designer.cs 2007-11-08 15:09:51 UTC (rev 1040) @@ -0,0 +1,221 @@ +namespace MyLyrics +{ + partial class ImportTags + { + /// <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.lbInfo = new System.Windows.Forms.Label(); + this.progressBar = new System.Windows.Forms.ProgressBar(); + this.bw = new System.ComponentModel.BackgroundWorker(); + this.btStart = new System.Windows.Forms.Button(); + this.gbMusicDBSearchStats = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.lbSongsToSearch2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbSongsToSearch = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbTotalSongs2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbTotalSongs = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbLyricsFound2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.lbLyricsFound = new MediaPortal.UserInterface.Controls.MPLabel(); + this.btCancel = new System.Windows.Forms.Button(); + this.btClose = new System.Windows.Forms.Button(); + this.lbCurrentArtist = new System.Windows.Forms.Label(); + this.gbMusicDBSearchStats.SuspendLayout(); + this.SuspendLayout(); + // + // lbInfo + // + this.lbInfo.AutoSize = true; + this.lbInfo.Location = new System.Drawing.Point(10, 12); + this.lbInfo.Name = "lbInfo"; + this.lbInfo.Size = new System.Drawing.Size(30, 13); + this.lbInfo.TabIndex = 0; + this.lbInfo.Text = "[text]"; + // + // progressBar + // + this.progressBar.Location = new System.Drawing.Point(13, 53); + this.progressBar.Maximum = 1000; + this.progressBar.Name = "progressBar"; + this.progressBar.Size = new System.Drawing.Size(249, 23); + this.progressBar.Step = 1; + this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; + this.progressBar.TabIndex = 1; + // + // 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); + // + // btStart + // + this.btStart.Location = new System.Drawing.Point(13, 166); + this.btStart.Name = "btStart"; + this.btStart.Size = new System.Drawing.Size(66, 23); + this.btStart.TabIndex = 2; + this.btStart.Text = "Start"; + this.btStart.UseVisualStyleBackColor = true; + this.btStart.Click += new System.EventHandler(this.btStart_Click); + // + // gbMusicDBSearchStats + // + this.gbMusicDBSearchStats.Controls.Add(this.lbSongsToSearch2); + this.gbMusicDBSearchStats.Controls.Add(this.lbSongsToSearch); + this.gbMusicDBSearchStats.Controls.Add(this.lbTotalSongs2); + this.gbMusicDBSearchStats.Controls.Add(this.lbTotalSongs); + 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(13, 86); + this.gbMusicDBSearchStats.Name = "gbMusicDBSearchStats"; + this.gbMusicDBSearchStats.Size = new System.Drawing.Size(249, 71); + this.gbMusicDBSearchStats.TabIndex = 13; + this.gbMusicDBSearchStats.TabStop = false; + this.gbMusicDBSearchStats.Text = "Search stats"; + // + // lbSongsToSearch2 + // + this.lbSongsToSearch2.Location = new System.Drawing.Point(173, 31); + this.lbSongsToSearch2.Name = "lbSongsToSearch2"; + this.lbSongsToSearch2.Size = new System.Drawing.Size(65, 15); + this.lbSongsToSearch2.TabIndex = 33; + this.lbSongsToSearch2.Text = "-"; + // + // lbSongsToSearch + // + this.lbSongsToSearch.Location = new System.Drawing.Point(5, 30); + this.lbSongsToSearch.Name = "lbSongsToSearch"; + this.lbSongsToSearch.Size = new System.Drawing.Size(140, 16); + this.lbSongsToSearch.TabIndex = 32; + this.lbSongsToSearch.Text = "Songs left to search:"; + // + // lbTotalSongs2 + // + this.lbTotalSongs2.Location = new System.Drawing.Point(172, 15); + this.lbTotalSongs2.Name = "lbTotalSongs2"; + this.lbTotalSongs2.Size = new System.Drawing.Size(65, 15); + this.lbTotalSongs2.TabIndex = 21; + this.lbTotalSongs2.Text = "-"; + // + // lbTotalSongs + // + this.lbTotalSongs.Location = new System.Drawing.Point(4, 15); + this.lbTotalSongs.Name = "lbTotalSongs"; + this.lbTotalSongs.Size = new System.Drawing.Size(91, 15); + this.lbTotalSongs.TabIndex = 20; + this.lbTotalSongs.Text = "Total songs:"; + // + // lbLyricsFound2 + // + this.lbLyricsFound2.Location = new System.Drawing.Point(173, 46); + this.lbLyricsFound2.Name = "lbLyricsFound2"; + this.lbLyricsFound2.Size = new System.Drawing.Size(65, 15); + this.lbLyricsFound2.TabIndex = 15; + this.lbLyricsFound2.Text = "-"; + // + // lbLyricsFound + // + this.lbLyricsFound.Location = new System.Drawing.Point(5, 46); + this.lbLyricsFound.Name = "lbLyricsFound"; + this.lbLyricsFound.Size = new System.Drawing.Size(162, 15); + this.lbLyricsFound.TabIndex = 14; + this.lbLyricsFound.Text = "Lyrics found in tags:"; + // + // btCancel + // + this.btCancel.Location = new System.Drawing.Point(85, 166); + this.btCancel.Name = "btCancel"; + this.btCancel.Size = new System.Drawing.Size(66, 23); + this.btCancel.TabIndex = 14; + this.btCancel.Text = "Cancel"; + this.btCancel.UseVisualStyleBackColor = true; + this.btCancel.Click += new System.EventHandler(this.btCancel_Click); + // + // btClose + // + this.btClose.Location = new System.Drawing.Point(196, 166); + this.btClose.Name = "btClose"; + this.btClose.Size = new System.Drawing.Size(66, 23); + this.btClose.TabIndex = 15; + this.btClose.Text = "Close"; + this.btClose.UseVisualStyleBackColor = true; + this.btClose.Click += new System.EventHandler(this.btClose_Click); + // + // lbCurrentArtist + // + this.lbCurrentArtist.AutoSize = true; + this.lbCurrentArtist.Location = new System.Drawing.Point(10, 25); + this.lbCurrentArtist.Name = "lbCurrentArtist"; + this.lbCurrentArtist.Size = new System.Drawing.Size(71, 13); + this.lbCurrentArtist.TabIndex = 16; + this.lbCurrentArtist.Text = "[current artist]"; + // + // ImportTags + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(272, 193); + this.ControlBox = false; + this.Controls.Add(this.lbCurrentArtist); + this.Controls.Add(this.btClose); + this.Controls.Add(this.btCancel); + this.Controls.Add(this.gbMusicDBSearchStats); + this.Controls.Add(this.btStart); + this.Controls.Add(this.progressBar); + this.Controls.Add(this.lbInfo); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ImportTags"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "Import lyrics from music tags"; + this.gbMusicDBSearchStats.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbInfo; + private System.Windows.Forms.ProgressBar progressBar; + private System.ComponentModel.BackgroundWorker bw; + private System.Windows.Forms.Button btStart; + private MediaPortal.UserInterface.Controls.MPGroupBox gbMusicDBSearchStats; + private MediaPortal.UserInterface.Controls.MPLabel lbSongsToSearch2; + private MediaPortal.UserInterface.Controls.MPLabel lbSongsToSearch; + private MediaPortal.UserInterface.Controls.MPLabel lbTotalSongs2; + private MediaPortal.UserInterface.Controls.MPLabel lbTotalSongs; + private MediaPortal.UserInterface.Controls.MPLabel lbLyricsFound2; + private MediaPortal.UserInterface.Controls.MPLabel lbLyricsFound; + private System.Windows.Forms.Button btCancel; + private System.Windows.Forms.Button btClose; + private System.Windows.Forms.Label lbCurrentArtist; + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.cs 2007-11-08 15:09:51 UTC (rev 1040) @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using MediaPortal.Music.Database; +using MediaPortal.TagReader; +using System.Collections; + +namespace MyLyrics +{ + public partial class ImportTags : Form + { + List<MusicTag> tags; + ArrayList artists; + List<Song> songs; + int totalSongsToSearch; + int totalSongsSearched; + + public ImportTags() + { + InitializeComponent(); + this.lbInfo.Text = "Press the 'Start'-button to begin the import"; + this.lbCurrentArtist.Text = string.Empty; + } + + private void btStart_Click(object sender, EventArgs e) + { + lbInfo.Text = string.Format("Currently checking music tags for:"); + + btStart.Enabled = false; + btCancel.Enabled = true; + btClose.Enabled = false; + + MusicDatabase mDB = MusicDatabase.Instance; + tags = new List<MusicTag>(); + artists = new ArrayList(); + songs = new List<Song>(); + mDB.GetArtists(0, "", ref artists); + artists.Sort(); + + progressBar.ResetText(); + progressBar.Enabled = true; + progressBar.Value = 0; + progressBar.Maximum = artists.Count; + totalSongsToSearch = mDB.GetTotalSongs(); + lbTotalSongs2.Text = totalSongsToSearch.ToString(); + + bw.RunWorkerAsync(); + } + + private void bw_DoWork(object sender, DoWorkEventArgs e) + { + MusicDatabase mDB = MusicDatabase.Instance; + int counter = 0; + + for (int i = 0; i < artists.Count; i++) + { + if (bw.CancellationPending) + { + return; + } + + string artist = (string)artists[i]; + bw.ReportProgress(counter, artist); + try + { + mDB.GetSongsByArtist(artist, ref songs); + + foreach (Song song in songs) + { + MusicTag tag = TagReader.ReadTag(song.FileName); + if (tag.Lyrics != string.Empty) + { + tags.Add(tag); + ++counter; + } + } + } + catch (Exception e2) + { + string s = e2.Message; + } + } + } + + private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + MusicDatabase mDB = MusicDatabase.Instance; + string artist = e.UserState as string; + List<Song> songs = new List<Song>(); + mDB.GetSongsByArtist(artist, ref songs); + totalSongsSearched += songs.Count; + lbCurrentArtist.Text = artist; + progressBar.PerformStep(); + lbLyricsFound2.Text = e.ProgressPercentage.ToString(); + lbSongsToSearch2.Text = string.Format("{0}", totalSongsToSearch - totalSongsSearched); + } + + + private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + lbSongsToSearch2.Text = "0"; + if (tags.Count > 0) + { + DialogResult dlgResult = MessageBox.Show(string.Format("{0} lyric were found in the search.{1}Do you want to import these into your lyrics database?", tags.Count, Environment.NewLine), "Import tags", MessageBoxButtons.YesNo); + if (dlgResult.Equals(DialogResult.Yes)) + { + foreach (MusicTag tag in tags) + { + string capArtist = LyricsEngine.LyricUtil.CapatalizeString(tag.Artist); + string capTitle = LyricsEngine.LyricUtil.CapatalizeString(tag.Title); + DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsDB, capArtist, capTitle, tag.Lyrics, "music tag"); + } + DatabaseUtil.SerializeLyricDB(); + } + } + + lbInfo.Text = "The search has ended."; + lbCurrentArtist.Text = string.Empty; + + btStart.Enabled = true; + btCancel.Enabled = false; + btClose.Enabled = true; + } + + private void btCancel_Click(object sender, EventArgs e) + { + bw.CancelAsync(); + progressBar.ResetText(); + progressBar.Value = 0; + } + + private void btClose_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.resx (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.resx 2007-11-08 15:09:51 UTC (rev 1040) @@ -0,0 +1,123 @@ +<?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> + <metadata name="bw.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>24, -1</value> + </metadata> +</root> \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-08 11:02:03 UTC (rev 1039) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-08 15:09:51 UTC (rev 1040) @@ -588,7 +588,7 @@ // 1) + 2) Check if LRC in music tag or Database - string lyricText = MyLyrics.DatabaseUtil.LookUpLyricInDatabase(LyricsDB, m_artist, m_title); + string lyricText = LyricsDB[CorrectKeyFormat(m_artist, m_title)].Lyrics; if ((CurrentTrackTag.Lyrics.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, CurrentTrackTag.Lyrics)).IsValid) || (lyricText.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, lyricText)).IsValid)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-11-10 14:59:20
|
Revision: 1045 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1045&view=rev Author: saamand Date: 2007-11-10 06:59:03 -0800 (Sat, 10 Nov 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.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/My Lyrics/MyLyrics Configuration/ExportTags.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 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-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -11,7 +11,6 @@ { class EvilLabs { - string lyric = ""; bool complete; System.Timers.Timer timer; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Lyrics007.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -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 Lyrics007(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) + public Lyrics007(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() + "Lyrics007(" + artist + ", " + title + ")"); artist = LyricUtil.RemoveFeatComment(artist); @@ -35,6 +41,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); @@ -146,5 +157,12 @@ complete = true; } } + + void timer_Elapsed(object sender, ElapsedEventArgs e) + { + 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-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -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 LyricsOnDemand(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) + public LyricsOnDemand(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() + "LyricsOnDemand(" + artist + ", " + title + ")"); artist = LyricUtil.RemoveFeatComment(artist); @@ -65,6 +71,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); @@ -144,6 +155,7 @@ lyricTemp.Replace("<p>", " \r\n"); lyricTemp.Replace("<BR>", " \r\n"); lyricTemp.Replace("<br />", " \r\n"); + lyricTemp.Replace("'", "'"); lyric = lyricTemp.ToString().Trim(); @@ -172,6 +184,13 @@ complete = true; } } + + void timer_Elapsed(object sender, ElapsedEventArgs e) + { + 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-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/SeekLyrics.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -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 SeekLyrics(string artist, string title, ManualResetEvent m_EventStop_SiteSearches) + public SeekLyrics(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); @@ -70,6 +76,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); @@ -185,5 +196,12 @@ complete = true; } } + + void timer_Elapsed(object sender, ElapsedEventArgs e) + { + lyric = "Not found"; + complete = true; + Thread.CurrentThread.Abort(); + } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -101,6 +101,11 @@ private string MakeLyricFit(string lyric) { + if (!lyric.Contains("\r\n")) + { + lyric = lyric.Replace("\n", "\r\n"); + } + for (int i = 0; i < commonReplacementsLyricWiki.Length; i = i + 2) { lyric = lyric.Replace(commonReplacementsLyricWiki[i], commonReplacementsLyricWiki[i + 1]); @@ -116,7 +121,7 @@ } } - if (lyric.Contains("API request randomly") || lyric.Contains("Upgrading right")) + if (lyric.Contains("API request randomly") || lyric.Contains("Upgrading right") || lyric.Contains("LyricWiki.org")) { lyric = string.Empty; } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.Designer.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.Designer.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -179,7 +179,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(272, 193); + this.ClientSize = new System.Drawing.Size(268, 191); this.ControlBox = false; this.Controls.Add(this.lbCurrentArtist); this.Controls.Add(this.btClose); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ExportTags.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -77,10 +77,9 @@ if (DatabaseUtil.IsTrackInLyricsDatabase(MyLyricsSettings.LyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_FOUND)) { - if (!Path.GetExtension(song.FileName).Equals(".wma", StringComparison.InvariantCultureIgnoreCase)) + string lyric = MyLyricsSettings.LyricsDB[DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)].Lyrics; + if (TagReaderUtil.WriteLyrics(song.FileName, lyric)) { - string lyric = MyLyricsSettings.LyricsDB[DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)].Lyrics; - bool test = TagReader.WriteLyrics(song.FileName, lyric); ++counter; } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -39,6 +39,7 @@ bool m_automaticFetch = true; bool m_automaticUpdate = true; bool m_moveLyricFromMarkedDatabase = true; + bool m_automaticWriteToMusicTag = true; bool markedDatabase; List<string> sitesToSearch; @@ -85,6 +86,7 @@ m_automaticFetch = xmlreader.GetValueAsBool("myLyrics", "automaticFetch", true); m_automaticUpdate = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false); m_moveLyricFromMarkedDatabase = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true); + m_automaticWriteToMusicTag = xmlreader.GetValueAsBool("myLyrics", "automaticWriteToMusicTag", true); } BeginSearchIfPossible(artist, title); @@ -304,9 +306,14 @@ DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsDB, originalArtist, originalTitle, lyric, site); DatabaseUtil.SerializeDBs(); parent.updateInfo(); - parent.highlightSong(originalArtist, originalTitle, false); + parent.highlightNextSong(treeArtistIndex, treeTitleIndex); } + if (m_automaticWriteToMusicTag) + { + TagReaderUtil.WriteLyrics(originalArtist, originalTitle, lyric); + } + parent.updateLyricDatabaseStats(); } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.Designer.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/ImportTags.Designer.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -179,7 +179,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(272, 193); + this.ClientSize = new System.Drawing.Size(268, 191); this.ControlBox = false; this.Controls.Add(this.lbCurrentArtist); this.Controls.Add(this.btClose); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -33,7 +33,7 @@ static string m_CurrentTitle = ""; string m_OriginalLyric = ""; - Form parent = null; + MyLyricsSetup parent = null; int m_NoOfArtists; int m_NoOfTitles; @@ -47,7 +47,7 @@ public LyricsLibrary(Form form) { - this.parent = form; + this.parent = form as MyLyricsSetup; InitializeComponent(); comboDatabase.SelectedIndex = 0; updateLyricsTree(); @@ -151,6 +151,15 @@ AddSong(item); treeView.Update(); DatabaseUtil.SerializeDB(CurrentDB); + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + if (xmlreader.GetValueAsBool("myLyrics", "automaticWriteToMusicTag", true)) + { + TagReaderUtil.WriteLyrics(artist, title, lyrics); + } + } + return true; } else @@ -313,9 +322,20 @@ private void btSave_Click(object sender, EventArgs e) { - CurrentDB[DatabaseUtil.CorrectKeyFormat(LyricUtil.CapatalizeString(m_CurrentArtist), LyricUtil.CapatalizeString(m_CurrentTitle))].Lyrics = tbLyrics.Text; + string capArtist = LyricUtil.CapatalizeString(m_CurrentArtist); + string capTitle = LyricUtil.CapatalizeString(m_CurrentTitle); + + CurrentDB[DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)].Lyrics = tbLyrics.Text; DatabaseUtil.SerializeDB(CurrentDB); + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + if (xmlreader.GetValueAsBool("myLyrics", "automaticWriteToMusicTag", true)) + { + TagReaderUtil.WriteLyrics(capArtist, capTitle, tbLyrics.Text); + } + } + if (CurrentDB.Equals(MyLyricsSettings.LyricsMarkedDB)) { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -14,7 +14,7 @@ { public partial class MusicDatabaseBrowse : UserControl, ILyricForm { - Form parent; + MyLyricsSetup parent; string selectedArtist = String.Empty; public delegate void DelegateStringUpdate(String message, String site); @@ -39,7 +39,7 @@ Queue<string[]> songs; LyricsController lc; - public MusicDatabaseBrowse(Form parent) + public MusicDatabaseBrowse(MyLyricsSetup parent) { this.parent = parent; InitializeComponent(); @@ -393,6 +393,15 @@ DatabaseUtil.WriteToLyricsDatabase(MyLyricsSettings.LyricsDB, MyLyricsSettings.LyricsMarkedDB, capArtist, capTitle, lyricStrings, site); DatabaseUtil.SerializeLyricDB(); + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + if (xmlreader.GetValueAsBool("myLyrics", "automaticWriteToMusicTag", true)) + { + TagReaderUtil.WriteLyrics(capArtist, capTitle, lyricStrings); + } + } + m_noOfCurrentlySearches -= 1; if (++m_noOfSearchesCompleted == m_noOfSearchesToComplete) Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -75,6 +75,8 @@ this.lbLyricsFound2 = new MediaPortal.UserInterface.Controls.MPLabel(); this.lbLyricsFound = new MediaPortal.UserInterface.Controls.MPLabel(); this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage(); + this.gbTag = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.cbMusicTag = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.mpGroupBox3 = new MediaPortal.UserInterface.Controls.MPGroupBox(); this.cbAutomaticUpdate = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.cbMoveSongFrom = new MediaPortal.UserInterface.Controls.MPCheckBox(); @@ -107,6 +109,7 @@ this.gbProgress.SuspendLayout(); this.gbMusicDBSearchStats.SuspendLayout(); this.tabPageSetup.SuspendLayout(); + this.gbTag.SuspendLayout(); this.mpGroupBox3.SuspendLayout(); this.mpGroupBox2.SuspendLayout(); this.gbLyricSites.SuspendLayout(); @@ -593,6 +596,7 @@ // // tabPageSetup // + this.tabPageSetup.Controls.Add(this.gbTag); this.tabPageSetup.Controls.Add(this.mpGroupBox3); this.tabPageSetup.Controls.Add(this.mpGroupBox2); this.tabPageSetup.Controls.Add(this.gbLyricSites); @@ -604,13 +608,38 @@ this.tabPageSetup.Text = "Settings"; this.tabPageSetup.UseVisualStyleBackColor = true; // + // gbTag + // + this.gbTag.Controls.Add(this.cbMusicTag); + this.gbTag.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbTag.Location = new System.Drawing.Point(5, 278); + this.gbTag.Name = "gbTag"; + this.gbTag.Size = new System.Drawing.Size(538, 49); + this.gbTag.TabIndex = 31; + this.gbTag.TabStop = false; + this.gbTag.Text = "Find lyric dialog settings"; + // + // cbMusicTag + // + this.cbMusicTag.AutoSize = true; + this.cbMusicTag.Checked = true; + this.cbMusicTag.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbMusicTag.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.cbMusicTag.Location = new System.Drawing.Point(16, 23); + this.cbMusicTag.Name = "cbMusicTag"; + this.cbMusicTag.Size = new System.Drawing.Size(238, 17); + this.cbMusicTag.TabIndex = 6; + this.cbMusicTag.Text = "When new lyric is found write it into music tag"; + this.cbMusicTag.UseVisualStyleBackColor = true; + this.cbMusicTag.Leave += new System.EventHandler(this.WriteMediaPortalXML); + // // 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, 70); + this.mpGroupBox3.Location = new System.Drawing.Point(5, 333); this.mpGroupBox3.Name = "mpGroupBox3"; this.mpGroupBox3.Size = new System.Drawing.Size(538, 92); this.mpGroupBox3.TabIndex = 30; @@ -697,7 +726,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, 168); + this.gbLyricSites.Location = new System.Drawing.Point(5, 70); this.gbLyricSites.Name = "gbLyricSites"; this.gbLyricSites.Size = new System.Drawing.Size(538, 202); this.gbLyricSites.TabIndex = 28; @@ -927,6 +956,8 @@ this.gbProgress.ResumeLayout(false); this.gbMusicDBSearchStats.ResumeLayout(false); this.tabPageSetup.ResumeLayout(false); + this.gbTag.ResumeLayout(false); + this.gbTag.PerformLayout(); this.mpGroupBox3.ResumeLayout(false); this.mpGroupBox3.PerformLayout(); this.mpGroupBox2.ResumeLayout(false); @@ -1015,5 +1046,7 @@ private System.Windows.Forms.TabPage tabPageMusicDatabaseBrowse; public MediaPortal.UserInterface.Controls.MPButton btClose; private System.Windows.Forms.TabPage tabPageInfo; + private MediaPortal.UserInterface.Controls.MPGroupBox gbTag; + internal MediaPortal.UserInterface.Controls.MPCheckBox cbMusicTag; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -79,6 +79,9 @@ bool m_DisregardSongWithLyricInTag = true; bool m_DisregardVariousArtist = true; bool m_SearchOnlyMarkedSongs = false; + + bool m_automaticWriteToMusicTag = true; + const int m_NoOfCurrentSearchesAllowed = 6; int m_Limit = 100; @@ -151,14 +154,11 @@ tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString()); tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics"); - string temp1 = xmlreader.GetValue("myLyrics", "automaticFetch"); - string temp2 = xmlreader.GetValue("myLyrics", "automaticUpdateWhenFirstFound"); - string temp3 = xmlreader.GetValue("myLyrics", "moveLyricFromMarkedDatabase"); - string temp4 = xmlreader.GetValue("myLyrics", "useLyrics007"); - cbAutoFetch.Checked = xmlreader.GetValue("myLyrics", "automaticFetch").Equals("yes"); cbAutomaticUpdate.Checked = xmlreader.GetValue("myLyrics", "automaticUpdateWhenFirstFound").Equals("yes"); cbMoveSongFrom.Checked = xmlreader.GetValue("myLyrics", "moveLyricFromMarkedDatabase").Equals("yes"); + m_automaticWriteToMusicTag = !xmlreader.GetValue("myLyrics", "automaticWriteToMusicTag").Equals("no"); + cbMusicTag.Checked = m_automaticWriteToMusicTag; lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)"); @@ -467,6 +467,11 @@ DatabaseUtil.WriteToLyricsDatabase(MyLyricsSettings.LyricsDB, MyLyricsSettings.LyricsMarkedDB, capArtist, capTitle, lyricStrings, site); + if (m_automaticWriteToMusicTag) + { + TagReaderUtil.WriteLyrics(capArtist, capTitle, lyricStrings); + } + StreamReader sr = File.OpenText(logFullFileName); log = sr.ReadToEnd(); sr.Close(); @@ -1002,6 +1007,7 @@ xmlwriter.SetValueAsBool("myLyrics", "automaticFetch", cbAutoFetch.Checked); xmlwriter.SetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", cbAutomaticUpdate.Checked); xmlwriter.SetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", cbMoveSongFrom.Checked); + xmlwriter.SetValueAsBool("myLyrics", "automaticWriteToMusicTag", cbMusicTag.Checked); } } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-10 14:59:03 UTC (rev 1045) @@ -76,6 +76,8 @@ bool lyricsFound = false; + bool m_automaticWriteToMusicTag = true; + String[] m_sitesToSearch; // Database and log settings @@ -84,7 +86,6 @@ internal const string LyricsDBName = "LyricsDatabaseV2.db"; internal const string LyricsMarkedDBName = "LyricsMarkedDatabaseV2.db"; internal string logName = "MyLyrics.log"; - #endregion #region GUI enums @@ -320,6 +321,8 @@ useSeekLyrics = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false; useHotLyrics = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false; + m_automaticWriteToMusicTag = xmlreader.GetValue("myLyrics", "automaticWriteToMusicTag").Equals("yes"); + skin = ((string)xmlreader.GetValueAsString("skin", "name", "BlueTwo")); } @@ -588,7 +591,7 @@ // 1) + 2) Check if LRC in music tag or Database - string lyricText = LyricsDB[CorrectKeyFormat(m_artist, m_title)].Lyrics; + string lyricText = LyricsDB[DatabaseUtil.CorrectKeyFormat(m_artist, m_title)].Lyrics; if ((CurrentTrackTag.Lyrics.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, CurrentTrackTag.Lyrics)).IsValid) || (lyricText.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, lyricText)).IsValid)) @@ -1218,6 +1221,11 @@ { ShowLyricOnScreen(lyricText, site); SaveLyricToDatabase(site); + + if (m_automaticWriteToMusicTag) + { + TagReaderUtil.WriteLyrics(artist, title, lyricText); + } } } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-09 16:29:46 UTC (rev 1044) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-10 14:59:03 UTC (rev 1045) @@ -121,6 +121,7 @@ <Compile Include="MyLyrics Configuration\FindLyric.Designer.cs"> <DependentUpon>FindLyric.cs</DependentUpon> </Compile> + <Compile Include="TagReaderUtil.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="MyLyrics Configuration\ExportTags.resx"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-11-15 18:58:51
|
Revision: 1066 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1066&view=rev Author: saamand Date: 2007-11-15 10:58:45 -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/Wiki.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-15 16:24:06 UTC (rev 1065) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-15 18:58:45 UTC (rev 1066) @@ -17,11 +17,13 @@ private ILyricForm m_Form; // status - private int noOfLyricsToSearch; - private int noOfLyricsSearched; - private int noOfLyricsFound; - private int noOfLyricsNotFound; + private int m_noOfLyricsToSearch; + private int m_noOfLyricsSearched; + private int m_noOfLyricsFound; + private int m_noOfLyricsNotFound; + private int m_noOfCurrentSearches; + private bool m_StopSearches; private bool m_allowAllToComplete; @@ -46,12 +48,12 @@ this.m_allowAllToComplete = allowAllToSearch; this.m_automaticUpdate = automaticUpdate; - noOfLyricsToSearch = 1; - noOfLyricsSearched = 0; - noOfLyricsFound = 0; - noOfLyricsNotFound = 0; + m_noOfLyricsToSearch = 1; + m_noOfLyricsSearched = 0; + m_noOfLyricsFound = 0; + m_noOfLyricsNotFound = 0; + m_noOfCurrentSearches = 0; - ArrayList easySitesArrayList = new ArrayList(); // If search all, then include all @@ -136,6 +138,8 @@ public void AddNewLyricSearch(string artist, string title) { + ++m_noOfCurrentSearches; + if (lyricsSites.Length > 0) { // create worker thread instance @@ -164,15 +168,15 @@ { //LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.elapsedTimeString() + artist + " - " + title + " - " + site + " - " +lyricFound.ToString() ); if (lyricFound) - ++noOfLyricsFound; + ++m_noOfLyricsFound; else - ++noOfLyricsNotFound; + ++m_noOfLyricsNotFound; - ++noOfLyricsSearched; + ++m_noOfLyricsSearched; - m_Form.UpdateStatus = new Object[] { noOfLyricsToSearch, noOfLyricsSearched, noOfLyricsFound, noOfLyricsNotFound }; + m_Form.UpdateStatus = new Object[] { m_noOfLyricsToSearch, m_noOfLyricsSearched, m_noOfLyricsFound, m_noOfLyricsNotFound }; - if ((noOfLyricsSearched >= noOfLyricsToSearch)) + if ((m_noOfLyricsSearched >= m_noOfLyricsToSearch)) { FinishThread(artist, title, "All songs have been searched!", site); } @@ -181,6 +185,8 @@ internal void LyricFound(String lyricStrings, String artist, String title, String site) { + --m_noOfCurrentSearches; + if (m_allowAllToComplete || m_StopSearches == false) { m_Form.LyricFound = new Object[] { lyricStrings, artist, title, site }; @@ -190,6 +196,8 @@ internal void LyricNotFound(String artist, String title, String message, String site) { + --m_noOfCurrentSearches; + if (m_allowAllToComplete || m_StopSearches == false) { m_Form.LyricNotFound = new Object[] { artist, title, message, site }; @@ -234,7 +242,12 @@ public int NoOfLyricsToSearch { - set { noOfLyricsToSearch = value; } + set { m_noOfLyricsToSearch = value; } } + + public int NoOfCurrentSearches + { + get { return m_noOfCurrentSearches; } + } } } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-11-15 16:24:06 UTC (rev 1065) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/EvilLabs.cs 2007-11-15 18:58:45 UTC (rev 1066) @@ -96,7 +96,7 @@ 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>")) + if (lyric.Contains("<b>Warning</b>") || lyric.Contains("type=")) { lyric = "Not found"; } Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-11-15 16:24:06 UTC (rev 1065) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/Wiki.cs 2007-11-15 18:58:45 UTC (rev 1066) @@ -17,7 +17,7 @@ public static bool Abort; LyricSearch lyricSearch ; - private string[] commonReplacementsLyricWiki = new string[16] { "<br>", "", "<BR>", "", "?d", "'d", "?s", "'s", "?t", "'t", "?v", "'v", "?e", "'e", "?r", "'r" }; + private string[] commonReplacementsLyricWiki = new string[18] { "<br>", "", "<br/>", "", "<BR>", "", "?d", "'d", "?s", "'s", "?t", "'t", "?v", "'v", "?e", "'e", "?r", "'r" }; private string[] commonRemoveFromLyricWiki = new string[2] { "[[category", "[[Category" }; public Wiki(LyricSearch lyricSearch) @@ -34,7 +34,7 @@ IAsyncResult ar = del.BeginInvoke(this.artist, this.title, null, null); - while (noOfTries < 10) + while (noOfTries < 9) { // If the user has aborted stop the search and return (false) if (Abort || lyricSearch.SearchHasEnded) @@ -121,7 +121,8 @@ } } - if (lyric.Contains("API request randomly") || lyric.Contains("Upgrading right") || lyric.Contains("LyricWiki.org")) + if (lyric.Contains("API request randomly") || lyric.Contains("Upgrading right") || lyric.Contains("LyricWiki.org") + || lyric.Contains("<!-- PUT LYRICS HERE")) { lyric = string.Empty; } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2007-11-15 16:24:06 UTC (rev 1065) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2007-11-15 18:58:45 UTC (rev 1066) @@ -70,7 +70,6 @@ int m_SongsToSearch = 0; int m_LyricsFound = 0; int m_LyricsNotFound = 0; - int m_noOfCurrentlySearches = 0; // Search criteries bool m_DisregardKnownLyric = true; @@ -82,7 +81,7 @@ bool m_automaticWriteToMusicTag = true; - const int m_NoOfCurrentSearchesAllowed = 5; + const int m_NoOfCurrentSearchesAllowed = 6; int m_Limit = 100; // Collections and arrays @@ -366,7 +365,6 @@ m_EventStopThread = new ManualResetEvent(false); m_noOfMessages = 0; - m_noOfCurrentlySearches = 0; btStartBatchSearch.Enabled = false; @@ -486,7 +484,6 @@ writerLog.Write(log); writerLog.Close(); - m_noOfCurrentlySearches -= 1; progressBar.PerformStep(); this.Update(); } @@ -520,7 +517,6 @@ writerLog.Write(log); writerLog.Close(); - m_noOfCurrentlySearches -= 1; progressBar.PerformStep(); this.Update(); } @@ -769,9 +765,8 @@ else if (lc == null) return; - if (m_noOfCurrentlySearches < m_NoOfCurrentSearchesAllowed && lc.StopSearches == false) + if (lc.NoOfCurrentSearches < m_NoOfCurrentSearchesAllowed && lc.StopSearches == false) { - m_noOfCurrentlySearches += 1; string[] lyricID = (string[])lyricConfigInfosQueue.Dequeue(); lc.AddNewLyricSearch(lyricID[0], lyricID[1]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-11-16 16:09:07
|
Revision: 1069 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1069&view=rev Author: saamand Date: 2007-11-16 08:09:02 -0800 (Fri, 16 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/MusicDatabaseBrowse.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyricsExternCode.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-11-16 15:15:39 UTC (rev 1068) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-16 16:09:02 UTC (rev 1069) @@ -42,10 +42,10 @@ public LyricsController(ILyricForm mainForm, ManualResetEvent eventStopThread, string[] lyricSites, - bool allowAllToSearch, bool automaticUpdate) + bool allowAllToComplete, bool automaticUpdate) { this.m_Form = mainForm; - this.m_allowAllToComplete = allowAllToSearch; + this.m_allowAllToComplete = allowAllToComplete; this.m_automaticUpdate = automaticUpdate; m_noOfLyricsToSearch = 1; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.Designer.cs 2007-11-16 15:15:39 UTC (rev 1068) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.Designer.cs 2007-11-16 16:09:02 UTC (rev 1069) @@ -27,6 +27,7 @@ this.columnHeaderStatus2 = new System.Windows.Forms.ColumnHeader(); this.btAdd = new System.Windows.Forms.Button(); this.gbMusicDatabase = new System.Windows.Forms.GroupBox(); + this.lbStats = new System.Windows.Forms.Label(); this.btAddAll = new System.Windows.Forms.Button(); this.lbSelectedArtist = new System.Windows.Forms.Label(); this.lvArtists = new System.Windows.Forms.ListView(); @@ -39,7 +40,6 @@ this.btRemove = new System.Windows.Forms.Button(); this.btSearch = new System.Windows.Forms.Button(); this.bw = new System.ComponentModel.BackgroundWorker(); - this.lbStats = new System.Windows.Forms.Label(); this.gbMusicDatabase.SuspendLayout(); this.gbSelected.SuspendLayout(); this.SuspendLayout(); @@ -74,7 +74,7 @@ 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.Size = new System.Drawing.Size(332, 162); this.lvSongs.SmallImageList = this.imageList; this.lvSongs.Sorting = System.Windows.Forms.SortOrder.Ascending; this.lvSongs.TabIndex = 8; @@ -122,7 +122,7 @@ 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.Size = new System.Drawing.Size(510, 162); this.lvSelectedSongs.SmallImageList = this.imageList; this.lvSelectedSongs.Sorting = System.Windows.Forms.SortOrder.Ascending; this.lvSelectedSongs.TabIndex = 11; @@ -177,6 +177,16 @@ this.gbMusicDatabase.TabStop = false; this.gbMusicDatabase.Text = "Select songs from music database"; // + // lbStats + // + 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, 219); @@ -205,7 +215,7 @@ 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.Size = new System.Drawing.Size(172, 162); this.lvArtists.TabIndex = 13; this.lvArtists.UseCompatibleStateImageBehavior = false; this.lvArtists.View = System.Windows.Forms.View.Details; @@ -302,16 +312,6 @@ this.bw.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bw_RunWorkerCompleted); this.bw.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bw_ProgressChanged); // - // lbStats - // - 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]"; - // // MusicDatabaseBrowse // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-16 15:15:39 UTC (rev 1068) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-16 16:09:02 UTC (rev 1069) @@ -444,6 +444,11 @@ { if (lvi.Text.Equals(artist) && lvi.SubItems[1].Text.Equals(title)) { + if (lvi.SubItems[3].Text.Equals("miss")) + { + MessageBox.Show("This is an error and should not be able to happen!"); + } + lvi.ImageIndex = 0; lvi.SubItems[2].Text = "LyricsDB"; lvi.SubItems[3].Text = "OK"; @@ -555,12 +560,11 @@ { m_noOfCurrentlySearches += 1; string[] lyricID = (string[])songs.Dequeue(); + bw.ReportProgress(counter++); lc.AddNewLyricSearch(lyricID[0], lyricID[1]); - - bw.ReportProgress(counter++); } - Thread.Sleep(100); + Thread.Sleep(200); } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs 2007-11-16 15:15:39 UTC (rev 1068) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs 2007-11-16 16:09:02 UTC (rev 1069) @@ -324,7 +324,7 @@ this.btCancel.Name = "btCancel"; this.btCancel.Size = new System.Drawing.Size(78, 23); this.btCancel.TabIndex = 33; - this.btCancel.Text = "Stop"; + this.btCancel.Text = "Cancel"; this.btCancel.UseVisualStyleBackColor = true; this.btCancel.Click += new System.EventHandler(this.btCancel_Click); // Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-16 15:15:39 UTC (rev 1068) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-16 16:09:02 UTC (rev 1069) @@ -186,7 +186,9 @@ { alreadyValidLRC = false; - CurrentTrackTag = new MusicTag(); + MusicDatabase mDB = MusicDatabase.Instance; + CurrentTrackTag = mDB.GetTag(g_Player.CurrentFile); + CurrentTrackTag.Artist = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); CurrentTrackTag.Title = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); @@ -437,7 +439,6 @@ case Action.ActionType.ACTION_PREVIOUS_MENU: { GUIWindowManager.ShowPreviousWindow(); - base.OnAction(action); break; } case Action.ActionType.ACTION_KEY_PRESSED: @@ -589,9 +590,13 @@ 3) Lyric in database 4) Search the Internet */ + string lyricText = string.Empty; // 1) + 2) Check if LRC in music tag or Database - string lyricText = LyricsDB[DatabaseUtil.CorrectKeyFormat(m_artist, m_title)].Lyrics; + if (LyricsDB.ContainsKey(DatabaseUtil.CorrectKeyFormat(m_artist, m_title))) + { + lyricText = LyricsDB[DatabaseUtil.CorrectKeyFormat(m_artist, m_title)].Lyrics; + } if ((CurrentTrackTag.Lyrics.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, CurrentTrackTag.Lyrics)).IsValid) || (lyricText.Length != 0 && (lrc = new SimpleLRC(m_artist, m_title, lyricText)).IsValid)) @@ -946,7 +951,8 @@ private void resetGUI(int screenID) { - if (skin.Equals("ReVision") && (screenID == (int)MyLyricsSettings.Screen.LYRICS_WIDE || screenID == (int)MyLyricsSettings.Screen.LRC_WIDE || screenID == (int)MyLyricsSettings.Screen.LRC_EDITOR)) + if ((skin.Equals("ReVision") || skin.Equals("Replicant")) && + (screenID == (int)MyLyricsSettings.Screen.LYRICS_WIDE || screenID == (int)MyLyricsSettings.Screen.LRC_WIDE || screenID == (int)MyLyricsSettings.Screen.LRC_EDITOR)) { GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_UPNEXT); GUIControl.HideControl(GetID, (int)GUI_General_Controls.CONTROL_ALBUM); @@ -1033,15 +1039,18 @@ 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); - 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); + // album art only visible for lyrics_basic screen AND also for Xface skin + if (!skin.Equals("Xface")) + { + 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); @@ -1110,15 +1119,18 @@ 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); - 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); + // album art only visible for lyrics_basic screen AND also for Xface skin + if (!skin.Equals("Xface")) + { + 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); @@ -1156,15 +1168,18 @@ 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); - 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); + // album art only visible for lyrics_basic screen AND also for Xface skin + if (!skin.Equals("Xface")) + { + 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); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-16 15:15:39 UTC (rev 1068) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-16 16:09:02 UTC (rev 1069) @@ -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> Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsExternCode.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsExternCode.cs 2007-11-16 15:15:39 UTC (rev 1068) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsExternCode.cs 2007-11-16 16:09:02 UTC (rev 1069) @@ -117,10 +117,14 @@ PreviousTrackTag = CurrentTrackTag; if (!isCurSongCdTrack) - CurrentTrackTag = GetTrackTag(dbs, CurrentTrackFileName, UseID3); + { + CurrentTrackTag = dbs.GetTag(CurrentTrackFileName); + CurrentTrackTag.Artist = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); + CurrentTrackTag.Title = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); + } if (!isNextSongCdTrack) - NextTrackTag = GetTrackTag(dbs, NextTrackFileName, UseID3); + NextTrackTag = dbs.GetTag(NextTrackFileName); if (isCurSongCdTrack || isNextSongCdTrack) { @@ -161,6 +165,8 @@ { MediaPortal.Freedb.CDTrackDetail curTrack = GUIMusicFiles.MusicCD.getTrack(curCDTrackNum); CurrentTrackTag = GetTrackTag(curTrack); + CurrentTrackTag.Artist = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); + CurrentTrackTag.Title = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); } if (nextCDTrackNum < GUIMusicFiles.MusicCD.Tracks.Length) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2007-11-17 15:00:12
|
Revision: 1071 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1071&view=rev Author: saamand Date: 2007-11-17 07:00:00 -0800 (Sat, 17 Nov 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-11-17 12:31:11 UTC (rev 1070) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsSites/LyricsOnDemand.cs 2007-11-17 15:00:00 UTC (rev 1071) @@ -160,7 +160,7 @@ lyric = lyricTemp.ToString().Trim(); // if warning message from Evil Labs' sql-server, then lyric isn't found - if (lyric.Contains("<td")) + if (lyric.Contains("<td") || lyric.Contains("<IFRAME")) { lyric = "Not found"; } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-17 12:31:11 UTC (rev 1070) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-17 15:00:00 UTC (rev 1071) @@ -59,7 +59,9 @@ private string NextTrackFileName = string.Empty; private PlayListPlayer PlaylistPlayer = null; + private System.Timers.Timer m_WriteTagTimer = null; + // worker thread Thread m_LyricControllerThread; LyricsController lc; @@ -73,7 +75,11 @@ string m_TrackText = ""; string m_StatusText = ""; string m_LyricText = ""; + string m_LastLyricText = ""; + string m_LastFileName = ""; + int m_crossfade = 0; + string[] m_strippedPrefixStrings = null; bool lyricsFound = false; @@ -186,7 +192,7 @@ { if (newTrack) { - alreadyValidLRC = false; + alreadyValidLRC = false; MusicDatabase mDB = MusicDatabase.Instance; CurrentTrackTag = mDB.GetTag(g_Player.CurrentFile); @@ -248,6 +254,15 @@ getAlbumArt(); startSearch(); } + + if (m_automaticWriteToMusicTag && !m_LastFileName.Equals(string.Empty)) + { + m_WriteTagTimer = new System.Timers.Timer(m_crossfade); + m_WriteTagTimer.Elapsed += new ElapsedEventHandler(WriteLatestLyricToTag); + m_WriteTagTimer.Enabled = true; + m_WriteTagTimer.Start(); + + } } if (lyricsFound) @@ -258,7 +273,15 @@ base.Process(); } + void WriteLatestLyricToTag(object sender, ElapsedEventArgs e) + { + TagReaderUtil.WriteLyrics(m_LastFileName, m_LastLyricText); + m_WriteTagTimer.Stop(); + m_WriteTagTimer.Close(); + m_WriteTagTimer.Dispose(); + } + private void startSearch() { lyricsFound = false; @@ -328,6 +351,8 @@ m_automaticWriteToMusicTag = xmlreader.GetValue("myLyrics", "automaticWriteToMusicTag").Equals("yes"); skin = ((string)xmlreader.GetValueAsString("skin", "name", "BlueTwo")); + + m_crossfade = xmlreader.GetValueAsInt("audioplayer", "crossfade", 2000); } m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); @@ -408,6 +433,15 @@ { StopThread(); resetAll(); + + if (m_WriteTagTimer != null) + { + m_WriteTagTimer.Stop(); + m_WriteTagTimer.Close(); + m_WriteTagTimer.Dispose(); + m_WriteTagTimer = null; + } + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.ElapsedTimeString() + "MyLyrics closes."); break; } @@ -516,6 +550,12 @@ { if (tag2.Equals("#Play.Current.Track") && !exitingMyLyrics) // track has changed { + if (!m_LyricText.Equals(string.Empty)) + { + m_LastLyricText = m_LyricText; + m_LastFileName = CurrentTrackTag.FileName; + } + if (value.Length != 0) // additional check { basicScreenSelected = null; @@ -1240,11 +1280,6 @@ { ShowLyricOnScreen(lyricText, site); SaveLyricToDatabase(site); - - if (m_automaticWriteToMusicTag) - { - TagReaderUtil.WriteLyrics(artist, title, lyricText); - } } } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-17 12:31:11 UTC (rev 1070) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-17 15:00:00 UTC (rev 1071) @@ -5,12 +5,13 @@ <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> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> - <StartupObject>MyLyrics.MyLyricsSetup_test</StartupObject> + <StartupObject> + </StartupObject> <SignAssembly>false</SignAssembly> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |