From: <sa...@us...> - 2008-12-17 17:43:26
|
Revision: 2445 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2445&view=rev Author: saamand Date: 2008-12-17 17:43:20 +0000 (Wed, 17 Dec 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.resx trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.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/TagReaderUtil.cs Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricUtil.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Text.RegularExpressions; namespace LyricsEngine { @@ -78,11 +79,31 @@ return str; } - public static string CleanLyrics(string lyrics) + + public static string FixLyrics(string lyrics) { - while (lyrics.Contains(@"''")) + lyrics = Regex.Replace(lyrics, "('){2,}", "'"); + return lyrics; + } + + public static string FixLyrics(string lyrics, string[] find, string[] replace) + { + lyrics = FixLyrics(lyrics); + + + if (find != null) { - lyrics = lyrics.Replace(@"''", "'"); + int valueIndex = 0; + + foreach (string findValue in find) + { + + if (findValue != "") + { + lyrics = lyrics.Replace(findValue, replace[valueIndex]); + valueIndex++; + } + } } return lyrics; Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs =================================================================== --- trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/LyricsEngine/LyricsController.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -38,12 +38,16 @@ ManualResetEvent m_EventStopped_LyricController; private string[] lyricsSites; + private string[] m_findArray; + private string[] m_replaceArray; public LyricsController(ILyricForm mainForm, ManualResetEvent eventStopThread, string[] lyricSites, - bool allowAllToComplete, bool automaticUpdate) + bool allowAllToComplete, bool automaticUpdate, + string find, string replace) { + this.m_Form = mainForm; this.m_allowAllToComplete = allowAllToComplete; this.m_automaticUpdate = automaticUpdate; @@ -73,6 +77,15 @@ m_EventStopped_LyricController = new ManualResetEvent(false); LyricSearch.Abort = false; + + if (!string.IsNullOrEmpty(find) && !string.IsNullOrEmpty(replace)) + { + if (find != "") + { + m_findArray = find.Split(','); + m_replaceArray = replace.Split(','); + } + } } @@ -185,8 +198,9 @@ internal void LyricFound(String lyricStrings, String artist, String title, String site) { - string cleanLyric = LyricUtil.CleanLyrics(lyricStrings); + string cleanLyric = LyricUtil.FixLyrics(lyricStrings, m_findArray, m_replaceArray); + --m_noOfCurrentSearches; if (m_allowAllToComplete || m_StopSearches == false) Modified: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -64,8 +64,6 @@ public static void WriteToLyricsDatabase(LyricsDatabase lyricsDB, LyricsDatabase lyricsMarkedDB, string capArtist, string capTitle, string lyric, string site) { - lyric = LyricUtil.CleanLyrics(lyric); - if (DatabaseUtil.IsTrackInLyricsDatabase(lyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) { lyricsDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, lyric, site)); @@ -79,8 +77,6 @@ public static void ReplaceInLyricsDatabase(LyricsDatabase currentLyricsDB, string capArtist, string capTitle, string lyric, string site) { - lyric = LyricUtil.CleanLyrics(lyric); - LyricsDatabase otherDatabase = GetOtherLyricsDatabase(currentLyricsDB); string key = DatabaseUtil.CorrectKeyFormat(capArtist, capTitle); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.Designer.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -42,6 +42,9 @@ this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.linkLabelForum = new System.Windows.Forms.LinkLabel(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.SuspendLayout(); // @@ -60,60 +63,62 @@ // lbInfo2 // this.lbInfo2.AutoSize = true; - this.lbInfo2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbInfo2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbInfo2.ForeColor = System.Drawing.Color.Black; - this.lbInfo2.Location = new System.Drawing.Point(26, 153); + this.lbInfo2.Location = new System.Drawing.Point(26, 150); this.lbInfo2.Name = "lbInfo2"; - this.lbInfo2.Size = new System.Drawing.Size(326, 17); + this.lbInfo2.Size = new System.Drawing.Size(288, 18); this.lbInfo2.TabIndex = 2; - this.lbInfo2.Text = "The four tabs of the MyLyrics configuration:"; + this.lbInfo2.Text = "The five tabs of the MyLyrics configuration:"; // // lbInfo1 // this.lbInfo1.AutoSize = true; - this.lbInfo1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbInfo1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbInfo1.ForeColor = System.Drawing.Color.Black; this.lbInfo1.Location = new System.Drawing.Point(26, 30); this.lbInfo1.Name = "lbInfo1"; - this.lbInfo1.Size = new System.Drawing.Size(246, 17); + this.lbInfo1.Size = new System.Drawing.Size(223, 18); this.lbInfo1.TabIndex = 3; this.lbInfo1.Text = "MyLyrics plugin, version 1.1 RC1"; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 17); + this.label2.Location = new System.Drawing.Point(12, 18); this.label2.MaximumSize = new System.Drawing.Size(460, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(445, 39); + this.label2.Size = new System.Drawing.Size(432, 39); this.label2.TabIndex = 4; this.label2.Text = resources.GetString("label2.Text"); // // label4 // this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.ForeColor = System.Drawing.Color.Black; - this.label4.Location = new System.Drawing.Point(3, 4); + this.label4.Location = new System.Drawing.Point(3, 1); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(100, 13); + this.label4.Size = new System.Drawing.Size(95, 15); this.label4.TabIndex = 6; this.label4.Text = "Lyrics database:"; // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(12, 140); + this.label5.Location = new System.Drawing.Point(12, 128); this.label5.MaximumSize = new System.Drawing.Size(460, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(458, 26); + this.label5.Size = new System.Drawing.Size(371, 26); this.label5.TabIndex = 7; - this.label5.Text = "You can perform a search on your whole music database in a single batch search. Y" + - "ou can also choose to select all songs contained in the marked database."; + this.label5.Text = "- Search lyrics for your complete MP music database in a single batch search.\r\n- " + + "Search lyrics for songs in your marked database database."; // // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel1.Controls.Add(this.label10); + this.panel1.Controls.Add(this.label9); this.panel1.Controls.Add(this.label8); this.panel1.Controls.Add(this.label7); this.panel1.Controls.Add(this.label6); @@ -124,49 +129,49 @@ this.panel1.Controls.Add(this.label2); this.panel1.Location = new System.Drawing.Point(29, 173); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(480, 251); + this.panel1.Size = new System.Drawing.Size(480, 269); this.panel1.TabIndex = 8; // // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(12, 189); + this.label8.Location = new System.Drawing.Point(12, 218); this.label8.MaximumSize = new System.Drawing.Size(460, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(454, 52); + this.label8.Size = new System.Drawing.Size(418, 39); this.label8.TabIndex = 11; this.label8.Text = resources.GetString("label8.Text"); // // label7 // this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label7.ForeColor = System.Drawing.Color.Black; - this.label7.Location = new System.Drawing.Point(3, 176); + this.label7.Location = new System.Drawing.Point(3, 201); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(53, 13); + this.label7.Size = new System.Drawing.Size(51, 15); this.label7.TabIndex = 10; this.label7.Text = "Settings"; // // label6 // this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label6.ForeColor = System.Drawing.Color.Black; - this.label6.Location = new System.Drawing.Point(3, 127); + this.label6.Location = new System.Drawing.Point(3, 112); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(136, 13); + this.label6.Size = new System.Drawing.Size(130, 15); this.label6.TabIndex = 9; this.label6.Text = "Music database batch:"; // // label1 // this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.Black; - this.label1.Location = new System.Drawing.Point(3, 66); + this.label1.Location = new System.Drawing.Point(3, 62); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(144, 13); + this.label1.Size = new System.Drawing.Size(140, 15); this.label1.TabIndex = 8; this.label1.Text = "Music database browse:"; // @@ -176,27 +181,64 @@ this.label3.Location = new System.Drawing.Point(12, 79); this.label3.MaximumSize = new System.Drawing.Size(460, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(447, 39); + this.label3.Size = new System.Drawing.Size(302, 26); this.label3.TabIndex = 7; - this.label3.Text = resources.GetString("label3.Text"); + this.label3.Text = "- Browse your MP music database.\r\n- Manually select the songs that you would like" + + " to find lyrics for."; // // linkLabelForum // this.linkLabelForum.AutoSize = true; - this.linkLabelForum.LinkColor = System.Drawing.Color.Navy; - this.linkLabelForum.Location = new System.Drawing.Point(364, 436); + this.linkLabelForum.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.linkLabelForum.ForeColor = System.Drawing.Color.Black; + this.linkLabelForum.LinkColor = System.Drawing.SystemColors.MenuHighlight; + this.linkLabelForum.Location = new System.Drawing.Point(354, 456); this.linkLabelForum.Name = "linkLabelForum"; - this.linkLabelForum.Size = new System.Drawing.Size(145, 13); + this.linkLabelForum.Size = new System.Drawing.Size(168, 15); this.linkLabelForum.TabIndex = 9; this.linkLabelForum.TabStop = true; this.linkLabelForum.Tag = "http://forum.team-mediaportal.com/my_lyrics_plugin-f163.html"; this.linkLabelForum.Text = "MyLyrics plugin forum section"; this.linkLabelForum.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelForum_LinkClicked); // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label9.ForeColor = System.Drawing.Color.Black; + this.label9.Location = new System.Drawing.Point(3, 163); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(89, 15); + this.label9.TabIndex = 12; + this.label9.Text = "Find && replace:"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(12, 180); + this.label10.MaximumSize = new System.Drawing.Size(460, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(334, 13); + this.label10.TabIndex = 13; + this.label10.Text = "- Select words to be found and replace during viewing and searching."; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label11.ForeColor = System.Drawing.Color.Black; + this.label11.Location = new System.Drawing.Point(34, 456); + this.label11.MaximumSize = new System.Drawing.Size(460, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(314, 15); + this.label11.TabIndex = 14; + this.label11.Text = "For bugs, issues and feature requests use the MP forum:"; + // // Information // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label11); this.Controls.Add(this.linkLabelForum); this.Controls.Add(this.panel1); this.Controls.Add(this.lbInfo1); @@ -226,5 +268,8 @@ private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; private System.Windows.Forms.LinkLabel linkLabelForum; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label11; } } Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.resx =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.resx 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/About.resx 2008-12-17 17:43:20 UTC (rev 2445) @@ -123,12 +123,13 @@ Also when run in configuration mode, you will be able to work on your lyrics database, import and export lyrics from music tags, and perform various types of searches.</value> </data> <data name="label2.Text" xml:space="preserve"> - <value>Here you can see your lyrics (containing the songs with a matching lyric) and your marked database (containing the songs that have been searched without any matching lyrics found). You can modify, import, and find an alternative title for a known song amont other things.</value> + <value>- See your lyrics database (containing the songs with a matching lyric). +- See your marked database (containing the songs that was searched without a matching). +- You can modify, import, and find an alternative title for a known song amont other things.</value> </data> <data name="label8.Text" xml:space="preserve"> - <value>Here you can set up the plugin as you prefer. E.g. you can choose the name to be shown for the plugin inside MediaPortal or if a found lyric should be stored in the tag of the music file. You can also tweak the settings regarding the "Find Lyric" dialog accessable from the "Lyrics database" tab, and choose which sites you want to query in your searches.</value> + <value>- Set up the plugin as you prefer. E.g. which sites to query in your searches. +- Choose the plugin alias and if a found lyric should be stored in the tag of the music file. +- Tweak the settings regarding the "Find Lyric" dialog. </value> </data> - <data name="label3.Text" xml:space="preserve"> - <value>This is where you can browsw your music database and manually select the songs taht you would like to search the Internet for. When a lyric is found it is added to the lyrics database. If not it is added to the marked database.</value> - </data> </root> \ No newline at end of file Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/FindLyric.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -42,6 +42,9 @@ bool m_automaticWriteToMusicTag = true; bool markedDatabase; + string m_find = string.Empty; + string m_replace = string.Empty; + string[] m_strippedPrefixStrings = null; List<string> sitesToSearch; @@ -89,6 +92,9 @@ m_automaticUpdate = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false); m_moveLyricFromMarkedDatabase = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true); m_automaticWriteToMusicTag = xmlreader.GetValueAsBool("myLyrics", "automaticWriteToMusicTag", true); + + m_find = xmlreader.GetValueAsString("myLyrics", "find", ""); + m_replace = xmlreader.GetValueAsString("myLyrics", "replace", ""); } m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); @@ -171,7 +177,7 @@ } // If automaticUpdate is set then return after the first positive search - lc = new LyricsController(this, m_EventStopThread, (string[])sitesToSearch.ToArray(), true, automaticUpdate); + lc = new LyricsController(this, m_EventStopThread, (string[])sitesToSearch.ToArray(), true, automaticUpdate, m_find, m_replace); ThreadStart job = delegate { Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/LyricsLibrary.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -325,7 +325,7 @@ string capArtist = LyricUtil.CapatalizeString(m_CurrentArtist); string capTitle = LyricUtil.CapatalizeString(m_CurrentTitle); - string lyrics = LyricUtil.CleanLyrics(tbLyrics.Text); + string lyrics = LyricUtil.FixLyrics(tbLyrics.Text); CurrentDB[DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)].Lyrics = lyrics; DatabaseUtil.SerializeDB(CurrentDB); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MusicDatabaseBrowse.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -46,6 +46,9 @@ Queue<string[]> songs; LyricsController lc; + string m_find = string.Empty; + string m_replace = string.Empty; + public MusicDatabaseBrowse(MyLyricsSetup parent) { this.parent = parent; @@ -252,6 +255,9 @@ sitesToSearch.Add("SeekLyrics"); if (((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True")) sitesToSearch.Add("HotLyrics"); + + m_find = xmlreader.GetValueAsString("myLyrics", "find", ""); + m_replace = xmlreader.GetValueAsString("myLyrics", "replace", ""); } m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); @@ -259,7 +265,7 @@ m_EventStopThread = new ManualResetEvent(false); // If automaticUpdate is set then return after the first positive search - lc = new LyricsController(this, m_EventStopThread, (string[])sitesToSearch.ToArray(), false, false); + lc = new LyricsController(this, m_EventStopThread, (string[])sitesToSearch.ToArray(), false, false, m_find, m_replace); m_noOfSearchesToComplete = songs.Count; lc.NoOfLyricsToSearch = m_noOfSearchesToComplete; Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.Designer.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -97,8 +97,9 @@ 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.tabPageReplace = new System.Windows.Forms.TabPage(); + this.mpGroupBox4 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.lbArtist = new MediaPortal.UserInterface.Controls.MPLabel(); this.dbGridView = new System.Windows.Forms.DataGridView(); this.Find = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Replace = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -121,6 +122,7 @@ this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit(); this.tabPageReplace.SuspendLayout(); + this.mpGroupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dbGridView)).BeginInit(); this.SuspendLayout(); // @@ -136,7 +138,7 @@ this.tabControl.Location = new System.Drawing.Point(0, 0); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(558, 524); + this.tabControl.Size = new System.Drawing.Size(558, 530); this.tabControl.TabIndex = 1; this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); // @@ -145,7 +147,7 @@ this.tabPageLyricsDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageLyricsDatabase.Name = "tabPageLyricsDatabase"; this.tabPageLyricsDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageLyricsDatabase.Size = new System.Drawing.Size(550, 498); + this.tabPageLyricsDatabase.Size = new System.Drawing.Size(550, 504); this.tabPageLyricsDatabase.TabIndex = 1; this.tabPageLyricsDatabase.Text = "Lyrics database"; this.tabPageLyricsDatabase.UseVisualStyleBackColor = true; @@ -155,7 +157,7 @@ this.tabPageMusicDatabaseBrowse.Location = new System.Drawing.Point(4, 22); this.tabPageMusicDatabaseBrowse.Name = "tabPageMusicDatabaseBrowse"; this.tabPageMusicDatabaseBrowse.Padding = new System.Windows.Forms.Padding(3); - this.tabPageMusicDatabaseBrowse.Size = new System.Drawing.Size(550, 498); + this.tabPageMusicDatabaseBrowse.Size = new System.Drawing.Size(550, 504); this.tabPageMusicDatabaseBrowse.TabIndex = 3; this.tabPageMusicDatabaseBrowse.Text = "Music database browse"; this.tabPageMusicDatabaseBrowse.UseVisualStyleBackColor = true; @@ -170,7 +172,7 @@ this.tabPageDatabase.Location = new System.Drawing.Point(4, 22); this.tabPageDatabase.Name = "tabPageDatabase"; this.tabPageDatabase.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDatabase.Size = new System.Drawing.Size(550, 498); + this.tabPageDatabase.Size = new System.Drawing.Size(550, 504); this.tabPageDatabase.TabIndex = 2; this.tabPageDatabase.Text = "Music database batch search"; this.tabPageDatabase.UseVisualStyleBackColor = true; @@ -557,7 +559,7 @@ this.lbSongsWithLyric.Name = "lbSongsWithLyric"; this.lbSongsWithLyric.Size = new System.Drawing.Size(91, 15); this.lbSongsWithLyric.TabIndex = 22; - this.lbSongsWithLyric.Text = "Songs with lyric:"; + this.lbSongsWithLyric.Text = "Songs with lyrics:"; // // lbTotalSongs2 // @@ -600,7 +602,7 @@ 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(550, 498); + this.tabPageSetup.Size = new System.Drawing.Size(550, 504); this.tabPageSetup.TabIndex = 2; this.tabPageSetup.Text = "Settings"; this.tabPageSetup.UseVisualStyleBackColor = true; @@ -609,7 +611,7 @@ // 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.Location = new System.Drawing.Point(4, 265); this.gbTag.Name = "gbTag"; this.gbTag.Size = new System.Drawing.Size(538, 49); this.gbTag.TabIndex = 31; @@ -624,9 +626,9 @@ 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(198, 17); + this.cbMusicTag.Size = new System.Drawing.Size(203, 17); this.cbMusicTag.TabIndex = 6; - this.cbMusicTag.Text = "Write newly found lyric into music tag"; + this.cbMusicTag.Text = "Write newly found lyrics into music tag"; this.cbMusicTag.UseVisualStyleBackColor = true; this.cbMusicTag.Leave += new System.EventHandler(this.WriteMediaPortalXML); // @@ -636,7 +638,7 @@ 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, 333); + this.mpGroupBox3.Location = new System.Drawing.Point(5, 320); this.mpGroupBox3.Name = "mpGroupBox3"; this.mpGroupBox3.Size = new System.Drawing.Size(538, 92); this.mpGroupBox3.TabIndex = 30; @@ -677,9 +679,9 @@ 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.Size = new System.Drawing.Size(124, 17); this.cbAutoFetch.TabIndex = 6; - this.cbAutoFetch.Text = "Automatic fetch lyric"; + this.cbAutoFetch.Text = "Automatic fetch lyrics"; this.cbAutoFetch.UseVisualStyleBackColor = true; this.cbAutoFetch.Leave += new System.EventHandler(this.WriteMediaPortalXML); // @@ -721,11 +723,10 @@ 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, 70); this.gbLyricSites.Name = "gbLyricSites"; - this.gbLyricSites.Size = new System.Drawing.Size(538, 202); + this.gbLyricSites.Size = new System.Drawing.Size(538, 189); this.gbLyricSites.TabIndex = 28; this.gbLyricSites.TabStop = false; this.gbLyricSites.Text = "Lyrics sites settings"; @@ -898,36 +899,47 @@ this.rbUserDefined.UseVisualStyleBackColor = true; this.rbUserDefined.Leave += new System.EventHandler(this.rdTrackBar_CheckedChanged); // - // 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 should currently not be used due to instable server"; - // // tabPageReplace // - this.tabPageReplace.Controls.Add(this.dbGridView); + this.tabPageReplace.Controls.Add(this.mpGroupBox4); this.tabPageReplace.Location = new System.Drawing.Point(4, 22); this.tabPageReplace.Name = "tabPageReplace"; this.tabPageReplace.Padding = new System.Windows.Forms.Padding(3); - this.tabPageReplace.Size = new System.Drawing.Size(550, 498); + this.tabPageReplace.Size = new System.Drawing.Size(550, 504); this.tabPageReplace.TabIndex = 5; this.tabPageReplace.Text = "Find & Replace"; this.tabPageReplace.UseVisualStyleBackColor = true; // + // mpGroupBox4 + // + this.mpGroupBox4.Controls.Add(this.lbArtist); + this.mpGroupBox4.Controls.Add(this.dbGridView); + this.mpGroupBox4.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.mpGroupBox4.Location = new System.Drawing.Point(6, 6); + this.mpGroupBox4.Name = "mpGroupBox4"; + this.mpGroupBox4.Size = new System.Drawing.Size(536, 453); + this.mpGroupBox4.TabIndex = 29; + this.mpGroupBox4.TabStop = false; + this.mpGroupBox4.Text = "Find && Replace setting"; + // + // lbArtist + // + this.lbArtist.AutoSize = true; + this.lbArtist.Location = new System.Drawing.Point(6, 26); + this.lbArtist.Name = "lbArtist"; + this.lbArtist.Size = new System.Drawing.Size(302, 13); + this.lbArtist.TabIndex = 1; + this.lbArtist.Text = "Select words to be found and replaced when lyrics are caught."; + // // dbGridView // this.dbGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dbGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Find, this.Replace}); - this.dbGridView.Location = new System.Drawing.Point(8, 6); + this.dbGridView.Location = new System.Drawing.Point(9, 55); this.dbGridView.Name = "dbGridView"; - this.dbGridView.Size = new System.Drawing.Size(244, 439); + this.dbGridView.Size = new System.Drawing.Size(244, 386); this.dbGridView.TabIndex = 0; this.dbGridView.Leave += new System.EventHandler(this.WriteMediaPortalXML); // @@ -946,7 +958,7 @@ this.tabPageAbout.Location = new System.Drawing.Point(4, 22); this.tabPageAbout.Name = "tabPageAbout"; this.tabPageAbout.Padding = new System.Windows.Forms.Padding(3); - this.tabPageAbout.Size = new System.Drawing.Size(550, 498); + this.tabPageAbout.Size = new System.Drawing.Size(550, 504); this.tabPageAbout.TabIndex = 4; this.tabPageAbout.Text = "About"; this.tabPageAbout.UseVisualStyleBackColor = true; @@ -973,7 +985,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(558, 524); + this.ClientSize = new System.Drawing.Size(558, 530); this.ControlBox = false; this.Controls.Add(this.btClose); this.Controls.Add(this.tabControl); @@ -1010,6 +1022,8 @@ this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBar)).EndInit(); this.tabPageReplace.ResumeLayout(false); + this.mpGroupBox4.ResumeLayout(false); + this.mpGroupBox4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dbGridView)).EndInit(); this.ResumeLayout(false); @@ -1058,7 +1072,6 @@ private MediaPortal.UserInterface.Controls.MPLabel lbPluginName; private MediaPortal.UserInterface.Controls.MPGroupBox gbLyricSites; internal MediaPortal.UserInterface.Controls.MPCheckBox cbHotLyrics; - private MediaPortal.UserInterface.Controls.MPLabel tbNote; internal MediaPortal.UserInterface.Controls.MPCheckBox cbSeekLyrics; internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyricsOnDemand; internal MediaPortal.UserInterface.Controls.MPCheckBox cbLyrics007; @@ -1094,5 +1107,7 @@ private System.Windows.Forms.DataGridView dbGridView; private System.Windows.Forms.DataGridViewTextBoxColumn Find; private System.Windows.Forms.DataGridViewTextBoxColumn Replace; + private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox4; + private MediaPortal.UserInterface.Controls.MPLabel lbArtist; } } \ 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 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics Configuration/MyLyricsSetup.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -81,6 +81,7 @@ bool m_automaticWriteToMusicTag = true; + string[] m_strippedPrefixStrings; const int m_NoOfCurrentSearchesAllowed = 6; @@ -92,6 +93,9 @@ private Queue lyricConfigInfosQueue; string[] sitesToSearchArray = null; + string m_find = string.Empty; + string m_replace = string.Empty; + // Timer variables int hour = 0; int min = 0; @@ -165,17 +169,17 @@ lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)"); + trackBar.Value = ((int)xmlreader.GetValueAsInt("myLyrics", "defaultSitesModeValue", 2)); rdDefault.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useDefaultSitesMode", "True")).ToString().Equals("True") ? true : false; - trackBar.Value = ((int)xmlreader.GetValueAsInt("myLyrics", "defaultSitesModeValue", 2)); - string find = xmlreader.GetValueAsString("myLyrics", "find", ""); - string replace = xmlreader.GetValueAsString("myLyrics", "replace", ""); + m_find = xmlreader.GetValueAsString("myLyrics", "find", ""); + m_replace = xmlreader.GetValueAsString("myLyrics", "replace", ""); - if (find != "") + if (m_find != "") { - string[] findArray = find.Split(','); - string[] replaceArray = replace.Split(','); + string[] findArray = m_find.Split(','); + string[] replaceArray = m_replace.Split(','); int valueIndex = 0; foreach (string findValue in findArray) @@ -770,9 +774,14 @@ // create worker thread instance if (lyricConfigInfosQueue.Count > 0) { - // start running the lyricController - lc = new LyricsController(this, m_EventStopThread, sitesToSearchArray, false, false); + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + m_find = xmlreader.GetValueAsString("myLyrics", "find", ""); + m_replace = xmlreader.GetValueAsString("myLyrics", "replace", ""); + } + lc = new LyricsController(this, m_EventStopThread, sitesToSearchArray, false, false, m_find, m_replace); + lc.NoOfLyricsToSearch = lyricConfigInfosQueue.Count; ThreadStart runLyricController = delegate { @@ -1052,7 +1061,7 @@ foreach (DataGridViewRow row in dbGridView.Rows) { - if (row.Cells[0].Value != null) + if (row.Cells[0].Value != null && row.Cells[1].Value != null) { find.Append(row.Cells[0].Value.ToString().Replace(",","") + ","); replace.Append(row.Cells[1].Value.ToString().Replace(",", "") + ","); Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -43,6 +43,8 @@ string skin = ""; + bool deinitAlreadyCalled = false; + bool exitingMyLyrics = false; bool newTrack = false; bool alreadyValidLRC = false; @@ -80,8 +82,8 @@ int m_crossfade = 0; - string[] m_findArray = null; - string[] m_replaceArray = null; + string m_Find = string.Empty; + string m_Replace = string.Empty; string[] m_strippedPrefixStrings = null; @@ -204,7 +206,7 @@ { CurrentTrackTag.Artist = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Artist")); CurrentTrackTag.Title = LyricUtil.CapatalizeString(GUIPropertyManager.GetProperty("#Play.Current.Title")); - CurrentTrackTag.Lyrics = TagReaderUtil.FixLyrics(CurrentTrackTag.Lyrics,m_findArray,m_replaceArray); + CurrentTrackTag.Lyrics = LyricUtil.FixLyrics(CurrentTrackTag.Lyrics); if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC || selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) { @@ -348,15 +350,8 @@ m_crossfade = xmlreader.GetValueAsInt("audioplayer", "crossfade", 2000); - string find = xmlreader.GetValueAsString("myLyrics", "find", ""); - string replace = xmlreader.GetValueAsString("myLyrics", "replace", ""); - - if (find != "") - { - m_findArray = find.Split(','); - m_replaceArray = replace.Split(','); - } - + m_Find = xmlreader.GetValueAsString("myLyrics", "find", ""); + m_Replace = xmlreader.GetValueAsString("myLyrics", "replace", ""); } m_strippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray(); @@ -427,6 +422,8 @@ exitingMyLyrics = false; base.OnMessage(message); + deinitAlreadyCalled = false; + LoadSettings(); LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logName)); @@ -435,23 +432,29 @@ } case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: { - StopThread(); - resetAll(); - - if (m_WriteTagTimer != null) + if (deinitAlreadyCalled == false) { - m_WriteTagTimer.Stop(); - m_WriteTagTimer.Close(); - m_WriteTagTimer.Dispose(); - m_WriteTagTimer = null; - } + deinitAlreadyCalled = true; - //deregister the handler! - GUIPropertyManager.OnPropertyChanged -= new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + StopThread(); + resetAll(); - LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.ElapsedTimeString() + "MyLyrics closes."); + if (m_WriteTagTimer != null) + { + m_WriteTagTimer.Stop(); + m_WriteTagTimer.Close(); + m_WriteTagTimer.Dispose(); + m_WriteTagTimer = null; + } - GUIWindowManager.ShowPreviousWindow(); + //deregister the handler! + GUIPropertyManager.OnPropertyChanged -= new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler); + + LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Stop, 0, LyricDiagnostics.ElapsedTimeString() + "MyLyrics closes."); + + GUIWindowManager.ShowPreviousWindow(); + + } break; } } @@ -477,62 +480,62 @@ switch (action.wID) { case Action.ActionType.ACTION_PREVIOUS_MENU: - { - GUIWindowManager.ShowPreviousWindow(); - break; - } - case Action.ActionType.ACTION_KEY_PRESSED: - { - if (action.m_key.KeyChar.Equals(13)) { - tagLine(); + GUIWindowManager.ShowPreviousWindow(); + break; } - else if (action.m_key.KeyChar.Equals(40) || action.m_key.KeyChar.Equals(101)) + case Action.ActionType.ACTION_KEY_PRESSED: { - lyricsFound = false; - if (selectedScreen != (int)MyLyricsSettings.Screen.LRC_EDITOR) + if (action.m_key.KeyChar.Equals(13)) { - resetGUI((int)MyLyricsSettings.Screen.LRC_EDITOR); - + tagLine(); } - else + else if (action.m_key.KeyChar.Equals(40) || action.m_key.KeyChar.Equals(101)) { - // parameter could be anything but LRC_EDITOR. Will find correct type when running findLyric(). - resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); - } + lyricsFound = false; + if (selectedScreen != (int)MyLyricsSettings.Screen.LRC_EDITOR) + { + resetGUI((int)MyLyricsSettings.Screen.LRC_EDITOR); - newTrack = true; - Process(); - } - else if (action.m_key.KeyChar.Equals(35) || action.m_key.KeyChar.Equals(119)) - { - if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_BASIC) - { - 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 + { + // parameter could be anything but LRC_EDITOR. Will find correct type when running findLyric(). + resetGUI((int)MyLyricsSettings.Screen.LYRICS_BASIC); + } + + newTrack = true; + Process(); } - else if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_WIDE) + else if (action.m_key.KeyChar.Equals(35) || action.m_key.KeyChar.Equals(119)) { - 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); + if (selectedScreen == (int)MyLyricsSettings.Screen.LYRICS_BASIC) + { + 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) + { + basicScreenSelected = false; + findLyric(); + } + else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) + { + basicScreenSelected = true; + findLyric(); + } } - else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_BASIC) - { - basicScreenSelected = false; - findLyric(); - } - else if (selectedScreen == (int)MyLyricsSettings.Screen.LRC_WIDE) - { - basicScreenSelected = true; - findLyric(); - } + break; } - break; - } case Action.ActionType.ACTION_REWIND: case Action.ActionType.ACTION_FORWARD: case Action.ActionType.ACTION_MUSIC_FORWARD: @@ -540,9 +543,15 @@ case Action.ActionType.ACTION_MUSIC_REWIND: case Action.ActionType.ACTION_PAUSE: case Action.ActionType.ACTION_PLAY: - { - break; - } + { + break; + } + case Action.ActionType.ACTION_EXIT: + case Action.ActionType.ACTION_END: + case Action.ActionType.ACTION_SHUTDOWN: + { + break; + } } base.OnAction(action); } @@ -707,7 +716,7 @@ // 2) Lyric in music tag else if (CurrentTrackTag.Lyrics.Length != 0) { - CurrentTrackTag.Lyrics = TagReaderUtil.FixLyrics(CurrentTrackTag.Lyrics,m_findArray,m_replaceArray); + CurrentTrackTag.Lyrics = LyricUtil.FixLyrics(CurrentTrackTag.Lyrics); ShowLyricOnScreen(CurrentTrackTag.Lyrics, CurrentTrackTag.FileName); } @@ -722,7 +731,7 @@ { lyricsFound = false; - lc = new LyricsController(this, m_EventStopThread, m_sitesToSearch, false, false); + lc = new LyricsController(this, m_EventStopThread, m_sitesToSearch, false, false, m_Find, m_Replace); // create worker thread instance ThreadStart job = delegate { @@ -911,7 +920,7 @@ GUIControl.FocusControl(GetID, (int)GUI_Lyrics_Controls.CONTROL_LyricWide); } - + } } @@ -1029,7 +1038,7 @@ 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); Modified: trunk/plugins/MyLyrics/My Lyrics/TagReaderUtil.cs =================================================================== --- trunk/plugins/MyLyrics/My Lyrics/TagReaderUtil.cs 2008-12-17 16:52:29 UTC (rev 2444) +++ trunk/plugins/MyLyrics/My Lyrics/TagReaderUtil.cs 2008-12-17 17:43:20 UTC (rev 2445) @@ -44,34 +44,5 @@ else return false; } - - public static string FixLyrics(string lyrics) - { - lyrics = Regex.Replace(lyrics, "('){2,}", "'"); - return lyrics; - } - - public static string FixLyrics(string lyrics, string[] find, string[] replace) - { - lyrics = Regex.Replace(lyrics, "('){2,}", "'"); - - - if (find != null) - { - int valueIndex = 0; - - foreach (string findValue in find) - { - - if (findValue != "") - { - lyrics = lyrics.Replace(findValue, replace[valueIndex]); - valueIndex++; - } - } - } - - return lyrics; - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |