From: <sa...@us...> - 2007-11-17 12:31:14
|
Revision: 1070 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1070&view=rev Author: saamand Date: 2007-11-17 04:31:11 -0800 (Sat, 17 Nov 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj Added Paths: ----------- trunk/plugins/MyLyrics/My Lyrics/MediaPortalUtil.cs Removed Paths: ------------- trunk/plugins/MyLyrics/My Lyrics/Changelog.txt Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricSearch.cs =================================================================== (Binary files differ) Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -136,20 +136,20 @@ FinishThread("", "", "The search has ended.", ""); } - public void AddNewLyricSearch(string artist, string title) + public void AddNewLyricSearch(string artist, string title, string strippedArtistName) { ++m_noOfCurrentSearches; if (lyricsSites.Length > 0) { // create worker thread instance - ThreadStart easySitesThreadInstance = delegate + ThreadStart threadInstance = delegate { - LyricSearch lyricSearch_EasySites = new LyricSearch(this, artist, title, m_allowAllToComplete, m_automaticUpdate); - lyricSearch_EasySites.Run(); + LyricSearch lyricSearch = new LyricSearch(this, artist, title, strippedArtistName, m_allowAllToComplete, m_automaticUpdate); + lyricSearch.Run(); }; - Thread lyricSearchThread = new Thread(easySitesThreadInstance); + Thread lyricSearchThread = new Thread(threadInstance); lyricSearchThread.Name = "BasicSearch for " + artist + " - " + title; // looks nice in Output window lyricSearchThread.IsBackground = true; lyricSearchThread.Start(); Deleted: trunk/plugins/MyLyrics/My Lyrics/Changelog.txt =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-11-17 12:31:11 UTC (rev 1070) @@ -1,32 +0,0 @@ -Changes from version 0.23 to 0.24: -- Fix: Better for - -Changes from version 0.14 to 0.15: -- Fix: A LOT of performance improvemence issues and code-clean up -- Fix: One lyric site added (HotLyrics), and one removed (SeekLyrics) due to instable server -- Add: Timer on batch search in configuration mode. -- Fix: A special formatting on SeekLyrics sites wasn't handled causing fetched of an incomplete lyrics -- Fix: For some users the tag reader added an additional space causing the search to fail. -- Fix: Various minor fixes on all the formatting on lyrics fetched from SeekLyrics -- Fix: Handling of special German and Danish letters - -Changes from version 0.13 to 0.14: -- Add: Added three new lyrics sites. Now there is a total of four lyrics sites to search from. -- Del: All Google related dependencies have been removed in the plugin. -- Fix: Even if all lyric search threads had ended the complete search wasn't terminated due to bad validation. -- Fix: LRC-text saved in music tags wasn't formatted correctly and accordingly shown as regular lyrics. -- Fix: Fields weren't reset before interpreting a new LRC-fields resulting in wrong timestamps and non-empty status field. -- Fix: Catches error when accessing displosed treeview due to application shutdown -- Fix: An improved configuration setup with various smaller bug fixes. -- Fix: Due to lack of options with the MP scroll-control the default textcontrol is uses once again in the MyLyrics screen. - -Changes from version 0.12 to 0.13: -- Add: Improved log. Logging search information in every session of MyLyric from MP starts to it closes. Saved in log\MyLyrics.log. -- Fix: All threads are now aborted as intended when search finishes. Both in configuration and play mode. -- Fix: Proper cleanup of trace objects and log files when configuration is closed. -- Fix: Lyrics searches optimized in regards to both speed and hit ration. -- Fix: Some threads ended up in deadlock when changing google license key. -- Fix: Sometimes when a lyric was found an unsuccessful, and not the succesful lyric site, was written to the MyLyrics.log. -- Add: MyLyric screen search now only uses lyric sites selected in the configuration. -- Fix: Exception messages (e.g. when license key is announced invalid for the day) is no longer shown on screen. -- Fix: Bad library handling caused the configuration in some circumstances to crash on when trying to access the MyLyricsBatch log-file. Added: trunk/plugins/MyLyrics/My Lyrics/MediaPortalUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MediaPortalUtil.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MediaPortalUtil.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace MyLyrics +{ + class MediaPortalUtil + { + public static string[] GetStrippedPrefixStringArray() + { + string strippedPrefixes = ""; + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + strippedPrefixes = ((string)xmlreader.GetValueAsString("musicfiles", "artistprefixes", "the,les,die")).ToString(); + } + string[] strippedPrefixesArray = (string[])strippedPrefixes.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries); + + for (int i = 0; i < strippedPrefixesArray.Length; i++) + { + string temp = strippedPrefixesArray[i]; + strippedPrefixesArray[i] = LyricsEngine.LyricUtil.CapatalizeString(", " + temp.Trim()); + } + + return strippedPrefixesArray; + } + + public static string GetStrippedPrefixArtist(string artist, string[] strippedPrefixStringArray) + { + foreach (string s in strippedPrefixStringArray) + { + artist = artist.Replace(s, ""); + } + return artist; + } + } +} Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -42,6 +42,8 @@ bool m_automaticWriteToMusicTag = true; bool markedDatabase; + string[] m_strippedPrefixStrings = null; + List<string> sitesToSearch; LyricsLibrary parent = null; @@ -89,6 +91,8 @@ m_automaticWriteToMusicTag = xmlreader.GetValueAsBool("myLyrics", "automaticWriteToMusicTag", true); } + m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); + BeginSearchIfPossible(artist, title); this.ShowDialog(); } @@ -178,7 +182,7 @@ m_LyricControllerThread.Name = "lyricSearch Thread"; // looks nice in Output window m_LyricControllerThread.Start(); - lc.AddNewLyricSearch(artist, title); + lc.AddNewLyricSearch(artist, title, MediaPortalUtil.GetStrippedPrefixArtist(artist, m_strippedPrefixStrings)); } private void stopSearch() Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -36,6 +36,8 @@ int m_noOfSearchesToComplete = 0; int m_noOfSearchesCompleted = 0; + string[] m_strippedPrefixStrings = null; + bool m_lockButtons = true; Thread m_LyricControllerThread; @@ -252,6 +254,8 @@ sitesToSearch.Add("SeekLyrics"); } + m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); + m_EventStopThread = new ManualResetEvent(false); // If automaticUpdate is set then return after the first positive search @@ -561,7 +565,7 @@ m_noOfCurrentlySearches += 1; string[] lyricID = (string[])songs.Dequeue(); bw.ReportProgress(counter++); - lc.AddNewLyricSearch(lyricID[0], lyricID[1]); + lc.AddNewLyricSearch(lyricID[0], lyricID[1], MediaPortalUtil.GetStrippedPrefixArtist(lyricID[0], m_strippedPrefixStrings)); } Thread.Sleep(200); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -81,6 +81,8 @@ bool m_automaticWriteToMusicTag = true; + string[] m_strippedPrefixStrings; + const int m_NoOfCurrentSearchesAllowed = 6; int m_Limit = 100; @@ -183,6 +185,9 @@ MessageBox.Show("Something has gone wrong when reading Mediaportal.xml"); } } + + m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); + #endregion #region Serialzie/deserialize lyricsdatabases @@ -768,7 +773,8 @@ if (lc.NoOfCurrentSearches < m_NoOfCurrentSearchesAllowed && lc.StopSearches == false) { string[] lyricID = (string[])lyricConfigInfosQueue.Dequeue(); - lc.AddNewLyricSearch(lyricID[0], lyricID[1]); + + lc.AddNewLyricSearch(lyricID[0], lyricID[1], MediaPortalUtil.GetStrippedPrefixArtist(lyricID[0], m_strippedPrefixStrings)); } Thread.Sleep(100); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-11-17 12:31:11 UTC (rev 1070) @@ -74,6 +74,8 @@ string m_StatusText = ""; string m_LyricText = ""; + string[] m_strippedPrefixStrings = null; + bool lyricsFound = false; bool m_automaticWriteToMusicTag = true; @@ -328,6 +330,8 @@ skin = ((string)xmlreader.GetValueAsString("skin", "name", "BlueTwo")); } + m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); + ArrayList sitesToSearch = new ArrayList(); if (useLyricWiki && Setup.IsMember("LyricWiki")) { @@ -685,7 +689,7 @@ m_LyricControllerThread.Name = "lyricSearch Thread"; // looks nice in Output window m_LyricControllerThread.Start(); - lc.AddNewLyricSearch(m_artist, m_title); + lc.AddNewLyricSearch(m_artist, m_title, MediaPortalUtil.GetStrippedPrefixArtist(m_artist, m_strippedPrefixStrings)); } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-16 16:09:02 UTC (rev 1069) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-11-17 12:31:11 UTC (rev 1070) @@ -5,13 +5,12 @@ <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{BBB2DAE2-0D83-4B4B-85B6-D1B5A7E10039}</ProjectGuid> - <OutputType>Library</OutputType> + <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MyLyrics</RootNamespace> <AssemblyName>MyLyrics</AssemblyName> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> - <StartupObject> - </StartupObject> + <StartupObject>MyLyrics.MyLyricsSetup_test</StartupObject> <SignAssembly>false</SignAssembly> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> @@ -62,6 +61,7 @@ </ItemGroup> <ItemGroup> <Compile Include="Convert\ConvertFromXMLtoLyricsDatabase.cs" /> + <Compile Include="MediaPortalUtil.cs" /> <Compile Include="MyLyrics Configuration\ExportTags.cs"> <SubType>Form</SubType> </Compile> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |