diff --git a/CUETools.Processor/Processor.cs b/CUETools.Processor/Processor.cs index 545b1af..e0e7e14 100644 --- a/CUETools.Processor/Processor.cs +++ b/CUETools.Processor/Processor.cs @@ -635,39 +635,6 @@ namespace CUETools.Processor { List Releases = new List(); - ReleaseQueryParameters p = new ReleaseQueryParameters(); - p.DiscId = _toc.MusicBrainzId; - Query results = Release.Query(p); - MusicBrainzService.XmlRequest += new EventHandler(MusicBrainz_LookupProgress); - _progress.percentDisk = 0; - try - { - foreach (MusicBrainz.Release release in results) - { - release.GetEvents(); - release.GetTracks(); - try - { - foreach (MusicBrainz.Track track in release.GetTracks()) - ; - } catch { } - try - { - foreach (MusicBrainz.Event ev in release.GetEvents()) - ; - } catch { } - Releases.Add(release); - } - } catch { } - MusicBrainzService.XmlRequest -= new EventHandler(MusicBrainz_LookupProgress); - //if (release != null) - //{ - // FillFromMusicBrainz(release); - // return; - //} - //if (cdEntry != null) - // FillFromFreedb(cdEntry); - FreedbHelper m_freedb = new FreedbHelper(); m_freedb.UserName = "gchudov"; @@ -679,9 +646,9 @@ namespace CUETools.Processor QueryResult queryResult; QueryResultCollection coll; string code = string.Empty; - CDEntry cdEntry = null; try { + CDEntry cdEntry = null; code = m_freedb.Query(AccurateRipVerify.CalculateCDDBQuery(_toc), out queryResult, out coll); if (code == FreedbHelper.ResponseCodes.CODE_200) { @@ -704,9 +671,141 @@ namespace CUETools.Processor catch (Exception) { } + + StringCollection DiscIds = new StringCollection(); + DiscIds.Add(_toc.MusicBrainzId); + //if (_tocFromLog != null && !DiscIds.Contains(_tocFromLog.MusicBrainzId)) + // DiscIds.Add(_tocFromLog.MusicBrainzId); + foreach (CDEntry cdEntry in Releases) + { + CDImageLayout toc = TocFromCDEntry(cdEntry); + if (!DiscIds.Contains(toc.MusicBrainzId)) + DiscIds.Add(toc.MusicBrainzId); + } + + MusicBrainzService.XmlRequest += new EventHandler(MusicBrainz_LookupProgress); + _progress.percentDisk = 0; + foreach (string DiscId in DiscIds) + { + ReleaseQueryParameters p = new ReleaseQueryParameters(); + p.DiscId = DiscId; + Query results = Release.Query(p); + try + { + foreach (MusicBrainz.Release release in results) + { + release.GetEvents(); + release.GetTracks(); + try + { + foreach (MusicBrainz.Track track in release.GetTracks()) + ; + } + catch { } + try + { + foreach (MusicBrainz.Event ev in release.GetEvents()) + ; + } + catch { } + Releases.Add(release); + } + } + catch { } + } + MusicBrainzService.XmlRequest -= new EventHandler(MusicBrainz_LookupProgress); + //if (release != null) + //{ + // FillFromMusicBrainz(release); + // return; + //} + //if (cdEntry != null) + // FillFromFreedb(cdEntry); return Releases; } + public CDImageLayout TocFromCDEntry(CDEntry cdEntry) + { + CDImageLayout tocFromCDEntry = new CDImageLayout(); + for (int i = 0; i < cdEntry.Tracks.Count; i++) + { + if (i >= _toc.TrackCount) + break; + tocFromCDEntry.AddTrack(new CDTrack((uint)i + 1, + (uint) cdEntry.Tracks[i].FrameOffset - 150, + (i + 1 < cdEntry.Tracks.Count) ? (uint) (cdEntry.Tracks[i + 1].FrameOffset - cdEntry.Tracks[i].FrameOffset) : _toc[i + 1].Length, + _toc[i + 1].IsAudio, + false/*preEmphasis*/)); + } + if (tocFromCDEntry.TrackCount > 0 && tocFromCDEntry[1].IsAudio) + tocFromCDEntry[1][0].Start = 0; + return tocFromCDEntry; + } + + public CDImageLayout TocFromLog(string eacLog) + { + CDImageLayout tocFromLog = new CDImageLayout(); + using (StringReader sr = new StringReader(eacLog)) + { + bool isEACLog = false; + bool iscdda2wavlog = false; + string lineStr; + int prevTrNo = 1, prevTrStart = 0; + while ((lineStr = sr.ReadLine()) != null) + { + if (isEACLog) + { + string[] n = lineStr.Split('|'); + uint trNo, trStart, trEnd; + if (n.Length == 5 && uint.TryParse(n[0], out trNo) && uint.TryParse(n[3], out trStart) && uint.TryParse(n[4], out trEnd) && trNo == tocFromLog.TrackCount + 1) + { + bool isAudio = true; + if (tocFromLog.TrackCount >= _toc.TrackCount && + trStart == tocFromLog[tocFromLog.TrackCount].End + 1U + 152U * 75U + ) + isAudio = false; + if (tocFromLog.TrackCount < _toc.TrackCount && + !_toc[tocFromLog.TrackCount + 1].IsAudio + ) + isAudio = false; + tocFromLog.AddTrack(new CDTrack(trNo, trStart, trEnd + 1 - trStart, isAudio, false)); + } + } + else if (iscdda2wavlog) + { + foreach (string entry in lineStr.Split(',')) + { + string[] n = entry.Split('('); + if (n.Length < 2) continue; + // assert n.Length == 2; + string key = n[0].Trim(' ', '.'); + int trStart = int.Parse(n[1].Trim(' ', ')')); + bool isAudio = true; // !!! + if (key != "1") + tocFromLog.AddTrack(new CDTrack((uint)prevTrNo, (uint)prevTrStart, (uint)(trStart - prevTrStart), isAudio, false)); + if (key == "lead-out") + { + iscdda2wavlog = false; + break; + } + prevTrNo = int.Parse(key); + prevTrStart = trStart; + } + } + else if (lineStr.StartsWith("TOC of the extracted CD") + || lineStr.StartsWith("Exact Audio Copy") + || lineStr.StartsWith("EAC extraction logfile") + || lineStr.StartsWith("CUERipper")) + isEACLog = true; + else if (lineStr.StartsWith("Table of Contents: starting sectors")) + iscdda2wavlog = true; + } + } + if (tocFromLog.TrackCount > 0 && tocFromLog[1].IsAudio) + tocFromLog[1][0].Start = 0; + return tocFromLog; + } + public void Open(string pathIn) { string cueDir = Path.GetDirectoryName(pathIn) ?? pathIn; @@ -858,6 +957,8 @@ namespace CUETools.Processor _hasEmbeddedCUESheet = true; } + string dataTrackLength = null; + using (sr) { while ((lineStr = sr.ReadLine()) != null) { line = new CUELine(lineStr); @@ -987,7 +1088,7 @@ namespace CUETools.Processor (line.Params.Count == 3) && (line.Params[1].ToUpper() == "DATATRACKLENGTH")) { - _dataTrackLength = (uint)CDImageLayout.TimeFromString(line.Params[2]); + dataTrackLength = line.Params[2]; } else if ((command == "REM") && (line.Params.Count == 3) && @@ -1149,50 +1250,24 @@ namespace CUETools.Processor if (_accurateRipId == null) _accurateRipId = GetCommonMiscTag("ACCURATERIPID"); + CDImageLayout tocFromLog = _eacLog == null ? null : TocFromLog(_eacLog); + + if (tocFromLog != null && tocFromLog.Pregap > _toc.Pregap) + PreGapLength = tocFromLog.Pregap; + if (_accurateRipId == null) { - if (_dataTrackLength != null) - { - // TODO: check if we have a data track of unknown length already, and just change it's length! - CDImageLayout toc2 = new CDImageLayout(_toc); - toc2.AddTrack(new CDTrack((uint)_toc.TrackCount, _toc.Length + 152U * 75U, _dataTrackLength.Value, false, false)); - _accurateRipId = AccurateRipVerify.CalculateAccurateRipId(toc2); - } + if (dataTrackLength != null) + DataTrackLength = dataTrackLength; else { bool dtlFound = false; - if (_eacLog != null) + if (tocFromLog != null) { - sr = new StringReader(_eacLog); - bool isEACLog = false; - CDImageLayout tocFromLog = new CDImageLayout(); - while ((lineStr = sr.ReadLine()) != null) - { - if (isEACLog) - { - string[] n = lineStr.Split('|'); - uint trNo, trStart, trEnd; - if (n.Length == 5 && uint.TryParse(n[0], out trNo) && uint.TryParse(n[3], out trStart) && uint.TryParse(n[4], out trEnd) && trNo == tocFromLog.TrackCount + 1) - { - bool isAudio = true; - if (tocFromLog.TrackCount >= _toc.TrackCount && - trStart == tocFromLog[tocFromLog.TrackCount].End + 1U + 152U * 75U - ) - isAudio = false; - if (tocFromLog.TrackCount < _toc.TrackCount && - !_toc[tocFromLog.TrackCount + 1].IsAudio - ) - isAudio = false; - tocFromLog.AddTrack(new CDTrack(trNo, trStart, trEnd + 1 - trStart, isAudio, false)); - } - } - else - if (lineStr.StartsWith("TOC of the extracted CD") - || lineStr.StartsWith("Exact Audio Copy") - || lineStr.StartsWith("EAC extraction logfile") - || lineStr.StartsWith("CUERipper")) - isEACLog = true; - } + // TODO: can just use smth like + // DataTrackLength = tocFromLog.DataTrackLengthMSF; + // The only proplem is DataTrackLength property doesn't set last track's offset. + if (tocFromLog.TrackCount == _toc.TrackCount + 1 && !tocFromLog[tocFromLog.TrackCount].IsAudio) { //_accurateRipId = AccurateRipVerify.CalculateAccurateRipId(tocFromLog); @@ -1815,6 +1890,8 @@ namespace CUETools.Processor { sw.WriteLine("[Verification date: {0}]", DateTime.Now); sw.WriteLine("[Disc ID: {0}]", _accurateRipId); + if (PreGapLength != 0) + sw.WriteLine("Pregap length {0}.", PreGapLengthMSF); if (_dataTrackLength.HasValue) sw.WriteLine("Assuming a data track was present, length {0}.", CDImageLayout.TimeToString(_dataTrackLength.Value)); else @@ -3009,14 +3086,76 @@ namespace CUETools.Processor uint dtl = (uint)CDImageLayout.TimeFromString(value); if (dtl != 0) { + if (!_toc[1].IsAudio) + { + for (int i = 2; i <= _toc.TrackCount; i++) + { + _toc[i].Start += dtl - _toc[1].Length; + for (int j = 0; j <= _toc[i].LastIndex; j++) + _toc[i][j].Start += dtl - _toc[1].Length; + } + _toc[1].Length = dtl; + } + else if (!_toc[_toc.TrackCount].IsAudio) + { + //_toc[_toc.TrackCount].Start = tocFromLog[_toc.TrackCount].Start; + _toc[_toc.TrackCount].Length = dtl; + //_toc[_toc.TrackCount][0].Start = tocFromLog[_toc.TrackCount].Start; + //_toc[_toc.TrackCount][1].Start = tocFromLog[_toc.TrackCount].Start; + } + else + _toc.AddTrack(new CDTrack((uint)_toc.TrackCount, _toc.Length + 152U * 75U, dtl, false, false)); _dataTrackLength = dtl; - CDImageLayout toc2 = new CDImageLayout(_toc); - toc2.AddTrack(new CDTrack((uint)_toc.TrackCount, _toc.Length + 152 * 75, dtl, false, false)); - _accurateRipIdActual = _accurateRipId = AccurateRipVerify.CalculateAccurateRipId(toc2); + _accurateRipIdActual = _accurateRipId = AccurateRipVerify.CalculateAccurateRipId(_toc); } } } + public string PreGapLengthMSF + { + get + { + return CDImageLayout.TimeToString(_toc.Pregap); + } + set + { + PreGapLength = (uint) CDImageLayout.TimeFromString(value); + } + } + + public uint PreGapLength + { + get + { + return _toc.Pregap; + } + set + { + if (value == _toc.Pregap || value == 0) + return; + if (!_toc[1].IsAudio) + throw new Exception("can't set pregap to a data track"); + if (value < _toc.Pregap) + throw new Exception("can't set negative pregap"); + uint offs = value - _toc.Pregap; + for (int i = 1; i <= _toc.TrackCount; i++) + { + _toc[i].Start += offs; + for (int j = 0; j <= _toc[i].LastIndex; j++) + _toc[i][j].Start += offs; + } + _toc[1][0].Start = 0; + + SourceInfo sourceInfo; + sourceInfo.Path = null; + sourceInfo.Offset = 0; + sourceInfo.Length = offs * 588; + _sources.Insert(0, sourceInfo); + + _accurateRipIdActual = _accurateRipId = AccurateRipVerify.CalculateAccurateRipId(_toc); + } + } + public bool UsePregapForFirstTrackInSingleFile { get { return _usePregapForFirstTrackInSingleFile; diff --git a/CUETools/frmCUETools.Designer.cs b/CUETools/frmCUETools.Designer.cs index 14bb38b..ef292de 100644 --- a/CUETools/frmCUETools.Designer.cs +++ b/CUETools/frmCUETools.Designer.cs @@ -62,6 +62,8 @@ namespace JDP { this.btnFilenameCorrector = new System.Windows.Forms.Button(); this.btnSettings = new System.Windows.Forms.Button(); this.grpAccurateRip = new System.Windows.Forms.GroupBox(); + this.txtPreGapLength = new System.Windows.Forms.MaskedTextBox(); + this.label2 = new System.Windows.Forms.Label(); this.rbArPlusCRC = new System.Windows.Forms.RadioButton(); this.rbArAndEncode = new System.Windows.Forms.RadioButton(); this.label1 = new System.Windows.Forms.Label(); @@ -561,6 +563,8 @@ namespace JDP { this.grpAccurateRip.AccessibleName = null; resources.ApplyResources(this.grpAccurateRip, "grpAccurateRip"); this.grpAccurateRip.BackgroundImage = null; + this.grpAccurateRip.Controls.Add(this.txtPreGapLength); + this.grpAccurateRip.Controls.Add(this.label2); this.grpAccurateRip.Controls.Add(this.rbArPlusCRC); this.grpAccurateRip.Controls.Add(this.rbArAndEncode); this.grpAccurateRip.Controls.Add(this.label1); @@ -573,6 +577,29 @@ namespace JDP { this.grpAccurateRip.TabStop = false; this.toolTip1.SetToolTip(this.grpAccurateRip, resources.GetString("grpAccurateRip.ToolTip")); // + // txtPreGapLength + // + this.txtPreGapLength.AccessibleDescription = null; + this.txtPreGapLength.AccessibleName = null; + resources.ApplyResources(this.txtPreGapLength, "txtPreGapLength"); + this.txtPreGapLength.BackgroundImage = null; + this.txtPreGapLength.Culture = new System.Globalization.CultureInfo(""); + this.txtPreGapLength.CutCopyMaskFormat = System.Windows.Forms.MaskFormat.IncludePromptAndLiterals; + this.txtPreGapLength.Font = null; + this.txtPreGapLength.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite; + this.txtPreGapLength.Name = "txtPreGapLength"; + this.txtPreGapLength.TextMaskFormat = System.Windows.Forms.MaskFormat.IncludePromptAndLiterals; + this.toolTip1.SetToolTip(this.txtPreGapLength, resources.GetString("txtPreGapLength.ToolTip")); + // + // label2 + // + this.label2.AccessibleDescription = null; + this.label2.AccessibleName = null; + resources.ApplyResources(this.label2, "label2"); + this.label2.Font = null; + this.label2.Name = "label2"; + this.toolTip1.SetToolTip(this.label2, resources.GetString("label2.ToolTip")); + // // rbArPlusCRC // this.rbArPlusCRC.AccessibleDescription = null; @@ -999,6 +1026,8 @@ namespace JDP { private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; private System.Windows.Forms.RadioButton rbArPlusCRC; + private System.Windows.Forms.MaskedTextBox txtPreGapLength; + private System.Windows.Forms.Label label2; } } diff --git a/CUETools/frmCUETools.cs b/CUETools/frmCUETools.cs index b29681d..3d78bfe 100644 --- a/CUETools/frmCUETools.cs +++ b/CUETools/frmCUETools.cs @@ -401,6 +401,7 @@ namespace JDP { cueSheet.AccurateRip = accurateRip; if (accurateRip != AccurateRipMode.None) cueSheet.DataTrackLength = txtDataTrackLength.Text; + cueSheet.PreGapLengthMSF = txtPreGapLength.Text; cueSheet.WriteAudioFiles(outDir, cueStyle); } @@ -490,6 +491,7 @@ namespace JDP { grpOutputStyle.Enabled = !running && !rbArVerify.Checked && !rbArPlusCRC.Checked; groupBox1.Enabled = !running && !rbArVerify.Checked && !rbArPlusCRC.Checked; txtDataTrackLength.Enabled = !running && !rbArNone.Checked; + txtPreGapLength.Enabled = !running; btnAbout.Enabled = !running; btnSettings.Enabled = !running; btnFilenameCorrector.Enabled = !running; diff --git a/CUETools/frmCUETools.de-DE.resx b/CUETools/frmCUETools.de-DE.resx index 48fd5d8..c452f77 100644 --- a/CUETools/frmCUETools.de-DE.resx +++ b/CUETools/frmCUETools.de-DE.resx @@ -379,6 +379,9 @@ + + + 6, 88 diff --git a/CUETools/frmCUETools.resx b/CUETools/frmCUETools.resx index c1dca6a..09abe09 100644 --- a/CUETools/frmCUETools.resx +++ b/CUETools/frmCUETools.resx @@ -128,8 +128,8 @@ - - 54, 21 + + 59, 17 toolStripSeparator1 @@ -155,8 +155,11 @@ 59, 17 - - 8, 52 + + &Manual + + + 4 rbGapsLeftOut @@ -173,6 +176,9 @@ &Resume + + 13 + NoControl @@ -198,9 +204,15 @@ 10 + + grpAccurateRip + 120, 142 + + True + 66, 23 @@ -210,12 +222,21 @@ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17 + grpOutputStyle %1:-2\New\%-1\%F.cue + + True + + + label2 + System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -243,6 +264,9 @@ contextMenuStripUDC + + 00:00:00 + 77, 138 @@ -258,9 +282,6 @@ 398, 115 - - grpAccurateRip - False @@ -291,8 +312,8 @@ rbEmbedCUE - - + + 131, 23 System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -303,9 +324,6 @@ btnResume - - 1 - @@ -364,14 +382,17 @@ Create a pair of files - .lossy.wav(flac,etc) and .lwcdf.wav(flac,etc). Lossy file contains (lossy) compressed music, but together with the lwcdf (correction) file the original audio can be reconstructed. - 1 + 3 - - System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + btnConvert 452, 49 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -426,6 +447,9 @@ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 1 + 12 @@ -465,8 +489,11 @@ groupBox1 + + grpAccurateRip + - 3 + 5 552, 22 @@ -474,8 +501,8 @@ NoControl - - Encode and verify + + toolStripMenuItem2 System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -529,7 +556,7 @@ Verify AR + CRCs - 5 + 7 6 @@ -549,8 +576,8 @@ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True + + grpAudioOutput @@ -591,8 +618,11 @@ 71, 23 - - 10, 88 + + CUE Paths + + + 45, 13 66, 117 @@ -606,6 +636,9 @@ System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 7, 120 + 2 @@ -708,6 +741,9 @@ True + + 0 + CUE Sheet Creator... @@ -738,8 +774,8 @@ 2 - - &Manual + + 2 8, 4 @@ -768,17 +804,17 @@ System.Windows.Forms.StatusStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 2 - Tahoma, 8.25pt + + txtPreGapLength + &Output: - - + + 8, 52 System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -798,9 +834,6 @@ grpOutputPathGeneration - - 10, 66 - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -822,6 +855,9 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 10, 37 + grpAudioOutput @@ -829,7 +865,7 @@ True - 6 + 8 APE @@ -855,8 +891,8 @@ 0 - - btnConvert + + 162, 164 On the first pass, verify and try to find an offset correction which makes the rip accurate according to the AccurateRip database. On the second pass, convert, possibly applying offset correction. @@ -876,12 +912,12 @@ True + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + Lossy: - - True - grpOutputPathGeneration @@ -918,9 +954,6 @@ txtInputPath - - 162, 164 - 44, 17 @@ -954,8 +987,8 @@ 2 - - btnCodec + + AccurateRip 412, 215 @@ -966,6 +999,9 @@ btnCUECreator + + Pregap is a certain amount of silence or hidden audio before track one. Normally it is known from the CUE sheet, but if converting/verifying a set of separate tracks without a CUE sheet you might want to set this. + grpAccurateRip @@ -1050,9 +1086,6 @@ 125, 17 - - grpAudioOutput - txtCustomFormat @@ -1080,8 +1113,8 @@ grpOutputPathGeneration - - AccurateRip + + statusStrip1 412, 92 @@ -1107,8 +1140,8 @@ Create single file + CUE sheet - - + + -New 10, 20 @@ -1122,11 +1155,8 @@ 1 - - 131, 23 - - - 8, 92 + + 0 Disk progress @@ -1143,6 +1173,9 @@ grpAccurateRip + + + True @@ -1249,6 +1282,12 @@ 5 + + 6, 19 + + + + 54, 17 @@ -1258,9 +1297,6 @@ - - 4 - $this @@ -1291,8 +1327,8 @@ 477, 339 - - Contact the AccurateRip databse for validation and compare the image against database + + 8, 92 11, 87 @@ -1318,6 +1354,9 @@ 6, 53 + + grpOutputStyle + 1 @@ -1330,8 +1369,8 @@ 6, 13 - - 0 + + grpAccurateRip 10, 68 @@ -1354,8 +1393,8 @@ 0 - - -New + + System.Windows.Forms.MaskedTextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1420,6 +1459,9 @@ 2 + + 0 + 14 @@ -1444,9 +1486,6 @@ Audio Output - - rbFreedbNever - 128, 164 @@ -1489,6 +1528,12 @@ 47, 17 + + System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + @@ -1510,8 +1555,11 @@ 166, 60 - - grpOutputStyle + + btnCodec + + + Encode and verify CUE Style @@ -1543,11 +1591,11 @@ 101, 17 - - 10, 37 + + 10, 88 - 0 + 2 3 @@ -1573,6 +1621,9 @@ grpCUEPaths + + 54, 21 + 3 @@ -1588,6 +1639,9 @@ $this + + Contact the AccurateRip databse for validation and compare the image against database + $this @@ -1603,8 +1657,8 @@ 5 - - CUE Paths + + True 385, 21 @@ -1612,9 +1666,6 @@ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - statusStrip1 - &Embedded @@ -1627,6 +1678,9 @@ 10, 17 + + 0 + 4 @@ -1663,8 +1717,8 @@ 75, 17 - - 0 + + 10, 66 5 @@ -1693,11 +1747,14 @@ Gaps Prepended + + 16 + &Input: - 2 + 4 toolStripStatusLabel1 @@ -1711,6 +1768,9 @@ System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Pregap: + 11 @@ -1753,9 +1813,6 @@ 4 - - toolStripMenuItem2 - True @@ -1786,11 +1843,14 @@ groupBox1 + + 54, 21 + $this - - 6, 19 + + rbFreedbNever System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1798,8 +1858,8 @@ - - 13 + + 1 12 @@ -1823,7 +1883,7 @@ 108, 211 - 4 + 6 System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1831,9 +1891,6 @@ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 59, 17 - txtDataTrackLength @@ -1855,6 +1912,9 @@ System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 77, 117 + True diff --git a/CUETools/frmChoice.Designer.cs b/CUETools/frmChoice.Designer.cs index 2570daf..d6f3b28 100644 --- a/CUETools/frmChoice.Designer.cs +++ b/CUETools/frmChoice.Designer.cs @@ -40,6 +40,7 @@ namespace JDP this.TrackNo = new System.Windows.Forms.ColumnHeader(); this.Length = new System.Windows.Forms.ColumnHeader(); this.btnEdit = new System.Windows.Forms.Button(); + this.Start = new System.Windows.Forms.ColumnHeader(); this.SuspendLayout(); // // button1 @@ -91,6 +92,7 @@ namespace JDP this.listTracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.Title, this.TrackNo, + this.Start, this.Length}); this.listTracks.FullRowSelect = true; this.listTracks.GridLines = true; @@ -123,6 +125,10 @@ namespace JDP this.btnEdit.UseVisualStyleBackColor = true; this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click); // + // Start + // + resources.ApplyResources(this.Start, "Start"); + // // frmChoice // this.AcceptButton = this.button1; @@ -133,8 +139,10 @@ namespace JDP this.Controls.Add(this.textBox1); this.Controls.Add(this.listChoices); this.Controls.Add(this.button1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; this.Name = "frmChoice"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.Load += new System.EventHandler(this.frmChoice_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmChoice_FormClosing); this.ResumeLayout(false); @@ -154,5 +162,6 @@ namespace JDP private System.Windows.Forms.ColumnHeader TrackNo; private System.Windows.Forms.ColumnHeader Length; private System.Windows.Forms.Button btnEdit; + private System.Windows.Forms.ColumnHeader Start; } } \ No newline at end of file diff --git a/CUETools/frmChoice.cs b/CUETools/frmChoice.cs index 7247bbb..6deafae 100644 --- a/CUETools/frmChoice.cs +++ b/CUETools/frmChoice.cs @@ -5,6 +5,7 @@ using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; +using CUETools.CDImage; using CUETools.Processor; using MusicBrainz; using Freedb; @@ -112,11 +113,23 @@ namespace JDP CUE.FillFromFreedb((CDEntry)item); } + private void AutoResizeTracks() + { + listTracks.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + listTracks.Columns[2].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + listTracks.Columns[3].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + int widthAvailable = listTracks.Width - listTracks.Columns[1].Width - listTracks.Columns[2].Width - listTracks.Columns[3].Width - listTracks.Padding.Horizontal - 24; + if (listTracks.Columns[0].Width < widthAvailable) + listTracks.Columns[0].Width = widthAvailable; + } + private void listChoices_SelectedIndexChanged(object sender, EventArgs e) { object item = ChosenObject; if (item != null && item is CUEToolsSourceFile) - textBox1.Text = (item as CUEToolsSourceFile).contents; + { + textBox1.Text = (item as CUEToolsSourceFile).contents.Replace("\r\n", "\r").Replace("\r", "\r\n"); + } else if (item != null && item is MusicBrainz.Release) { MusicBrainz.Release release = item as MusicBrainz.Release; @@ -126,22 +139,27 @@ namespace JDP listTracks.Items.Add(new ListViewItem(new string[] { track.GetTitle(), (listTracks.Items.Count + 1).ToString(), + CUE == null ? "" : CUE.TOC[listTracks.Items.Count + 1].StartMSF, CUE == null ? "" : CUE.TOC[listTracks.Items.Count + 1].LengthMSF })); } + AutoResizeTracks(); } else if (item != null && item is CDEntry) { CDEntry cdEntry = item as CDEntry; + listTracks.Items.Clear(); foreach (Freedb.Track track in cdEntry.Tracks) { listTracks.Items.Add(new ListViewItem(new string[] { track.Title, (listTracks.Items.Count + 1).ToString(), + CDImageLayout.TimeToString((uint)track.FrameOffset - 150), CUE == null ? "" : CUE.TOC[listTracks.Items.Count + 1].LengthMSF })); } + AutoResizeTracks(); } else if (item != null && item is CUESheet) { @@ -152,9 +170,11 @@ namespace JDP listTracks.Items.Add(new ListViewItem(new string[] { track.Title, (listTracks.Items.Count + 1).ToString(), + CUE == null ? "" : CUE.TOC[listTracks.Items.Count + 1].StartMSF, CUE == null ? "" : CUE.TOC[listTracks.Items.Count + 1].LengthMSF })); } + AutoResizeTracks(); } else { diff --git a/CUETools/frmChoice.resx b/CUETools/frmChoice.resx index 79d881e..8321947 100644 --- a/CUETools/frmChoice.resx +++ b/CUETools/frmChoice.resx @@ -259,6 +259,36 @@ Top, Left, Right + + 1 + + + Title + + + 360 + + + 0 + + + # + + + 30 + + + Start + + + Right + + + Length + + + Right + 12, 90 @@ -283,30 +313,6 @@ 1 - - 1 - - - Title - - - 455 - - - 0 - - - # - - - 30 - - - Length - - - 62 - 407, 293 @@ -379,6 +385,12 @@ System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Start + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + frmChoice diff --git a/Freedb/CDEntry.cs b/Freedb/CDEntry.cs index 7e420dc..fe7b8d7 100644 --- a/Freedb/CDEntry.cs +++ b/Freedb/CDEntry.cs @@ -199,13 +199,41 @@ namespace Freedb private bool Parse(StringCollection data) { + int offsetNumber = -1; foreach (string line in data) { // check for comment if (line[0] == '#') + { + if (offsetNumber == -2) + continue; + if (offsetNumber == -1) + { + if (line.Substring(1).Trim() != "Track frame offsets:") + continue; + offsetNumber = 0; + continue; + } + if (line.Substring(1).Trim() == "" || line.Substring(1).Trim()[0] == 'D') + { + offsetNumber = -2; + continue; + } + int offset; + if (!int.TryParse(line.Substring(1).Trim(), out offset)) + { + Debug.WriteLine("Failed to parse track FrameOffset: " + line); + continue; + } + //may need to concatenate track info + while (offsetNumber >= m_Tracks.Count) + this.m_Tracks.Add(new Track("")); + m_Tracks[offsetNumber].FrameOffset = offset; + offsetNumber++; continue; + } int index = line.IndexOf('='); if (index == -1) // couldn't find equal sign have no clue what the data is diff --git a/Freedb/Track.cs b/Freedb/Track.cs index b013f79..bfe4008 100644 --- a/Freedb/Track.cs +++ b/Freedb/Track.cs @@ -28,6 +28,7 @@ namespace Freedb private string m_Title; private string m_ExtendedData; + private int m_FrameOffset; #region Public Properties /// @@ -59,6 +60,21 @@ namespace Freedb this.m_Title = value; } } + + /// + /// Property FrameOffset (int) + /// + public int FrameOffset + { + get + { + return this.m_FrameOffset; + } + set + { + this.m_FrameOffset = value; + } + } #endregion diff --git a/MAC_SDK/Source/MACLib/Assembly/Assembly.obj b/MAC_SDK/Source/MACLib/Assembly/Assembly.obj index cc5abb6..dc277f0 100644 Binary files a/MAC_SDK/Source/MACLib/Assembly/Assembly.obj and b/MAC_SDK/Source/MACLib/Assembly/Assembly.obj differ