|
From: <sa...@us...> - 2007-03-07 16:03:36
|
Revision: 163
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=163&view=rev
Author: saamand
Date: 2007-03-07 08:03:32 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
Before new serialization structure
Modified Paths:
--------------
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs
Removed Paths:
-------------
trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj
Deleted: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-03-06 15:07:16 UTC (rev 162)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-03-07 16:03:32 UTC (rev 163)
@@ -1,129 +0,0 @@
-<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>MyLyrics.MyLyricsSetup_test</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="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="MyLyricsSetup_test.cs" />
- <Compile Include="MyLyricsUtil.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>
- </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>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\LRC\LRC.csproj">
- <Project>{1555695C-1274-46BD-97CB-CAC3A393522D}</Project>
- <Name>LRC</Name>
- </ProjectReference>
- <ProjectReference Include="..\LyricsEngine\LyricsEngine.csproj">
- <Project>{B0760CE8-086F-4301-9091-C9BE54F261FD}</Project>
- <Name>LyricsEngine</Name>
- </ProjectReference>
- </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
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-06 15:07:16 UTC (rev 162)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-07 16:03:32 UTC (rev 163)
@@ -31,6 +31,7 @@
this.tabControl = new MediaPortal.UserInterface.Controls.MPTabControl();
this.tabPageLyricsDatabase = new MediaPortal.UserInterface.Controls.MPTabPage();
this.tabPageSetup = new MediaPortal.UserInterface.Controls.MPTabPage();
+ this.tbNote = new MediaPortal.UserInterface.Controls.MPLabel();
this.gbLyricSites = new MediaPortal.UserInterface.Controls.MPGroupBox();
this.cbHotLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox();
this.cbSeekLyrics = new MediaPortal.UserInterface.Controls.MPCheckBox();
@@ -44,6 +45,7 @@
this.btCancel = new MediaPortal.UserInterface.Controls.MPButton();
this.mpLabel3 = new MediaPortal.UserInterface.Controls.MPLabel();
this.gbGenerel = new MediaPortal.UserInterface.Controls.MPGroupBox();
+ this.cbSearchOnlyForMarkedSongs = new MediaPortal.UserInterface.Controls.MPCheckBox();
this.cbDisregardSongWithLyricInTag = new MediaPortal.UserInterface.Controls.MPCheckBox();
this.cbDisregardVariousArtist = new MediaPortal.UserInterface.Controls.MPCheckBox();
this.cbDisregardSongsWithNoLyric = new MediaPortal.UserInterface.Controls.MPCheckBox();
@@ -82,7 +84,6 @@
this.btSave = new MediaPortal.UserInterface.Controls.MPButton();
this.btClose = new MediaPortal.UserInterface.Controls.MPButton();
this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker();
- this.tbNote = new MediaPortal.UserInterface.Controls.MPLabel();
this.tabControl.SuspendLayout();
this.tabPageSetup.SuspendLayout();
this.gbLyricSites.SuspendLayout();
@@ -127,6 +128,15 @@
this.tabPageSetup.Text = "General setup";
this.tabPageSetup.UseVisualStyleBackColor = true;
//
+ // tbNote
+ //
+ this.tbNote.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.tbNote.Location = new System.Drawing.Point(17, 111);
+ this.tbNote.Name = "tbNote";
+ this.tbNote.Size = new System.Drawing.Size(377, 18);
+ this.tbNote.TabIndex = 19;
+ this.tbNote.Text = "(Seek Lyrics and Evil Labs are currently disabled due to instable servers)";
+ //
// gbLyricSites
//
this.gbLyricSites.AutoSize = true;
@@ -283,6 +293,7 @@
//
// gbGenerel
//
+ this.gbGenerel.Controls.Add(this.cbSearchOnlyForMarkedSongs);
this.gbGenerel.Controls.Add(this.cbDisregardSongWithLyricInTag);
this.gbGenerel.Controls.Add(this.cbDisregardVariousArtist);
this.gbGenerel.Controls.Add(this.cbDisregardSongsWithNoLyric);
@@ -299,6 +310,18 @@
this.gbGenerel.TabStop = false;
this.gbGenerel.Text = "Music database search setup";
//
+ // cbSearchOnlyForMarkedSongs
+ //
+ this.cbSearchOnlyForMarkedSongs.AutoSize = true;
+ this.cbSearchOnlyForMarkedSongs.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.cbSearchOnlyForMarkedSongs.Location = new System.Drawing.Point(245, 91);
+ this.cbSearchOnlyForMarkedSongs.Name = "cbSearchOnlyForMarkedSongs";
+ this.cbSearchOnlyForMarkedSongs.Size = new System.Drawing.Size(232, 17);
+ this.cbSearchOnlyForMarkedSongs.TabIndex = 19;
+ this.cbSearchOnlyForMarkedSongs.Text = "Search for marked songs ONLY (only batch)";
+ this.cbSearchOnlyForMarkedSongs.UseVisualStyleBackColor = true;
+ this.cbSearchOnlyForMarkedSongs.CheckedChanged += new System.EventHandler(this.cbSearchOnlyForMarkedSongs_CheckedChanged);
+ //
// cbDisregardSongWithLyricInTag
//
this.cbDisregardSongWithLyricInTag.AutoSize = true;
@@ -665,20 +688,11 @@
this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted);
this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged);
//
- // 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(17, 111);
- this.tbNote.Name = "tbNote";
- this.tbNote.Size = new System.Drawing.Size(377, 18);
- this.tbNote.TabIndex = 19;
- this.tbNote.Text = "(Seek Lyrics and Evil Labs are currently disabled due to instable servers)";
- //
// MyLyricsSetup
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(541, 539);
+ this.ClientSize = new System.Drawing.Size(539, 542);
this.ControlBox = false;
this.Controls.Add(this.btClose);
this.Controls.Add(this.tabControl);
@@ -764,5 +778,6 @@
private MediaPortal.UserInterface.Controls.MPLabel lbTimeElapsed;
internal MediaPortal.UserInterface.Controls.MPCheckBox cbHotLyrics;
private MediaPortal.UserInterface.Controls.MPLabel tbNote;
+ private MediaPortal.UserInterface.Controls.MPCheckBox cbSearchOnlyForMarkedSongs;
}
}
\ No newline at end of file
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-06 15:07:16 UTC (rev 162)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-07 16:03:32 UTC (rev 163)
@@ -74,6 +74,9 @@
bool m_DisregardKnownLyric = true;
bool m_MarkSongsWhenNoLyricFound = true;
bool m_DisregardMarkedLyric = true;
+ bool m_DisregardSongWithLyricInTag = true;
+ bool m_DisregardVariousArtist = true;
+ bool m_SearchOnlyMarkedSongs = false;
int m_noOfCurrentlySearches = 0;
const int m_NoOfCurrentSearchesAllowed = 4;
@@ -289,9 +292,12 @@
m_Limit = int.Parse(lbLimit.Text);
- m_DisregardKnownLyric = cbDisconsiderTitlesWithLyrics.Checked;
- m_MarkSongsWhenNoLyricFound = cbMarkSongsWithNoLyrics.Checked;
- m_DisregardMarkedLyric = cbDisregardSongsWithNoLyric.Checked;
+ m_DisregardKnownLyric = cbDisconsiderTitlesWithLyrics.Enabled && cbDisconsiderTitlesWithLyrics.Checked;
+ m_MarkSongsWhenNoLyricFound = cbMarkSongsWithNoLyrics.Enabled && cbMarkSongsWithNoLyrics.Checked;
+ m_DisregardMarkedLyric = cbDisregardSongsWithNoLyric.Enabled && cbDisregardSongsWithNoLyric.Checked;
+ m_DisregardSongWithLyricInTag = cbDisregardSongWithLyricInTag.Enabled && cbDisregardSongWithLyricInTag.Checked;
+ m_DisregardVariousArtist = cbDisregardVariousArtist.Enabled && cbDisregardVariousArtist.Checked;
+ m_SearchOnlyMarkedSongs = cbSearchOnlyForMarkedSongs.Enabled && cbSearchOnlyForMarkedSongs.Checked;
m_SongsNotKnown = 0;
m_SongsWithLyric = 0;
@@ -355,6 +361,14 @@
xmlwriter.SetValue(capArtist, capTitle, m_LyricText);
}
+ if (MyLyricsUtil.isTrackInLyricsMarkedDatabase(capArtist, capTitle).Equals(MyLyricsUtil.LYRIC_MARKED))
+ {
+ using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("LyricsToFetch.xml", false))
+ {
+ xmlwriter.RemoveEntry(capArtist, capTitle);
+ }
+ }
+
StreamReader sr = File.OpenText(logFullFileName);
log = sr.ReadToEnd();
sr.Close();
@@ -380,7 +394,7 @@
string capTitle = LyricUtil.capatalizeString(title);
if (m_MarkSongsWhenNoLyricFound)
{
- using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("Lyrics.xml", false))
+ using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("LyricsToFetch.xml", false))
{
xmlwriter.SetValue(capArtist, capTitle, MyLyricsUtil.MARK);
}
@@ -495,68 +509,121 @@
#region 1. Sorting song
lyricConfigInfosQueue = new Queue();
- MusicDatabase dbs = new MusicDatabase();
- dbs.GetArtists(ref artists);
+ if (m_SearchOnlyMarkedSongs == false)
+ {
+ MusicDatabase dbs = new MusicDatabase();
- m_noOfArtistsToSearch = artists.Count;
+ dbs.GetArtists(ref artists);
- for (int albumIndex = 0; albumIndex < artists.Count; albumIndex++)
- {
- string currentArtist = (string)artists[albumIndex];
- dbs.GetSongsByArtist(currentArtist, ref songs);
+ m_noOfArtistsToSearch = artists.Count;
- for (int i = 0; i < songs.Count; i++)
+ for (int albumIndex = 0; albumIndex < artists.Count; albumIndex++)
{
- // if song isn't known in lyric database the progressbar should not be incremented
- int songNotKnown = -1;
- Song song = (Song)songs[i];
+ string currentArtist = (string)artists[albumIndex];
+ dbs.GetSongsByArtist(currentArtist, ref songs);
- /* Don't include song if one of the following is true
- * 1. The artist isn't known (MP issue - should be deleted?)
- * 2. Various artister should not be considered and the artist is "various artist"
- * 3. Song with a lyric in the tag should not be considered and the music tag has an lyrictext included */
+ for (int i = 0; i < songs.Count; i++)
+ {
+ // if song isn't known in lyric database the progressbar should not be incremented
+ int songNotKnown = -1;
+ Song song = (Song)songs[i];
- MusicTag tag = null;
+ /* Don't include song if one of the following is true
+ * 1. The artist isn't known (MP issue - should be deleted?)
+ * 2. Various artister should not be considered and the artist is "various artist"
+ * 3. Song with a lyric in the tag should not be considered and the music tag has an lyrictext included */
- if (song.Artist.Equals("unknown")
- || (cbDisregardVariousArtist.Checked && (song.Artist.ToLower().Equals("various artists") || song.Artist.ToLower().Equals("diverse kunstnere")))
- || (cbDisregardSongWithLyricInTag.Checked && ((tag = MediaPortal.TagReader.TagReader.ReadTag(song.FileName)) != null) && tag.Lyrics.Equals("") == false))
- {
- m_DisregardedSongs += 1;
- }
- else
- {
- int status = MyLyricsUtil.isTrackInLyricsDatabase(song.Artist, song.Title);
+ MusicTag tag = null;
- if (!m_DisregardKnownLyric && status.Equals(MyLyricsUtil.LYRIC_FOUND)
- || !m_DisregardMarkedLyric && status.Equals(MyLyricsUtil.LYRIC_MARKED)
- || status.Equals(MyLyricsUtil.LYRIC_NOT_FOUND))
+ if (song.Artist.Equals("unknown")
+ || (m_DisregardVariousArtist && (song.Artist.ToLower().Equals("various artists") || song.Artist.ToLower().Equals("diverse kunstnere")))
+ || (m_DisregardSongWithLyricInTag && ((tag = MediaPortal.TagReader.TagReader.ReadTag(song.FileName)) != null) && tag.Lyrics.Equals("") == false))
{
+ m_DisregardedSongs += 1;
+ }
+ else
+ {
+ int status = MyLyricsUtil.isTrackInLyricsDatabase(song.Artist, song.Title);
+ bool isTrackInLyricsMarkedDatabase = true;
- songNotKnown = 1;
- if (++m_SongsNotKnown > m_Limit)
+ if (!m_DisregardKnownLyric && status.Equals(MyLyricsUtil.LYRIC_FOUND)
+ || (!m_DisregardMarkedLyric && ((isTrackInLyricsMarkedDatabase = MyLyricsUtil.isTrackInLyricsMarkedDatabase(song.Artist, song.Title).Equals(MyLyricsUtil.LYRIC_MARKED)) || status.Equals(MyLyricsUtil.LYRIC_MARKED)))
+ || (status.Equals(MyLyricsUtil.LYRIC_NOT_FOUND) && !MyLyricsUtil.isTrackInLyricsMarkedDatabase(song.Artist, song.Title).Equals(MyLyricsUtil.LYRIC_MARKED)))
{
- songNotKnown = 0;
- bgWorkerSearch.ReportProgress(songNotKnown);
- goto startSearch;
+
+ songNotKnown = 1;
+ if (++m_SongsNotKnown > m_Limit)
+ {
+ songNotKnown = 0;
+ bgWorkerSearch.ReportProgress(songNotKnown);
+ goto startSearch;
+ }
+
+ string[] lyricId = new string[2] { song.Artist, song.Title };
+ lyricConfigInfosQueue.Enqueue(lyricId);
}
+ else if (status.Equals(MyLyricsUtil.LYRIC_FOUND))
+ {
+ m_SongsWithLyric += 1;
+ }
+ else //if (status.Equals(MyLyricsUtil.LYRIC_MARKED))
+ {
+ m_SongsWithMark += 1;
+ }
+ }
+ m_SongsToSearch = lyricConfigInfosQueue.Count;
+ bgWorkerSearch.ReportProgress(songNotKnown);
+ }
+ }
+ }
+ else
+ {
+ XmlTextReader tr = null;
+ try
+ {
+ tr = new XmlTextReader("LyricsToFetch.xml");
- string[] lyricId = new string[2] { song.Artist, song.Title };
- lyricConfigInfosQueue.Enqueue(lyricId);
- }
- else if (status.Equals(MyLyricsUtil.LYRIC_FOUND))
+ string currentArtist = "";
+ string currentTitle = "";
+ while (tr.Read())
+ {
+ switch (tr.Name)
{
- m_SongsWithLyric += 1;
+ case "section":
+ if (tr.AttributeCount == 1)
+ {
+ currentArtist = tr.GetAttribute(0);
+ }
+ break;
+ case "entry":
+ if (tr.AttributeCount == 1)
+ {
+ currentTitle = tr.GetAttribute(0);
+ string currentLyrics = tr.Value;
+
+ if (++m_SongsNotKnown > m_Limit)
+ {
+ bgWorkerSearch.ReportProgress(-1);
+ goto startSearch;
+ }
+
+ string[] lyricId = new string[2] { currentArtist, currentTitle };
+ lyricConfigInfosQueue.Enqueue(lyricId);
+ }
+ break;
}
- else //if (status.Equals(MyLyricsUtil.LYRIC_MARKED))
- {
- m_SongsWithMark += 1;
- }
+
}
- m_SongsToSearch = lyricConfigInfosQueue.Count;
- bgWorkerSearch.ReportProgress(songNotKnown);
+
}
+ catch { ;}
+ finally
+ {
+ tr.Close();
+ }
+ //m_SongsToSearch = lyricConfigInfosQueue.Count;
+ //bgWorkerSearch.ReportProgress(songNotKnown);
}
startSearch:
@@ -663,5 +730,25 @@
lbTimer.Text = (hour < 10 ? "0" + hour.ToString() : hour.ToString()) + ":" + (min < 10 ? "0" + min.ToString() : min.ToString()) + "." + (sec < 10 ? "0" + sec.ToString() : sec.ToString());
}
+
+ private void cbSearchOnlyForMarkedSongs_CheckedChanged(object sender, EventArgs e)
+ {
+ if (cbSearchOnlyForMarkedSongs.Checked)
+ {
+ cbDisconsiderTitlesWithLyrics.Enabled = false;
+ cbDisregardSongsWithNoLyric.Enabled = false;
+ cbDisregardSongWithLyricInTag.Enabled = false;
+ cbDisregardVariousArtist.Enabled = false;
+ cbMarkSongsWithNoLyrics.Enabled = false;
+ }
+ else
+ {
+ cbDisconsiderTitlesWithLyrics.Enabled = true;
+ cbDisregardSongsWithNoLyric.Enabled = true;
+ cbDisregardSongWithLyricInTag.Enabled = true;
+ cbDisregardVariousArtist.Enabled = true;
+ cbMarkSongsWithNoLyrics.Enabled = true;
+ }
+ }
}
}
\ 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-03-06 15:07:16 UTC (rev 162)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.Designer.cs 2007-03-07 16:03:32 UTC (rev 163)
@@ -20,6 +20,8 @@
this.btDelete = new System.Windows.Forms.Button();
this.btAdd = new System.Windows.Forms.Button();
this.gbLibrary = new MediaPortal.UserInterface.Controls.MPGroupBox();
+ this.comboDatabase = new MediaPortal.UserInterface.Controls.MPComboBox();
+ this.lbDatabase = new MediaPortal.UserInterface.Controls.MPLabel();
this.lbTestSecondsLeft = new System.Windows.Forms.Label();
this.btImportLRC = new MediaPortal.UserInterface.Controls.MPButton();
this.lbSongs2 = new MediaPortal.UserInterface.Controls.MPLabel();
@@ -30,6 +32,7 @@
this.lbArtists = new MediaPortal.UserInterface.Controls.MPLabel();
this.treeView = new System.Windows.Forms.TreeView();
this.gbResetDatabase = new MediaPortal.UserInterface.Controls.MPGroupBox();
+ this.button1 = new System.Windows.Forms.Button();
this.btResetDatabase = new System.Windows.Forms.Button();
this.lbResetDatabase = new MediaPortal.UserInterface.Controls.MPLabel();
this.openFileDialog2 = new System.Windows.Forms.OpenFileDialog();
@@ -40,7 +43,7 @@
// btSave
//
this.btSave.Enabled = false;
- this.btSave.Location = new System.Drawing.Point(218, 275);
+ this.btSave.Location = new System.Drawing.Point(218, 301);
this.btSave.Name = "btSave";
this.btSave.Size = new System.Drawing.Size(75, 23);
this.btSave.TabIndex = 6;
@@ -51,7 +54,7 @@
// lbTitle
//
this.lbTitle.AutoSize = true;
- this.lbTitle.Location = new System.Drawing.Point(215, 40);
+ this.lbTitle.Location = new System.Drawing.Point(215, 66);
this.lbTitle.MaximumSize = new System.Drawing.Size(275, 13);
this.lbTitle.MinimumSize = new System.Drawing.Size(275, 13);
this.lbTitle.Name = "lbTitle";
@@ -68,7 +71,7 @@
//
// btDelete
//
- this.btDelete.Location = new System.Drawing.Point(95, 275);
+ this.btDelete.Location = new System.Drawing.Point(95, 301);
this.btDelete.Name = "btDelete";
this.btDelete.Size = new System.Drawing.Size(75, 23);
this.btDelete.TabIndex = 3;
@@ -78,7 +81,7 @@
//
// btAdd
//
- this.btAdd.Location = new System.Drawing.Point(14, 275);
+ this.btAdd.Location = new System.Drawing.Point(14, 301);
this.btAdd.Name = "btAdd";
this.btAdd.Size = new System.Drawing.Size(75, 23);
this.btAdd.TabIndex = 2;
@@ -88,6 +91,8 @@
//
// gbLibrary
//
+ this.gbLibrary.Controls.Add(this.comboDatabase);
+ this.gbLibrary.Controls.Add(this.lbDatabase);
this.gbLibrary.Controls.Add(this.lbTestSecondsLeft);
this.gbLibrary.Controls.Add(this.btImportLRC);
this.gbLibrary.Controls.Add(this.lbSongs2);
@@ -104,15 +109,37 @@
this.gbLibrary.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.gbLibrary.Location = new System.Drawing.Point(3, 3);
this.gbLibrary.Name = "gbLibrary";
- this.gbLibrary.Size = new System.Drawing.Size(515, 336);
+ this.gbLibrary.Size = new System.Drawing.Size(515, 362);
this.gbLibrary.TabIndex = 8;
this.gbLibrary.TabStop = false;
this.gbLibrary.Text = "Editor";
//
+ // comboDatabase
+ //
+ this.comboDatabase.BorderColor = System.Drawing.Color.Empty;
+ this.comboDatabase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboDatabase.FormattingEnabled = true;
+ this.comboDatabase.Items.AddRange(new object[] {
+ "Lyrics database",
+ "LyricsToFetct database"});
+ this.comboDatabase.Location = new System.Drawing.Point(85, 15);
+ this.comboDatabase.Name = "comboDatabase";
+ this.comboDatabase.Size = new System.Drawing.Size(144, 21);
+ this.comboDatabase.TabIndex = 27;
+ this.comboDatabase.SelectedIndexChanged += new System.EventHandler(this.comboDatabase_SelectedIndexChanged);
+ //
+ // lbDatabase
+ //
+ this.lbDatabase.Location = new System.Drawing.Point(11, 18);
+ this.lbDatabase.Name = "lbDatabase";
+ this.lbDatabase.Size = new System.Drawing.Size(60, 26);
+ this.lbDatabase.TabIndex = 26;
+ this.lbDatabase.Text = "Database:";
+ //
// lbTestSecondsLeft
//
this.lbTestSecondsLeft.AutoSize = true;
- this.lbTestSecondsLeft.Location = new System.Drawing.Point(215, 309);
+ this.lbTestSecondsLeft.Location = new System.Drawing.Point(215, 335);
this.lbTestSecondsLeft.Name = "lbTestSecondsLeft";
this.lbTestSecondsLeft.Size = new System.Drawing.Size(93, 13);
this.lbTestSecondsLeft.TabIndex = 25;
@@ -121,7 +148,7 @@
//
// btImportLRC
//
- this.btImportLRC.Location = new System.Drawing.Point(95, 304);
+ this.btImportLRC.Location = new System.Drawing.Point(95, 330);
this.btImportLRC.Name = "btImportLRC";
this.btImportLRC.Size = new System.Drawing.Size(75, 23);
this.btImportLRC.TabIndex = 24;
@@ -131,7 +158,7 @@
//
// lbSongs2
//
- this.lbSongs2.Location = new System.Drawing.Point(92, 33);
+ this.lbSongs2.Location = new System.Drawing.Point(82, 59);
this.lbSongs2.Name = "lbSongs2";
this.lbSongs2.Size = new System.Drawing.Size(65, 15);
this.lbSongs2.TabIndex = 23;
@@ -142,7 +169,7 @@
this.tbLyrics.AllowDrop = true;
this.tbLyrics.BorderColor = System.Drawing.Color.Empty;
this.tbLyrics.Enabled = false;
- this.tbLyrics.Location = new System.Drawing.Point(218, 55);
+ this.tbLyrics.Location = new System.Drawing.Point(218, 81);
this.tbLyrics.Multiline = true;
this.tbLyrics.Name = "tbLyrics";
this.tbLyrics.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
@@ -152,7 +179,7 @@
//
// lbSongs
//
- this.lbSongs.Location = new System.Drawing.Point(11, 33);
+ this.lbSongs.Location = new System.Drawing.Point(11, 59);
this.lbSongs.Name = "lbSongs";
this.lbSongs.Size = new System.Drawing.Size(60, 15);
this.lbSongs.TabIndex = 22;
@@ -160,7 +187,7 @@
//
// btImportSingle
//
- this.btImportSingle.Location = new System.Drawing.Point(14, 304);
+ this.btImportSingle.Location = new System.Drawing.Point(14, 330);
this.btImportSingle.Name = "btImportSingle";
this.btImportSingle.Size = new System.Drawing.Size(75, 23);
this.btImportSingle.TabIndex = 4;
@@ -170,7 +197,7 @@
//
// lbArtists2
//
- this.lbArtists2.Location = new System.Drawing.Point(92, 18);
+ this.lbArtists2.Location = new System.Drawing.Point(82, 44);
this.lbArtists2.Name = "lbArtists2";
this.lbArtists2.Size = new System.Drawing.Size(65, 15);
this.lbArtists2.TabIndex = 21;
@@ -178,7 +205,7 @@
//
// lbArtists
//
- this.lbArtists.Location = new System.Drawing.Point(11, 18);
+ this.lbArtists.Location = new System.Drawing.Point(11, 44);
this.lbArtists.Name = "lbArtists";
this.lbArtists.Size = new System.Drawing.Size(60, 15);
this.lbArtists.TabIndex = 20;
@@ -186,7 +213,7 @@
//
// treeView
//
- this.treeView.Location = new System.Drawing.Point(14, 55);
+ this.treeView.Location = new System.Drawing.Point(14, 81);
this.treeView.Name = "treeView";
this.treeView.Size = new System.Drawing.Size(200, 213);
this.treeView.TabIndex = 1;
@@ -194,33 +221,45 @@
//
// gbResetDatabase
//
+ this.gbResetDatabase.Controls.Add(this.button1);
this.gbResetDatabase.Controls.Add(this.btResetDatabase);
this.gbResetDatabase.Controls.Add(this.lbResetDatabase);
this.gbResetDatabase.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
- this.gbResetDatabase.Location = new System.Drawing.Point(3, 345);
+ this.gbResetDatabase.Location = new System.Drawing.Point(3, 371);
this.gbResetDatabase.Name = "gbResetDatabase";
- this.gbResetDatabase.Size = new System.Drawing.Size(515, 68);
+ this.gbResetDatabase.Size = new System.Drawing.Size(515, 76);
this.gbResetDatabase.TabIndex = 11;
this.gbResetDatabase.TabStop = false;
this.gbResetDatabase.Text = "Reset database";
//
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(309, 45);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(181, 23);
+ this.button1.TabIndex = 11;
+ this.button1.Text = "Reset LyricsToFetch database";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
// btResetDatabase
//
- this.btResetDatabase.Location = new System.Drawing.Point(387, 32);
+ this.btResetDatabase.Location = new System.Drawing.Point(309, 16);
this.btResetDatabase.Name = "btResetDatabase";
- this.btResetDatabase.Size = new System.Drawing.Size(114, 23);
- this.btResetDatabase.TabIndex = 7;
- this.btResetDatabase.Text = "&Reset database";
+ this.btResetDatabase.Size = new System.Drawing.Size(181, 23);
+ this.btResetDatabase.TabIndex = 10;
+ this.btResetDatabase.Text = "Reset Lyrics database";
this.btResetDatabase.UseVisualStyleBackColor = true;
this.btResetDatabase.Click += new System.EventHandler(this.btResetDatabase_Click);
//
// lbResetDatabase
//
- this.lbResetDatabase.Location = new System.Drawing.Point(11, 23);
+ this.lbResetDatabase.Location = new System.Drawing.Point(11, 22);
this.lbResetDatabase.Name = "lbResetDatabase";
- this.lbResetDatabase.Size = new System.Drawing.Size(370, 32);
+ this.lbResetDatabase.Size = new System.Drawing.Size(282, 41);
this.lbResetDatabase.TabIndex = 9;
- this.lbResetDatabase.Text = "Reset the lyrics database.\r\nNOTICE: all lyrics in database will be deleted.";
+ this.lbResetDatabase.Text = "Reset the \"Lyrics\" and/or \"LyricsToFetch\" database.\r\n\r\nAll data in each database" +
+ " that is reset is lost for ever";
//
// openFileDialog2
//
@@ -252,7 +291,6 @@
private MediaPortal.UserInterface.Controls.MPTextBox tbLyrics;
private System.Windows.Forms.TreeView treeView;
private MediaPortal.UserInterface.Controls.MPGroupBox gbResetDatabase;
- private MediaPortal.UserInterface.Controls.MPLabel lbResetDatabase;
private MediaPortal.UserInterface.Controls.MPLabel lbSongs;
private MediaPortal.UserInterface.Controls.MPLabel lbArtists;
internal MediaPortal.UserInterface.Controls.MPLabel lbArtists2;
@@ -261,9 +299,13 @@
internal System.Windows.Forms.Button btDelete;
internal System.Windows.Forms.Button btAdd;
internal MediaPortal.UserInterface.Controls.MPButton btImportSingle;
- internal System.Windows.Forms.Button btResetDatabase;
internal MediaPortal.UserInterface.Controls.MPButton btImportLRC;
private System.Windows.Forms.OpenFileDialog openFileDialog2;
private System.Windows.Forms.Label lbTestSecondsLeft;
+ private MediaPortal.UserInterface.Controls.MPComboBox comboDatabase;
+ private MediaPortal.UserInterface.Controls.MPLabel lbDatabase;
+ internal System.Windows.Forms.Button button1;
+ internal System.Windows.Forms.Button btResetDatabase;
+ private MediaPortal.UserInterface.Controls.MPLabel lbResetDatabase;
}
}
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-06 15:07:16 UTC (rev 162)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_LyricsLibrary.cs 2007-03-07 16:03:32 UTC (rev 163)
@@ -42,11 +42,14 @@
string nextLineToShow;
int lineCounter;
const int SHIFT_WHEN_HIT = 15;
+ string currentDatabase = "";
public MyLyricsSetup_LyricsLibrary(Form form)
{
this.m_Form = form;
InitializeComponent();
+ currentDatabase = "Lyrics.xml";
+ comboDatabase.SelectedIndex = 0;
updateLyricsTree();
}
@@ -57,6 +60,10 @@
{
MyLyricsUtil.createLyricDatabase();
}
+ if (!System.IO.File.Exists("LyricsToFetch.xml"))
+ {
+ MyLyricsUtil.createLyricToFetchDatabase();
+ }
// catch error when treeView suddenly is disposed due to application shutdown
try
@@ -65,7 +72,7 @@
m_NoOfArtists = 0;
m_NoOfTitles = 0;
- XmlTextReader tr = new XmlTextReader("Lyrics.xml");
+ XmlTextReader tr = new XmlTextReader(currentDatabase);
string currentArtist = "";
string currentTitle = "";
@@ -84,7 +91,6 @@
if (tr.AttributeCount == 1)
{
currentTitle = tr.GetAttribute(0);
- string currentLyrics = tr.Value;
AddSong(currentArtist, currentTitle);
}
break;
@@ -105,7 +111,7 @@
private ArrayList getTitlesByArtist(string artist)
{
- XmlTextReader tr = new XmlTextReader("Lyrics.xml");
+ XmlTextReader tr = new XmlTextReader(currentDatabase);
ArrayList titles = new ArrayList();
while (tr.Read())
@@ -176,7 +182,7 @@
/// <param name="lyric"></param>
private void AddSong(string artist, string title, string lyric)
{
- using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("Lyrics.xml", false))
+ using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(currentDatabase, false))
{
xmlwriter.SetValue(artist, title, lyric);
}
@@ -201,7 +207,7 @@
--m_NoOfTitles;
// remove title from xml-file
- using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("Lyrics.xml", false))
+ using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(currentDatabase, false))
{
xmlwriter.RemoveEntry(artist, title);
}
@@ -228,7 +234,7 @@
m_CurrentTitle = LyricUtil.capatalizeString(title);
string lyricText = "";
- using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("Lyrics.xml", false))
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(currentDatabase, false))
{
lyricText = xmlreader.GetValueAsString(m_CurrentArtist, m_CurrentTitle, "");
}
@@ -268,7 +274,7 @@
m_CurrentTitle = LyricUtil.capatalizeString(title);
string lyricText = "";
- using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("Lyrics.xml", false))
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(currentDatabase, false))
{
lyricText = xmlreader.GetValueAsString(m_CurrentArtist, m_CurrentTitle, "");
}
@@ -321,7 +327,7 @@
private void btSave_Click(object sender, EventArgs e)
{
- using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("Lyrics.xml", false))
+ using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(currentDatabase, false))
{
xmlwriter.SetValue(LyricUtil.capatalizeString(m_CurrentArtist), LyricUtil.capatalizeString(m_CurrentTitle), tbLyrics.Text);
btSave.Enabled = false;
@@ -469,15 +475,6 @@
}
}
- private void btResetDatabase_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show(this, "Are you sure the lyrics database should be deleted?", "Delete lyrics database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
- {
- MyLyricsUtil.createLyricDatabase();
- updateLyricsTree();
- updateInfo();
- }
- }
private void btUpgradeDatabase_Click(object sender, EventArgs e)
{
@@ -624,5 +621,44 @@
timer.Dispose();
}
}
+
+ private void comboDatabase_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (comboDatabase.SelectedIndex == 0)
+ {
+ currentDatabase = "Lyrics.xml";
+ updateLyricsTree();
+ }
+ else
+ {
+ currentDatabase = "LyricsToFetch.xml";
+ updateLyricsTree();
+ }
+ }
+
+ private void btResetDatabase_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show(this, "Are you sure the Lyrics database should be deleted?", "Delete Lyrics database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
+ {
+ MyLyricsUtil.createLyricDatabase();
+ currentDatabase = "Lyrics.xml";
+ comboDatabase.SelectedIndex = 0;
+ updateLyricsTree();
+ updateInfo();
+ }
+ }
+
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show(this, "Are you sure the LyricsToFetch database should be deleted?", "Delete LyricsToFetch database", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
+ {
+ MyLyricsUtil.createLyricToFetchDatabase();
+ currentDatabase = "LyricsToFetch.xml";
+ comboDatabase.SelectedIndex = 1;
+ updateLyricsTree();
+ updateInfo();
+ }
+ }
}
}
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs 2007-03-06 15:07:16 UTC (rev 162)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsUtil.cs 2007-03-07 16:03:32 UTC (rev 163)
@@ -42,6 +42,24 @@
return LYRIC_FOUND;
}
+ internal static int isTrackInLyricsMarkedDatabase(string artist, string title)
+ {
+ string lyricText = "";
+ try
+ {
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("LyricsToFetch.xml", false))
+ {
+ string capatalizedArtist = LyricUtil.capatalizeString(artist);
+ string capatalizedTitle = LyricUtil.capatalizeString(title);
+ lyricText = xmlreader.GetValue(capatalizedArtist, capatalizedTitle);
+ }
+ }
+ catch{;}
+ if (lyricText.Equals(MyLyricsUtil.MARK))
+ return LYRIC_MARKED;
+ return LYRIC_NOT_FOUND;
+ }
+
internal static void createLyricDatabase()
{
XmlTextWriter xmlWriter = new XmlTextWriter("Lyrics.xml", System.Text.Encoding.UTF8);
@@ -51,6 +69,15 @@
xmlWriter.Close();
}
+ internal static void createLyricToFetchDatabase()
+ {
+ XmlTextWriter xmlWriter = new XmlTextWriter("LyricsToFetch.xml", System.Text.Encoding.UTF8);
+ xmlWriter.Formatting = Formatting.Indented;
+ xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
+ xmlWriter.WriteStartElement("Lyrics");
+ xmlWriter.Close();
+ }
+
public static string LookUpLyricInDatabase(string artist, string title)
{
string lyricText;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|