From: <sa...@us...> - 2007-03-27 16:52:44
|
Revision: 240 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=240&view=rev Author: saamand Date: 2007-03-27 09:52:34 -0700 (Tue, 27 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs Added Paths: ----------- trunk/plugins/MyLyrics/Lyrics.suo trunk/plugins/MyLyrics/LyricsEngine/LRC/ 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/My Lyrics/Changelog.txt trunk/plugins/MyLyrics/My Lyrics/Convert/ trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/Refactor/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/TempPE/ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.resx trunk/plugins/MyLyrics/MyLyrics.suo Added: trunk/plugins/MyLyrics/Lyrics.suo =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/Lyrics.suo ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,219 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace LRC +{ + public class SimpleLRC + { + string artist; + string title; + string album; + string lyric; + bool isValid; + + System.Collections.ArrayList lyricLines; + System.Collections.ArrayList simpleLRCTimeAndLineArray; + SimpleLRCTimeAndLineCollection simpleLRCTimeAndLineCollection; + + public SimpleLRC(string file) + { + FileInfo fileInfo = new FileInfo(file); + TextReader textReader = new StreamReader(file); + + string line = ""; + lyricLines = new System.Collections.ArrayList(); + simpleLRCTimeAndLineArray = new System.Collections.ArrayList(); + + while ((line = textReader.ReadLine()) != null) + { + bool done = false; + bool originalLine = true; + while (done == false) + { + done = getLRCinfoFromFile(ref line, originalLine); + originalLine = false; + } + } + + if (simpleLRCTimeAndLineArray.Count > 0) + { + simpleLRCTimeAndLineCollection = new SimpleLRCTimeAndLineCollection((SimpleLRCTimeAndLine[])simpleLRCTimeAndLineArray.ToArray(typeof(SimpleLRCTimeAndLine))); + isValid = true; + } + + textReader.Close(); + } + + + public SimpleLRC(string artist, string title, string lyric) + { + this.artist = artist; + this.title = title; + + string[] separators = new string[1]{"\n"}; + string[] lines = lyric.Split(separators, StringSplitOptions.None); + string line = ""; + lyricLines = new System.Collections.ArrayList(); + simpleLRCTimeAndLineArray = new System.Collections.ArrayList(); + + for (int i = 0; i < lines.Length; i++) + { + bool done = false; + bool originalLine = true; + line = lines[i]; + while (done == false) + { + done = getLRCinfoFromFile(ref line, originalLine); + originalLine = false; + } + } + + if (simpleLRCTimeAndLineArray.Count > 0) + { + simpleLRCTimeAndLineCollection = new SimpleLRCTimeAndLineCollection((SimpleLRCTimeAndLine[])simpleLRCTimeAndLineArray.ToArray(typeof(SimpleLRCTimeAndLine))); + isValid = true; + } + } + + private bool getLRCinfoFromFile(ref string line, bool originalLine) + { + System.Text.RegularExpressions.Match m; + + if ((m = LRC.SimpleLRCFormat.Line_Line_Regex.Match(line)).Success) + { + line = line.Trim(); + int index; + if ((index = m.Value.IndexOf("[")) > 0) + { + line = line.Substring(index); + } + + string lineWithTimeAndNewLine = line + Environment.NewLine; + + // if a line with multiple timetags, only add the first which is the complete with all tags. + if (originalLine) + { + lyric += lineWithTimeAndNewLine; + } + + // we update the line for potential further time-tags. This will natural not be regarded as an original line + // and will therefore not be added to the lyric. It will however be added to the LRC-object just as every other line + line = line.Replace(m.Value, ""); + + string lineWithNewLine = line + Environment.NewLine; + lyricLines.Add(lineWithNewLine); + + int NEXT = 1; + int minStart, minLength, secStart, secLength, msecStart, msecLength = 0; + long min, sec, msec = 0; + sec = 0; + + minStart = NEXT; + minLength = m.Value.IndexOf(":") - minStart; + min = long.Parse(m.Value.Substring(minStart, minLength)); + + secStart = minStart + minLength + NEXT; + + if (m.Value.IndexOf(".") != -1 && m.Value.IndexOf(".") < m.Value.IndexOf("]")) + { + secLength = m.Value.IndexOf(".") - secStart; + sec = long.Parse(m.Value.Substring(secStart, secLength)); + + msecStart = secStart + secLength + NEXT; + msecLength = m.Value.IndexOf("]") - msecStart; + msec = long.Parse(m.Value.Substring(msecStart, msecLength)); + } + else + { + secLength = m.Value.IndexOf("]") - secStart; + sec = long.Parse(m.Value.Substring(secStart, secLength)); + } + + string lineTemp = lineWithNewLine; + bool done = true; + + while ((m = LRC.SimpleLRCFormat.Line_Line_Regex.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) + { + 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) + { + 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) + { + album = line.Substring(m.Index + m.Length); + album = LyricsEngine.LyricUtil.capatalizeString((album.Substring(0, album.LastIndexOf("]")))); + return true; + } + else + { + return true; + } + } + + #region properties + public string Artist + { + get { return artist; } + } + + public string Title + { + get { return title; } + } + + public string Album + { + get { return album; } + } + + public string Lyric + { + get { return lyric; } + } + + public bool IsValid + { + get { return isValid; } + } + + public SimpleLRCTimeAndLineCollection SimpleLRCTimeAndLineCollection + { + get { return simpleLRCTimeAndLineCollection; } + } + #endregion + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using System.Text.RegularExpressions; + +namespace LRC +{ + 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*\]"); + } + } + + +} \ No newline at end of file Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LRC +{ + public class SimpleLRCTimeAndLine : IComparable + { + long min, sec, msec; + string line; + + public SimpleLRCTimeAndLine(long min, long sec, long msec, string line) + { + this.min = min; + this.sec = sec; + this.msec = msec; + this.line = line; + } + + public long Time + { + get { return min * 60 * 1000 + sec * 1000 + msec; } + } + + public string TimeString + { + get { return min.ToString() + ":" + sec.ToString() + "." + msec.ToString(); } + } + + public string Line + { + get { return line; } + } + + public int CompareTo(object obj) + { + SimpleLRCTimeAndLine objSLRC = (SimpleLRCTimeAndLine)obj; + long thisTime = this.min * 60 * 1000 + this.sec * 1000 + this.msec; + long objTime = objSLRC.min * 60 * 1000 + objSLRC.sec * 1000 + objSLRC.msec; + + if (thisTime > objTime) + return -1; + else if (thisTime < objTime) + return 1; + else + return 0; + } + } +} Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs (rev 0) +++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,85 @@ +using System; +using System.Collections; +using System.Text; + +namespace LRC +{ + public class SimpleLRCTimeAndLineCollection : IEnumerable + { + + private object[] items = null; + + public SimpleLRCTimeAndLineCollection(object[] array) + { + items = array; + Sort(items); + } + + public IEnumerator GetEnumerator() + { + return new Enumerator(items); + } + + private class Enumerator : IEnumerator + { + private int cursor; + private object[] elements = null; + + public Enumerator(object[] items) + { + elements = new object[items.Length]; + Array.Copy(items, elements, items.Length); + cursor = -1; + } + + public bool MoveNext() + { + ++cursor; + if (cursor > (elements.Length - 1)) + { + return false; + } + return true; + } + + public void Reset() + { + cursor = -1; + } + + public object Current + { + get + { + if (cursor > (elements.Length - 1)) + { + throw new InvalidOperationException("Enumration already finished"); + } + if (cursor == -1) + { + throw new InvalidOperationException("Enumeration not started"); + } + return elements[cursor]; + } + } + } + + + private void Sort(object obj) + { + IComparer myComparer = new SortAfterTimeClass(); + Array.Sort(items, myComparer); + } + + public class SortAfterTimeClass : IComparer + { + // Calls CaseInsensitiveComparer.Compare with the parameters reversed. + int IComparer.Compare(Object x, Object y) + { + return ((new CaseInsensitiveComparer()).Compare(y, x)); + } + + } + } +} + Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -78,7 +78,7 @@ { get { - return db[key]; + return db[key]; } set { Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 16:52:34 UTC (rev 240) @@ -125,7 +125,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> <PreBuildEvent> </PreBuildEvent> </PropertyGroup> Added: trunk/plugins/MyLyrics/My Lyrics/Changelog.txt =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Changelog.txt (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,29 @@ +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/Convert/ConvertFromXMLtoLyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; + +namespace MyLyrics +{ + class ConvertFromXMLtoLyricsDatabase + { + public ConvertFromXMLtoLyricsDatabase() + { + } + + public LyricsDatabase Convert(string path) + { + LyricsDatabase db = new LyricsDatabase(); + XmlTextReader tr = new XmlTextReader(path); + + string currentArtist = ""; + string currentTitle = ""; + while (tr.Read()) + { + switch (tr.Name) + { + case "section": + if (tr.AttributeCount == 1) + { + currentArtist = tr.GetAttribute(0); + } + break; + case "entry": + if (tr.AttributeCount == 1) + { + currentTitle = tr.GetAttribute(0); + LyricsItem item = new LyricsItem(currentArtist, currentTitle, "", ""); + db.Add(DatabaseUtil.CorrectKeyFormat(currentArtist, currentTitle), item); + } + break; + } + } + tr.Close(); + + LyricsDatabase lyricsDatabase = new LyricsDatabase(); + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(path, false)) + { + string lyrics; + foreach (KeyValuePair<string, LyricsItem> kvp in db) + { + lyrics = xmlreader.GetValueAsString(kvp.Value.Artist, kvp.Value.Title, ""); + lyricsDatabase.Add(DatabaseUtil.CorrectKeyFormat(kvp.Value.Artist, kvp.Value.Title), new LyricsItem(kvp.Value.Artist, kvp.Value.Title, lyrics, "old database entry")); + } + } + + return lyricsDatabase; + } + } +} Added: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,163 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; + +using LyricsEngine; + +namespace MyLyrics +{ + internal class DatabaseUtil + { + internal const string MARK = "(no lyric attached)"; + + internal const int LYRIC_NOT_FOUND = -1; + internal const int LYRIC_MARKED = 0; + internal const int LYRIC_FOUND = 1; + + internal static int IsTrackInLyricsDatabase(LyricsDatabase lyricDB, string artist, string title) + { + string lyricText = ""; + try + { + string capatalizedArtist = LyricUtil.capatalizeString(artist); + string capatalizedTitle = LyricUtil.capatalizeString(title); + + lyricText = lyricDB[CorrectKeyFormat(capatalizedArtist, capatalizedTitle)].Lyrics; + } + catch + { + return LYRIC_NOT_FOUND; + } + + if (lyricText.Equals(MARK)) + { + return LYRIC_MARKED; + } + else + { + return LYRIC_FOUND; + } + } + + internal static int IsTrackInLyricsMarkedDatabase(LyricsDatabase lyricMarkedDB, string artist, string title) + { + string lyricsText = ""; + try + { + lyricsText = lyricMarkedDB[DatabaseUtil.CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics; + } + catch + { + return LYRIC_NOT_FOUND; + } + return LYRIC_MARKED; + } + + + 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; + } + + public static void WriteToLyricsDatabase(LyricsDatabase lyricsDB, LyricsDatabase lyricsMarkedDB, string capArtist, string capTitle, string lyric, string site) + { + if (DatabaseUtil.IsTrackInLyricsDatabase(lyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) + { + lyricsDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, lyric, site)); + } + + if (DatabaseUtil.IsTrackInLyricsMarkedDatabase(lyricsMarkedDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_MARKED)) + { + lyricsMarkedDB.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)); + } + } + + public static void ReplaceInLyricsDatabase(LyricsDatabase currentLyricsDB, string capArtist, string capTitle, string lyric, string site) + { + LyricsDatabase otherDatabase = GetOtherLyricsDatabase(currentLyricsDB); + + string key = DatabaseUtil.CorrectKeyFormat(capArtist, capTitle); + if (DatabaseUtil.IsTrackInLyricsDatabase(currentLyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND) == false) + { + currentLyricsDB.Remove(key); + } + + currentLyricsDB.Add(key, new LyricsItem(capArtist, capTitle, lyric, site)); + + if (DatabaseUtil.IsTrackInLyricsMarkedDatabase(otherDatabase, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_MARKED)) + { + otherDatabase.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)); + } + } + + public static void SerializeDB(LyricsDatabase lyricsDatabase) + { + if (lyricsDatabase == MyLyricsSettings.LyricsDB) + { + SerializeLyricDB(); + } + else + { + SerializeLyricMarkedDB(); + } + } + + public static void SerializeDBs() + { + SerializeLyricDB(); + SerializeLyricMarkedDB(); + } + + public static void SerializeLyricDB() + { + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); + using (FileStream fs = new FileStream(path, FileMode.Open)) + { + BinaryFormatter bf = new BinaryFormatter(); + MyLyricsSettings.LyricsDB.SetLastModified(); + bf.Serialize(fs, MyLyricsSettings.LyricsDB); + fs.Close(); + } + } + + public static void SerializeLyricMarkedDB() + { + string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); + using (FileStream fs = new FileStream(path, FileMode.Open)) + { + BinaryFormatter bf = new BinaryFormatter(); + MyLyricsSettings.LyricsMarkedDB.SetLastModified(); + bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); + fs.Close(); + } + } + + public static LyricsDatabase GetOtherLyricsDatabase(LyricsDatabase currentDatabase) + { + if (currentDatabase.Equals(MyLyricsSettings.LyricsDB)) + { + return MyLyricsSettings.LyricsMarkedDB; + } + else + { + return MyLyricsSettings.LyricsDB; + } + } + } +} Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.Serialization; + +namespace MyLyrics +{ + [Serializable] + public class LyricsDatabase : IDictionary<string, LyricsItem>, ISerializable + { + private DateTime created; + private DateTime lastModified; + private Dictionary<string, LyricsItem> db; + + public LyricsDatabase() + { + created = DateTime.Now; + lastModified = DateTime.Now; + db = new Dictionary<string, LyricsItem>(); + } + + #region Serialization methods + + [OnDeserializing] + protected void test(StreamingContext sc) + { + Console.WriteLine(sc.Context + " - " + sc.State); + } + + protected LyricsDatabase(SerializationInfo info, StreamingContext context) + { + try + { + Dictionary<string, LyricsItem> dbTemp = new Dictionary<string, LyricsItem>(); + db = (Dictionary<string, LyricsItem>)info.GetValue("db", dbTemp.GetType()); + } + catch (System.Runtime.Serialization.SerializationException serExc) + { + } + + } + + public virtual void GetObjectData(SerializationInfo info, StreamingContext context) + { + Dictionary<string, LyricsItem> dbTemp = new Dictionary<string, LyricsItem>(); + info.AddValue("db", db, dbTemp.GetType()); + } + #endregion + + #region IDictionary<string,LyricsItem> Members + + public void Add(string key, LyricsItem value) + { + db.Add(key, value); + } + + public bool ContainsKey(string key) + { + return db.ContainsKey(key); + } + + public ICollection<string> Keys + { + get { return db.Keys; } + } + + public bool Remove(string key) + { + return db.Remove(key); + } + + public bool TryGetValue(string key, out LyricsItem value) + { + return db.TryGetValue(key, out value); + } + + public ICollection<LyricsItem> Values + { + get { return db.Values; } + } + + public LyricsItem this[string key] + { + get + { + return db[key]; + } + set + { + db[key] = value; + } + } + + #endregion + + #region ICollection<KeyValuePair<string,LyricsItem>> Members + + public void Add(KeyValuePair<string, LyricsItem> item) + { + db.Add(item.Key, item.Value); + } + + public void Clear() + { + db.Clear(); + } + + public bool Contains(KeyValuePair<string, LyricsItem> item) + { + return db.ContainsKey(item.Key); + } + + public void CopyTo(KeyValuePair<string, LyricsItem>[] array, int arrayIndex) + { + throw new Exception("The method or operation is not implemented."); + } + + public int Count + { + get { return db.Count; } + } + + public bool IsReadOnly + { + get { return false; } + } + + public bool Remove(KeyValuePair<string, LyricsItem> item) + { + return db.Remove(item.Key); + } + + #endregion + + #region IEnumerable<KeyValuePair<string,LyricsItem>> Members + + public IEnumerator<KeyValuePair<string, LyricsItem>> GetEnumerator() + { + foreach (KeyValuePair<string, LyricsItem> kvp in db) + { + yield return kvp; + } + } + + #endregion + + #region IEnumerable Members + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + foreach (KeyValuePair<string, LyricsItem> kvp in db) + { + yield return kvp; + } + } + + #endregion + } +} Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,51 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{F5789699-28EB-4E09-BD52-3BE057D38005}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>LyricsDatabase</RootNamespace> + <AssemblyName>LyricsDatabase</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="LyricsDatabase.cs" /> + <Compile Include="LyricsItem.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </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. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.Serialization; + +namespace MyLyrics +{ + [Serializable] + public class LyricsItem + { + private string artist; + private string title; + private string lyrics; + private string source; + + public LyricsItem(string artist, string title, string lyrics, string source) + { + this.artist = artist; + this.title = title; + this.lyrics = lyrics; + this.source = source; + } + + #region Properties + public string Artist + { + get { return artist; } + set { artist = value; } + } + + public string Title + { + get { return title; } + set { title = value; } + } + + public string Lyrics + { + get { return lyrics; } + set { lyrics = value; } + } + + public string Source + { + get { return source; } + set { source = value; } + } + #endregion + } +} \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LyricsDatabase")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LyricsDatabase")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("228d90d2-d845-468a-a6c1-89499e6f0c55")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,5 @@ +obj\Debug\ResolveAssemblyReference.cache +bin\Debug\LyricsDatabase.dll +bin\Debug\LyricsDatabase.pdb +obj\Debug\LyricsDatabase.dll +obj\Debug\LyricsDatabase.pdb Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -101,7 +101,12 @@ public override bool Init() { - return Load(GUIGraphicsContext.Skin + @"\myLyrics.xml"); + string lyricsXML = ""; + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + lyricsXML = (string)xmlreader.GetValueAsString("myLyrics", "myLyricsXml", "myLyrics.xml"); + } + return Load(GUIGraphicsContext.Skin + @"\" + lyricsXML); } public override void OnAction(Action action) @@ -705,7 +710,7 @@ public void ShowPlugin() { MyLyricsSetup dlg = new MyLyricsSetup(); - dlg.Show(); + dlg.ShowDialog(); } #endregion Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,136 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{BBB2DAE2-0D83-4B4B-85B6-D1B5A7E10039}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>MyLyrics</RootNamespace> + <AssemblyName>MyLyrics</AssemblyName> + <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> + <StartupObject> + </StartupObject> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <NoWarn> + </NoWarn> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Core, Version=1.0.2546.32606, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Core.DLL</HintPath> + </Reference> + <Reference Include="Databases, Version=1.0.2546.32610, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Databases.DLL</HintPath> + </Reference> + <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86"> + <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" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=1.0.2546.32604, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Utils.DLL</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Convert\ConvertFromXMLtoLyricsDatabase.cs" /> + <Compile Include="MyLyricsSettings.cs" /> + <Compile Include="MyLyricsSetup_test.cs" /> + <Compile Include="DatabaseUtil.cs" /> + <Compile Include="MyLyrics.cs" /> + <Compile Include="MyLyricsSetup.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MyLyricsSetup.Designer.cs"> + <DependentUpon>MyLyricsSetup.cs</DependentUpon> + </Compile> + <Compile Include="MyLyricsSetup_AddNewSong.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MyLyricsSetup_AddNewSong.Designer.cs"> + <DependentUpon>MyLyricsSetup_AddNewSong.cs</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="MyLyricsSetup_LyricsLibrary.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="MyLyricsSetup_LyricsLibrary.Designer.cs"> + <DependentUpon>MyLyricsSetup_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"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MyLyricsSetup_SearchTitleDialog.Designer.cs"> + <DependentUpon>MyLyricsSetup_SearchTitleDialog.cs</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="MyLyricsSetup_LyricsLibrary.resx"> + <SubType>Designer</SubType> + <DependentUpon>MyLyricsSetup_LyricsLibrary.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="MyLyricsSetup.resx"> + <SubType>Designer</SubType> + <DependentUpon>MyLyricsSetup.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="MyLyricsSetup_AddNewSong.resx"> + <SubType>Designer</SubType> + <DependentUpon>MyLyricsSetup_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"> + <SubType>Designer</SubType> + <DependentUpon>MyLyricsSetup_SearchTitleDialog.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <Content Include="Changelog.txt" /> + </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. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal\plugins\windows"</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace MyLyrics +{ + class MyLyricsSettings + { + // Database settings + internal static LyricsDatabase LyricsDB = null; + internal static LyricsDatabase LyricsMarkedDB = null; + internal static string LyricsDBName = "LyricsDatabaseV2.db"; + internal static string LyricsMarkedDBName = "LyricsMarkedDatabaseV2.db"; + internal static string LyricsXMLName = "Lyrics.xml"; + + // log information + internal static string LogName = "MyLyrics.log"; + internal static string LogBatchFileName = "MyLyricsBatch.log"; + } +} Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -94,6 +94,8 @@ this.btSave = new MediaPortal.UserInterface.Controls.MPButton(); this.btClose = new MediaPortal.UserInterface.Controls.MPButton(); this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker(); + this.lbLyricsPage = new MediaPortal.UserInterface.Controls.MPLabel(); + this.comboLyricsPage = new MediaPortal.UserInterface.Controls.MPComboBox(); this.tabControl.SuspendLayout(); this.tabPageSetup.SuspendLayout(); this.mpGroupBox2.SuspendLayout(); @@ -146,12 +148,14 @@ // mpGroupBox2 // this.mpGroupBox2.AutoSize = true; + this.mpGroupBox2.Controls.Add(this.comboLyricsPage); + this.mpGroupBox2.Controls.Add(this.lbLyricsPage); 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, 63); + this.mpGroupBox2.Size = new System.Drawing.Size(538, 98); this.mpGroupBox2.TabIndex = 29; this.mpGroupBox2.TabStop = false; this.mpGroupBox2.Text = "Basic settings"; @@ -159,10 +163,10 @@ // tbPluginName // this.tbPluginName.BorderColor = System.Drawing.Color.Empty; - this.tbPluginName.Location = new System.Drawing.Point(87, 24); + this.tbPluginName.Location = new System.Drawing.Point(96, 24); this.tbPluginName.MaxLength = 30; this.tbPluginName.Name = "tbPluginName"; - this.tbPluginName.Size = new System.Drawing.Size(154, 20); + this.tbPluginName.Size = new System.Drawing.Size(144, 20); this.tbPluginName.TabIndex = 13; this.tbPluginName.Text = "My Lyrics"; // @@ -183,7 +187,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, 74); + this.gbLyricSites.Location = new System.Drawing.Point(5, 109); this.gbLyricSites.Name = "gbLyricSites"; this.gbLyricSites.Size = new System.Drawing.Size(538, 202); this.gbLyricSites.TabIndex = 28; @@ -817,18 +821,43 @@ this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted); this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged); // + // lbLyricsPage + // + this.lbLyricsPage.AutoSize = true; + this.lbLyricsPage.Location = new System.Drawing.Point(13, 61); + this.lbLyricsPage.Name = "lbLyricsPage"; + this.lbLyricsPage.Size = new System.Drawing.Size(64, 13); + this.lbLyricsPage.TabIndex = 15; + this.lbLyricsPage.Text = "Lyrics page:"; + // + // comboLyricsPage + // + this.comboLyricsPage.BorderColor = System.Drawing.Color.Empty; + this.comboLyricsPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboLyricsPage.FormattingEnabled = true; + this.comboLyricsPage.Items.AddRange(new object[] { + "Basic lyrics page", + "Wide lyrics page", + "LRC creation page"}); + this.comboLyricsPage.Location = new System.Drawing.Point(96, 58); + this.comboLyricsPage.Name = "comboLyricsPage"; + this.comboLyricsPage.Size = new System.Drawing.Size(144, 21); + this.comboLyricsPage.TabIndex = 16; + // // MyLyricsSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(569, 537); + this.ClientSize = new System.Drawing.Size(566, 536); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); this.Controls.Add(this.btSave); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(576, 572); this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(576, 572); this.Name = "MyLyricsSetup"; this.ShowIcon = false; this.Text = "My Lyrics Configuration"; @@ -925,5 +954,7 @@ private MediaPortal.UserInterface.Controls.MPCheckBox cbDisregardSongsWithNoLyric; private MediaPortal.UserInterface.Controls.MPCheckBox cbMarkSongsWithNoLyrics; private MediaPortal.UserInterface.Controls.MPCheckBox cbDisconsiderTitlesWithLyrics; + private MediaPortal.UserInterface.Controls.MPLabel lbLyricsPage; + private MediaPortal.UserInterface.Controls.MPComboBox comboLyricsPage; } } \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-27 16:07:52 UTC (rev 239) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -120,7 +120,6 @@ m_DelegateThreadFinished = new DelegateThreadFinished(this.ThreadFinishedMethod); m_DelegateThreadException = new DelegateThreadException(this.ThreadExceptionMethod); - // Grab music database MusicDatabase dbs = new MusicDatabase(); m_TotalTitles = dbs.GetNumOfSongs(); @@ -133,6 +132,22 @@ { tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString()); tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics"); + + string xmlPage = xmlreader.GetValueAsString("myLyrics", "myLyricsXml", "myLyrics.xml"); + if (xmlPage.Equals("myLyrics.xml")) + { + comboLyricsPage.SelectedIndex = 0; + } + else if (xmlPage.Equals("myLyricsWide.xml")) + { + comboLyricsPage.SelectedIndex = 1; + } + else if (xmlPage.Equals("myLyricsEditor.xml")) + { + comboLyricsPage.SelectedIndex = 2; + } + + lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)"); rdDefault.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useDefaultSitesMode", "True")).ToString().Equals("True") ? true : false; @@ -316,6 +331,22 @@ xmlwriter.SetValue("myLyrics", "useLyricsOnDemand", cbLyricsOnDemand.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useSeekLyrics", cbSeekLyrics.Checked.ToString()); xmlwriter.SetValue("myLyrics", "useHotLyrics", cbHotLyrics.Checked.ToString()); + + string xmlPage = ""; + if (comboLyricsPage.SelectedIndex == 0) + { + xmlPage = "myLyrics.xml"; + } + else if (comboLyricsPage.SelectedIndex == 1) + { + xmlPage = "myLyricsWide.xml"; + } + else if (comboLyricsPage.SelectedIndex == 2) + { + xmlPage = "myLyricsEditor.xml"; + } + + xmlwriter.SetValue("myLyrics", "myLyricsXml", xmlPage); } } Added: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs (rev 0) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs 2007-03-27 16:52:34 UTC (rev 240) @@ -0,0 +1,344 @@ +namespace MyLyrics +{ + partial class MyLyricsSetup_SearchTitleDialog + { + /// <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.gbSearchInfo = new System.Windows.Forms.GroupBox(); + this.tbTitle = new System.Windows.Forms.TextBox(); + this.lbTitle = new System.Windows.Forms.Label(); + this.tbArtist = new System.Windows.Forms.TextBox(); + this.lbArtist = new System.Windows.Forms.Label(); + this.btFind = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lvSearchResults = new System.Windows.Forms.ListView(); + this.cbSite = new System.Windows.Forms.ColumnHeader(); + this.cbResu... [truncated message content] |