CUERipper: test & copy

This commit is contained in:
chudov
2012-02-15 00:18:58 +00:00
parent dd7b130697
commit 512599be54
5 changed files with 102 additions and 20 deletions

View File

@@ -102,6 +102,7 @@ namespace CUERipper
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.backgroundWorkerArtwork = new System.ComponentModel.BackgroundWorker();
this.buttonSettings = new System.Windows.Forms.Button();
this.checkBoxTestAndCopy = new System.Windows.Forms.CheckBox();
this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericWriteOffset)).BeginInit();
this.groupBoxSettings.SuspendLayout();
@@ -270,6 +271,7 @@ namespace CUERipper
//
// groupBoxSettings
//
this.groupBoxSettings.Controls.Add(this.checkBoxTestAndCopy);
this.groupBoxSettings.Controls.Add(this.bnComboBoxLosslessOrNot);
this.groupBoxSettings.Controls.Add(this.bnComboBoxEncoder);
this.groupBoxSettings.Controls.Add(this.labelSecureMode);
@@ -704,6 +706,13 @@ namespace CUERipper
this.buttonSettings.UseVisualStyleBackColor = true;
this.buttonSettings.Click += new System.EventHandler(this.buttonSettings_Click);
//
// checkBoxTestAndCopy
//
resources.ApplyResources(this.checkBoxTestAndCopy, "checkBoxTestAndCopy");
this.checkBoxTestAndCopy.Name = "checkBoxTestAndCopy";
this.checkBoxTestAndCopy.UseVisualStyleBackColor = true;
this.checkBoxTestAndCopy.Click += new System.EventHandler(this.checkBoxTestAndCopy_Click);
//
// frmCUERipper
//
resources.ApplyResources(this, "$this");
@@ -822,6 +831,7 @@ namespace CUERipper
private System.Windows.Forms.PictureBox pictureBox1;
private System.ComponentModel.BackgroundWorker backgroundWorkerArtwork;
private System.Windows.Forms.Button buttonSettings;
private System.Windows.Forms.CheckBox checkBoxTestAndCopy;
}
}

View File

@@ -14,6 +14,7 @@ using CUETools.Processor;
using CUETools.Processor.Settings;
using CUETools.Ripper;
using Freedb;
using CUETools.Codecs;
namespace CUERipper
{
@@ -28,6 +29,7 @@ namespace CUERipper
string _defaultLosslessFormat, _defaultLossyFormat, _defaultHybridFormat;
private CUEControls.ShellIconMgr m_icon_mgr;
private string defaultDrive;
private bool testAndCopy = false;
internal CUERipperData data = new CUERipperData();
public frmCUERipper()
@@ -163,6 +165,7 @@ namespace CUERipper
trackBarSecureMode.Value = sr.LoadInt32("SecureMode", 0, trackBarSecureMode.Maximum - 1) ?? 1;
trackBarSecureMode_Scroll(this, new EventArgs());
defaultDrive = sr.Load("DefaultDrive");
this.checkBoxTestAndCopy.Checked = this.testAndCopy = sr.LoadBoolean("TestAndCopy") ?? this.testAndCopy;
UpdateDrives();
}
@@ -373,7 +376,12 @@ namespace CUERipper
try
{
cueSheet.Go();
if (this.testAndCopy)
cueSheet.TestBeforeCopy();
else
cueSheet.ArTestVerify = null;
cueSheet.Go();
cueSheet.CTDB.Submit(
(int)cueSheet.ArVerify.WorstConfidence() + 1,
audioSource.CorrectionQuality == 0 ? 0 :
@@ -865,7 +873,7 @@ namespace CUERipper
{
if (e.KeyCode == Keys.Enter)
{
if (listTracks.FocusedItem.Index + 1 < listTracks.Items.Count)// && e.Label != null)
if (listTracks.FocusedItem != null && listTracks.FocusedItem.Index + 1 < listTracks.Items.Count)// && e.Label != null)
{
listTracks.FocusedItem.Selected = false;
listTracks.FocusedItem = listTracks.Items[listTracks.FocusedItem.Index + 1];
@@ -899,7 +907,8 @@ namespace CUERipper
sw.Save("PathFormat", bnComboBoxOutputFormat.Text);
sw.Save("SecureMode", trackBarSecureMode.Value);
sw.Save("OutputPathUseTemplates", bnComboBoxOutputFormat.Items.Count - OutputPathUseTemplates.Length);
for (int iFormat = bnComboBoxOutputFormat.Items.Count - 1; iFormat >= OutputPathUseTemplates.Length; iFormat--)
sw.Save("TestAndCopy", this.testAndCopy);
for (int iFormat = bnComboBoxOutputFormat.Items.Count - 1; iFormat >= OutputPathUseTemplates.Length; iFormat--)
sw.Save(string.Format("OutputPathUseTemplate{0}", iFormat - OutputPathUseTemplates.Length), bnComboBoxOutputFormat.Items[iFormat].ToString());
if (defaultDrive != null)
@@ -1513,6 +1522,11 @@ namespace CUERipper
var form = new Options(this._config);
form.ShowDialog(this);
}
private void checkBoxTestAndCopy_Click(object sender, EventArgs e)
{
this.testAndCopy = checkBoxTestAndCopy.Checked;
}
}
internal class BackgroundWorkerArtworkArgs

View File

@@ -383,7 +383,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;numericWriteOffset.ZOrder" xml:space="preserve">
<value>11</value>
<value>12</value>
</data>
<data name="lblWriteOffset.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -413,7 +413,34 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;lblWriteOffset.ZOrder" xml:space="preserve">
<value>10</value>
<value>11</value>
</data>
<data name="checkBoxTestAndCopy.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="checkBoxTestAndCopy.Location" type="System.Drawing.Point, System.Drawing">
<value>192, 48</value>
</data>
<data name="checkBoxTestAndCopy.Size" type="System.Drawing.Size, System.Drawing">
<value>83, 17</value>
</data>
<data name="checkBoxTestAndCopy.TabIndex" type="System.Int32, mscorlib">
<value>34</value>
</data>
<data name="checkBoxTestAndCopy.Text" xml:space="preserve">
<value>Test &amp;&amp; Copy</value>
</data>
<data name="&gt;&gt;checkBoxTestAndCopy.Name" xml:space="preserve">
<value>checkBoxTestAndCopy</value>
</data>
<data name="&gt;&gt;checkBoxTestAndCopy.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;checkBoxTestAndCopy.Parent" xml:space="preserve">
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;checkBoxTestAndCopy.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="losslessOrNotBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
@@ -443,7 +470,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;bnComboBoxLosslessOrNot.ZOrder" xml:space="preserve">
<value>0</value>
<value>1</value>
</data>
<metadata name="encodersBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1217, 56</value>
@@ -470,7 +497,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;bnComboBoxEncoder.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="labelSecureMode.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@@ -497,7 +524,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;labelSecureMode.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<metadata name="formatsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1045, 56</value>
@@ -524,7 +551,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;bnComboBoxFormat.ZOrder" xml:space="preserve">
<value>3</value>
<value>4</value>
</data>
<data name="labelEncoderMinMode.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -563,7 +590,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;labelEncoderMinMode.ZOrder" xml:space="preserve">
<value>4</value>
<value>5</value>
</data>
<metadata name="cUEStylesBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>526, 56</value>
@@ -590,7 +617,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;bnComboBoxImage.ZOrder" xml:space="preserve">
<value>5</value>
<value>6</value>
</data>
<data name="labelEncoderMaxMode.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
@@ -629,7 +656,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;labelEncoderMaxMode.ZOrder" xml:space="preserve">
<value>6</value>
<value>7</value>
</data>
<data name="labelEncoderMode.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 8.25pt</value>
@@ -665,7 +692,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;labelEncoderMode.ZOrder" xml:space="preserve">
<value>7</value>
<value>8</value>
</data>
<data name="trackBarEncoderMode.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@@ -692,7 +719,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;trackBarEncoderMode.ZOrder" xml:space="preserve">
<value>8</value>
<value>9</value>
</data>
<data name="trackBarSecureMode.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@@ -716,7 +743,7 @@
<value>groupBoxSettings</value>
</data>
<data name="&gt;&gt;trackBarSecureMode.ZOrder" xml:space="preserve">
<value>9</value>
<value>10</value>
</data>
<data name="groupBoxSettings.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 332</value>
@@ -750,7 +777,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABy
CQAAAk1TRnQBSQFMAgEBBAEAAYQBAAGEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CQAAAk1TRnQBSQFMAgEBBAEAAYwBAAGMAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@@ -900,7 +927,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADy
EAAAAk1TRnQBSQFMAgEBCgEAAYQBAAGEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
EAAAAk1TRnQBSQFMAgEBCgEAAYwBAAGMAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@@ -67,6 +67,7 @@ namespace CUETools.Processor
private string _archivePassword;
private CUEToolsProgressEventArgs _progress;
private AccurateRipVerify _arVerify;
private AccurateRipVerify _arTestVerify;
private CUEToolsDB _CUEToolsDB;
private CDImageLayout _toc;
private string _arLogFileName, _alArtFileName;
@@ -195,6 +196,19 @@ namespace CUETools.Processor
}
}
public AccurateRipVerify ArTestVerify
{
get
{
return _arTestVerify;
}
set
{
_arTestVerify = value;
}
}
public AccurateRipVerify ArVerify
{
get
@@ -1614,7 +1628,7 @@ namespace CUETools.Processor
_CUEToolsDB.UploadHelper.onProgress += new EventHandler<Krystalware.UploadHelper.UploadProgressEventArgs>(UploadProgress);
_CUEToolsDB.ContactDB(_config.advanced.CTDBServer, userAgent, driveName, true, fuzzy, metadataSearch);
if (!_toc[_toc.TrackCount].IsAudio && DataTrackLength == 0)
if (!_isCD && !_toc[_toc.TrackCount].IsAudio && DataTrackLength == 0)
foreach (DBEntry e in _CUEToolsDB.Entries)
if (e.toc.TrackCount == _toc.TrackCount && e.toc.AudioLength == _toc.AudioLength && !e.toc[e.toc.TrackCount].IsAudio)
{
@@ -2380,6 +2394,21 @@ namespace CUETools.Processor
outTracksMatch = bestTracksMatch;
}
public void TestBeforeCopy()
{
if (!_isCD)
throw new Exception("Not a cd");
_arTestVerify = new AccurateRipVerify(_toc, proxy);
var buff = new AudioBuffer(AudioPCMConfig.RedBook, 0x10000);
while (_ripper.Read(buff, -1) != 0)
{
_arTestVerify.Write(buff);
}
_ripper.Position = 0;
}
public string Go()
{
int[] destLengths;

View File

@@ -150,7 +150,8 @@ namespace CUETools.Processor
logWriter.WriteLine();
logWriter.WriteLine(" Peak level {0:F1} %", (sheet.ArVerify.PeakLevel(track + 1) * 1000 / 65534) * 0.1);
logWriter.WriteLine(" Track quality 100.0 %");
logWriter.WriteLine(" Test CRC {0:X8}", sheet.ArVerify.CRC32(track + 1));
if (sheet.ArTestVerify != null)
logWriter.WriteLine(" Test CRC {0:X8}", sheet.ArTestVerify.CRC32(track + 1));
logWriter.WriteLine(" Copy CRC {0:X8}", sheet.ArVerify.CRC32(track + 1));
if (sheet.ArVerify.Total(track) == 0)
logWriter.WriteLine(" Track not present in AccurateRip database");
@@ -181,7 +182,8 @@ namespace CUETools.Processor
logWriter.WriteLine();
logWriter.WriteLine(" Peak level {0:F1} %", (sheet.ArVerify.PeakLevel() * 1000 / 65535) * 0.1);
logWriter.WriteLine(" Range quality 100.0 %");
logWriter.WriteLine(" Test CRC {0:X8}", sheet.ArVerify.CRC32(0));
if (sheet.ArTestVerify != null)
logWriter.WriteLine(" Test CRC {0:X8}", sheet.ArTestVerify.CRC32(0));
logWriter.WriteLine(" Copy CRC {0:X8}", sheet.ArVerify.CRC32(0));
logWriter.WriteLine(" Copy OK");
logWriter.WriteLine();