mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
EAC plugin for CTDB
This commit is contained in:
Binary file not shown.
@@ -34,7 +34,8 @@ namespace AudioDataPlugIn
|
|||||||
AccurateRipVerify arTest;
|
AccurateRipVerify arTest;
|
||||||
CUEToolsDB ctdb;
|
CUEToolsDB ctdb;
|
||||||
bool sequence_ok = true;
|
bool sequence_ok = true;
|
||||||
bool is_accurate;
|
bool is_secure_mode;
|
||||||
|
bool is_offset_set;
|
||||||
string m_drivename;
|
string m_drivename;
|
||||||
|
|
||||||
|
|
||||||
@@ -124,23 +125,21 @@ namespace AudioDataPlugIn
|
|||||||
// the offset was setted by AccurateRip (so having a comparable
|
// the offset was setted by AccurateRip (so having a comparable
|
||||||
// offset value)
|
// offset value)
|
||||||
|
|
||||||
public void StartNewSession(IMetadataLookup data, string drivename, int offset, bool aroffset)
|
public void StartNewSession(IMetadataLookup data, string drivename, int offset, bool aroffset, int mode)
|
||||||
{
|
{
|
||||||
// Copy the CD metadata to the object
|
// Copy the CD metadata to the object
|
||||||
m_data = data;
|
m_data = data;
|
||||||
m_drivename = drivename;
|
|
||||||
|
var parts = drivename.Split(' ');
|
||||||
|
m_drivename = parts[0].PadRight(8, ' ') + " -";
|
||||||
|
for (int i = 1; i < parts.Length; i++)
|
||||||
|
m_drivename += " " + parts[i];
|
||||||
|
|
||||||
TOC = new CDImageLayout();
|
TOC = new CDImageLayout();
|
||||||
for (int i = 0; i < m_data.NumberOfTracks; i++)
|
for (int i = 0; i < m_data.NumberOfTracks; i++)
|
||||||
{
|
{
|
||||||
uint start = m_data.GetTrackStartPosition(i);
|
uint start = m_data.GetTrackStartPosition(i);
|
||||||
uint next;
|
uint next = m_data.GetTrackEndPosition(i);
|
||||||
if (i < m_data.NumberOfTracks - 1)
|
|
||||||
{
|
|
||||||
next = m_data.GetTrackStartPosition(i + 1);
|
|
||||||
if (!m_data.GetTrackDataTrack(i) && m_data.GetTrackDataTrack(i + 1))
|
|
||||||
next -= 152 * 75;
|
|
||||||
} else
|
|
||||||
next = m_data.LeadoutPosition;
|
|
||||||
TOC.AddTrack(new CDTrack(
|
TOC.AddTrack(new CDTrack(
|
||||||
(uint)i + 1,
|
(uint)i + 1,
|
||||||
start,
|
start,
|
||||||
@@ -153,14 +152,17 @@ namespace AudioDataPlugIn
|
|||||||
ar = new AccurateRipVerify(TOC, null);
|
ar = new AccurateRipVerify(TOC, null);
|
||||||
arTest = new AccurateRipVerify(TOC, null);
|
arTest = new AccurateRipVerify(TOC, null);
|
||||||
ctdb = new CUEToolsDB(TOC, null);
|
ctdb = new CUEToolsDB(TOC, null);
|
||||||
|
#if USEAR
|
||||||
ar.ContactAccurateRip(ArId);
|
ar.ContactAccurateRip(ArId);
|
||||||
ctdb.ContactDB("EAC 1.0 CTDB 2.1.1: " + m_drivename);
|
#endif
|
||||||
|
ctdb.ContactDB("EAC" + m_data.HostVersion + " CTDB 2.1.1: " + m_drivename);
|
||||||
ctdb.Init(true, ar);
|
ctdb.Init(true, ar);
|
||||||
this.sequence_ok = true;
|
this.sequence_ok = true;
|
||||||
this.m_start_pos = 0;
|
this.m_start_pos = 0;
|
||||||
this.m_length = 0;
|
this.m_length = 0;
|
||||||
this.m_test_mode = false;
|
this.m_test_mode = false;
|
||||||
this.is_accurate = aroffset; // TODO: && not a virtual drive && not a burst mode!!!!
|
this.is_offset_set = aroffset;
|
||||||
|
this.is_secure_mode = mode >= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function will be called once per session. A session
|
// This function will be called once per session. A session
|
||||||
@@ -239,14 +241,12 @@ namespace AudioDataPlugIn
|
|||||||
return "";
|
return "";
|
||||||
if (this.sequence_ok)
|
if (this.sequence_ok)
|
||||||
{
|
{
|
||||||
int rippingErrorsCount = 0; // TODO: !!!
|
bool is_accurate = (arTest.Position == 0 && this.is_secure_mode) || arTest.CRC32(0) == ar.CRC32(0);
|
||||||
if (arTest.Position > 0 && arTest.CRC32(0) != ar.CRC32(0))
|
|
||||||
rippingErrorsCount = 1;
|
|
||||||
DBEntry confirm = null;
|
DBEntry confirm = null;
|
||||||
if (ctdb.AccResult == HttpStatusCode.OK)
|
if (ctdb.AccResult == HttpStatusCode.OK)
|
||||||
ctdb.DoVerify();
|
ctdb.DoVerify();
|
||||||
if ((ctdb.AccResult == HttpStatusCode.NotFound || ctdb.AccResult == HttpStatusCode.OK)
|
if ((ctdb.AccResult == HttpStatusCode.NotFound || ctdb.AccResult == HttpStatusCode.OK)
|
||||||
&& this.is_accurate && rippingErrorsCount == 0)
|
&& is_accurate)
|
||||||
{
|
{
|
||||||
foreach (DBEntry entry in ctdb.Entries)
|
foreach (DBEntry entry in ctdb.Entries)
|
||||||
if (entry.toc.TrackOffsets == TOC.TrackOffsets && !entry.hasErrors)
|
if (entry.toc.TrackOffsets == TOC.TrackOffsets && !entry.hasErrors)
|
||||||
@@ -256,8 +256,12 @@ namespace AudioDataPlugIn
|
|||||||
ctdb.Confirm(confirm);
|
ctdb.Confirm(confirm);
|
||||||
else
|
else
|
||||||
ctdb.Submit(
|
ctdb.Submit(
|
||||||
|
#if USEAR
|
||||||
(int)ar.WorstConfidence() + 1,
|
(int)ar.WorstConfidence() + 1,
|
||||||
(int)ar.WorstTotal() + 1,
|
(int)ar.WorstTotal() + 1,
|
||||||
|
#else
|
||||||
|
1, 1,
|
||||||
|
#endif
|
||||||
m_data.AlbumArtist,
|
m_data.AlbumArtist,
|
||||||
m_data.AlbumTitle);
|
m_data.AlbumTitle);
|
||||||
}
|
}
|
||||||
@@ -288,7 +292,7 @@ namespace AudioDataPlugIn
|
|||||||
(confirm != entry || ctdb.SubStatus == null) ? "" : (", Submit result: " + ctdb.SubStatus));
|
(confirm != entry || ctdb.SubStatus == null) ? "" : (", Submit result: " + ctdb.SubStatus));
|
||||||
}
|
}
|
||||||
bool canFix = false;
|
bool canFix = false;
|
||||||
if (ctdb.AccResult == HttpStatusCode.OK && rippingErrorsCount != 0)
|
if (ctdb.AccResult == HttpStatusCode.OK && !is_accurate)
|
||||||
{
|
{
|
||||||
foreach (DBEntry entry in ctdb.Entries)
|
foreach (DBEntry entry in ctdb.Entries)
|
||||||
if (entry.hasErrors && entry.canRecover)
|
if (entry.hasErrors && entry.canRecover)
|
||||||
@@ -297,7 +301,9 @@ namespace AudioDataPlugIn
|
|||||||
if (canFix)
|
if (canFix)
|
||||||
sw.WriteLine("You can use CUETools to repair this rip.");
|
sw.WriteLine("You can use CUETools to repair this rip.");
|
||||||
|
|
||||||
//ar.GenerateFullLog(sw, true, ArId);
|
#if USEAR
|
||||||
|
ar.GenerateFullLog(sw, false, ArId);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sw.WriteLine("Some tracks have been skipped");
|
sw.WriteLine("Some tracks have been skipped");
|
||||||
|
|||||||
Reference in New Issue
Block a user