diff --git a/CUETools.CTDB.EACPlugin/FormMetadata.cs b/CUETools.CTDB.EACPlugin/FormMetadata.cs index e04d59f..6686e39 100644 --- a/CUETools.CTDB.EACPlugin/FormMetadata.cs +++ b/CUETools.CTDB.EACPlugin/FormMetadata.cs @@ -58,7 +58,7 @@ namespace CUETools.CTDB.EACPlugin private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { #if DEBUG - string server = "hq.cuetools.net"; + string server = "db.cuetools.net"; #else string server = null; #endif @@ -239,12 +239,13 @@ namespace CUETools.CTDB.EACPlugin var discnumber01 = (uint.TryParse(disccount, out td) && uint.TryParse(discnumber, out dn) && td > 9 && dn > 0) ? string.Format("{0:00}", dn) : discnumber; var discnumberandtotal = disccount != "1" ? discnumber01 + "/" + disccount : (discnumber != "1" ? discnumber01 : ""); - var label = metadata.country ?? ""; + var label = ""; + if (metadata.release != null) + foreach (var r in metadata.release) + label = (label == "" ? "" : label + ": ") + (r.country ?? "") + (r.country != null && r.date != null ? " " : "") + (r.date ?? ""); if (metadata.label != null) foreach (var l in metadata.label) label = (label == "" ? "" : label + ": ") + (l.name ?? "") + (l.name != null && l.catno != null ? " " : "") + (l.catno ?? ""); - if (metadata.releasedate != null) - label = (label == "" ? "" : label + ": ") + metadata.releasedate; var text = string.Format("{0}{1} - {2}{3}{4}", metadata.year != null ? metadata.year + ": " : "", metadata.artist == null ? "Unknown Artist" : metadata.artist, metadata.album == "" ? "Unknown Title" : metadata.album, diff --git a/CUETools.CTDB.EACPlugin/Interop.HelperFunctionsLib.dll b/CUETools.CTDB.EACPlugin/Interop.HelperFunctionsLib.dll index 064ab50..a195177 100644 Binary files a/CUETools.CTDB.EACPlugin/Interop.HelperFunctionsLib.dll and b/CUETools.CTDB.EACPlugin/Interop.HelperFunctionsLib.dll differ diff --git a/CUETools.CTDB.EACPlugin/Metadata.cs b/CUETools.CTDB.EACPlugin/Metadata.cs index dcc5cb4..f08c4d9 100644 --- a/CUETools.CTDB.EACPlugin/Metadata.cs +++ b/CUETools.CTDB.EACPlugin/Metadata.cs @@ -62,10 +62,14 @@ namespace MetadataPlugIn extra += "Info URL: " + meta.infourl + "\r\n"; if (!string.IsNullOrEmpty(meta.barcode)) extra += "Barcode: " + meta.barcode + "\r\n"; - if (!string.IsNullOrEmpty(meta.releasedate)) - extra += "Release date: " + meta.releasedate + "\r\n"; - if (!string.IsNullOrEmpty(meta.country)) - extra += "Release country: " + meta.country + "\r\n"; + if (meta.release != null) + foreach (var release in meta.release) + { + if (!string.IsNullOrEmpty(release.date)) + extra += "Release date: " + release.date + "\r\n"; + if (!string.IsNullOrEmpty(release.country)) + extra += "Release country: " + release.country + "\r\n"; + } if (meta.label != null) foreach (var label in meta.label) { diff --git a/CUETools.CTDB.EACPlugin/Plugin.cs b/CUETools.CTDB.EACPlugin/Plugin.cs index 3acb4e6..09fb542 100644 --- a/CUETools.CTDB.EACPlugin/Plugin.cs +++ b/CUETools.CTDB.EACPlugin/Plugin.cs @@ -27,6 +27,8 @@ namespace AudioDataPlugIn public class AudioDataTransfer : IAudioDataTransfer { int m_start_pos = 0, m_length = 0; + int m_suspicious = 0; + int m_suspiciousTest = 0; bool m_test_mode = false; IMetadataLookup m_data = null; CDImageLayout TOC; @@ -72,6 +74,17 @@ namespace AudioDataPlugIn } + public void SuspiciousPosition() + { + if (this.m_test_mode) + this.m_suspiciousTest++; + else + this.m_suspicious++; +#if DEBUG + var thisAr = m_test_mode ? arTest : ar; + m_trace.WriteLine("Suspicious position: {0} ({1}*588)", thisAr.Position, thisAr.Position/588); +#endif + } // Now to the audio transfer functions, the sequence how // the functions are called is: @@ -133,6 +146,8 @@ namespace AudioDataPlugIn this.sequence_ok = true; this.m_start_pos = 0; this.m_length = 0; + this.m_suspicious = 0; + this.m_suspiciousTest = 0; this.m_test_mode = false; this.is_offset_set = aroffset; this.is_secure_mode = mode >= 2; @@ -266,7 +281,10 @@ namespace AudioDataPlugIn "EAC" + m_data.HostVersion + " CTDB 2.1.6", m_drivename, conf, - (arTest.Position == 0 && this.is_secure_mode) || (arTest.Position != 0 && arTest.CRC32(0) == ar.CRC32(0)) ? 100 : 0, + (arTest.Position != 0 && arTest.CRC32(0) == ar.CRC32(0)) ? 100 : + (arTest.Position == 0 && this.is_secure_mode) ? + (int)(100 * (1.0 - Math.Log(m_suspicious + 1) / Math.Log(TOC.AudioLength + 1))) : + (int)( 49 * (1.0 - Math.Log(m_suspicious + 1) / Math.Log(TOC.AudioLength + 1))), m_data.AlbumArtist, m_data.AlbumTitle); form.ShowDialog(); diff --git a/CUETools.CTDB/CTDBResponseMeta.cs b/CUETools.CTDB/CTDBResponseMeta.cs index 0a6c2bc..7796301 100644 --- a/CUETools.CTDB/CTDBResponseMeta.cs +++ b/CUETools.CTDB/CTDBResponseMeta.cs @@ -19,8 +19,6 @@ namespace CUETools.CTDB this.year = src.year; this.genre = src.genre; this.extra = src.extra; - this.country = src.country; - this.releasedate = src.releasedate; this.discnumber = src.discnumber; this.disccount = src.disccount; this.discname = src.discname; @@ -46,6 +44,13 @@ namespace CUETools.CTDB for (int i = 0; i < src.label.Length; i++) this.label[i] = new CTDBResponseMetaLabel(src.label[i]); } + + if (src.release != null) + { + this.release = new CTDBResponseMetaRelease[src.release.Length]; + for (int i = 0; i < src.release.Length; i++) + this.release[i] = new CTDBResponseMetaRelease(src.release[i]); + } } [XmlAttribute] @@ -63,10 +68,6 @@ namespace CUETools.CTDB [XmlElement] public string extra { get; set; } [XmlAttribute] - public string country { get; set; } - [XmlAttribute] - public string releasedate { get; set; } - [XmlAttribute] public string discnumber { get; set; } [XmlAttribute] public string disccount { get; set; } @@ -82,5 +83,7 @@ namespace CUETools.CTDB public CTDBResponseMetaTrack[] track; [XmlElement] public CTDBResponseMetaLabel[] label; + [XmlElement] + public CTDBResponseMetaRelease[] release; } } diff --git a/CUETools.CTDB/CTDBResponseMetaRelease.cs b/CUETools.CTDB/CTDBResponseMetaRelease.cs new file mode 100644 index 0000000..8911b3c --- /dev/null +++ b/CUETools.CTDB/CTDBResponseMetaRelease.cs @@ -0,0 +1,24 @@ +using System; +using System.Xml.Serialization; + +namespace CUETools.CTDB +{ + [Serializable] + public class CTDBResponseMetaRelease + { + public CTDBResponseMetaRelease() + { + } + + public CTDBResponseMetaRelease(CTDBResponseMetaRelease src) + { + this.date = src.date; + this.country = src.country; + } + + [XmlAttribute] + public string date { get; set; } + [XmlAttribute] + public string country { get; set; } + } +} diff --git a/CUETools.CTDB/CUETools.CTDB.csproj b/CUETools.CTDB/CUETools.CTDB.csproj index a7a22f7..8a08580 100644 --- a/CUETools.CTDB/CUETools.CTDB.csproj +++ b/CUETools.CTDB/CUETools.CTDB.csproj @@ -59,6 +59,7 @@ + diff --git a/CUETools.CTDB/CUEToolsDB.cs b/CUETools.CTDB/CUEToolsDB.cs index 772973b..23a1ae4 100644 --- a/CUETools.CTDB/CUEToolsDB.cs +++ b/CUETools.CTDB/CUEToolsDB.cs @@ -70,7 +70,7 @@ namespace CUETools.CTDB HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urlbase + "/lookup2.php" - + "?version=2" + + "?version=3" + "&ctdb=" + (ctdb ? 1 : 0) + "&fuzzy=" + (fuzzy ? 1 : 0) + "&metadata=" + (metadataSearch == CTDBMetadataSearch.None ? "none" : metadataSearch == CTDBMetadataSearch.Fast ? "fast" : metadataSearch == CTDBMetadataSearch.Default ? "default" : "extensive")