|
From: <sa...@us...> - 2007-04-01 16:15:29
|
Revision: 272
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=272&view=rev
Author: saamand
Date: 2007-04-01 09:15:16 -0700 (Sun, 01 Apr 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs
trunk/plugins/MyLyrics/MyLyrics.suo
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-04-01 16:15:16 UTC (rev 272)
@@ -8,6 +8,7 @@
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
using LyricsEngine;
using LyricsEngineConfig;
@@ -96,13 +97,15 @@
#region Fields releated to the editor mode
internal const int TAG_IN_ROUND = 5;
- internal int currentLineToTag = 1;
+ internal int currentLineToTagIndex = 1;
+ internal int currentLineToTag_Total = 0;
internal int tagRoundFinished = 0;
internal int min = 0;
internal int sec = 0;
internal int msec = 0;
string[] lines;
+ ArrayList times;
enum EditorGUI_Controls : int
{
@@ -250,24 +253,59 @@
{
if (iControl == (int)EditorGUI_Controls.CONTROL_TAGBUTTON)
{
- string time = min.ToString() + ":" + sec.ToString() + "." + stopwatch.ElapsedMilliseconds;
- GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + currentLineToTag, time);
- GUIControl.HideControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + currentLineToTag);
+ string time = "[" + min.ToString() + ":" + (sec.ToString().Length == 2 ? sec.ToString() : "0" + sec.ToString()) + "." + (stopwatch.ElapsedMilliseconds.ToString().Length == 3 ? stopwatch.ElapsedMilliseconds.ToString() : stopwatch.ElapsedMilliseconds.ToString() + "0") + "]";
+ lines[currentLineToTag_Total] = time + lines[currentLineToTag_Total];
+ GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + currentLineToTagIndex, time);
+ GUIControl.HideControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + currentLineToTagIndex);
- // If a new round has to start
- if (++currentLineToTag == TAG_IN_ROUND + 1)
+ if (++currentLineToTag_Total < lines.Length)
{
- currentLineToTag = 1;
- ++tagRoundFinished;
- for (int i = 1; i <= TAG_IN_ROUND; i++)
+ // If a new round has to start
+ if (++currentLineToTagIndex == TAG_IN_ROUND + 1)
{
- GUIControl.ShowControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i);
- GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + i, "");
- GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]);
- GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]);
+ currentLineToTagIndex = 1;
+ ++tagRoundFinished;
+
+ for (int i = 1; i <= TAG_IN_ROUND && currentLineToTag_Total + i < lines.Length ; i++)
+ {
+ GUIControl.ShowControl(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i);
+ GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_TIME + i, "");
+ GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]);
+ GUIControl.SetControlLabel(GetID, (int)EditorGUI_Controls.CONTROL_LINE_DONE + i, lines[tagRoundFinished * TAG_IN_ROUND + i]);
+ }
}
}
+ else
+ {
+ MessageBox.Show("The lyric has now completely been converted into a lrc!");
+ StringBuilder lyric = new StringBuilder();
+ for (int i = 0; i < lines.Length; i++)
+ {
+ lyric.Append(lines[i] + "\n");
+ }
+ lyric.Replace("\r", "");
+
+ string artist = LyricUtil.capatalizeString(m_artist);
+ string title = LyricUtil.capatalizeString(m_title);
+ string lyricAsString = lyric.ToString();
+
+ int lastLineShift = lyricAsString.LastIndexOf("\n");
+ lyricAsString = lyricAsString.Substring(0, lastLineShift);
+
+ LyricsItem item = new LyricsItem(artist, title, lyricAsString, "MP LRC-editor");
+ LyricsDB[DatabaseUtil.CorrectKeyFormat(artist, title)] = item;
+
+ string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, LyricsDBName);
+ using (FileStream fs = new FileStream(path, FileMode.Open))
+ {
+ BinaryFormatter bf = new BinaryFormatter();
+ LyricsDB.SetLastModified();
+ bf.Serialize(fs, LyricsDB);
+ fs.Close();
+ }
+ }
+
}
}
return true;
@@ -463,6 +501,8 @@
GUIControl.SetControlLabel(GetID, (int)LyricGUI_Controls.CONTROL_Lyric, m_LyricText);
GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(trackChangeHandler);
+
+ times = new ArrayList();
}
else if(selectedScreen == (int)MyLyricsSettings.Screen.LRC_EDITOR)
{
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-04-01 16:15:16 UTC (rev 272)
@@ -5,7 +5,7 @@
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BBB2DAE2-0D83-4B4B-85B6-D1B5A7E10039}</ProjectGuid>
- <OutputType>Library</OutputType>
+ <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyLyrics</RootNamespace>
<AssemblyName>MyLyrics</AssemblyName>
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-04-01 16:15:16 UTC (rev 272)
@@ -96,6 +96,10 @@
this.btSave = new MediaPortal.UserInterface.Controls.MPButton();
this.btClose = new MediaPortal.UserInterface.Controls.MPButton();
this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker();
+ this.mpGroupBox3 = new MediaPortal.UserInterface.Controls.MPGroupBox();
+ this.cbAutoFetch = new MediaPortal.UserInterface.Controls.MPCheckBox();
+ this.cbMoveSongFrom = new MediaPortal.UserInterface.Controls.MPCheckBox();
+ this.cbAutomaticUpdate = new MediaPortal.UserInterface.Controls.MPCheckBox();
this.tabControl.SuspendLayout();
this.tabPageSetup.SuspendLayout();
this.mpGroupBox2.SuspendLayout();
@@ -109,13 +113,14 @@
this.gbMessages.SuspendLayout();
this.gbProgress.SuspendLayout();
this.gbMusicDBSearchStats.SuspendLayout();
+ this.mpGroupBox3.SuspendLayout();
this.SuspendLayout();
//
// tabControl
//
this.tabControl.Controls.Add(this.tabPageLyricsDatabase);
+ this.tabControl.Controls.Add(this.tabPageDatabase);
this.tabControl.Controls.Add(this.tabPageSetup);
- this.tabControl.Controls.Add(this.tabPageDatabase);
this.tabControl.Location = new System.Drawing.Point(7, 12);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
@@ -135,6 +140,7 @@
//
// tabPageSetup
//
+ this.tabPageSetup.Controls.Add(this.mpGroupBox3);
this.tabPageSetup.Controls.Add(this.mpGroupBox2);
this.tabPageSetup.Controls.Add(this.gbLyricSites);
this.tabPageSetup.Location = new System.Drawing.Point(4, 22);
@@ -166,10 +172,10 @@
this.comboLyricsPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboLyricsPage.FormattingEnabled = true;
this.comboLyricsPage.Items.AddRange(new object[] {
- "Lyrics page (basic)",
- "Lyrics page (wide)",
- "LRC page (basic)",
- "LRC page (editor)"});
+ "Lyrics screen (basic)",
+ "Lyrics screen (wide)",
+ "LRC screen (basic)",
+ "LRC screen (editor)"});
this.comboLyricsPage.Location = new System.Drawing.Point(96, 58);
this.comboLyricsPage.Name = "comboLyricsPage";
this.comboLyricsPage.Size = new System.Drawing.Size(144, 21);
@@ -180,9 +186,9 @@
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.Size = new System.Drawing.Size(72, 13);
this.lbLyricsPage.TabIndex = 15;
- this.lbLyricsPage.Text = "Lyrics page:";
+ this.lbLyricsPage.Text = "Lyrics screen:";
//
// tbPluginName
//
@@ -211,7 +217,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, 109);
+ this.gbLyricSites.Location = new System.Drawing.Point(5, 207);
this.gbLyricSites.Name = "gbLyricSites";
this.gbLyricSites.Size = new System.Drawing.Size(538, 202);
this.gbLyricSites.TabIndex = 28;
@@ -845,6 +851,56 @@
this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted);
this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged);
//
+ // mpGroupBox3
+ //
+ this.mpGroupBox3.Controls.Add(this.cbAutomaticUpdate);
+ this.mpGroupBox3.Controls.Add(this.cbMoveSongFrom);
+ this.mpGroupBox3.Controls.Add(this.cbAutoFetch);
+ this.mpGroupBox3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.mpGroupBox3.Location = new System.Drawing.Point(5, 109);
+ this.mpGroupBox3.Name = "mpGroupBox3";
+ this.mpGroupBox3.Size = new System.Drawing.Size(538, 92);
+ this.mpGroupBox3.TabIndex = 30;
+ this.mpGroupBox3.TabStop = false;
+ this.mpGroupBox3.Text = "Fetch lyric dialog settings";
+ //
+ // cbAutoFetch
+ //
+ this.cbAutoFetch.AutoSize = true;
+ this.cbAutoFetch.Checked = true;
+ this.cbAutoFetch.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.cbAutoFetch.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.cbAutoFetch.Location = new System.Drawing.Point(16, 23);
+ this.cbAutoFetch.Name = "cbAutoFetch";
+ this.cbAutoFetch.Size = new System.Drawing.Size(119, 17);
+ this.cbAutoFetch.TabIndex = 6;
+ this.cbAutoFetch.Text = "Automatic fetch lyric";
+ this.cbAutoFetch.UseVisualStyleBackColor = true;
+ //
+ // cbMoveSongFrom
+ //
+ this.cbMoveSongFrom.AutoSize = true;
+ this.cbMoveSongFrom.Checked = true;
+ this.cbMoveSongFrom.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.cbMoveSongFrom.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.cbMoveSongFrom.Location = new System.Drawing.Point(16, 68);
+ this.cbMoveSongFrom.Name = "cbMoveSongFrom";
+ this.cbMoveSongFrom.Size = new System.Drawing.Size(341, 17);
+ this.cbMoveSongFrom.TabIndex = 7;
+ this.cbMoveSongFrom.Text = "Move lyrics from marked database to lyrics database when updated";
+ this.cbMoveSongFrom.UseVisualStyleBackColor = true;
+ //
+ // cbAutomaticUpdate
+ //
+ this.cbAutomaticUpdate.AutoSize = true;
+ this.cbAutomaticUpdate.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.cbAutomaticUpdate.Location = new System.Drawing.Point(16, 45);
+ this.cbAutomaticUpdate.Name = "cbAutomaticUpdate";
+ this.cbAutomaticUpdate.Size = new System.Drawing.Size(206, 17);
+ this.cbAutomaticUpdate.TabIndex = 8;
+ this.cbAutomaticUpdate.Text = "Automatic update when first lyric found";
+ this.cbAutomaticUpdate.UseVisualStyleBackColor = true;
+ //
// MyLyricsSetup
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -883,6 +939,8 @@
this.gbMessages.ResumeLayout(false);
this.gbProgress.ResumeLayout(false);
this.gbMusicDBSearchStats.ResumeLayout(false);
+ this.mpGroupBox3.ResumeLayout(false);
+ this.mpGroupBox3.PerformLayout();
this.ResumeLayout(false);
}
@@ -957,5 +1015,9 @@
private MediaPortal.UserInterface.Controls.MPCheckBox cbDisconsiderTitlesWithLyrics;
private MediaPortal.UserInterface.Controls.MPLabel lbLyricsPage;
private MediaPortal.UserInterface.Controls.MPComboBox comboLyricsPage;
+ private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox3;
+ internal MediaPortal.UserInterface.Controls.MPCheckBox cbAutoFetch;
+ internal MediaPortal.UserInterface.Controls.MPCheckBox cbMoveSongFrom;
+ internal MediaPortal.UserInterface.Controls.MPCheckBox cbAutomaticUpdate;
}
}
\ No newline at end of file
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-04-01 16:15:16 UTC (rev 272)
@@ -133,6 +133,10 @@
tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString());
tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics");
+ cbAutoFetch.Checked = xmlreader.GetValueAsBool("myLyrics", "automaticFetch", true);
+ cbAutomaticUpdate.Checked = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false);
+ cbMoveSongFrom.Checked = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true);
+
int xmlScreen = xmlreader.GetValueAsInt("myLyrics", "myLyricsScreen", (int)MyLyricsSettings.Screen.LYRICS_BASIC);
comboLyricsPage.SelectedIndex = xmlScreen;
@@ -319,6 +323,9 @@
xmlwriter.SetValue("myLyrics", "useLyricsOnDemand", cbLyricsOnDemand.Checked.ToString());
xmlwriter.SetValue("myLyrics", "useSeekLyrics", cbSeekLyrics.Checked.ToString());
xmlwriter.SetValue("myLyrics", "useHotLyrics", cbHotLyrics.Checked.ToString());
+ xmlwriter.SetValueAsBool("myLyrics", "automaticFetch", cbAutoFetch.Checked);
+ xmlwriter.SetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", cbAutomaticUpdate.Checked);
+ xmlwriter.SetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", cbMoveSongFrom.Checked);
int xmlScreen = comboLyricsPage.SelectedIndex;
xmlwriter.SetValue("myLyrics", "myLyricsScreen", xmlScreen);
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.resx 2007-04-01 16:15:16 UTC (rev 272)
@@ -118,9 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="bgWorkerSearch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>94, 17</value>
+ <value>6, 4</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>51</value>
+ <value>27</value>
</metadata>
</root>
\ No newline at end of file
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-04-01 16:15:16 UTC (rev 272)
@@ -135,7 +135,7 @@
// lbSource
//
this.lbSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbSource.Location = new System.Drawing.Point(386, 297);
+ this.lbSource.Location = new System.Drawing.Point(400, 297);
this.lbSource.Name = "lbSource";
this.lbSource.Size = new System.Drawing.Size(113, 15);
this.lbSource.TabIndex = 28;
@@ -167,7 +167,7 @@
//
this.lbLRCTest.AutoSize = true;
this.lbLRCTest.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbLRCTest.Location = new System.Drawing.Point(440, 313);
+ this.lbLRCTest.Location = new System.Drawing.Point(453, 313);
this.lbLRCTest.MaximumSize = new System.Drawing.Size(60, 13);
this.lbLRCTest.MinimumSize = new System.Drawing.Size(60, 13);
this.lbLRCTest.Name = "lbLRCTest";
@@ -235,7 +235,7 @@
// lbTitle
//
this.lbTitle.AutoSize = true;
- this.lbTitle.Location = new System.Drawing.Point(221, 53);
+ this.lbTitle.Location = new System.Drawing.Point(238, 53);
this.lbTitle.MaximumSize = new System.Drawing.Size(290, 26);
this.lbTitle.MinimumSize = new System.Drawing.Size(290, 26);
this.lbTitle.Name = "lbTitle";
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-04-01 16:15:16 UTC (rev 272)
@@ -167,7 +167,7 @@
treeView.Update();
}
- private void RemoveSong(string artist, string title)
+ public void RemoveSong(string artist, string title)
{
int artistIndex = treeView.Nodes.IndexOfKey(artist);
int titleIndex = treeView.Nodes[artistIndex].Nodes.IndexOfKey(title);
@@ -238,17 +238,20 @@
m_CurrentArtist = LyricUtil.capatalizeString(artist);
m_CurrentTitle = LyricUtil.capatalizeString(title);
- LyricsItem item = CurrentDB[DatabaseUtil.CorrectKeyFormat(m_CurrentArtist, m_CurrentTitle)];
- string lyricsText = item.Lyrics;
+ if (DatabaseUtil.IsTrackInLyricsDatabase(CurrentDB, m_CurrentArtist, m_CurrentTitle).Equals(DatabaseUtil.LYRIC_FOUND))
+ {
+ LyricsItem item = CurrentDB[DatabaseUtil.CorrectKeyFormat(m_CurrentArtist, m_CurrentTitle)];
+ string lyricsText = item.Lyrics;
- lyricsText = LyricsEngine.LyricUtil.ReturnEnvironmentNewLine(lyricsText);
+ lyricsText = LyricsEngine.LyricUtil.ReturnEnvironmentNewLine(lyricsText);
- m_OriginalLyric = lyricsText;
- tbLyrics.Text = m_OriginalLyric;
- tbLyrics.Enabled = true;
+ m_OriginalLyric = lyricsText;
+ tbLyrics.Text = m_OriginalLyric;
+ tbLyrics.Enabled = true;
- lbTitle.Text = "\"" + m_CurrentArtist + " - " + m_CurrentTitle + "\"";
- lbSource.Text = "(" + item.Source + ")";
+ lbTitle.Text = "\"" + m_CurrentArtist + " - " + m_CurrentTitle + "\"";
+ lbSource.Text = "(" + item.Source + ")";
+ }
}
}
// Selected an artist
@@ -662,7 +665,8 @@
}
}
- MyLyricsSetup_SearchTitleDialog std = new MyLyricsSetup_SearchTitleDialog(this, artist, title);
+
+ MyLyricsSetup_SearchTitleDialog std = new MyLyricsSetup_SearchTitleDialog(this, artist, title, CurrentDB.Equals(MyLyricsSettings.LyricsMarkedDB));
}
private void btSwitch_Click(object sender, EventArgs e)
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs 2007-04-01 16:15:16 UTC (rev 272)
@@ -50,6 +50,7 @@
this.cbLyricWiki = new MediaPortal.UserInterface.Controls.MPCheckBox();
this.btClose = new System.Windows.Forms.Button();
this.btUpdate = new System.Windows.Forms.Button();
+ this.btCancel = new System.Windows.Forms.Button();
this.gbSearchInfo.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
@@ -74,7 +75,7 @@
this.tbTitle.Location = new System.Drawing.Point(73, 53);
this.tbTitle.Name = "tbTitle";
this.tbTitle.Size = new System.Drawing.Size(344, 20);
- this.tbTitle.TabIndex = 3;
+ this.tbTitle.TabIndex = 2;
//
// lbTitle
//
@@ -103,10 +104,10 @@
//
// btFind
//
- this.btFind.Location = new System.Drawing.Point(342, 69);
+ this.btFind.Location = new System.Drawing.Point(281, 67);
this.btFind.Name = "btFind";
- this.btFind.Size = new System.Drawing.Size(75, 23);
- this.btFind.TabIndex = 4;
+ this.btFind.Size = new System.Drawing.Size(65, 23);
+ this.btFind.TabIndex = 3;
this.btFind.Text = "&Fetch";
this.btFind.UseVisualStyleBackColor = true;
this.btFind.Click += new System.EventHandler(this.btFind_Click);
@@ -174,6 +175,7 @@
//
// gbLyricSites
//
+ this.gbLyricSites.Controls.Add(this.btCancel);
this.gbLyricSites.Controls.Add(this.btFind);
this.gbLyricSites.Controls.Add(this.cbHotLyrics);
this.gbLyricSites.Controls.Add(this.cbSeekLyrics);
@@ -195,10 +197,10 @@
this.cbHotLyrics.Checked = true;
this.cbHotLyrics.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbHotLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
- this.cbHotLyrics.Location = new System.Drawing.Point(148, 21);
+ this.cbHotLyrics.Location = new System.Drawing.Point(146, 21);
this.cbHotLyrics.Name = "cbHotLyrics";
this.cbHotLyrics.Size = new System.Drawing.Size(71, 17);
- this.cbHotLyrics.TabIndex = 7;
+ this.cbHotLyrics.TabIndex = 14;
this.cbHotLyrics.Text = "Hot Lyrics";
this.cbHotLyrics.UseVisualStyleBackColor = true;
//
@@ -208,10 +210,10 @@
this.cbSeekLyrics.Checked = true;
this.cbSeekLyrics.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbSeekLyrics.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
- this.cbSeekLyrics.Location = new System.Drawing.Point(148, 43);
+ this.cbSeekLyrics.Location = new System.Drawing.Point(146, 43);
this.cbSeekLyrics.Name = "cbSeekLyrics";
this.cbSeekLyrics.Size = new System.Drawing.Size(79, 17);
- this.cbSeekLyrics.TabIndex = 6;
+ this.cbSeekLyrics.TabIndex = 15;
this.cbSeekLyrics.Text = "Seek Lyrics";
this.cbSeekLyrics.UseVisualStyleBackColor = true;
//
@@ -224,7 +226,7 @@
this.cbLyricsOnDemand.Location = new System.Drawing.Point(16, 43);
this.cbLyricsOnDemand.Name = "cbLyricsOnDemand";
this.cbLyricsOnDemand.Size = new System.Drawing.Size(108, 17);
- this.cbLyricsOnDemand.TabIndex = 5;
+ this.cbLyricsOnDemand.TabIndex = 12;
this.cbLyricsOnDemand.Text = "Lyrics OnDemand";
this.cbLyricsOnDemand.UseVisualStyleBackColor = true;
//
@@ -237,7 +239,7 @@
this.cbLyrics007.Location = new System.Drawing.Point(16, 66);
this.cbLyrics007.Name = "cbLyrics007";
this.cbLyrics007.Size = new System.Drawing.Size(72, 17);
- this.cbLyrics007.TabIndex = 4;
+ this.cbLyrics007.TabIndex = 13;
this.cbLyrics007.Text = "Lyrics 007";
this.cbLyrics007.UseVisualStyleBackColor = true;
//
@@ -247,10 +249,10 @@
this.cbEvilLabs.Checked = true;
this.cbEvilLabs.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbEvilLabs.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
- this.cbEvilLabs.Location = new System.Drawing.Point(148, 66);
+ this.cbEvilLabs.Location = new System.Drawing.Point(146, 66);
this.cbEvilLabs.Name = "cbEvilLabs";
this.cbEvilLabs.Size = new System.Drawing.Size(67, 17);
- this.cbEvilLabs.TabIndex = 3;
+ this.cbEvilLabs.TabIndex = 16;
this.cbEvilLabs.Text = "Evil Labs";
this.cbEvilLabs.UseVisualStyleBackColor = true;
//
@@ -263,7 +265,7 @@
this.cbLyricWiki.Location = new System.Drawing.Point(16, 21);
this.cbLyricWiki.Name = "cbLyricWiki";
this.cbLyricWiki.Size = new System.Drawing.Size(67, 17);
- this.cbLyricWiki.TabIndex = 2;
+ this.cbLyricWiki.TabIndex = 11;
this.cbLyricWiki.Text = "LyricWiki";
this.cbLyricWiki.UseVisualStyleBackColor = true;
//
@@ -288,6 +290,16 @@
this.btUpdate.UseVisualStyleBackColor = true;
this.btUpdate.Click += new System.EventHandler(this.btUpdate_Click);
//
+ // btCancel
+ //
+ this.btCancel.Location = new System.Drawing.Point(352, 67);
+ this.btCancel.Name = "btCancel";
+ this.btCancel.Size = new System.Drawing.Size(65, 23);
+ this.btCancel.TabIndex = 4;
+ this.btCancel.Text = "&Cancel";
+ this.btCancel.UseVisualStyleBackColor = true;
+ this.btCancel.Click += new System.EventHandler(this.btCancel_Click);
+ //
// MyLyricsSetup_SearchTitleDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -340,5 +352,6 @@
private System.Windows.Forms.ColumnHeader chLyric;
private System.Windows.Forms.Button btClose;
private System.Windows.Forms.Button btUpdate;
+ private System.Windows.Forms.Button btCancel;
}
}
\ No newline at end of file
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs 2007-04-01 08:44:30 UTC (rev 271)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs 2007-04-01 16:15:16 UTC (rev 272)
@@ -36,16 +36,21 @@
string originalArtist;
string originalTitle;
int counter;
+ bool automaticFetch = true;
+ bool automaticUpdate = true;
+ bool moveLyricFromMarkedDatabase = true;
+ bool markedDatabase;
List<string> sitesToSearch;
MyLyricsSetup_LyricsLibrary parent = null;
- public MyLyricsSetup_SearchTitleDialog(MyLyricsSetup_LyricsLibrary form, string artist, string title)
+ public MyLyricsSetup_SearchTitleDialog(MyLyricsSetup_LyricsLibrary form, string artist, string title, bool markedDatabase)
{
InitializeComponent();
this.parent = form;
+ this.markedDatabase = markedDatabase;
// initialize delegates
m_DelegateStringUpdate = new DelegateStringUpdate(this.updateStringMethod);
@@ -64,12 +69,32 @@
originalArtist = artist;
originalTitle = title;
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml"))
+ {
+ cbLyricWiki.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false;
+ cbEvilLabs.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false;
+ cbLyrics007.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false;
+ cbLyricsOnDemand.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false;
+ cbSeekLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false;
+ cbHotLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false;
+ automaticFetch = xmlreader.GetValueAsBool("myLyrics", "automaticFetch", true);
+ automaticUpdate = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false);
+ moveLyricFromMarkedDatabase = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true);
+ }
+
this.Show();
if (!artist.Equals("") && !title.Equals(""))
{
- fetchLyric(originalArtist, originalTitle);
- lvSearchResults.Focus();
+ if (automaticFetch)
+ {
+ fetchLyric(originalArtist, originalTitle);
+ lvSearchResults.Focus();
+ }
+ else
+ {
+ btFind.Focus();
+ }
}
else if (!artist.Equals(""))
{
@@ -84,11 +109,13 @@
private void lockGUI()
{
btFind.Enabled = false;
+ btCancel.Enabled = true;
}
private void openGUI()
{
btFind.Enabled = true;
+ btCancel.Enabled = false;
}
private void fetchLyric(string artist, string title)
@@ -126,7 +153,6 @@
sitesToSearch.Add("SeekLyrics");
}
-
lc = new LyricsController(this, m_EventStopThread, (string[])sitesToSearch.ToArray(), true);
ThreadStart job = delegate
@@ -143,19 +169,27 @@
private void stopSearch()
{
- if (lc != null)
+ Monitor.Enter(this);
+ try
{
- lc.finishThread(originalArtist, originalTitle, "", "");
- lc.Dispose();
- lc = null;
+ if (lc != null)
+ {
+ lc.finishThread(originalArtist, originalTitle, "", "");
+ lc.Dispose();
+ lc = null;
+ }
+ else
+ {
+ m_EventStopThread.Set();
+ ThreadFinishedMethod(originalArtist, originalTitle, "", "");
+ }
+
+ m_LyricControllerThread = null;
}
- else
+ finally
{
- m_EventStopThread.Set();
- ThreadFinishedMethod(originalArtist, originalTitle, "", "");
+ Monitor.Exit(this);
}
-
- m_LyricControllerThread = null;
}
private void btFind_Click(object sender, EventArgs e)
@@ -200,14 +234,17 @@
item.SubItems.Add("yes");
item.SubItems.Add(lyricStrings);
lvSearchResults.Items.Add(item);
+ lvSearchResults.Items[lvSearchResults.Items.Count - 1].Selected = true;
- if (++counter == sitesToSearch.Count)
+ if (automaticUpdate)
{
+ btUpdate_Click(null, null);
+ }
+ else if (++counter == sitesToSearch.Count)
+ {
stopSearch();
openGUI();
}
-
- lvSearchResults.Items[lvSearchResults.Items.Count - 1].Selected = true;
}
private void lyricNotFoundMethod(String artist, String title, String message, String site)
@@ -249,7 +286,7 @@
{
set
{
- this.Invoke(m_DelegateStatusUpdate, value);
+ //this.Invoke(m_DelegateStatusUpdate, value);
}
}
public Object[] LyricFound
@@ -317,11 +354,30 @@
ListViewItem item = lvSearchResults.Items[0];
string site = lvSearchResults.SelectedItems[0].Text;
string lyric = tbLyrics.Text;
- DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSetup_LyricsLibrary.CurrentDB, originalArtist, originalTitle, lyric, site);
- DatabaseUtil.SerializeDBs();
- parent.updateInfo();
+
+ if (markedDatabase && moveLyricFromMarkedDatabase)
+ {
+ parent.RemoveSong(originalArtist, originalTitle);
+ string key = DatabaseUtil.CorrectKeyFormat(originalArtist, originalTitle);
+ MyLyricsSettings.LyricsDB[key] = new LyricsItem(originalArtist, originalTitle, lyric, site);
+ DatabaseUtil.SerializeLyricDB();
+ parent.updateInfo();
+ }
+ else if (markedDatabase)
+ {
+ DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsMarkedDB, originalArtist, originalTitle, lyric, site);
+ DatabaseUtil.SerializeDBs();
+ parent.updateInfo();
+ parent.highlightSong(originalArtist, originalTitle, false);
+ }
+ else
+ {
+ DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsDB, originalArtist, originalTitle, lyric, site);
+ DatabaseUtil.SerializeDBs();
+ parent.updateInfo();
+ parent.highlightSong(originalArtist, originalTitle, false);
+ }
this.Close();
- parent.highlightSong(originalArtist, originalTitle, false);
}
}
@@ -329,5 +385,11 @@
{
btUpdate.PerformClick();
}
+
+ private void btCancel_Click(object sender, EventArgs e)
+ {
+ stopSearch();
+ openGUI();
+ }
}
}
\ No newline at end of file
Modified: trunk/plugins/MyLyrics/MyLyrics.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|