) freedb submission

) proxy support in freedb/musicbrainz
) advanced settings
) bugfixes
This commit is contained in:
chudov
2010-05-09 07:01:47 +00:00
parent 057c892303
commit 4562034e5e
23 changed files with 871 additions and 421 deletions

View File

@@ -156,6 +156,12 @@ namespace CUEControls
AdjustControls();
}
protected override void OnGotFocus(EventArgs e)
{
base.OnGotFocus(e);
Invalidate(true);
}
protected override void OnDrawItem(DrawItemEventArgs e)
{
if (_drawMode != DrawMode.Normal)
@@ -250,7 +256,7 @@ namespace CUEControls
LinearGradientMode.Vertical);
Brush brBackground;
if (this.DropDownStyle == ComboBoxStyle.DropDownList)
brBackground = new LinearGradientBrush(pathInnerBorder.GetBounds(), BackColor, hovered ? Color.FromArgb(100, SystemColors.HotTrack) : foreColor, LinearGradientMode.Vertical);
brBackground = new LinearGradientBrush(pathInnerBorder.GetBounds(), BackColor, (hovered || Focused)? Color.FromArgb(100, SystemColors.HotTrack) : foreColor, LinearGradientMode.Vertical);
else
brBackground = new SolidBrush(BackColor);
Pen penInnerBorder = new Pen(brInnerBrush, 0);

View File

@@ -79,6 +79,12 @@
<Compile Include="frmCUERipper.Designer.cs">
<DependentUpon>frmCUERipper.cs</DependentUpon>
</Compile>
<Compile Include="frmFreedbSubmit.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmFreedbSubmit.Designer.cs">
<DependentUpon>frmFreedbSubmit.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmCUERipper.de-DE.resx">
@@ -91,6 +97,9 @@
<EmbeddedResource Include="frmCUERipper.ru-RU.resx">
<DependentUpon>frmCUERipper.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmFreedbSubmit.resx">
<DependentUpon>frmFreedbSubmit.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -224,6 +233,8 @@
<Content Include="Plugins\CUETools.Codecs.FlaCuda.dll" />
<Content Include="Plugins\CUETools.Codecs.FLAKE.dll" />
<Content Include="Plugins\CUETools.Ripper.SCSI.dll" />
<None Include="Properties\DataSources\frmFreedbSubmitData.datasource" />
<None Include="Resources\freedb16.png" />
<None Include="Resources\edit-list-order.png" />
<None Include="Resources\spellcheck.png" />
<None Include="Resources\users--arrow.png" />

View File

@@ -177,6 +177,13 @@ namespace CUERipper.Properties {
}
}
internal static System.Drawing.Bitmap freedb16 {
get {
object obj = ResourceManager.GetObject("freedb16", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Icon ipod_sound {
get {
object obj = ResourceManager.GetObject("ipod_sound", resourceCulture);

View File

@@ -123,15 +123,18 @@
<data name="LookingUpVia" xml:space="preserve">
<value>Looking up album via</value>
</data>
<data name="NoDrives" xml:space="preserve">
<value>No CD drives found</value>
</data>
<data name="FailedToLoadRipperModule" xml:space="preserve">
<value>Failed to load ripper module</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="flac" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\flac.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="ipod_sound" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ipod_sound.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="wave" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wave.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="tta" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\tta.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="PausedMessage" xml:space="preserve">
<value>Paused</value>
</data>
<data name="DoneRippingErrors" xml:space="preserve">
<value>Rip probably contains errors</value>
@@ -139,11 +142,11 @@
<data name="musicbrainz" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\musicbrainz.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DoneRipping" xml:space="preserve">
<value>Done ripping</value>
<data name="freedb" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\freedb.gif;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DoneRippingRepair" xml:space="preserve">
<value>You can try to repair it using CUETools</value>
<data name="arok" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\arok.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cdrepair" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cdrepair.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -157,14 +160,11 @@
<data name="ogg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ogg.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DetectingDrives" xml:space="preserve">
<value>Detecting drives</value>
<data name="NoDrives" xml:space="preserve">
<value>No CD drives found</value>
</data>
<data name="ape" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ape.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ipod_sound" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ipod_sound.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="tag-label" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\tag-label.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="wv" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wv.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -172,37 +172,40 @@
<data name="accuraterip16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\accuraterip_16.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="freedb" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\freedb.gif;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="arrow-circle-double" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow-circle-double.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="spellcheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\spellcheck.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="PausedMessage" xml:space="preserve">
<value>Paused</value>
<data name="ape" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ape.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mp3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mp3.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="arok" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\arok.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="spellcheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\spellcheck.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="tta" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\tta.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="DoneRippingRepair" xml:space="preserve">
<value>You can try to repair it using CUETools</value>
</data>
<data name="wave" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wave.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="DoneRipping" xml:space="preserve">
<value>Done ripping</value>
</data>
<data name="arrow-circle-double" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow-circle-double.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="DetectingDrives" xml:space="preserve">
<value>Detecting drives</value>
</data>
<data name="FailedToLoadRipperModule" xml:space="preserve">
<value>Failed to load ripper module</value>
</data>
<data name="flac" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\flac.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Retry" xml:space="preserve">
<value>retry</value>
</data>
<data name="tag-label" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\tag-label.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="edit-list-order" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\edit-list-order.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="freedb16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\freedb16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -47,6 +47,7 @@ namespace CUERipper
this.listTracks = new System.Windows.Forms.ListView();
this.Title = new System.Windows.Forms.ColumnHeader();
this.TrackNo = new System.Windows.Forms.ColumnHeader();
this.columnHeaderArtist = new System.Windows.Forms.ColumnHeader();
this.Start = new System.Windows.Forms.ColumnHeader();
this.Length = new System.Windows.Forms.ColumnHeader();
this.buttonGo = new System.Windows.Forms.Button();
@@ -97,6 +98,7 @@ namespace CUERipper
this.buttonReload = new System.Windows.Forms.Button();
this.buttonEncoding = new System.Windows.Forms.Button();
this.buttonTracks = new System.Windows.Forms.Button();
this.buttonFreedbSubmit = new System.Windows.Forms.Button();
this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericWriteOffset)).BeginInit();
this.groupBoxSettings.SuspendLayout();
@@ -183,6 +185,7 @@ namespace CUERipper
this.listTracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Title,
this.TrackNo,
this.columnHeaderArtist,
this.Start,
this.Length});
this.listTracks.FullRowSelect = true;
@@ -193,10 +196,10 @@ namespace CUERipper
this.listTracks.UseCompatibleStateImageBehavior = false;
this.listTracks.View = System.Windows.Forms.View.Details;
this.listTracks.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listTracks_AfterLabelEdit);
this.listTracks.DoubleClick += new System.EventHandler(this.listTracks_DoubleClick);
this.listTracks.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.listTracks_PreviewKeyDown);
this.listTracks.BeforeLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listTracks_BeforeLabelEdit);
this.listTracks.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listTracks_KeyDown);
this.listTracks.Click += new System.EventHandler(this.listTracks_Click);
//
// Title
//
@@ -206,6 +209,10 @@ namespace CUERipper
//
resources.ApplyResources(this.TrackNo, "TrackNo");
//
// columnHeaderArtist
//
resources.ApplyResources(this.columnHeaderArtist, "columnHeaderArtist");
//
// Start
//
resources.ApplyResources(this.Start, "Start");
@@ -444,6 +451,7 @@ namespace CUERipper
this.progressBarErrors.ProgressPainter = this.plainProgressPainter1;
this.progressBarErrors.ProgressType = ProgressODoom.ProgressType.Smooth;
this.progressBarErrors.ShowPercentage = false;
this.progressBarErrors.TabStop = false;
this.progressBarErrors.Value = 10;
//
// plainBackgroundPainter1
@@ -487,6 +495,7 @@ namespace CUERipper
this.progressBarCD.ProgressPainter = this.plainProgressPainter2;
this.progressBarCD.ProgressType = ProgressODoom.ProgressType.Smooth;
this.progressBarCD.ShowPercentage = true;
this.progressBarCD.TabStop = false;
this.progressBarCD.Value = 10;
//
// plainProgressPainter2
@@ -560,7 +569,7 @@ namespace CUERipper
//
// bnComboBoxOutputFormat
//
this.bnComboBoxOutputFormat.BackColor = System.Drawing.Color.Transparent;
this.bnComboBoxOutputFormat.BackColor = System.Drawing.SystemColors.Window;
this.bnComboBoxOutputFormat.ForeColor = System.Drawing.SystemColors.ControlText;
this.bnComboBoxOutputFormat.ImageList = null;
resources.ApplyResources(this.bnComboBoxOutputFormat, "bnComboBoxOutputFormat");
@@ -571,6 +580,7 @@ namespace CUERipper
rectRadius7.TopLeft = 2;
rectRadius7.TopRight = 6;
this.bnComboBoxOutputFormat.Radius = rectRadius7;
this.bnComboBoxOutputFormat.TabStop = false;
this.bnComboBoxOutputFormat.Leave += new System.EventHandler(this.bnComboBoxOutputFormat_Leave);
this.bnComboBoxOutputFormat.MouseLeave += new System.EventHandler(this.bnComboBoxOutputFormat_MouseLeave);
this.bnComboBoxOutputFormat.DropDown += new System.EventHandler(this.bnComboBoxOutputFormat_DroppedDown);
@@ -590,6 +600,7 @@ namespace CUERipper
this.listMetadata.UseCompatibleStateImageBehavior = false;
this.listMetadata.View = System.Windows.Forms.View.Details;
this.listMetadata.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listMetadata_AfterLabelEdit);
this.listMetadata.BeforeLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listMetadata_BeforeLabelEdit);
this.listMetadata.Click += new System.EventHandler(this.listMetadata_Click);
//
// columnHeaderValue
@@ -652,10 +663,19 @@ namespace CUERipper
this.buttonTracks.UseVisualStyleBackColor = true;
this.buttonTracks.Click += new System.EventHandler(this.buttonTracks_Click);
//
// buttonFreedbSubmit
//
this.buttonFreedbSubmit.Image = global::CUERipper.Properties.Resources.freedb16;
resources.ApplyResources(this.buttonFreedbSubmit, "buttonFreedbSubmit");
this.buttonFreedbSubmit.Name = "buttonFreedbSubmit";
this.buttonFreedbSubmit.UseVisualStyleBackColor = true;
this.buttonFreedbSubmit.Click += new System.EventHandler(this.buttonFreedbSubmit_Click);
//
// frmCUERipper
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.buttonFreedbSubmit);
this.Controls.Add(this.buttonTracks);
this.Controls.Add(this.buttonEncoding);
this.Controls.Add(this.buttonMetadata);
@@ -764,6 +784,8 @@ namespace CUERipper
private System.Windows.Forms.Button buttonReload;
private System.Windows.Forms.Button buttonEncoding;
private System.Windows.Forms.Button buttonTracks;
private System.Windows.Forms.ColumnHeader columnHeaderArtist;
private System.Windows.Forms.Button buttonFreedbSubmit;
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
@@ -312,8 +313,9 @@ namespace CUERipper
buttonTracks.Enabled = data.selectedRelease != null && !running;
buttonMetadata.Enabled = data.selectedRelease != null && !running;
buttonFreedbSubmit.Enabled = data.selectedRelease != null && !running;
buttonVA.Enabled = data.selectedRelease != null && !running &&
data.selectedRelease.ImageKey == "freedb" && !data.selectedRelease.metadata.IsVarious();
data.selectedRelease.ImageKey == "freedb" && !data.selectedRelease.metadata.IsVarious() && (new CUEMetadata(data.selectedRelease.metadata)).FreedbToVarious();
buttonEncoding.Enabled = data.selectedRelease != null && !running &&
data.selectedRelease.ImageKey == "freedb" && (new CUEMetadata(data.selectedRelease.metadata)).FreedbToEncoding();
buttonReload.Enabled = data.selectedRelease != null && !running;
@@ -517,21 +519,37 @@ namespace CUERipper
listTracks.Visible = true;
listMetadata.Visible = false;
if (data.selectedRelease != null)
{
bool various = data.selectedRelease.metadata.IsVarious();
if (various)
{
Title.Width = 235;
columnHeaderArtist.Width = 120;
}
else
{
Title.Width = 235 + 120;
columnHeaderArtist.Width = 0;
}
for (int i = 1; i <= selectedDriveInfo.drive.TOC.TrackCount; i++)
{
string title;
if (!selectedDriveInfo.drive.TOC[i].IsAudio)
title = "Data track";
else
string title = "Data track";
string artist = "";
if (selectedDriveInfo.drive.TOC[i].IsAudio)
{
title = data.selectedRelease.metadata.Tracks[i - selectedDriveInfo.drive.TOC.FirstAudio].Title;
artist = data.selectedRelease.metadata.Tracks[i - selectedDriveInfo.drive.TOC.FirstAudio].Artist;
}
listTracks.Items.Add(new ListViewItem(new string[] {
title,
selectedDriveInfo.drive.TOC[i].Number.ToString(),
artist,
selectedDriveInfo.drive.TOC[i].StartMSF,
selectedDriveInfo.drive.TOC[i].LengthMSF }));
}
}
else //if (data.selectedTrack.no == 0)
}
else if (data.metadataTrack < 0)
{
listTracks.Visible = false;
listMetadata.Visible = true;
@@ -544,20 +562,27 @@ namespace CUERipper
listMetadata.Items.Add(new ListViewItem(new string[] { p.GetValue(data.selectedRelease.metadata).ToString(), p.Name }));
}
}
//else
//{
// listTracks.Visible = false;
// listMetadata.Visible = true;
// if (data.selectedRelease != null)
// {
// CUETrackMetadata track = data.selectedRelease.metadata.Tracks[data.selectedTrack.no - 1];
// PropertyDescriptorCollection props = TypeDescriptor.GetProperties(track);
// //props = props.Sort(new string[] { "TopLeft", "TopRight", "BottomLeft", "BottomRight" });
// foreach (PropertyDescriptor p in props)
// if (p.Name != "ISRC")
// listMetadata.Items.Add(new ListViewItem(new string[] { p.GetValue(track).ToString(), p.Name }));
// }
//}
else
{
listTracks.Visible = false;
listMetadata.Visible = true;
if (data.selectedRelease != null)
{
CUETrackMetadata track = data.selectedRelease.metadata.Tracks[data.metadataTrack];
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(track);
props = props.Sort(new string[] { "ISRC", "Title", "Artist" });
ListViewItem lvItem = new ListViewItem(new string[] { (data.metadataTrack + 1).ToString(), "Number" });
lvItem.ForeColor = SystemColors.GrayText;
listMetadata.Items.Add(lvItem);
foreach (PropertyDescriptor p in props)
{
lvItem = new ListViewItem(new string[] { p.GetValue(track).ToString(), p.Name });
if (p.Name == "ISRC")
lvItem.ForeColor = SystemColors.GrayText;
listMetadata.Items.Add(lvItem);
}
}
}
listTracks.EndUpdate();
listMetadata.EndUpdate();
SetupControls();
@@ -645,6 +670,7 @@ namespace CUERipper
ReleaseQueryParameters p = new ReleaseQueryParameters();
p.DiscId = audioSource.TOC.MusicBrainzId;
Query<Release> results = Release.Query(p);
MusicBrainzService.Proxy = _config.GetProxy();
MusicBrainzService.XmlRequest += new EventHandler<XmlRequestEventArgs>(MusicBrainz_LookupProgress);
try
@@ -663,13 +689,14 @@ namespace CUERipper
if (!(ex is MusicBrainzNotFoundException))
musicbrainzError = ex.Message;
}
MusicBrainzService.Proxy = null;
MusicBrainzService.XmlRequest -= new EventHandler<XmlRequestEventArgs>(MusicBrainz_LookupProgress);
FreedbHelper m_freedb = new FreedbHelper();
m_freedb.UserName = "gchudov";
m_freedb.Hostname = "gmail.com";
m_freedb.Proxy = _config.GetProxy();
m_freedb.UserName = _config.advanced.FreedbUser;
m_freedb.Hostname = _config.advanced.FreedbDomain;
m_freedb.ClientName = "CUERipper";
m_freedb.Version = "2.0.8";
m_freedb.SetDefaultSiteAddress(Properties.Settings.Default.MAIN_FREEDB_SITEADDRESS);
@@ -803,11 +830,6 @@ namespace CUERipper
_workThread.Start(selectedDriveInfo.drive);
}
private void listTracks_DoubleClick(object sender, EventArgs e)
{
listTracks.FocusedItem.BeginEdit();
}
private void listTracks_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F2)
@@ -1110,11 +1132,11 @@ namespace CUERipper
{
if (outputFormatVisible)
return;
txtOutputPath.Enabled = false;
txtOutputPath.Visible = false;
outputFormatVisible = true;
bnComboBoxOutputFormat.Visible = true;
bnComboBoxOutputFormat.Focus();
txtOutputPath.Enabled = false;
txtOutputPath.Visible = false;
}
private void bnComboBoxOutputFormat_MouseLeave(object sender, EventArgs e)
@@ -1129,7 +1151,7 @@ namespace CUERipper
private void bnComboBoxOutputFormat_DroppedDown(object sender, EventArgs e)
{
if (!outputFormatVisible || bnComboBoxOutputFormat.DroppedDown || bnComboBoxOutputFormat.Focused)
if (!outputFormatVisible || bnComboBoxOutputFormat.DroppedDown || ActiveControl == bnComboBoxOutputFormat)
return;
outputFormatVisible = false;
bnComboBoxOutputFormat.Visible = false;
@@ -1147,13 +1169,32 @@ namespace CUERipper
listMetadata.FocusedItem.BeginEdit();
}
private void listMetadata_BeforeLabelEdit(object sender, LabelEditEventArgs e)
{
if (data.selectedRelease == null || !data.metadataMode)
{
e.CancelEdit = true;
}
else if (data.metadataTrack < 0)
{
}
else
{
if (listMetadata.Items[e.Item].SubItems[1].Text == "ISRC" ||
listMetadata.Items[e.Item].SubItems[1].Text == "Number")
{
e.CancelEdit = true;
}
}
}
private void listMetadata_AfterLabelEdit(object sender, LabelEditEventArgs e)
{
if (data.selectedRelease == null || e.Label == null || !data.metadataMode)
{
e.CancelEdit = true;
}
else
else if (data.metadataTrack < 0)
{
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(data.selectedRelease.metadata);
PropertyDescriptor prop = props[listMetadata.Items[e.Item].SubItems[1].Text];
@@ -1163,13 +1204,13 @@ namespace CUERipper
prop.SetValue(data.selectedRelease.metadata, e.Label);
data.Releases.ResetItem(bnComboBoxRelease.SelectedIndex);
}
//else
//{
// CUETrackMetadata track = data.selectedRelease.metadata.Tracks[data.selectedTrack.no - 1];
// PropertyDescriptorCollection props = TypeDescriptor.GetProperties(track);
// props[listMetadata.Items[e.Item].SubItems[1].Text].SetValue(track, e.Label);
// data.Tracks.ResetItem(data.selectedTrack.no + 1);
//}
else
{
CUETrackMetadata track = data.selectedRelease.metadata.Tracks[data.metadataTrack];
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(track);
props[listMetadata.Items[e.Item].SubItems[1].Text].SetValue(track, e.Label);
//data.Tracks.ResetItem(data.metadataTrack);
}
}
private void buttonMetadata_Click(object sender, EventArgs e)
@@ -1177,6 +1218,7 @@ namespace CUERipper
buttonTracks.Visible = true;
buttonTracks.Focus();
buttonMetadata.Visible = false;
data.metadataTrack = -1;
data.metadataMode = true;
UpdateRelease();
}
@@ -1221,6 +1263,118 @@ namespace CUERipper
comboBoxOutputFormat_TextUpdate(sender, e);
SetupControls();
}
private void listTracks_Click(object sender, EventArgs e)
{
Point p = listTracks.PointToClient(MousePosition);
ListViewItem lvItem = listTracks.GetItemAt(p.X, p.Y);
if (lvItem != null)
{
ListViewItem.ListViewSubItem a = lvItem.GetSubItemAt(p.X, p.Y);
if (a != null)
{
int track = lvItem.Index + 1 - selectedDriveInfo.drive.TOC.FirstAudio;
if (a == lvItem.SubItems[0])
lvItem.BeginEdit();
else if (/*a == lvItem.SubItems[2] &&*/ track >= 0)
{
buttonTracks.Visible = true;
buttonTracks.Focus();
buttonMetadata.Visible = false;
data.metadataTrack = track;
data.metadataMode = true;
UpdateRelease();
}
}
}
}
private void FreedbSubmit(object o)
{
StringCollection tmp = new StringCollection();
tmp.Add("DTITLE=");
CDEntry entry = new CDEntry(tmp);
entry.Artist = data.selectedRelease.metadata.Artist;
entry.Title = data.selectedRelease.metadata.Title;
entry.Year = data.selectedRelease.metadata.Year;
entry.Genre = data.selectedRelease.metadata.Genre;
int i = 1;
foreach (CUETrackMetadata t in data.selectedRelease.metadata.Tracks)
{
Freedb.Track tt = new Freedb.Track();
if (t.Artist != "" && t.Artist != entry.Artist)
tt.Title = t.Artist + " / " + t.Title;
else
tt.Title = t.Title;
tt.FrameOffset = 150 + (int)selectedDriveInfo.drive.TOC[i++].Start;
entry.Tracks.Add(tt);
}
FreedbHelper m_freedb = new FreedbHelper();
frmFreedbSubmit frm = new frmFreedbSubmit();
foreach (string c in m_freedb.ValidCategories)
frm.Data.Categories.Add(c);
frm.Data.User = _config.advanced.FreedbUser;
frm.Data.Domain = _config.advanced.FreedbDomain;
frm.Data.Category = "misc";
DialogResult dlgRes = DialogResult.Cancel;
this.Invoke((MethodInvoker)delegate() { dlgRes = frm.ShowDialog(); });
if (dlgRes == DialogResult.Cancel)
{
_workThread = null;
this.BeginInvoke((MethodInvoker)delegate() { SetupControls(); });
return;
}
data.selectedRelease.metadata.Save();
_config.advanced.FreedbUser = frm.Data.User;
_config.advanced.FreedbDomain = frm.Data.Domain;
m_freedb.Proxy = _config.GetProxy();
m_freedb.UserName = _config.advanced.FreedbUser;
m_freedb.Hostname = _config.advanced.FreedbDomain;
m_freedb.ClientName = "CUERipper";
m_freedb.Version = "2.0.8";
//try
//{
// string code = m_freedb.GetCategories(out tmp);
// if (code == FreedbHelper.ResponseCodes.CODE_210)
// m_freedb.ValidCategories = tmp;
//}
//catch
//{
//}
uint length = selectedDriveInfo.drive.TOC.Length / 75 - selectedDriveInfo.drive.TOC[1].Start / 75 + 2;
try
{
string res = m_freedb.Submit(entry, (int)length, AccurateRipVerify.CalculateCDDBId(selectedDriveInfo.drive.TOC), frm.Data.Category, false);
this.BeginInvoke((MethodInvoker)delegate()
{
dlgRes = MessageBox.Show(this, res, "Submit result", MessageBoxButtons.OK, MessageBoxIcon.Information);
});
}
catch (Exception ex)
{
this.BeginInvoke((MethodInvoker)delegate()
{
dlgRes = MessageBox.Show(this, ex.Message, "Submit result", MessageBoxButtons.OK, MessageBoxIcon.Error);
});
}
_workThread = null;
this.BeginInvoke((MethodInvoker)delegate() { SetupControls(); });
}
private void buttonFreedbSubmit_Click(object sender, EventArgs e)
{
_workThread = new Thread(FreedbSubmit);
_workThread.Priority = ThreadPriority.BelowNormal;
_workThread.IsBackground = true;
SetupControls();
_workThread.Start();
}
}
public class StartStop
@@ -1348,6 +1502,7 @@ namespace CUERipper
public CUEMetadataEntry selectedRelease { get; set; }
public bool metadataMode { get; set; }
public int metadataTrack { get; set; }
public BindingList<string> CUEStyles
{

View File

@@ -197,7 +197,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;statusStrip1.ZOrder" xml:space="preserve">
<value>15</value>
<value>16</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="listTracks.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
@@ -210,7 +210,7 @@
<value>Title</value>
</data>
<data name="Title.Width" type="System.Int32, mscorlib">
<value>355</value>
<value>235</value>
</data>
<data name="TrackNo.DisplayIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -221,6 +221,12 @@
<data name="TrackNo.Width" type="System.Int32, mscorlib">
<value>30</value>
</data>
<data name="columnHeaderArtist.Text" xml:space="preserve">
<value>Artist</value>
</data>
<data name="columnHeaderArtist.Width" type="System.Int32, mscorlib">
<value>120</value>
</data>
<data name="Start.Text" xml:space="preserve">
<value>Start</value>
</data>
@@ -240,7 +246,7 @@
<value>553, 221</value>
</data>
<data name="listTracks.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
<value>7</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>357, 17</value>
@@ -258,7 +264,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;listTracks.ZOrder" xml:space="preserve">
<value>13</value>
<value>14</value>
</data>
<data name="buttonGo.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
@@ -273,7 +279,7 @@
<value>177, 33</value>
</data>
<data name="buttonGo.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
<value>12</value>
</data>
<data name="buttonGo.Text" xml:space="preserve">
<value>Go</value>
@@ -288,7 +294,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonGo.ZOrder" xml:space="preserve">
<value>14</value>
<value>15</value>
</data>
<data name="buttonAbort.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
@@ -303,7 +309,7 @@
<value>85, 33</value>
</data>
<data name="buttonAbort.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
<value>13</value>
</data>
<data name="buttonAbort.Text" xml:space="preserve">
<value>Abort</value>
@@ -321,7 +327,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonAbort.ZOrder" xml:space="preserve">
<value>16</value>
<value>17</value>
</data>
<data name="buttonPause.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
@@ -354,7 +360,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonPause.ZOrder" xml:space="preserve">
<value>17</value>
<value>18</value>
</data>
<data name="numericWriteOffset.Location" type="System.Drawing.Point, System.Drawing">
<value>310, 15</value>
@@ -363,7 +369,7 @@
<value>54, 20</value>
</data>
<data name="numericWriteOffset.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
<value>5</value>
</data>
<data name="numericWriteOffset.TextAlign" type="System.Windows.Forms.HorizontalAlignment, System.Windows.Forms">
<value>Right</value>
@@ -423,7 +429,7 @@
<value>64, 17</value>
</data>
<data name="checkBoxEACMode.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
<value>6</value>
</data>
<data name="checkBoxEACMode.Text" xml:space="preserve">
<value>EAC log</value>
@@ -453,7 +459,7 @@
<value>80, 21</value>
</data>
<data name="bnComboBoxLosslessOrNot.TabIndex" type="System.Int32, mscorlib">
<value>39</value>
<value>0</value>
</data>
<data name="bnComboBoxLosslessOrNot.Text" xml:space="preserve">
<value>lossless</value>
@@ -480,7 +486,7 @@
<value>80, 21</value>
</data>
<data name="bnComboBoxEncoder.TabIndex" type="System.Int32, mscorlib">
<value>38</value>
<value>3</value>
</data>
<data name="bnComboBoxEncoder.Text" xml:space="preserve">
<value>libFlac</value>
@@ -534,7 +540,7 @@
<value>80, 21</value>
</data>
<data name="bnComboBoxFormat.TabIndex" type="System.Int32, mscorlib">
<value>37</value>
<value>2</value>
</data>
<data name="bnComboBoxFormat.Text" xml:space="preserve">
<value>flac</value>
@@ -600,7 +606,7 @@
<value>80, 21</value>
</data>
<data name="bnComboBoxImage.TabIndex" type="System.Int32, mscorlib">
<value>34</value>
<value>1</value>
</data>
<data name="bnComboBoxImage.Text" xml:space="preserve">
<value>image</value>
@@ -705,7 +711,7 @@
<value>166, 45</value>
</data>
<data name="trackBarEncoderMode.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
<value>4</value>
</data>
<data name="&gt;&gt;trackBarEncoderMode.Name" xml:space="preserve">
<value>trackBarEncoderMode</value>
@@ -729,7 +735,7 @@
<value>127, 45</value>
</data>
<data name="trackBarSecureMode.TabIndex" type="System.Int32, mscorlib">
<value>30</value>
<value>7</value>
</data>
<data name="&gt;&gt;trackBarSecureMode.Name" xml:space="preserve">
<value>trackBarSecureMode</value>
@@ -750,7 +756,7 @@
<value>370, 134</value>
</data>
<data name="groupBoxSettings.TabIndex" type="System.Int32, mscorlib">
<value>29</value>
<value>11</value>
</data>
<data name="&gt;&gt;groupBoxSettings.Name" xml:space="preserve">
<value>groupBoxSettings</value>
@@ -762,7 +768,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;groupBoxSettings.ZOrder" xml:space="preserve">
<value>12</value>
<value>13</value>
</data>
<metadata name="drivesBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>998, 56</value>
@@ -855,7 +861,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;progressBarErrors.ZOrder" xml:space="preserve">
<value>9</value>
<value>10</value>
</data>
<data name="progressBarCD.Location" type="System.Drawing.Point, System.Drawing">
<value>382, 392</value>
@@ -882,7 +888,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;progressBarCD.ZOrder" xml:space="preserve">
<value>11</value>
<value>12</value>
</data>
<data name="txtOutputPath.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 314</value>
@@ -891,7 +897,7 @@
<value>552, 20</value>
</data>
<data name="txtOutputPath.TabIndex" type="System.Int32, mscorlib">
<value>33</value>
<value>10</value>
</data>
<data name="txtOutputPath.ToolTip" xml:space="preserve">
<value>Click to edit output path template</value>
@@ -906,7 +912,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtOutputPath.ZOrder" xml:space="preserve">
<value>7</value>
<value>8</value>
</data>
<metadata name="releasesBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>708, 56</value>
@@ -990,7 +996,7 @@
<value>552, 21</value>
</data>
<data name="bnComboBoxRelease.TabIndex" type="System.Int32, mscorlib">
<value>35</value>
<value>1</value>
</data>
<data name="bnComboBoxRelease.Text" xml:space="preserve">
<value>Releases</value>
@@ -1005,11 +1011,8 @@
<value>$this</value>
</data>
<data name="&gt;&gt;bnComboBoxRelease.ZOrder" xml:space="preserve">
<value>6</value>
<value>7</value>
</data>
<metadata name="tracksBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 469</value>
</metadata>
<data name="bnComboBoxDrives.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 6</value>
</data>
@@ -1017,7 +1020,7 @@
<value>552, 21</value>
</data>
<data name="bnComboBoxDrives.TabIndex" type="System.Int32, mscorlib">
<value>36</value>
<value>0</value>
</data>
<data name="bnComboBoxDrives.Text" xml:space="preserve">
<value>Drives</value>
@@ -1032,7 +1035,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;bnComboBoxDrives.ZOrder" xml:space="preserve">
<value>8</value>
<value>9</value>
</data>
<data name="bnComboBoxOutputFormat.Location" type="System.Drawing.Point, System.Drawing">
<value>5, 313</value>
@@ -1041,7 +1044,7 @@
<value>552, 21</value>
</data>
<data name="bnComboBoxOutputFormat.TabIndex" type="System.Int32, mscorlib">
<value>37</value>
<value>9</value>
</data>
<data name="&gt;&gt;bnComboBoxOutputFormat.Name" xml:space="preserve">
<value>bnComboBoxOutputFormat</value>
@@ -1053,7 +1056,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;bnComboBoxOutputFormat.ZOrder" xml:space="preserve">
<value>10</value>
<value>11</value>
</data>
<data name="columnHeaderValue.DisplayIndex" type="System.Int32, mscorlib">
<value>1</value>
@@ -1080,7 +1083,7 @@
<value>550, 220</value>
</data>
<data name="listMetadata.TabIndex" type="System.Int32, mscorlib">
<value>39</value>
<value>8</value>
</data>
<data name="listMetadata.Visible" type="System.Boolean, mscorlib">
<value>False</value>
@@ -1095,7 +1098,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;listMetadata.ZOrder" xml:space="preserve">
<value>18</value>
<value>19</value>
</data>
<data name="buttonTrackMetadata.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
<value>Flat</value>
@@ -1128,7 +1131,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonTrackMetadata.ZOrder" xml:space="preserve">
<value>4</value>
<value>5</value>
</data>
<data name="buttonMetadata.Location" type="System.Drawing.Point, System.Drawing">
<value>7, 60</value>
@@ -1137,7 +1140,7 @@
<value>80, 23</value>
</data>
<data name="buttonMetadata.TabIndex" type="System.Int32, mscorlib">
<value>41</value>
<value>3</value>
</data>
<data name="buttonMetadata.Text" xml:space="preserve">
<value>Meta</value>
@@ -1155,7 +1158,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonMetadata.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="buttonVA.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@@ -1167,7 +1170,7 @@
<value>80, 23</value>
</data>
<data name="buttonVA.TabIndex" type="System.Int32, mscorlib">
<value>42</value>
<value>5</value>
</data>
<data name="buttonVA.Text" xml:space="preserve">
<value>V/A</value>
@@ -1185,7 +1188,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonVA.ZOrder" xml:space="preserve">
<value>5</value>
<value>6</value>
</data>
<data name="buttonReload.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@@ -1197,7 +1200,7 @@
<value>80, 23</value>
</data>
<data name="buttonReload.TabIndex" type="System.Int32, mscorlib">
<value>43</value>
<value>4</value>
</data>
<data name="buttonReload.Text" xml:space="preserve">
<value>Reload</value>
@@ -1215,7 +1218,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonReload.ZOrder" xml:space="preserve">
<value>3</value>
<value>4</value>
</data>
<data name="buttonEncoding.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@@ -1227,7 +1230,7 @@
<value>80, 23</value>
</data>
<data name="buttonEncoding.TabIndex" type="System.Int32, mscorlib">
<value>44</value>
<value>6</value>
</data>
<data name="buttonEncoding.Text" xml:space="preserve">
<value>Codepage</value>
@@ -1245,7 +1248,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonEncoding.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="buttonTracks.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@@ -1257,7 +1260,7 @@
<value>80, 23</value>
</data>
<data name="buttonTracks.TabIndex" type="System.Int32, mscorlib">
<value>45</value>
<value>3</value>
</data>
<data name="buttonTracks.Text" xml:space="preserve">
<value>Tracks</value>
@@ -1278,14 +1281,44 @@
<value>$this</value>
</data>
<data name="&gt;&gt;buttonTracks.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="buttonFreedbSubmit.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="buttonFreedbSubmit.Location" type="System.Drawing.Point, System.Drawing">
<value>357, 60</value>
</data>
<data name="buttonFreedbSubmit.Size" type="System.Drawing.Size, System.Drawing">
<value>80, 23</value>
</data>
<data name="buttonFreedbSubmit.TabIndex" type="System.Int32, mscorlib">
<value>41</value>
</data>
<data name="buttonFreedbSubmit.Text" xml:space="preserve">
<value>Submit</value>
</data>
<data name="buttonFreedbSubmit.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageBeforeText</value>
</data>
<data name="&gt;&gt;buttonFreedbSubmit.Name" xml:space="preserve">
<value>buttonFreedbSubmit</value>
</data>
<data name="&gt;&gt;buttonFreedbSubmit.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonFreedbSubmit.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;buttonFreedbSubmit.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>50</value>
</metadata>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>50</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
@@ -1743,6 +1776,12 @@
<data name="&gt;&gt;TrackNo.Type" xml:space="preserve">
<value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;columnHeaderArtist.Name" xml:space="preserve">
<value>columnHeaderArtist</value>
</data>
<data name="&gt;&gt;columnHeaderArtist.Type" xml:space="preserve">
<value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Start.Name" xml:space="preserve">
<value>Start</value>
</data>
@@ -1851,12 +1890,6 @@
<data name="&gt;&gt;imageListMetadataSource.Type" xml:space="preserve">
<value>System.Windows.Forms.ImageList, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tracksBindingSource.Name" xml:space="preserve">
<value>tracksBindingSource</value>
</data>
<data name="&gt;&gt;tracksBindingSource.Type" xml:space="preserve">
<value>System.Windows.Forms.BindingSource, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;columnHeaderValue.Name" xml:space="preserve">
<value>columnHeaderValue</value>
</data>

View File

@@ -15,17 +15,10 @@ namespace CUETools.AccurateRip
public AccurateRipVerify(CDImageLayout toc, IWebProxy proxy)
{
this.proxy = proxy;
_toc = toc;
_accDisks = new List<AccDisk>();
//_crc32 = new Crc32();
_hasLogCRC = false;
_finalSampleCount = _toc.AudioLength * 588;
_CRCLOG = new uint[_toc.AudioTracks + 1];
_CRCMASK = new uint[_toc.AudioTracks + 1];
_CRCMASK[0] = 0xffffffff ^ Crc32.Combine(0xffffffff, 0, (int)_finalSampleCount * 4);
for (int iTrack = 1; iTrack <= _toc.AudioTracks; iTrack++)
_CRCMASK[iTrack] = 0xffffffff ^ Crc32.Combine(0xffffffff, 0, (int)_toc[iTrack + _toc.FirstAudio - 1].Length * 588 * 4);
Init();
_CRCLOG = new uint[toc.AudioTracks + 1];
Init(toc);
}
public uint Confidence(int iTrack)
@@ -336,7 +329,7 @@ namespace CUETools.AccurateRip
this.npar = npar;
this.calcSyn = calcSyn;
this.calcParity = calcParity;
Init();
Init(_toc);
}
internal unsafe uint CTDBCRC(int actualOffset)
@@ -648,8 +641,14 @@ namespace CUETools.AccurateRip
}
}
public void Init()
public void Init(CDImageLayout toc)
{
_toc = toc;
_finalSampleCount = _toc.AudioLength * 588;
_CRCMASK = new uint[_toc.AudioTracks + 1];
_CRCMASK[0] = 0xffffffff ^ Crc32.Combine(0xffffffff, 0, (int)_finalSampleCount * 4);
for (int iTrack = 1; iTrack <= _toc.AudioTracks; iTrack++)
_CRCMASK[iTrack] = 0xffffffff ^ Crc32.Combine(0xffffffff, 0, (int)_toc[iTrack + _toc.FirstAudio - 1].Length * 588 * 4);
_CRCAR = new uint[_toc.AudioTracks + 1, 31 * 588];
_CRCSM = new uint[_toc.AudioTracks + 1, 31 * 588];
_CRC32 = new uint[_toc.AudioTracks + 1, 31 * 588];

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{082D6B9E-326E-4D15-9798-EDAE9EDE70A6}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\bin\Debug\plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DFE50673-906C-4B8F-993B-A24CAD1CA17D}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\bin\Debug\plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

View File

@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\bin\Debug\plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

View File

@@ -111,8 +111,8 @@ namespace CUETools.Processor
break;
case "CUETools.Codecs.FlaCuda.FlaCudaWriter":
dest.Options = string.Format("{0}{1}--padding-length {2} --cpu-threads {3}",
config.flaCudaVerify ? "--verify " : "",
config.flaCudaGPUOnly ? "--gpu-only " : "",
config.FlaCudaVerify ? "--verify " : "",
config.FlaCudaGPUOnly ? "--gpu-only " : "",
padding,
config.FlaCudaThreads ? 1 : 0);
break;

View File

@@ -82,6 +82,53 @@ namespace CUETools.Processor
return serializer.Deserialize(fs) as CUEMetadata;
}
public void Merge(CUEMetadata metadata, bool overwrite)
{
if ((overwrite || TotalDiscs == "") && metadata.TotalDiscs != "") TotalDiscs = metadata.TotalDiscs;
if ((overwrite || DiscNumber == "") && metadata.DiscNumber != "") DiscNumber = metadata.DiscNumber;
if ((overwrite || Year == "") && metadata.Year != "") Year = metadata.Year;
if ((overwrite || Genre == "") && metadata.Genre != "") Genre = metadata.Genre;
if ((overwrite || Artist == "") && metadata.Artist != "") Artist = metadata.Artist;
if ((overwrite || Title == "") && metadata.Title != "") Title = metadata.Title;
if ((overwrite || Catalog == "") && metadata.Catalog != "") Catalog = metadata.Catalog;
for (int i = 0; i < Tracks.Count; i++)
{
if ((overwrite || Tracks[i].Title == "") && metadata.Tracks[i].Title != "") Tracks[i].Title = metadata.Tracks[i].Title;
if ((overwrite || Tracks[i].Artist == "") && metadata.Tracks[i].Artist != "") Tracks[i].Artist = metadata.Tracks[i].Artist;
if ((overwrite || Tracks[i].ISRC == "") && metadata.Tracks[i].ISRC != "") Tracks[i].ISRC = metadata.Tracks[i].ISRC;
}
}
public override bool Equals(object obj)
{
CUEMetadata metadata = obj as CUEMetadata;
if (metadata == null)
return false;
if (TotalDiscs != metadata.TotalDiscs ||
DiscNumber != metadata.DiscNumber ||
Year != metadata.Year ||
Genre != metadata.Genre ||
Artist != metadata.Artist ||
Title != metadata.Title ||
Catalog != metadata.Catalog ||
Tracks.Count != metadata.Tracks.Count
)
return false;
for (int i = 0; i < Tracks.Count; i++)
if (Tracks[i].Title != metadata.Tracks[i].Title ||
Tracks[i].Artist != metadata.Tracks[i].Artist ||
Tracks[i].ISRC != metadata.Tracks[i].ISRC)
return false;
return true;
}
public bool Contains(CUEMetadata metadata)
{
CUEMetadata sum = new CUEMetadata(metadata);
sum.Merge(this, false);
return sum.Equals(this);
}
public void CopyMetadata(CUEMetadata metadata)
{
// if (metadata.Tracks.Count != Tracks.Count) throw;
@@ -161,8 +208,9 @@ namespace CUETools.Processor
return different && !error;
}
public void FreedbToVarious()
public bool FreedbToVarious()
{
bool found = false;
for (int i = 0; i < Tracks.Count; i++)
{
string title = Tracks[i].Title;
@@ -172,12 +220,14 @@ namespace CUETools.Processor
{
Tracks[i].Title = title.Substring(idx + 3);
Tracks[i].Artist = title.Substring(0, idx);
found = true;
}
else
{
Tracks[i].Artist = title;
}
}
return found;
}
public void UpdateArtist(string artist)

View File

@@ -38,6 +38,7 @@ using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Xml.Serialization;
using CUETools.Codecs;
using CUETools.CDImage;
using CUETools.AccurateRip;
@@ -873,6 +874,65 @@ namespace CUETools.Processor
}
}
//class LocalizedDisplayNameAttribute : DisplayNameAttribute
//{
// private readonly string resourceName;
// public LocalizedDisplayNameAttribute(string resourceName)
// : base()
// {
// this.resourceName = resourceName;
// }
// public override string DisplayName
// {
// get
// {
// return Resources.ResourceManager.GetString(this.resourceName);
// }
// }
//}
[Serializable]
public class CUEConfigAdvanced
{
public CUEConfigAdvanced()
{
// Iterate through each property and call ResetValue()
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(this))
property.ResetValue(this);
}
internal static XmlSerializer serializer = new XmlSerializer(typeof(CUEConfigAdvanced));
[DefaultValue("i"),Category("Freedb"),DisplayName("Email user")]
public string FreedbUser { get; set; }
[DefaultValue("wont.tell"), Category("Freedb"), DisplayName("Email domain")]
public string FreedbDomain { get; set; }
[DefaultValue(ProxyMode.System), Category("Proxy"), DisplayName("Proxy mode")]
public ProxyMode UseProxyMode { get; set; }
[DefaultValue("127.0.0.1"), Category("Proxy"), DisplayName("Proxy server host")]
public string ProxyServer { get; set; }
[DefaultValue(8080), Category("Proxy"), DisplayName("Proxy server port")]
public int ProxyPort { get; set; }
[DefaultValue(""), Category("Proxy"), DisplayName("Proxy auth user")]
public string ProxyUser { get; set; }
[DefaultValue(""), Category("Proxy"), DisplayName("Proxy auth password")]
public string ProxyPassword { get; set; }
[DefaultValue(true), Category("Cache"), DisplayName("Cache metadata")]
public bool CacheMetadata { get; set; }
[DefaultValue(new string[]{"folder.jpg", "cover.jpg", "albumart.jpg", "thumbnail.jpg", "albumartlarge.jpg", "front.jpg"})]
[Category("Cover Art"), DisplayName("Cover Art Files")]
public string[] CoverArtFiles { get; set; }
[DefaultValue(true)]
[Category("Cover Art"), DisplayName("Cover Art Extended Search")]
public bool CoverArtSearchSubdirs { get; set; }
public enum ProxyMode
{
None,
System,
Custom
}
}
public class CUEConfig {
public uint fixOffsetMinimumConfidence;
public uint fixOffsetMinimumTracksPercent;
@@ -887,9 +947,6 @@ namespace CUETools.Processor
public bool noUnverifiedOutput;
public bool autoCorrectFilenames;
public bool flacVerify;
public bool flaCudaVerify;
public bool flaCudaGPUOnly;
public bool flaCudaThreads;
public bool preserveHTOA;
public int wvExtraMode;
public bool wvStoreMD5;
@@ -929,24 +986,22 @@ namespace CUETools.Processor
public bool writeBasicTagsFromCUEData;
public bool copyBasicTags;
public bool copyUnknownTags;
public bool copyAlbumArt;
public bool embedAlbumArt;
public bool extractAlbumArt;
public bool arLogToSourceFolder;
public bool arLogVerbose;
public bool fixOffsetToNearest;
public int maxAlbumArtSize;
public string arLogFilenameFormat, alArtFilenameFormat;
public CUEStyle gapsHandling;
public bool separateDecodingThread;
public bool useSystemProxySettings;
public bool CopyAlbumArt { get { return copyAlbumArt; } set { copyAlbumArt = value; } }
public bool FlaCudaThreads { get { return flaCudaThreads; } set { flaCudaThreads = value; } }
public bool FlaCudaGPUOnly { get { return flaCudaGPUOnly; } set { flaCudaGPUOnly = value; } }
public bool FlaCudaVerify { get { return flaCudaVerify; } set { flaCudaVerify = value; } }
public string ArLogFilenameFormat { get { return arLogFilenameFormat; } set { arLogFilenameFormat = value; } }
public string AlArtFilenameFormat { get { return alArtFilenameFormat; } set { alArtFilenameFormat = value; } }
public CUEConfigAdvanced advanced { get; private set; }
public bool CopyAlbumArt { get; set; }
public bool FlaCudaThreads { get; set; }
public bool FlaCudaGPUOnly { get; set; }
public bool FlaCudaVerify { get; set; }
public string ArLogFilenameFormat { get; set; }
public string AlArtFilenameFormat { get; set; }
public CUEToolsUDCList Encoders
{
get { return encoders; }
@@ -968,9 +1023,9 @@ namespace CUETools.Processor
autoCorrectFilenames = true;
flacVerify = false;
flaCudaVerify = false;
flaCudaGPUOnly = false;
flaCudaThreads = true;
FlaCudaVerify = false;
FlaCudaGPUOnly = false;
FlaCudaThreads = true;
preserveHTOA = true;
wvExtraMode = 0;
wvStoreMD5 = false;
@@ -1005,7 +1060,7 @@ namespace CUETools.Processor
writeBasicTagsFromCUEData = true;
copyBasicTags = true;
copyUnknownTags = true;
copyAlbumArt = true;
CopyAlbumArt = true;
embedAlbumArt = true;
extractAlbumArt = true;
maxAlbumArtSize = 300;
@@ -1013,14 +1068,15 @@ namespace CUETools.Processor
arLogToSourceFolder = false;
arLogVerbose = true;
fixOffsetToNearest = true;
arLogFilenameFormat = "%filename%.accurip";
alArtFilenameFormat = "folder.jpg";
ArLogFilenameFormat = "%filename%.accurip";
AlArtFilenameFormat = "folder.jpg";
separateDecodingThread = true;
useSystemProxySettings = true;
gapsHandling = CUEStyle.GapsAppended;
advanced = new CUEConfigAdvanced();
language = Thread.CurrentThread.CurrentUICulture.Name;
encoders = new CUEToolsUDCList();
@@ -1151,9 +1207,9 @@ string status = processor.Go();
sw.Save("PreserveHTOA", preserveHTOA);
sw.Save("AutoCorrectFilenames", autoCorrectFilenames);
sw.Save("FLACVerify", flacVerify);
sw.Save("FlaCudaVerify", flaCudaVerify);
sw.Save("FlaCudaGPUOnly", flaCudaGPUOnly);
sw.Save("FlaCudaThreads", flaCudaThreads);
sw.Save("FlaCudaVerify", FlaCudaVerify);
sw.Save("FlaCudaGPUOnly", FlaCudaGPUOnly);
sw.Save("FlaCudaThreads", FlaCudaThreads);
sw.Save("WVExtraMode", wvExtraMode);
sw.Save("WVStoreMD5", wvStoreMD5);
sw.Save("KeepOriginalFilenames", keepOriginalFilenames);
@@ -1185,12 +1241,11 @@ string status = processor.Go();
sw.Save("Language", language);
sw.Save("SeparateDecodingThread", separateDecodingThread);
sw.Save("UseSystemProxySettings", useSystemProxySettings);
sw.Save("WriteBasicTagsFromCUEData", writeBasicTagsFromCUEData);
sw.Save("CopyBasicTags", copyBasicTags);
sw.Save("CopyUnknownTags", copyUnknownTags);
sw.Save("CopyAlbumArt", copyAlbumArt);
sw.Save("CopyAlbumArt", CopyAlbumArt);
sw.Save("EmbedAlbumArt", embedAlbumArt);
sw.Save("ExtractAlbumArt", extractAlbumArt);
sw.Save("MaxAlbumArtSize", maxAlbumArtSize);
@@ -1199,8 +1254,14 @@ string status = processor.Go();
sw.Save("ArLogVerbose", arLogVerbose);
sw.Save("FixOffsetToNearest", fixOffsetToNearest);
sw.Save("ArLogFilenameFormat", arLogFilenameFormat);
sw.Save("AlArtFilenameFormat", alArtFilenameFormat);
sw.Save("ArLogFilenameFormat", ArLogFilenameFormat);
sw.Save("AlArtFilenameFormat", AlArtFilenameFormat);
using (TextWriter writer = new StringWriter())
{
CUEConfigAdvanced.serializer.Serialize(writer, advanced); //writer.Close();
sw.SaveText("Advanced", writer.ToString());
}
int nEncoders = 0;
foreach (CUEToolsUDC encoder in encoders)
@@ -1284,9 +1345,9 @@ string status = processor.Go();
preserveHTOA = sr.LoadBoolean("PreserveHTOA") ?? true;
autoCorrectFilenames = sr.LoadBoolean("AutoCorrectFilenames") ?? true;
flacVerify = sr.LoadBoolean("FLACVerify") ?? false;
flaCudaVerify = sr.LoadBoolean("FlaCudaVerify") ?? false;
flaCudaGPUOnly = sr.LoadBoolean("FlaCudaGPUOnly") ?? false;
flaCudaThreads = sr.LoadBoolean("FlaCudaThreads") ?? true;
FlaCudaVerify = sr.LoadBoolean("FlaCudaVerify") ?? false;
FlaCudaGPUOnly = sr.LoadBoolean("FlaCudaGPUOnly") ?? false;
FlaCudaThreads = sr.LoadBoolean("FlaCudaThreads") ?? true;
wvExtraMode = sr.LoadInt32("WVExtraMode", 0, 6) ?? 0;
wvStoreMD5 = sr.LoadBoolean("WVStoreMD5") ?? false;
keepOriginalFilenames = sr.LoadBoolean("KeepOriginalFilenames") ?? false;
@@ -1320,7 +1381,7 @@ string status = processor.Go();
writeBasicTagsFromCUEData = sr.LoadBoolean("WriteBasicTagsFromCUEData") ?? true;
copyBasicTags = sr.LoadBoolean("CopyBasicTags") ?? true;
copyUnknownTags = sr.LoadBoolean("CopyUnknownTags") ?? true;
copyAlbumArt = sr.LoadBoolean("CopyAlbumArt") ?? true;
CopyAlbumArt = sr.LoadBoolean("CopyAlbumArt") ?? true;
embedAlbumArt = sr.LoadBoolean("EmbedAlbumArt") ?? true;
extractAlbumArt = sr.LoadBoolean("ExtractAlbumArt") ?? true;
maxAlbumArtSize = sr.LoadInt32("MaxAlbumArtSize", 100, 10000) ?? maxAlbumArtSize;
@@ -1328,11 +1389,20 @@ string status = processor.Go();
arLogToSourceFolder = sr.LoadBoolean("ArLogToSourceFolder") ?? arLogToSourceFolder;
arLogVerbose = sr.LoadBoolean("ArLogVerbose") ?? arLogVerbose;
fixOffsetToNearest = sr.LoadBoolean("FixOffsetToNearest") ?? fixOffsetToNearest;
arLogFilenameFormat = sr.Load("ArLogFilenameFormat") ?? arLogFilenameFormat;
alArtFilenameFormat = sr.Load("AlArtFilenameFormat") ?? alArtFilenameFormat;
ArLogFilenameFormat = sr.Load("ArLogFilenameFormat") ?? ArLogFilenameFormat;
AlArtFilenameFormat = sr.Load("AlArtFilenameFormat") ?? AlArtFilenameFormat;
separateDecodingThread = sr.LoadBoolean("SeparateDecodingThread") ?? separateDecodingThread;
useSystemProxySettings = sr.LoadBoolean("UseSystemProxySettings") ?? useSystemProxySettings;
try
{
using (TextReader reader = new StringReader(sr.Load("Advanced")))
advanced = CUEConfigAdvanced.serializer.Deserialize(reader) as CUEConfigAdvanced;
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
int totalEncoders = sr.LoadInt32("ExternalEncoders", 0, null) ?? 0;
for (int nEncoders = 0; nEncoders < totalEncoders; nEncoders++)
@@ -1449,8 +1519,8 @@ string status = processor.Go();
language = sr.Load("Language") ?? Thread.CurrentThread.CurrentUICulture.Name;
if (arLogFilenameFormat.Contains("%F"))
arLogFilenameFormat = "%filename%.accurip";
if (ArLogFilenameFormat.Contains("%F"))
ArLogFilenameFormat = "%filename%.accurip";
if (singleFilenameFormat.Contains("%F"))
singleFilenameFormat = "%filename%";
if (trackFilenameFormat.Contains("%N"))
@@ -1466,6 +1536,23 @@ string status = processor.Go();
return result == null ? null : result.Name;
}
public IWebProxy GetProxy()
{
IWebProxy proxy = null;
switch (advanced.UseProxyMode)
{
case CUEConfigAdvanced.ProxyMode.System:
proxy = WebRequest.GetSystemWebProxy();
break;
case CUEConfigAdvanced.ProxyMode.Custom:
proxy = new WebProxy(advanced.ProxyServer, advanced.ProxyPort);
if (advanced.ProxyUser != "")
proxy.Credentials = new NetworkCredential(advanced.ProxyUser, advanced.ProxyPassword);
break;
}
return proxy;
}
public string CleanseString (string s)
{
StringBuilder sb = new StringBuilder();
@@ -1668,7 +1755,7 @@ string status = processor.Go();
_hasEmbeddedCUESheet = false;
_isArchive = false;
_isCD = false;
proxy = _config.useSystemProxySettings ? WebRequest.GetSystemWebProxy() : null;
proxy = _config.GetProxy();
}
public void OpenCD(ICDRipper ripper)
@@ -1797,69 +1884,6 @@ string status = processor.Go();
}
}
public void FillFromMusicBrainz(MusicBrainz.Release release)
{
string date = release.GetEvents().Count > 0 ? release.GetEvents()[0].Date : null;
Year = date == null ? "" : date.Substring(0, 4);
Artist = release.GetArtist();
Title = release.GetTitle();
// How to get Genre: http://mm.musicbrainz.org/ws/1/release/6fe1e218-2aee-49ac-94f0-7910ba2151df.html?type=xml&inc=tags
//Catalog = release.GetEvents().Count > 0 ? release.GetEvents()[0].Barcode : "";
for (int i = 1; i <= _toc.AudioTracks; i++)
{
MusicBrainz.Track track = release.GetTracks()[(int)_toc[i].Number - 1]; // !!!!!! - _toc.FirstAudio
Tracks[i - 1].Title = track.GetTitle();
Tracks[i - 1].Artist = track.GetArtist();
}
}
public bool FreedbToEncoding()
{
Encoding iso = Encoding.GetEncoding("iso-8859-1");
bool different = false;
string tmp;
tmp = Encoding.Default.GetString(iso.GetBytes(Artist)); different |= Artist != tmp; Artist = tmp;
tmp = Encoding.Default.GetString(iso.GetBytes(Title)); different |= Title != tmp; Title = tmp;
for (int i = 0; i < _toc.AudioTracks; i++)
{
tmp = Encoding.Default.GetString(iso.GetBytes(Tracks[i].Artist)); different |= Tracks[i].Artist != tmp; Tracks[i].Artist = tmp;
tmp = Encoding.Default.GetString(iso.GetBytes(Tracks[i].Title)); different |= Tracks[i].Title != tmp; Tracks[i].Title = tmp;
}
return different;
}
public void FreedbToVarious()
{
for (int i = 0; i < _toc.AudioTracks; i++)
{
string title = Tracks[i].Title;
int idx = title.IndexOf(" / ");
if (idx < 0) idx = title.IndexOf(" - ");
if (idx >= 0)
{
Tracks[i].Title = title.Substring(idx + 3);
Tracks[i].Artist = title.Substring(0, idx);
}
else
{
Tracks[i].Artist = title;
}
}
}
public void FillFromFreedb(Freedb.CDEntry cdEntry)
{
Year = cdEntry.Year;
Genre = cdEntry.Genre;
Artist = cdEntry.Artist;
Title = cdEntry.Title;
for (int i = 0; i < _toc.AudioTracks; i++)
{
Tracks[i].Title = cdEntry.Tracks[i + _toc.FirstAudio - 1].Title;
Tracks[i].Artist = cdEntry.Artist;
}
}
public List<object> LookupAlbumInfo(bool useFreedb, bool useMusicBrainz, bool useCache)
{
List<object> Releases = new List<object>();
@@ -1880,7 +1904,10 @@ string status = processor.Go();
}
}
Releases.Add(new CUEMetadataEntry(Metadata, TOC, "cue"));
CUEMetadata meta = Metadata;
if (meta.Contains(taglibMetadata) || !taglibMetadata.Contains(meta))
Releases.Add(new CUEMetadataEntry(meta, TOC, "cue"));
if (!meta.Contains(taglibMetadata))
Releases.Add(new CUEMetadataEntry(new CUEMetadata(taglibMetadata), TOC, "tags"));
if (useFreedb)
@@ -1888,9 +1915,9 @@ string status = processor.Go();
ShowProgress("Looking up album via Freedb...", 0.0, null, null);
FreedbHelper m_freedb = new FreedbHelper();
m_freedb.UserName = "gchudov";
m_freedb.Hostname = "gmail.com";
m_freedb.Proxy = proxy;
m_freedb.UserName = _config.advanced.FreedbUser;
m_freedb.Hostname = _config.advanced.FreedbDomain;
m_freedb.ClientName = "CUETools";
m_freedb.Version = "2.0.8";
m_freedb.SetDefaultSiteAddress("freedb.org");
@@ -1953,6 +1980,7 @@ string status = processor.Go();
// DiscIds.Add(_tocFromLog.MusicBrainzId);
MusicBrainzService.XmlRequest += new EventHandler<XmlRequestEventArgs>(MusicBrainz_LookupProgress);
MusicBrainzService.Proxy = proxy;
foreach (string DiscId in DiscIds)
{
ReleaseQueryParameters p = new ReleaseQueryParameters();
@@ -1986,6 +2014,7 @@ string status = processor.Go();
System.Diagnostics.Trace.WriteLine(ex.Message);
}
}
MusicBrainzService.Proxy = null;
MusicBrainzService.XmlRequest -= new EventHandler<XmlRequestEventArgs>(MusicBrainz_LookupProgress);
//if (release != null)
//{
@@ -2598,24 +2627,11 @@ string status = processor.Go();
if (_config.fillUpCUE)
{
if ((_config.overwriteCUEData || General.FindCUELine(_attributes, "PERFORMER") == null) && taglibMetadata.Artist != "")
General.SetCUELine(_attributes, "PERFORMER", taglibMetadata.Artist, true);
if ((_config.overwriteCUEData || General.FindCUELine(_attributes, "TITLE") == null) && taglibMetadata.Title != "")
General.SetCUELine(_attributes, "TITLE", taglibMetadata.Title, true);
if ((_config.overwriteCUEData || General.FindCUELine(_attributes, "REM", "DATE") == null) && taglibMetadata.Year != "")
General.SetCUELine(_attributes, "REM", "DATE", taglibMetadata.Year, false);
if ((_config.overwriteCUEData || General.FindCUELine(_attributes, "REM", "GENRE") == null) && taglibMetadata.Genre != "")
General.SetCUELine(_attributes, "REM", "GENRE", taglibMetadata.Genre, true);
if ((_config.overwriteCUEData || TotalDiscs == "") && taglibMetadata.TotalDiscs != "")
TotalDiscs = taglibMetadata.TotalDiscs;
if ((_config.overwriteCUEData || DiscNumber == "") && taglibMetadata.DiscNumber != "")
DiscNumber = taglibMetadata.DiscNumber;
CUEMetadata meta = Metadata; // new CUEMetadata(Metadata);
meta.Merge(taglibMetadata, _config.overwriteCUEData);
CopyMetadata(meta);
for (i = 0; i < TrackCount; i++)
{
if ((_config.overwriteCUEData || _tracks[i].Artist == "") && taglibMetadata.Tracks[i].Artist != "")
_tracks[i].Artist = taglibMetadata.Tracks[i].Artist;
if ((_config.overwriteCUEData || _tracks[i].Title == "") && taglibMetadata.Tracks[i].Title != "")
_tracks[i].Title = taglibMetadata.Tracks[i].Title;
if (_tracks[i].Title == "" && _hasTrackFilenames)
_tracks[i].Title = Path.GetFileNameWithoutExtension(_trackFilenames[i]).TrimStart(" .-_0123456789".ToCharArray());
}
@@ -2778,7 +2794,7 @@ string status = processor.Go();
LoadAlbumArt(_tracks[0]._fileInfo ?? _fileInfo);
ResizeAlbumArt();
if (_config.embedAlbumArt || _config.copyAlbumArt)
if (_config.embedAlbumArt || _config.CopyAlbumArt)
_albumArt.ForEach(t => _padding += _albumArt[0].Data.Count);
if (_config.embedLog && _eacLog != null)
_padding += _eacLog.Length;
@@ -3147,9 +3163,9 @@ string status = processor.Go();
extension = ".20bit" + extension;
}
ArLogFileName = General.ReplaceMultiple(_config.arLogFilenameFormat, vars, "unique", CheckIfFileExists)
ArLogFileName = General.ReplaceMultiple(_config.ArLogFilenameFormat, vars, "unique", CheckIfFileExists)
?? vars["%filename%"] + ".accurip";
AlArtFileName = General.ReplaceMultiple(_config.alArtFilenameFormat, vars, "unique", CheckIfFileExists)
AlArtFileName = General.ReplaceMultiple(_config.AlArtFilenameFormat, vars, "unique", CheckIfFileExists)
?? "folder.jpg";
if (OutputStyle == CUEStyle.SingleFileWithCUE)
@@ -3883,7 +3899,7 @@ string status = processor.Go();
if (_action == CUEAction.Encode)
{
string cueContents = CUESheetContents(OutputStyle);
if (_config.createEACLOG)
if (_config.createEACLOG && _isCD)
cueContents = CUESheet.Encoding.GetString(CUESheet.Encoding.GetBytes(cueContents));
if (OutputStyle == CUEStyle.SingleFileWithCUE && _config.createCUEFileWhenEmbedded)
WriteText(Path.ChangeExtension(_outputPath, ".cue"), cueContents);
@@ -3985,7 +4001,7 @@ string status = processor.Go();
fileInfo.Tag.Year = sourceFileInfo.Tag.Year;
}
if ((_config.embedAlbumArt || _config.copyAlbumArt) && _albumArt.Count > 0)
if ((_config.embedAlbumArt || _config.CopyAlbumArt) && _albumArt.Count > 0)
fileInfo.Tag.Pictures = _albumArt.ToArray();
fileInfo.Save();
@@ -4052,7 +4068,7 @@ string status = processor.Go();
fileInfo.Tag.Genres = sourceFileInfo.Tag.Genres;
}
if ((_config.embedAlbumArt || _config.copyAlbumArt) && _albumArt.Count > 0)
if ((_config.embedAlbumArt || _config.CopyAlbumArt) && _albumArt.Count > 0)
fileInfo.Tag.Pictures = _albumArt.ToArray();
fileInfo.Save();
@@ -4113,7 +4129,7 @@ string status = processor.Go();
public void LoadAlbumArt(TagLib.File fileInfo)
{
if ((_config.extractAlbumArt || _config.copyAlbumArt) && fileInfo != null)
if ((_config.extractAlbumArt || _config.CopyAlbumArt) && fileInfo != null)
foreach (TagLib.IPicture picture in fileInfo.Tag.Pictures)
if (picture.Type == TagLib.PictureType.FrontCover)
if (picture.MimeType == "image/jpeg")
@@ -4123,15 +4139,7 @@ string status = processor.Go();
}
if ((_config.extractAlbumArt || _config.embedAlbumArt) && !_isCD)
{
List<string> names = new List<string>();
names.Add("folder.jpg");
names.Add("cover.jpg");
names.Add("albumart.jpg");
names.Add("thumbnail.jpg");
names.Add("albumartlarge.jpg");
names.Add("front.jpg");
foreach (string name in names)
foreach (string name in _config.advanced.CoverArtFiles)
{
string imgPath = Path.Combine(_isArchive ? _archiveCUEpath : _inputDir, name);
bool exists = _isArchive ? _archiveContents.Contains(imgPath) : File.Exists(imgPath);
@@ -4147,9 +4155,28 @@ string status = processor.Go();
}
}
if (!_isArchive)
if (!_isArchive && _config.advanced.CoverArtSearchSubdirs)
{
// TODO: archive case
foreach (string name in _config.advanced.CoverArtFiles)
{
foreach (string imgPath in Directory.GetFiles(_inputDir, name, SearchOption.AllDirectories))
{
TagLib.File.IFileAbstraction file = _isArchive
? (TagLib.File.IFileAbstraction)new ArchiveFileAbstraction(this, imgPath)
: (TagLib.File.IFileAbstraction)new TagLib.File.LocalFileAbstraction(imgPath);
TagLib.Picture pic = new TagLib.Picture(file);
pic.Description = name;
_albumArt.Add(pic);
}
if (_albumArt.Count == 1)
return;
if (_albumArt.Count > 1)
{
_albumArt.Clear();
break;
}
}
foreach (string imgPath in Directory.GetFiles(_inputDir, "*.jpg", SearchOption.AllDirectories))
{
TagLib.Picture pic = new TagLib.Picture(imgPath);
@@ -4158,11 +4185,15 @@ string status = processor.Go();
else
pic.Description = Path.GetFileName(imgPath);
_albumArt.Add(pic);
if (Action != CUEAction.Encode)
return;
}
}
if (Action != CUEAction.Encode && _albumArt.Count > 1)
{
_albumArt.Clear();
return;
}
if (_albumArt.Count != 0)
{
CUEToolsSelectionEventArgs e = new CUEToolsSelectionEventArgs();
@@ -4505,11 +4536,11 @@ string status = processor.Go();
int diskLength = 588 * (int)_toc.AudioLength;
int diskOffset = 0;
// we init CTDB before AR so that AR gets inited with correct CTDB settings
// we init AR before CTDB so that CTDB gets inited with correct TOC
if (_useAccurateRip || _useCUEToolsDB)
_arVerify.Init(_toc);
if (_useCUEToolsDB && !_useCUEToolsDBFix)
_CUEToolsDB.Init(_useCUEToolsDBSibmit, _arVerify);
if (_useAccurateRip)
_arVerify.Init();
ShowProgress(String.Format("{2} track {0:00} ({1:00}%)...", 0, 0, noOutput ? "Verifying" : "Writing"), 0.0, null, null);
@@ -4663,11 +4694,11 @@ string status = processor.Go();
hdcdDecoder = null;
// we init CTDB before AR so that AR gets inited with correct CTDB settings
// we init AR before CTDB so that CTDB gets inited with correct TOC
if (_useAccurateRip || _useCUEToolsDB)
_arVerify.Init(_toc);
if (_useCUEToolsDB && !_useCUEToolsDBFix)
_CUEToolsDB.Init(_useCUEToolsDBSibmit, _arVerify);
if (_useAccurateRip)
_arVerify.Init();
ShowProgress(String.Format("Verifying ({0:00}%)...", 0), 0.0, null, null);

View File

@@ -746,9 +746,9 @@ namespace JDP {
if (_batchPaths.Count == 0 && action == CUEAction.Encode)
{
if (checkBoxUseFreeDb.Checked || checkBoxUseMusicBrainz.Checked)
releases = cueSheet.LookupAlbumInfo(checkBoxUseFreeDb.Checked, checkBoxUseMusicBrainz.Checked, true);
releases = cueSheet.LookupAlbumInfo(checkBoxUseFreeDb.Checked, checkBoxUseMusicBrainz.Checked, _profile._config.advanced.CacheMetadata);
}
else // if checkBoxUseMetadataCache.Checked
else if (_profile._config.advanced.CacheMetadata)
{
try
{

View File

@@ -140,6 +140,7 @@ namespace JDP
if (e.CloseReason != CloseReason.None || DialogResult != DialogResult.OK || ri == null || CUE == null)
return;
CUE.CopyMetadata(ri.metadata);
if (CUE.Config.advanced.CacheMetadata)
ri.metadata.Save();
}

View File

@@ -172,11 +172,12 @@ namespace JDP {
this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
this.listViewScripts = new System.Windows.Forms.ListView();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.labelFormatDecoder = new System.Windows.Forms.Label();
this.labelFormatEncoder = new System.Windows.Forms.Label();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBoxUseSystemProxy = new System.Windows.Forms.CheckBox();
btnCancel = new System.Windows.Forms.Button();
this.grpGeneral.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -218,6 +219,7 @@ namespace JDP {
this.grpHDCD.SuspendLayout();
this.tabPage5.SuspendLayout();
this.groupBoxScriptConditions.SuspendLayout();
this.tabPage7.SuspendLayout();
this.SuspendLayout();
//
// btnCancel
@@ -229,7 +231,6 @@ namespace JDP {
//
// grpGeneral
//
this.grpGeneral.Controls.Add(this.checkBoxUseSystemProxy);
this.grpGeneral.Controls.Add(this.checkBoxSeparateDecodingThread);
this.grpGeneral.Controls.Add(this.checkBoxCheckForUpdates);
this.grpGeneral.Controls.Add(this.chkAllowMultipleInstances);
@@ -654,6 +655,7 @@ namespace JDP {
this.tabControl1.Controls.Add(this.tabPage11);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Controls.Add(this.tabPage5);
this.tabControl1.Controls.Add(this.tabPage7);
this.tabControl1.HotTrack = true;
this.tabControl1.Multiline = true;
this.tabControl1.Name = "tabControl1";
@@ -1453,6 +1455,20 @@ namespace JDP {
//
resources.ApplyResources(this.columnHeader5, "columnHeader5");
//
// tabPage7
//
this.tabPage7.BackColor = System.Drawing.SystemColors.Control;
this.tabPage7.Controls.Add(this.propertyGrid1);
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Name = "tabPage7";
//
// propertyGrid1
//
resources.ApplyResources(this.propertyGrid1, "propertyGrid1");
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.PropertySort = System.Windows.Forms.PropertySort.Categorized;
this.propertyGrid1.ToolbarVisible = false;
//
// labelFormatDecoder
//
resources.ApplyResources(this.labelFormatDecoder, "labelFormatDecoder");
@@ -1473,12 +1489,6 @@ namespace JDP {
this.checkBox1.Name = "checkBox1";
this.checkBox1.UseVisualStyleBackColor = true;
//
// checkBoxUseSystemProxy
//
resources.ApplyResources(this.checkBoxUseSystemProxy, "checkBoxUseSystemProxy");
this.checkBoxUseSystemProxy.Name = "checkBoxUseSystemProxy";
this.checkBoxUseSystemProxy.UseVisualStyleBackColor = true;
//
// frmSettings
//
this.AcceptButton = this.btnOK;
@@ -1557,6 +1567,7 @@ namespace JDP {
this.grpHDCD.PerformLayout();
this.tabPage5.ResumeLayout(false);
this.groupBoxScriptConditions.ResumeLayout(false);
this.tabPage7.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -1713,7 +1724,8 @@ namespace JDP {
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBoxFlaCudaMultithread;
private System.Windows.Forms.CheckBox checkBoxSeparateDecodingThread;
private System.Windows.Forms.CheckBox checkBoxUseSystemProxy;
private System.Windows.Forms.TabPage tabPage7;
private System.Windows.Forms.PropertyGrid propertyGrid1;
}
}

View File

@@ -35,6 +35,7 @@ namespace JDP {
private void frmSettings_Load(object sender, EventArgs e)
{
cUEConfigBindingSource.DataSource = _config;
propertyGrid1.SelectedObject = _config.advanced;
chkReducePriority.Checked = _reducePriority;
checkBoxCheckForUpdates.Checked = _config.checkForUpdates;
@@ -85,7 +86,6 @@ namespace JDP {
//textBoxARLogExtension.Text = _config.arLogFilenameFormat;
numericUpDownMaxResolution.Value = _config.maxAlbumArtSize;
checkBoxSeparateDecodingThread.Checked = _config.separateDecodingThread;
checkBoxUseSystemProxy.Checked = _config.useSystemProxySettings;
switch (_config.gapsHandling)
{
@@ -249,7 +249,6 @@ namespace JDP {
//_config.arLogFilenameFormat = textBoxARLogExtension.Text;
_config.maxAlbumArtSize = (int) numericUpDownMaxResolution.Value;
_config.separateDecodingThread = checkBoxSeparateDecodingThread.Checked;
_config.useSystemProxySettings = checkBoxUseSystemProxy.Checked;
_config.language = ((CultureInfo)comboLanguage.SelectedItem).Name;
}

View File

@@ -150,33 +150,6 @@
<data name="&gt;&gt;btnCancel.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="checkBoxUseSystemProxy.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="checkBoxUseSystemProxy.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 157</value>
</data>
<data name="checkBoxUseSystemProxy.Size" type="System.Drawing.Size, System.Drawing">
<value>153, 17</value>
</data>
<data name="checkBoxUseSystemProxy.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="checkBoxUseSystemProxy.Text" xml:space="preserve">
<value>Use system proxy settings</value>
</data>
<data name="&gt;&gt;checkBoxUseSystemProxy.Name" xml:space="preserve">
<value>checkBoxUseSystemProxy</value>
</data>
<data name="&gt;&gt;checkBoxUseSystemProxy.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;checkBoxUseSystemProxy.Parent" xml:space="preserve">
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;checkBoxUseSystemProxy.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="checkBoxSeparateDecodingThread.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@@ -208,7 +181,7 @@
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;checkBoxSeparateDecodingThread.ZOrder" xml:space="preserve">
<value>1</value>
<value>0</value>
</data>
<data name="checkBoxCheckForUpdates.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -241,7 +214,7 @@
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;checkBoxCheckForUpdates.ZOrder" xml:space="preserve">
<value>2</value>
<value>1</value>
</data>
<data name="chkAllowMultipleInstances.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -274,7 +247,7 @@
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;chkAllowMultipleInstances.ZOrder" xml:space="preserve">
<value>3</value>
<value>2</value>
</data>
<data name="chkReducePriority.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -307,7 +280,7 @@
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;chkReducePriority.ZOrder" xml:space="preserve">
<value>4</value>
<value>3</value>
</data>
<data name="chkTruncateExtra4206Samples.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -340,7 +313,7 @@
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;chkTruncateExtra4206Samples.ZOrder" xml:space="preserve">
<value>5</value>
<value>4</value>
</data>
<data name="chkCreateCUEFileWhenEmbedded.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -373,7 +346,7 @@
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;chkCreateCUEFileWhenEmbedded.ZOrder" xml:space="preserve">
<value>6</value>
<value>5</value>
</data>
<data name="chkCreateM3U.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -406,7 +379,7 @@
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;chkCreateM3U.ZOrder" xml:space="preserve">
<value>7</value>
<value>6</value>
</data>
<data name="chkAutoCorrectFilenames.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -439,7 +412,7 @@
<value>grpGeneral</value>
</data>
<data name="&gt;&gt;chkAutoCorrectFilenames.ZOrder" xml:space="preserve">
<value>8</value>
<value>7</value>
</data>
<data name="grpGeneral.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 6</value>
@@ -4192,6 +4165,54 @@
<data name="&gt;&gt;tabPage5.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="propertyGrid1.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 6</value>
</data>
<data name="propertyGrid1.Size" type="System.Drawing.Size, System.Drawing">
<value>518, 279</value>
</data>
<data name="propertyGrid1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;propertyGrid1.Name" xml:space="preserve">
<value>propertyGrid1</value>
</data>
<data name="&gt;&gt;propertyGrid1.Type" xml:space="preserve">
<value>System.Windows.Forms.PropertyGrid, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;propertyGrid1.Parent" xml:space="preserve">
<value>tabPage7</value>
</data>
<data name="&gt;&gt;propertyGrid1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tabPage7.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 22</value>
</data>
<data name="tabPage7.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
</data>
<data name="tabPage7.Size" type="System.Drawing.Size, System.Drawing">
<value>535, 291</value>
</data>
<data name="tabPage7.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="tabPage7.Text" xml:space="preserve">
<value>Advanced</value>
</data>
<data name="&gt;&gt;tabPage7.Name" xml:space="preserve">
<value>tabPage7</value>
</data>
<data name="&gt;&gt;tabPage7.Type" xml:space="preserve">
<value>System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tabPage7.Parent" xml:space="preserve">
<value>tabControl1</value>
</data>
<data name="&gt;&gt;tabPage7.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="tabControl1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>

View File

@@ -62,7 +62,7 @@
</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
@@ -72,7 +72,7 @@
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<DebugType>pdbonly</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>

View File

@@ -32,6 +32,7 @@ namespace Freedb
{
public const string MAIN_FREEDB_ADDRESS = "freedb.freedb.org";
public const string DEFAULT_ADDITIONAL_URL_INFO = "/~cddb/cddb.cgi";
public const string SUBMIT_ADDITIONAL_URL_INFO = "/~cddb/submit.cgi";
private Site m_mainSite = new Site(MAIN_FREEDB_ADDRESS,"http",DEFAULT_ADDITIONAL_URL_INFO);
private string m_UserName;
private string m_Hostname;
@@ -77,6 +78,13 @@ namespace Freedb
#region Public Properties
/// <summary>
/// Proxy server to use
/// </summary>
public IWebProxy Proxy { get; set; }
/// <summary>
/// Property Version (string)
/// </summary>
@@ -189,6 +197,7 @@ namespace Freedb
public FreedbHelper()
{
m_ProtocolLevel = "6"; // default it
ValidCategories.AddRange(new string[]{"blues", "classical", "country", "data", "folk", "jazz", "misc", "newage", "reggae", "rock", "soundtrack"});
}
@@ -452,6 +461,94 @@ namespace Freedb
}
public StringCollection ValidCategories = new StringCollection();
public string Submit(CDEntry entry, int length, string discid, string category, bool test)
{
StreamReader reader = null;
HttpWebResponse response = null;
string url = "http://" + MAIN_FREEDB_ADDRESS + SUBMIT_ADDITIONAL_URL_INFO;
string command = "";
string result = "";
if ((entry.Artist ?? "") == "")
throw new Exception("Artist not set");
if ((entry.Title ?? "") == "")
throw new Exception("Title not set");
if (!ValidCategories.Contains(category))
throw new Exception("Category not valid");
foreach (Track t in entry.Tracks)
if ((t.Title ?? "") == "")
throw new Exception("Track titles not set");
foreach (Track t in entry.Tracks)
if (t.FrameOffset < 150)
throw new Exception("Track frame offsets not set");
command += "# xmcd CD database file\n";
command += "#\n";
command += "# Track frame offsets:\n";
foreach(Track t in entry.Tracks)
command += "# " + t.FrameOffset + "\n";
command += "#\n";
command += "# Disc length: " + length.ToString() + " seconds\n";
command += "#\n";
command += "# Revision: 0\n";
command += "# Submitted via: " + ClientName + " " + Version + "\n";
command += "#\n";
command += "DISCID=" + discid.ToLower() + "\n";
command += "DTITLE=" + entry.Artist.Replace(" / ", "/") + " / " + entry.Title.Replace(" / ", "/") + "\n";
command += "DYEAR=" + entry.Year + "\n"; // DYEAR=#{@year.to_i == 0 ? "" : "%04d" % @year}
command += "DGENRE=" + entry.Genre + "\n"; // DGENRE=#{(@genre || "").split(" ").collect do |w| w.capitalize end.join(" ")}
int i = 0;
foreach (Track t in entry.Tracks)
command += "TTITLE" + (i++).ToString() + "=" + t.Title + "\n"; // escape
i = 0;
command += "EXTD=" + entry.ExtendedData + "\n";
foreach (Track t in entry.Tracks)
command += "EXTT" + (i++).ToString() + "=" + t.ExtendedData + "\n"; // escape
command += "PLAYORDER=\n";
try
{
//create our HttpWebRequest which we use to call the freedb server
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Proxy = Proxy;
req.ContentType = "text/plain";
req.Method = "POST";
req.Headers.Add("Category", category);
req.Headers.Add("Discid", discid.ToLower());
req.Headers.Add("User-Email", UserName + '@' + Hostname);
req.Headers.Add("Submit-Mode", test ? "test" : "submit");
req.Headers.Add("X-Cddbd-Note", "Sent by " + ClientName + " " + Version);
req.Headers.Add("Charset", "utf-8");
//using Unicode
byte[] byteArray = Encoding.UTF8.GetBytes(command);
//get our request stream
Stream newStream = req.GetRequestStream();
//write our command data to it
newStream.Write(byteArray, 0, byteArray.Length);
newStream.Close();
//Make the call. Note this is a synchronous call
response = (HttpWebResponse)req.GetResponse();
//put the results into a StreamReader
reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8);
result = reader.ReadToEnd();
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (response != null)
response.Close();
if (reader != null)
reader.Close();
}
return result;
}
/// <summary>
/// Retrieve the categories
@@ -549,6 +646,7 @@ namespace Freedb
{
//create our HttpWebRequest which we use to call the freedb server
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Proxy = Proxy;
req.ContentType = "text/plain";
// we are using th POST method of calling the http server. We could have also used the GET method
req.Method="POST";

View File

@@ -380,8 +380,8 @@ namespace MusicBrainz
static void XmlProcessingClosure (string url, XmlProcessingDelegate code)
{
Monitor.Enter (server_mutex);
lock (server_mutex)
{
// Don't access the MB server twice within a second
if (last_accessed != null)
{
@@ -390,49 +390,49 @@ namespace MusicBrainz
Thread.Sleep((min_interval - time).Milliseconds);
}
WebRequest request = WebRequest.Create (url);
WebRequest request = WebRequest.Create(url);
bool cache_implemented = false;
try {
request.Proxy = MusicBrainzService.Proxy;
try
{
request.CachePolicy = MusicBrainzService.CachePolicy;
cache_implemented = true;
} catch (NotImplementedException) {}
}
catch (NotImplementedException) { }
HttpWebResponse response = null;
try {
response = (HttpWebResponse)request.GetResponse ();
} catch (WebException e) {
try
{
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException e)
{
if (e.Response == null)
throw e;
response = (HttpWebResponse)e.Response;
}
if (response == null) throw new MusicBrainzNotFoundException ();
switch (response.StatusCode)
{
case HttpStatusCode.BadRequest:
Monitor.Exit(server_mutex);
throw new MusicBrainzInvalidParameterException();
case HttpStatusCode.Unauthorized:
Monitor.Exit(server_mutex);
throw new MusicBrainzUnauthorizedException();
case HttpStatusCode.NotFound:
Monitor.Exit(server_mutex);
throw new MusicBrainzNotFoundException();
case HttpStatusCode.ServiceUnavailable:
Monitor.Exit(server_mutex);
throw new MusicBrainzUnavailableException(response.StatusDescription);
case HttpStatusCode.OK:
break;
default:
Monitor.Exit(server_mutex);
throw new MusicBrainzUnavailableException(response.StatusDescription);
}
bool from_cache = cache_implemented && response.IsFromCache;
if (from_cache) Monitor.Exit (server_mutex);
try
{
MusicBrainzService.OnXmlRequest(url, from_cache);
@@ -446,7 +446,7 @@ namespace MusicBrainz
if (!from_cache)
{
last_accessed = DateTime.Now;
Monitor.Exit(server_mutex);
}
}
}
}

View File

@@ -42,6 +42,8 @@ namespace MusicBrainz
set { cache_policy = value; }
}
public static System.Net.IWebProxy Proxy { get; set; }
public static event EventHandler<XmlRequestEventArgs> XmlRequest;
internal static void OnXmlRequest (string url, bool fromCache)