Minor bugfixes (2.0.4a)

This commit is contained in:
chudov
2009-08-08 16:14:06 +00:00
parent 577354eba8
commit 98c80c8396
17 changed files with 2291 additions and 2628 deletions

View File

@@ -32,7 +32,7 @@ namespace ArCueDotNet
cueSheet.Action = CUEAction.Verify;
//cueSheet.OutputStyle = CUEStyle.SingleFile;
cueSheet.Open(pathIn);
cueSheet.Lookup();
cueSheet.UseAccurateRip();
cueSheet.GenerateFilenames(AudioEncoderType.NoAudio, "dummy", pathIn);
cueSheet.Go();
cueSheet.GenerateAccurateRipLog(sw);

View File

@@ -76,7 +76,7 @@ namespace CUERipper
_config.createEACLOG = sr.LoadBoolean("CreateEACLOG") ?? false;
_config.preserveHTOA = sr.LoadBoolean("PreserveHTOA") ?? false;
_config.createM3U = sr.LoadBoolean("CreateM3U") ?? true;
_pathFormat = sr.Load("PathFormat") ?? "%music%\\%artist%\\%year% - %album%\\%artist% - %album%.cue";
_pathFormat = sr.Load("PathFormat") ?? "%music%\\%artist%\\[%year% - ]%album%\\%artist% - %album%.cue";
checkBoxEACMode.Checked = _config.createEACLOG;
SelectedOutputAudioType = (AudioEncoderType?)sr.LoadInt32("OutputAudioType", null, null) ?? AudioEncoderType.Lossless;
comboBoxAudioFormat.SelectedIndex = sr.LoadInt32("ComboCodec", 0, comboBoxAudioFormat.Items.Count - 1) ?? 0;
@@ -244,39 +244,22 @@ namespace CUERipper
});
}
private string GenerateOutputPath()
{
List<string> find = new List<string>();
find.Add("%music%");
find.Add("%artist%");
find.Add("%D");
find.Add("%album%");
find.Add("%C");
find.Add("%year%");
find.Add("%Y");
List<string> replace = new List<string>();
replace.Add(m_icon_mgr.GetFolderPath(CUEControls.ExtraSpecialFolder.MyMusic));
replace.Add(General.EmptyStringToNull(_config.CleanseString(_cueSheet.Artist)));
replace.Add(General.EmptyStringToNull(_config.CleanseString(_cueSheet.Artist)));
replace.Add(General.EmptyStringToNull(_config.CleanseString(_cueSheet.Title)));
replace.Add(General.EmptyStringToNull(_config.CleanseString(_cueSheet.Title)));
replace.Add(_cueSheet.Year);
replace.Add(_cueSheet.Year);
return Path.ChangeExtension(General.ReplaceMultiple(_pathFormat, find, replace) ?? "image.cue", ".cue");
}
private void buttonGo_Click(object sender, EventArgs e)
{
if (_reader == null)
return;
_format = (string)comboBoxAudioFormat.SelectedItem;
_cueSheet.OutputStyle = comboImage.SelectedIndex == 0 ? CUEStyle.SingleFileWithCUE :
CUEStyle.GapsAppended;
_pathOut = GenerateOutputPath();
if (_cueSheet.OutputStyle == CUEStyle.SingleFileWithCUE)
_cueSheet.SingleFilename = Path.GetFileName(_pathOut);
_format = (string)comboBoxAudioFormat.SelectedItem;
_pathOut = _cueSheet.GenerateUniqueOutputPath(_pathFormat,
_cueSheet.OutputStyle == CUEStyle.SingleFileWithCUE ? "." + _format : ".cue",
CUEAction.Encode, null);
if (_pathOut == "")
{
MessageBox.Show(this, "Output path generation failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_cueSheet.GenerateFilenames(SelectedOutputAudioType, _format, _pathOut);
_workThread = new Thread(Rip);
@@ -383,8 +366,9 @@ namespace CUERipper
}
if (r.cueSheet.Genre == "") r.cueSheet.Genre = "";
if (r.cueSheet.Year == "") r.cueSheet.Year = "";
r.cueSheet.Action = CUEAction.VerifyAndConvert;
r.cueSheet.ArVerify.ContactAccurateRip(AccurateRipVerify.CalculateAccurateRipId(audioSource.TOC));
r.cueSheet.Action = CUEAction.Encode;
r.cueSheet.UseAccurateRip();
//r.cueSheet.ArVerify.ContactAccurateRip(AccurateRipVerify.CalculateAccurateRipId(audioSource.TOC));
return r;
}

View File

@@ -148,7 +148,7 @@
<value>0, 443</value>
</metadata>
<data name="toolStripStatusLabel1.Size" type="System.Drawing.Size, System.Drawing">
<value>229, 17</value>
<value>260, 17</value>
</data>
<data name="toolStripStatusLabel1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
@@ -745,7 +745,7 @@
<value>CenterScreen</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>CUERipper 2.0.2</value>
<value>CUERipper 2.0.4a</value>
</data>
<data name="&gt;&gt;toolStripStatusLabel1.Name" xml:space="preserve">
<value>toolStripStatusLabel1</value>

View File

@@ -735,7 +735,7 @@ namespace CUETools.Codecs
Process _encoderProcess;
WAVWriter wrt;
public UserDefinedWriter(string path, int bitsPerSample, int channelCount, int sampleRate, Stream IO, string encoder, string encoderParams, string encoderMode)
public UserDefinedWriter(string path, int bitsPerSample, int channelCount, int sampleRate, Stream IO, string encoder, string encoderParams, string encoderMode, int padding)
{
_path = path;
_encoder = encoder;
@@ -744,7 +744,7 @@ namespace CUETools.Codecs
_encoderProcess = new Process();
_encoderProcess.StartInfo.FileName = _encoder;
_encoderProcess.StartInfo.Arguments = _encoderParams.Replace("%O", "\"" + path + "\"").Replace("%M", encoderMode);
_encoderProcess.StartInfo.Arguments = _encoderParams.Replace("%O", "\"" + path + "\"").Replace("%M", encoderMode).Replace("%P", padding.ToString());
_encoderProcess.StartInfo.CreateNoWindow = true;
_encoderProcess.StartInfo.RedirectStandardInput = true;
_encoderProcess.StartInfo.UseShellExecute = false;

View File

@@ -42,7 +42,7 @@ namespace CUETools.Converter
#endif
{
IAudioSource audioSource = AudioReadWrite.GetAudioSource(sourceFile, null, config);
IAudioDest audioDest = AudioReadWrite.GetAudioDest(AudioEncoderType.Lossless, destFile, (long)audioSource.Length, audioSource.BitsPerSample, audioSource.SampleRate, config);
IAudioDest audioDest = AudioReadWrite.GetAudioDest(AudioEncoderType.Lossless, destFile, (long)audioSource.Length, audioSource.BitsPerSample, audioSource.SampleRate, 8192, config);
int[,] buff = new int[0x4000, audioSource.ChannelCount];
Console.WriteLine("Filename : {0}", sourceFile);

View File

@@ -69,7 +69,7 @@ namespace CUETools.Processor
return new LossyWAVReader(lossySource, lwcdfSource);
}
public static IAudioDest GetAudioDest(AudioEncoderType audioEncoderType, string path, int bitsPerSample, int channelCount, int sampleRate, long finalSampleCount, string extension, CUEConfig config)
public static IAudioDest GetAudioDest(AudioEncoderType audioEncoderType, string path, int bitsPerSample, int channelCount, int sampleRate, long finalSampleCount, int padding, string extension, CUEConfig config)
{
IAudioDest dest;
if (audioEncoderType == AudioEncoderType.NoAudio || extension == ".dummy")
@@ -94,6 +94,7 @@ namespace CUETools.Processor
#if !MONO
case "FLACWriter":
dest = new FLACWriter(path, bitsPerSample, channelCount, sampleRate);
((FLACWriter)dest).PaddingLength = padding;
((FLACWriter)dest).CompressionLevel = encoder.DefaultModeIndex;
((FLACWriter)dest).Verify = config.flacVerify;
((FLACWriter)dest).DisableAsm = config.disableAsm;
@@ -115,24 +116,24 @@ namespace CUETools.Processor
default:
if (encoder.path == null)
throw new Exception("Unsupported audio type: " + path);
dest = new UserDefinedWriter(path, bitsPerSample, channelCount, sampleRate, null, encoder.path, encoder.parameters, encoder.default_mode);
dest = new UserDefinedWriter(path, bitsPerSample, channelCount, sampleRate, null, encoder.path, encoder.parameters, encoder.default_mode, padding);
break;
}
dest.FinalSampleCount = finalSampleCount;
return dest;
}
public static IAudioDest GetAudioDest(AudioEncoderType audioEncoderType, string path, long finalSampleCount, int bitsPerSample, int sampleRate, CUEConfig config)
public static IAudioDest GetAudioDest(AudioEncoderType audioEncoderType, string path, long finalSampleCount, int bitsPerSample, int sampleRate, int padding, CUEConfig config)
{
string extension = Path.GetExtension(path).ToLower();
string filename = Path.GetFileNameWithoutExtension(path);
if (audioEncoderType == AudioEncoderType.NoAudio || audioEncoderType == AudioEncoderType.Lossless || Path.GetExtension(filename).ToLower() != ".lossy")
return GetAudioDest(audioEncoderType, path, bitsPerSample, 2, sampleRate, finalSampleCount, extension, config);
return GetAudioDest(audioEncoderType, path, bitsPerSample, 2, sampleRate, finalSampleCount, padding, extension, config);
string lwcdfPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(filename) + ".lwcdf" + extension);
int lossyBitsPerSample = (config.detectHDCD && config.decodeHDCD && !config.decodeHDCDtoLW16) ? 24 : 16;
IAudioDest lossyDest = GetAudioDest(AudioEncoderType.Lossless, path, lossyBitsPerSample, 2, sampleRate, finalSampleCount, extension, config);
IAudioDest lwcdfDest = audioEncoderType == AudioEncoderType.Hybrid ? GetAudioDest(AudioEncoderType.Lossless, lwcdfPath, bitsPerSample, 2, sampleRate, finalSampleCount, extension, config) : null;
IAudioDest lossyDest = GetAudioDest(AudioEncoderType.Lossless, path, lossyBitsPerSample, 2, sampleRate, finalSampleCount, padding, extension, config);
IAudioDest lwcdfDest = audioEncoderType == AudioEncoderType.Hybrid ? GetAudioDest(AudioEncoderType.Lossless, lwcdfPath, bitsPerSample, 2, sampleRate, finalSampleCount, padding, extension, config) : null;
return new LossyWAVWriter(lossyDest, lwcdfDest, bitsPerSample, 2, sampleRate, config.lossyWAVQuality);
}
}

View File

@@ -65,11 +65,10 @@ namespace CUETools.Processor
public enum CUEAction
{
Convert,
Verify,
VerifyAndConvert,
CreateDummyCUE,
CorrectFilenames
Encode = 0,
Verify = 1,
CreateDummyCUE = 2,
CorrectFilenames = 3
}
public enum CUEStyle
@@ -405,6 +404,30 @@ namespace CUETools.Processor
return ReplaceMultiple(s, find, replace);
}
public delegate bool CheckIfExists(string output);
public static string ReplaceMultiple(string fmt, NameValueCollection tags, string unique_key, CheckIfExists exists)
{
string result = ReplaceMultiple(fmt, tags);
if (result == String.Empty || result == null)
return result;
int unique = 1;
try
{
while (exists(result))
{
tags[unique_key] = unique.ToString();
string new_result = ReplaceMultiple(fmt, tags);
if (new_result == result || new_result == String.Empty || new_result == null)
break;
result = new_result;
unique++;
}
}
catch { }
return result;
}
public static string ReplaceMultiple(string s, List<string> find, List<string> replace)
{
if (find.Count != replace.Count)
@@ -757,7 +780,7 @@ namespace CUETools.Processor
public bool encodeWhenZeroOffset;
public bool writeArTagsOnVerify;
public bool writeArLogOnVerify;
public bool writeArTagsOnConvert;
public bool writeArTagsOnEncode;
public bool writeArLogOnConvert;
public bool fixOffset;
public bool noUnverifiedOutput;
@@ -798,7 +821,7 @@ namespace CUETools.Processor
public Dictionary<string, CUEToolsUDC> decoders;
public Dictionary<string, CUEToolsScript> scripts;
public string defaultVerifyScript;
public string defaultVerifyAndConvertScript;
public string defaultEncodeScript;
public bool writeBasicTagsFromCUEData;
public bool copyBasicTags;
public bool copyUnknownTags;
@@ -813,8 +836,8 @@ namespace CUETools.Processor
public CUEStyle gapsHandling;
public bool CopyAlbumArt { get { return copyAlbumArt; } set { copyAlbumArt = value; } }
public string ArLogFilenameFormat { get { return arLogFilenameFormat; } }
public string AlArtFilenameFormat { get { return alArtFilenameFormat; } }
public string ArLogFilenameFormat { get { return arLogFilenameFormat; } set { arLogFilenameFormat = value; } }
public string AlArtFilenameFormat { get { return alArtFilenameFormat; } set { alArtFilenameFormat = value; } }
public CUEToolsUDCList Encoders
{
get { return encoders; }
@@ -829,7 +852,7 @@ namespace CUETools.Processor
encodeWhenZeroOffset = false;
fixOffset = false;
noUnverifiedOutput = false;
writeArTagsOnConvert = true;
writeArTagsOnEncode = true;
writeArLogOnConvert = true;
writeArTagsOnVerify = false;
writeArLogOnVerify = true;
@@ -840,8 +863,8 @@ namespace CUETools.Processor
wvExtraMode = 0;
wvStoreMD5 = false;
keepOriginalFilenames = false;
trackFilenameFormat = "%N. %T";
singleFilenameFormat = "%F";
trackFilenameFormat = "%tracknumber%. %title%";
singleFilenameFormat = "%filename%";
removeSpecial = false;
specialExceptions = "-()";
replaceSpaces = false;
@@ -878,7 +901,7 @@ namespace CUETools.Processor
arLogToSourceFolder = false;
arLogVerbose = true;
fixOffsetToNearest = true;
arLogFilenameFormat = "%F.accurip";
arLogFilenameFormat = "%filename%.accurip";
alArtFilenameFormat = "folder.jpg";
gapsHandling = CUEStyle.GapsAppended;
@@ -926,7 +949,7 @@ namespace CUETools.Processor
scripts = new Dictionary<string, CUEToolsScript>();
scripts.Add("default", new CUEToolsScript("default", true,
new CUEAction[] { CUEAction.VerifyAndConvert, CUEAction.Verify, CUEAction.Convert },
new CUEAction[] { CUEAction.Verify, CUEAction.Encode },
"return processor.Go();"));
scripts.Add("only if found", new CUEToolsScript("only if found", true,
new CUEAction[] { CUEAction.Verify },
@@ -934,7 +957,7 @@ namespace CUETools.Processor
return processor.WriteReport();
return processor.Go();"));
scripts.Add("fix offset", new CUEToolsScript("fix offset", true,
new CUEAction[] { CUEAction.VerifyAndConvert },
new CUEAction[] { CUEAction.Encode },
@"if (processor.ArVerify.AccResult != HttpStatusCode.OK)
return processor.WriteReport();
processor.WriteOffset = 0;
@@ -946,12 +969,12 @@ processor.FindBestOffset(processor.Config.fixOffsetMinimumConfidence, !processor
if (tracksMatch * 100 < processor.Config.fixOffsetMinimumTracksPercent * processor.TrackCount)
return status;
processor.WriteOffset = bestOffset;
processor.Action = CUEAction.VerifyAndConvert;
processor.Action = CUEAction.Encode;
//MessageBox.Show(null, processor.AccurateRipLog, " + "\"Done\"" + @"MessageBoxButtons.OK, MessageBoxIcon.Information);
return processor.Go();
"));
scripts.Add("encode if verified", new CUEToolsScript("encode if verified", true,
new CUEAction[] { CUEAction.VerifyAndConvert },
new CUEAction[] { CUEAction.Encode },
@"if (processor.ArVerify.AccResult != HttpStatusCode.OK)
return processor.WriteReport();
processor.Action = CUEAction.Verify;
@@ -961,11 +984,11 @@ int bestOffset;
processor.FindBestOffset(processor.Config.encodeWhenConfidence, false, out tracksMatch, out bestOffset);
if (tracksMatch * 100 < processor.Config.encodeWhenPercent * processor.TrackCount || (processor.Config.encodeWhenZeroOffset && bestOffset != 0))
return status;
processor.Action = CUEAction.VerifyAndConvert;
processor.Action = CUEAction.Encode;
return processor.Go();
"));
defaultVerifyScript = "default";
defaultVerifyAndConvertScript = "default";
defaultEncodeScript = "default";
}
public void Save (SettingsWriter sw)
@@ -978,7 +1001,7 @@ return processor.Go();
sw.Save("ArEncodeWhenZeroOffset", encodeWhenZeroOffset);
sw.Save("ArNoUnverifiedOutput", noUnverifiedOutput);
sw.Save("ArFixOffset", fixOffset);
sw.Save("ArWriteCRC", writeArTagsOnConvert);
sw.Save("ArWriteCRC", writeArTagsOnEncode);
sw.Save("ArWriteLog", writeArLogOnConvert);
sw.Save("ArWriteTagsOnVerify", writeArTagsOnVerify);
sw.Save("ArWriteLogOnVerify", writeArLogOnVerify);
@@ -1089,7 +1112,7 @@ return processor.Go();
}
sw.Save("CustomScripts", nScripts);
sw.Save("DefaultVerifyScript", defaultVerifyScript);
sw.Save("DefaultVerifyAndConvertScript", defaultVerifyAndConvertScript);
sw.Save("DefaultVerifyAndConvertScript", defaultEncodeScript);
sw.Save("GapsHandling", (int)gapsHandling);
}
@@ -1105,7 +1128,7 @@ return processor.Go();
encodeWhenZeroOffset = sr.LoadBoolean("ArEncodeWhenZeroOffset") ?? false;
noUnverifiedOutput = sr.LoadBoolean("ArNoUnverifiedOutput") ?? false;
fixOffset = sr.LoadBoolean("ArFixOffset") ?? false;
writeArTagsOnConvert = sr.LoadBoolean("ArWriteCRC") ?? true;
writeArTagsOnEncode = sr.LoadBoolean("ArWriteCRC") ?? true;
writeArLogOnConvert = sr.LoadBoolean("ArWriteLog") ?? true;
writeArTagsOnVerify = sr.LoadBoolean("ArWriteTagsOnVerify") ?? false;
writeArLogOnVerify = sr.LoadBoolean("ArWriteLogOnVerify") ?? true;
@@ -1116,8 +1139,8 @@ return processor.Go();
wvExtraMode = sr.LoadInt32("WVExtraMode", 0, 6) ?? 0;
wvStoreMD5 = sr.LoadBoolean("WVStoreMD5") ?? false;
keepOriginalFilenames = sr.LoadBoolean("KeepOriginalFilenames") ?? false;
singleFilenameFormat = sr.Load("SingleFilenameFormat") ?? "%F";
trackFilenameFormat = sr.Load("TrackFilenameFormat") ?? "%N. %T";
singleFilenameFormat = sr.Load("SingleFilenameFormat") ?? singleFilenameFormat;
trackFilenameFormat = sr.Load("TrackFilenameFormat") ?? trackFilenameFormat;
removeSpecial = sr.LoadBoolean("RemoveSpecialCharacters") ?? false;
specialExceptions = sr.Load("SpecialCharactersExceptions") ?? "-()";
replaceSpaces = sr.LoadBoolean("ReplaceSpaces") ?? false;
@@ -1266,11 +1289,18 @@ return processor.Go();
}
defaultVerifyScript = sr.Load("DefaultVerifyScript") ?? "default";
defaultVerifyAndConvertScript = sr.Load("DefaultVerifyAndConvertScript") ?? "default";
defaultEncodeScript = sr.Load("DefaultVerifyAndConvertScript") ?? "default";
gapsHandling = (CUEStyle?)sr.LoadInt32("GapsHandling", null, null) ?? gapsHandling;
language = sr.Load("Language") ?? Thread.CurrentThread.CurrentUICulture.Name;
if (arLogFilenameFormat.Contains("%F"))
arLogFilenameFormat = "%filename%.accurip";
if (singleFilenameFormat.Contains("%F"))
singleFilenameFormat = "%filename%";
if (trackFilenameFormat.Contains("%N"))
trackFilenameFormat = "%tracknumber%. %title%";
}
public string CleanseString (string s)
@@ -1313,10 +1343,10 @@ return processor.Go();
_script = "only if found";
break;
case "convert":
_action = CUEAction.VerifyAndConvert;
_action = CUEAction.Encode;
break;
case "fix":
_action = CUEAction.VerifyAndConvert;
_action = CUEAction.Encode;
_script = "fix offset";
break;
}
@@ -1331,7 +1361,7 @@ return processor.Go();
_useAccurateRip = sr.LoadBoolean("AccurateRipLookup") ?? _useAccurateRip;
_outputAudioType = (AudioEncoderType?)sr.LoadInt32("OutputAudioType", null, null) ?? _outputAudioType;
_outputAudioFormat = sr.Load("OutputAudioFmt") ?? _outputAudioFormat;
_action = (CUEAction?)sr.LoadInt32("AccurateRipMode", null, null) ?? _action;
_action = (CUEAction?)sr.LoadInt32("AccurateRipMode", (int)CUEAction.Encode, (int)CUEAction.CorrectFilenames) ?? _action;
_CUEStyle = (CUEStyle?)sr.LoadInt32("CUEStyle", null, null) ?? _CUEStyle;
_writeOffset = sr.LoadInt32("WriteOffset", null, null) ?? 0;
_outputTemplate = sr.Load("OutputPathTemplate") ?? _outputTemplate;
@@ -1357,7 +1387,7 @@ return processor.Go();
public CUEConfig _config;
public AudioEncoderType _outputAudioType = AudioEncoderType.Lossless;
public string _outputAudioFormat = "flac", _outputTemplate = null, _script = "default";
public CUEAction _action = CUEAction.VerifyAndConvert;
public CUEAction _action = CUEAction.Encode;
public CUEStyle _CUEStyle = CUEStyle.SingleFileWithCUE;
public int _writeOffset = 0;
public bool _useFreeDb = true, _useMusicBrainz = true, _useAccurateRip = true;
@@ -1416,6 +1446,7 @@ return processor.Go();
private bool _paddedToFrame, _truncated4608, _usePregapForFirstTrackInSingleFile;
private int _writeOffset;
private CUEAction _action;
private bool _useAccurateRip = false;
private uint? _minDataTrackLength;
private string _accurateRipId;
private string _eacLog;
@@ -1444,6 +1475,7 @@ return processor.Go();
private CDImageLayout _toc;
private string _arLogFileName, _alArtFileName;
private TagLib.IPicture[] _albumArt;
private int _padding = 8192;
public event ArchivePasswordRequiredHandler PasswordRequired;
public event CUEToolsProgressHandler CUEToolsProgress;
@@ -1465,7 +1497,7 @@ return processor.Go();
_paddedToFrame = false;
_truncated4608 = false;
_usePregapForFirstTrackInSingleFile = false;
_action = CUEAction.Convert;
_action = CUEAction.Encode;
_appliedWriteOffset = false;
_minDataTrackLength = null;
hdcdDecoder = null;
@@ -1907,7 +1939,8 @@ return processor.Go();
List<CUEToolsSourceFile> logFiles = new List<CUEToolsSourceFile>();
foreach (string logPath in Directory.GetFiles(_inputDir, "*.log"))
logFiles.Add(new CUEToolsSourceFile(logPath, new StreamReader(logPath, CUESheet.Encoding)));
try { logFiles.Add(new CUEToolsSourceFile(logPath, new StreamReader(logPath, CUESheet.Encoding))); }
catch { }
CUEToolsSourceFile selectedLogFile = ChooseFile(logFiles, Path.GetFileNameWithoutExtension(pathIn), false);
_eacLog = selectedLogFile != null ? selectedLogFile.contents : null;
}
@@ -1943,7 +1976,8 @@ return processor.Go();
sr = new StringReader(cueSheet);
List<CUEToolsSourceFile> logFiles = new List<CUEToolsSourceFile>();
foreach (string logPath in Directory.GetFiles(_inputDir, "*.log"))
logFiles.Add(new CUEToolsSourceFile(logPath, new StreamReader(logPath, CUESheet.Encoding)));
try { logFiles.Add(new CUEToolsSourceFile(logPath, new StreamReader(logPath, CUESheet.Encoding))); }
catch { }
CUEToolsSourceFile selectedLogFile = ChooseFile(logFiles, null, false);
_eacLog = selectedLogFile != null ? selectedLogFile.contents : null;
}
@@ -2410,13 +2444,14 @@ return processor.Go();
}
LoadAlbumArt(_tracks[0]._fileInfo ?? _fileInfo);
ResizeAlbumArt();
if ((_config.embedAlbumArt || _config.copyAlbumArt) && _albumArt != null && _albumArt.Length > 0)
_padding += _albumArt[0].Data.Count;
if (_config.embedLog && _eacLog != null)
_padding += _eacLog.Length;
}
public void Lookup()
{
if (_action == CUEAction.Verify
|| _action == CUEAction.VerifyAndConvert
)
public void UseAccurateRip()
{
ShowProgress((string)"Contacting AccurateRip database...", 0, 0, null, null);
if (!_toc[_toc.TrackCount].IsAudio && DataTrackLength == 0 && _minDataTrackLength.HasValue && _accurateRipId == null && _config.bruteForceDTL)
@@ -2444,7 +2479,7 @@ return processor.Go();
{
_arVerify.ContactAccurateRip(_accurateRipId ?? AccurateRipVerify.CalculateAccurateRipId(_toc));
}
}
_useAccurateRip = true;
}
public static Encoding Encoding {
@@ -2686,20 +2721,14 @@ return processor.Go();
return pathIn.Length == 3 && pathIn.Substring(1) == ":\\" && new DriveInfo(pathIn).DriveType == DriveType.CDRom;
}
private static string GenerateOutputPath(CUEConfig _config, string format, NameValueCollection tags, string ext)
public string GenerateUniqueOutputPath(string format, string ext, CUEAction action, string pathIn)
{
string pathOut = General.ReplaceMultiple(format, tags);
if (pathOut == null)
return String.Empty;
try { pathOut = Path.ChangeExtension(pathOut, ext); }
catch { pathOut = ""; }
return pathOut;
return GenerateUniqueOutputPath(_config, format, ext, action, new NameValueCollection(), pathIn, this);
}
public static string GenerateUniqueOutputPath(CUEConfig _config, string format, string ext, CUEAction action, NameValueCollection vars, string pathIn, CUESheet cueSheet)
{
if (pathIn.Length == 0 || (!IsCDROM(pathIn) && !File.Exists(pathIn) && !Directory.Exists(pathIn)))
if (pathIn == "" || (pathIn == null && action != CUEAction.Encode) || (pathIn != null && !IsCDROM(pathIn) && !File.Exists(pathIn) && !Directory.Exists(pathIn)))
return String.Empty;
if (action == CUEAction.Verify && _config.arLogToSourceFolder)
return Path.ChangeExtension(pathIn, ".cue");
@@ -2716,6 +2745,8 @@ return processor.Go();
ext = ".20bit" + ext;
}
if (pathIn != null)
{
vars.Add("path", pathIn);
try
{
@@ -2724,12 +2755,12 @@ return processor.Go();
vars.Add("directoryname", General.EmptyStringToNull(Path.GetDirectoryName(pathIn)));
}
catch { }
}
vars.Add("music", Environment.GetFolderPath(Environment.SpecialFolder.MyMusic));
bool rs = _config.replaceSpaces;
string artist = cueSheet == null ? "Artist" : cueSheet.Artist == "" ? "Unknown Artist" : cueSheet.Artist;
string album = cueSheet == null ? "Album" : cueSheet.Title == "" ? "Unknown Title" : cueSheet.Title;
vars.Add("artist", General.EmptyStringToNull(_config.CleanseString(rs ? artist.Replace(' ', '_') : artist)));
vars.Add("album", General.EmptyStringToNull(_config.CleanseString(rs ? album.Replace(' ', '_') : album)));
vars.Add("artist", General.EmptyStringToNull(_config.CleanseString(artist)));
vars.Add("album", General.EmptyStringToNull(_config.CleanseString(album)));
if (cueSheet != null)
{
@@ -2738,37 +2769,34 @@ return processor.Go();
vars.Add("discnumber", General.EmptyStringToNull(cueSheet.DiscNumber));
vars.Add("totaldiscs", General.EmptyStringToNull(cueSheet.TotalDiscs));
NameValueCollection tags = cueSheet.Tags;
if (tags != null)
foreach (string tag in tags.AllKeys)
{
string key = tag.ToLower();
string val = tags[tag];
if (vars.Get(key) == null && val != null && val != "")
vars.Add(key, _config.CleanseString(rs ? val.Replace(' ', '_') : val));
vars.Add(key, _config.CleanseString(val));
}
}
vars.Add("unique", null);
string outputPath = GenerateOutputPath(_config, format, vars, ext);
if (outputPath == String.Empty)
return outputPath;
int unique = 1;
try
{
while (File.Exists(outputPath))
{
vars["unique"] = unique.ToString();
string newPath = GenerateOutputPath(_config, format, vars, ext);
if (newPath == outputPath || newPath == String.Empty)
break;
outputPath = newPath;
unique++;
}
}
catch { }
string outputPath = General.ReplaceMultiple(format, vars, "unique",
(General.CheckIfExists)delegate(string pathOut) {
return File.Exists(Path.ChangeExtension(pathOut, ext));
});
if (outputPath == "" || outputPath == null)
return "";
try { outputPath = Path.ChangeExtension(outputPath, ext); }
catch { outputPath = ""; }
return outputPath;
}
private bool CheckIfFileExists(string output)
{
return File.Exists(Path.Combine(OutputDir, output));
}
public void GenerateFilenames(AudioEncoderType audioEncoderType, string format, string outputPath)
{
_audioEncoderType = audioEncoderType;
@@ -2777,28 +2805,21 @@ return processor.Go();
_outputPath = outputPath;
string extension = "." + format;
List<string> find, replace;
string filename;
int iTrack;
find = new List<string>();
replace = new List<string>();
find.Add("%D"); // 0: Album artist
find.Add("%C"); // 1: Album title
find.Add("%N"); // 2: Track number
find.Add("%A"); // 3: Track artist
find.Add("%T"); // 4: Track title
find.Add("%F"); // 5: Input filename
find.Add("%Y"); // 6: Album date
replace.Add(General.EmptyStringToNull(_config.CleanseString(Artist)));
replace.Add(General.EmptyStringToNull(_config.CleanseString(Title)));
replace.Add(null);
replace.Add(null);
replace.Add(null);
replace.Add(Path.GetFileNameWithoutExtension(outputPath));
replace.Add(General.EmptyStringToNull(_config.CleanseString(Year)));
NameValueCollection vars = new NameValueCollection();
vars.Add("unique", null);
vars.Add("album artist", General.EmptyStringToNull(_config.CleanseString(Artist)));
vars.Add("artist", General.EmptyStringToNull(_config.CleanseString(Artist)));
vars.Add("album", General.EmptyStringToNull(_config.CleanseString(Title)));
vars.Add("year", General.EmptyStringToNull(_config.CleanseString(Year)));
vars.Add("catalog", General.EmptyStringToNull(_config.CleanseString(Catalog)));
vars.Add("discnumber", General.EmptyStringToNull(_config.CleanseString(DiscNumber)));
vars.Add("totaldiscs", General.EmptyStringToNull(_config.CleanseString(TotalDiscs)));
vars.Add("filename", Path.GetFileNameWithoutExtension(outputPath));
vars.Add("tracknumber", null);
vars.Add("title", null);
if (_config.detectHDCD && _config.decodeHDCD && (!_outputLossyWAV || !_config.decodeHDCDtoLW16))
{
@@ -2808,21 +2829,17 @@ return processor.Go();
extension = ".20bit" + extension;
}
ArLogFileName = General.ReplaceMultiple(_config.arLogFilenameFormat, find, replace) ?? Path.ChangeExtension(outputPath, ".accurip");
AlArtFileName = General.ReplaceMultiple(_config.alArtFilenameFormat, find, replace) ?? "Folder.jpg";
ArLogFileName = General.ReplaceMultiple(_config.arLogFilenameFormat, vars, "unique", CheckIfFileExists)
?? vars["%filename%"] + ".accurip";
AlArtFileName = General.ReplaceMultiple(_config.alArtFilenameFormat, vars, "unique", CheckIfFileExists)
?? "folder.jpg";
if (_config.keepOriginalFilenames && HasSingleFilename)
{
if (OutputStyle == CUEStyle.SingleFileWithCUE)
SingleFilename = Path.ChangeExtension(Path.GetFileName(outputPath), extension);
else if (_config.keepOriginalFilenames && HasSingleFilename)
SingleFilename = Path.ChangeExtension(SingleFilename, extension);
}
else
{
filename = General.ReplaceMultiple(_config.singleFilenameFormat, find, replace);
if (filename == null)
filename = "Range";
filename += extension;
SingleFilename = filename;
}
SingleFilename = (General.ReplaceMultiple(_config.singleFilenameFormat, vars) ?? "range") + extension;
for (iTrack = -1; iTrack < TrackCount; iTrack++)
{
@@ -2843,25 +2860,18 @@ return processor.Go();
string artist = Tracks[htoa ? 0 : iTrack].Artist;
string title = htoa ? "(HTOA)" : Tracks[iTrack].Title;
replace[2] = trackStr;
replace[3] = General.EmptyStringToNull(_config.CleanseString(artist==""?Artist:artist));
replace[4] = General.EmptyStringToNull(_config.CleanseString(title));
vars["tracknumber"] = trackStr;
vars["artist"] = General.EmptyStringToNull(_config.CleanseString(artist)) ?? vars["album artist"];
vars["title"] = General.EmptyStringToNull(_config.CleanseString(title));
filename = General.ReplaceMultiple(_config.trackFilenameFormat, find, replace);
if (filename == null)
filename = replace[2];
filename += extension;
filename = (General.ReplaceMultiple(_config.trackFilenameFormat, vars) ?? vars["tracknumber"]) + extension;
if (htoa)
{
HTOAFilename = filename;
}
else
{
TrackFilenames[iTrack] = filename;
}
}
}
if (OutputStyle == CUEStyle.SingleFile || OutputStyle == CUEStyle.SingleFileWithCUE)
{
@@ -2880,6 +2890,34 @@ return processor.Go();
}
}
public bool OutputExists()
{
bool outputExists = false;
bool outputCUE = Action == CUEAction.Encode && (OutputStyle != CUEStyle.SingleFileWithCUE || _config.createCUEFileWhenEmbedded);
bool outputAudio = Action == CUEAction.Encode && _audioEncoderType != AudioEncoderType.NoAudio;
if (outputCUE)
outputExists = File.Exists(_outputPath);
if (_useAccurateRip && (
(Action == CUEAction.Encode && _config.writeArLogOnConvert) ||
(Action == CUEAction.Verify && _config.writeArLogOnVerify)))
outputExists |= File.Exists(Path.Combine(OutputDir, ArLogFileName));
if (outputAudio)
{
if (_config.extractAlbumArt && AlbumArt != null && AlbumArt.Length != 0)
outputExists |= File.Exists(Path.Combine(OutputDir, AlArtFileName));
if (OutputStyle == CUEStyle.SingleFile || OutputStyle == CUEStyle.SingleFileWithCUE)
outputExists |= File.Exists(Path.Combine(OutputDir, SingleFilename));
else
{
if (OutputStyle == CUEStyle.GapsAppended && _config.preserveHTOA)
outputExists |= File.Exists(Path.Combine(OutputDir, HTOAFilename));
for (int i = 0; i < TrackCount; i++)
outputExists |= File.Exists(Path.Combine(OutputDir, TrackFilenames[i]));
}
}
return outputExists;
}
private int GetSampleLength(string path, out TagLib.File fileInfo)
{
ShowProgress("Analyzing input file...", 0.0, 0.0, path, null);
@@ -3158,7 +3196,7 @@ return processor.Go();
logWriter.WriteLine("Track {0} contains {1} errors", iTrack + 1, cdErrors);
}
}
if (_action != CUEAction.Convert)
if (_useAccurateRip)
{
logWriter.WriteLine();
logWriter.WriteLine("AccurateRip summary");
@@ -3216,7 +3254,7 @@ return processor.Go();
using (sw)
{
if (_config.writeArTagsOnConvert)
if (_config.writeArTagsOnEncode)
WriteLine(sw, 0, "REM ACCURATERIPID " + (_accurateRipId ?? AccurateRipVerify.CalculateAccurateRipId(_toc)));
for (i = 0; i < _attributes.Count; i++)
@@ -3316,8 +3354,7 @@ return processor.Go();
string prefix = "";
if (hdcdDecoder != null && hdcdDecoder.Detected)
prefix += "hdcd detected, ";
if (_action == CUEAction.Verify ||
(_action == CUEAction.VerifyAndConvert && _audioEncoderType != AudioEncoderType.NoAudio))
if (_useAccurateRip)
{
if (_arVerify.ARStatus != null)
prefix += _arVerify.ARStatus;
@@ -3418,8 +3455,8 @@ return processor.Go();
bool htoaToFile = ((OutputStyle == CUEStyle.GapsAppended) && _config.preserveHTOA &&
(_toc.Pregap != 0));
if (_isCD && (OutputStyle == CUEStyle.GapsLeftOut || OutputStyle == CUEStyle.GapsPrepended) && (_action == CUEAction.Convert || _action == CUEAction.VerifyAndConvert))
throw new Exception("When ripping a CD, gaps Left Out/Gaps prepended modes can only be used in verify-then-convert mode");
if (_isCD && (OutputStyle == CUEStyle.GapsLeftOut || OutputStyle == CUEStyle.GapsPrepended))
throw new Exception("Gaps Left Out/Gaps prepended modes cannot be used when ripping a CD");
if (_usePregapForFirstTrackInSingleFile)
throw new Exception("UsePregapForFirstTrackInSingleFile is not supported for writing audio files.");
@@ -3444,15 +3481,17 @@ return processor.Go();
if (_audioEncoderType != AudioEncoderType.NoAudio || _action == CUEAction.Verify)
WriteAudioFilesPass(OutputDir, OutputStyle, destLengths, htoaToFile, _action == CUEAction.Verify);
CreateRipperLOG();
if (_action == CUEAction.Convert || _action == CUEAction.VerifyAndConvert)
if (_action == CUEAction.Encode)
{
string cueContents = CUESheetContents(OutputStyle);
uint tracksMatch = 0;
int bestOffset = 0;
if (_action != CUEAction.Convert &&
_config.writeArTagsOnConvert &&
if (_useAccurateRip &&
_config.writeArTagsOnEncode &&
_arVerify.AccResult == HttpStatusCode.OK)
FindBestOffset(1, true, out tracksMatch, out bestOffset);
@@ -3469,6 +3508,9 @@ return processor.Go();
if (_eacLog != null && _config.extractLog)
WriteText(Path.ChangeExtension(_outputPath, ".log"), _eacLog);
if (_audioEncoderType != AudioEncoderType.NoAudio && _config.extractAlbumArt)
ExtractAlbumArt();
if (OutputStyle == CUEStyle.SingleFileWithCUE || OutputStyle == CUEStyle.SingleFile)
{
if (OutputStyle == CUEStyle.SingleFileWithCUE && _config.createCUEFileWhenEmbedded)
@@ -3524,7 +3566,9 @@ return processor.Go();
fileInfo.Tag.Year = sourceFileInfo.Tag.Year;
}
ProcessAlbumArt(fileInfo);
if ((_config.embedAlbumArt || _config.copyAlbumArt) && _albumArt != null && _albumArt.Length > 0)
fileInfo.Tag.Pictures = _albumArt;
fileInfo.Save();
}
}
@@ -3594,7 +3638,9 @@ return processor.Go();
fileInfo.Tag.Genres = sourceFileInfo.Tag.Genres;
}
ProcessAlbumArt(fileInfo);
if ((_config.embedAlbumArt || _config.copyAlbumArt) && _albumArt != null && _albumArt.Length > 0)
fileInfo.Tag.Pictures = _albumArt;
fileInfo.Save();
}
}
@@ -3634,14 +3680,6 @@ return processor.Go();
return b;
}
public void ProcessAlbumArt(TagLib.File destFileInfo)
{
ResizeAlbumArt();
ExtractAlbumArt();
if ((_config.embedAlbumArt || _config.copyAlbumArt) && _albumArt != null)
destFileInfo.Tag.Pictures = _albumArt;
}
public void ExtractAlbumArt()
{
if (!_config.extractAlbumArt || _albumArt == null || _albumArt.Length == 0)
@@ -3725,8 +3763,7 @@ return processor.Go();
public string WriteReport()
{
if (_action == CUEAction.Verify ||
(_action != CUEAction.Convert && _audioEncoderType != AudioEncoderType.NoAudio))
if (_useAccurateRip)
{
ShowProgress((string)"Generating AccurateRip report...", 0, 0, null, null);
if (_action == CUEAction.Verify && _config.writeArTagsOnVerify && _writeOffset == 0 && !_isArchive && !_isCD)
@@ -3833,7 +3870,7 @@ return processor.Go();
//CleanupTags(destTags, "REPLAYGAIN");
}
if (_config.writeArTagsOnConvert && _action == CUEAction.VerifyAndConvert && _arVerify.AccResult == HttpStatusCode.OK)
if (_config.writeArTagsOnEncode && _action == CUEAction.Encode && _useAccurateRip && _arVerify.AccResult == HttpStatusCode.OK)
GenerateAccurateRipTags(destTags, bestOffset, iTrack);
return destTags;
@@ -3904,7 +3941,7 @@ return processor.Go();
if (_config.embedLog && logContents != null)
destTags.Add("LOG", logContents);
if (fWithCUE && _config.writeArTagsOnConvert && _action == CUEAction.VerifyAndConvert && _arVerify.AccResult == HttpStatusCode.OK)
if (fWithCUE && _config.writeArTagsOnEncode && _action == CUEAction.Encode && _useAccurateRip && _arVerify.AccResult == HttpStatusCode.OK)
GenerateAccurateRipTags(destTags, bestOffset, -1);
return destTags;
@@ -3975,7 +4012,7 @@ return processor.Go();
if (style == CUEStyle.SingleFile || style == CUEStyle.SingleFileWithCUE)
{
iDest++;
audioDest = GetAudioDest(_destPaths[iDest], destLengths[iDest], hdcdDecoder != null && hdcdDecoder.Decoding ? hdcdDecoder.BitsPerSample : 16, noOutput);
audioDest = GetAudioDest(_destPaths[iDest], destLengths[iDest], hdcdDecoder != null && hdcdDecoder.Decoding ? hdcdDecoder.BitsPerSample : 16, _padding, noOutput);
}
uint currentOffset = 0, previousOffset = 0;
@@ -3983,7 +4020,7 @@ return processor.Go();
uint diskLength = 588 * _toc.AudioLength;
uint diskOffset = 0;
if (_action != CUEAction.Convert)
if (_useAccurateRip)
_arVerify.Init();
ShowProgress(String.Format("{2} track {0:00} ({1:00}%)...", 0, 0, noOutput ? "Verifying" : "Writing"), 0, 0.0, null, null);
@@ -4003,7 +4040,7 @@ return processor.Go();
hdcdDecoder.AudioDest = null;
if (audioDest != null)
audioDest.Close();
audioDest = GetAudioDest(_destPaths[iDest], destLengths[iDest], hdcdDecoder != null && hdcdDecoder.Decoding ? hdcdDecoder.BitsPerSample : 16, noOutput);
audioDest = GetAudioDest(_destPaths[iDest], destLengths[iDest], hdcdDecoder != null && hdcdDecoder.Decoding ? hdcdDecoder.BitsPerSample : 16, _padding, noOutput);
}
for (iIndex = 0; iIndex <= _toc[_toc.FirstAudio + iTrack].LastIndex; iIndex++)
@@ -4024,7 +4061,7 @@ return processor.Go();
if (audioDest != null)
audioDest.Close();
iDest++;
audioDest = GetAudioDest(_destPaths[iDest], destLengths[iDest], hdcdDecoder != null && hdcdDecoder.Decoding ? hdcdDecoder.BitsPerSample : 16, noOutput);
audioDest = GetAudioDest(_destPaths[iDest], destLengths[iDest], hdcdDecoder != null && hdcdDecoder.Decoding ? hdcdDecoder.BitsPerSample : 16, _padding, noOutput);
}
if ((style == CUEStyle.GapsAppended) && (iIndex == 0) && (iTrack == 0))
@@ -4033,7 +4070,7 @@ return processor.Go();
if (htoaToFile)
{
iDest++;
audioDest = GetAudioDest(_destPaths[iDest], destLengths[iDest], hdcdDecoder != null && hdcdDecoder.Decoding ? hdcdDecoder.BitsPerSample : 16, noOutput);
audioDest = GetAudioDest(_destPaths[iDest], destLengths[iDest], hdcdDecoder != null && hdcdDecoder.Decoding ? hdcdDecoder.BitsPerSample : 16, _padding, noOutput);
}
}
else if ((style == CUEStyle.GapsLeftOut) && (iIndex == 0))
@@ -4096,7 +4133,7 @@ return processor.Go();
}
}
}
if (_action != CUEAction.Convert)
if (_useAccurateRip)
_arVerify.Write(sampleBuffer, copyCount);
if (iTrack > 0 || iIndex > 0)
Tracks[iTrack + (iIndex == 0 ? -1 : 0)].MeasurePeakLevel(sampleBuffer, copyCount);
@@ -4400,11 +4437,11 @@ return processor.Go();
}
}
private IAudioDest GetAudioDest(string path, int finalSampleCount, int bps, bool noOutput)
private IAudioDest GetAudioDest(string path, int finalSampleCount, int bps, int padding, bool noOutput)
{
if (noOutput)
return new DummyWriter(path, bps, 2, 44100);
return AudioReadWrite.GetAudioDest(_audioEncoderType, path, finalSampleCount, bps, 44100, _config);
return AudioReadWrite.GetAudioDest(_audioEncoderType, path, finalSampleCount, bps, 44100, padding, _config);
}
private IAudioSource GetAudioSource(int sourceIndex) {
@@ -4934,7 +4971,7 @@ return processor.Go();
if (tracksMatch * 100 >= Config.fixOffsetMinimumTracksPercent * TrackCount)
{
WriteOffset = bestOffset;
Action = CUEAction.VerifyAndConvert;
Action = CUEAction.Encode;
status = Go();
}
return status;
@@ -4953,7 +4990,7 @@ return processor.Go();
FindBestOffset(Config.encodeWhenConfidence, false, out tracksMatch, out bestOffset);
if (tracksMatch * 100 >= Config.encodeWhenPercent * TrackCount && (!_config.encodeWhenZeroOffset || bestOffset == 0))
{
Action = CUEAction.VerifyAndConvert;
Action = CUEAction.Encode;
status = Go();
}
return status;

View File

@@ -156,6 +156,6 @@ hdcd.dll (c) Christopher Key
<value>439, 296</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>CUETools v1.9.5: О программе</value>
<value>CUETools: О программе</value>
</data>
</root>

View File

@@ -114,17 +114,28 @@ namespace JDP
pathIn = Path.GetFullPath(pathIn);
this.Invoke((MethodInvoker)delegate()
{
textBox1.Text += "Processing " + pathIn + ":\r\n";
textBox1.Select(0, 0);
});
if (!File.Exists(pathIn) && !Directory.Exists(pathIn))
throw new Exception("Input CUE Sheet not found.");
if (_profile._action == CUEAction.CorrectFilenames)
throw new Exception("CorrectFilenames action not yet supported in commandline mode.");
if (_profile._action == CUEAction.CreateDummyCUE)
throw new Exception("CreateDummyCUE action not yet supported in commandline mode.");
bool useAR = _profile._action == CUEAction.Verify || _profile._useAccurateRip;
cueSheet.Action = _profile._action;
cueSheet.OutputStyle = _profile._CUEStyle;
cueSheet.WriteOffset = _profile._writeOffset;
cueSheet.Open(pathIn);
cueSheet.Lookup();
if (useAR)
cueSheet.UseAccurateRip();
pathOut = CUESheet.GenerateUniqueOutputPath(_config,
_profile._outputTemplate,
@@ -137,10 +148,8 @@ namespace JDP
throw new Exception("Could not generate output path.");
cueSheet.GenerateFilenames(_profile._outputAudioType, _profile._outputAudioFormat, pathOut);
if (_profile._action != CUEAction.Verify && _profile._CUEStyle == CUEStyle.SingleFileWithCUE)
cueSheet.SingleFilename = Path.ChangeExtension(Path.GetFileName(pathOut), "." + _profile._outputAudioFormat);
cueSheet.UsePregapForFirstTrackInSingleFile = false;
if (script == null)
cueSheet.Go();
else
@@ -158,7 +167,7 @@ namespace JDP
textBox1.Text += cueSheet.LOGContents;
textBox1.Show();
}
else if (cueSheet.Action != CUEAction.Convert)
else if (useAR)
{
StringWriter sw = new StringWriter();
cueSheet.GenerateAccurateRipLog(sw);

View File

@@ -629,15 +629,18 @@ namespace JDP {
// toolStripOutput
//
resources.ApplyResources(this.toolStripOutput, "toolStripOutput");
this.toolStripOutput.GripMargin = new System.Windows.Forms.Padding(0);
this.toolStripOutput.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStripOutput.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripLabelOutput,
this.toolStripSplitButtonOutputBrowser});
this.toolStripOutput.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
this.toolStripOutput.Name = "toolStripOutput";
this.toolStripOutput.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
//
// toolStripLabelOutput
//
this.toolStripLabelOutput.Margin = new System.Windows.Forms.Padding(0);
this.toolStripLabelOutput.Name = "toolStripLabelOutput";
resources.ApplyResources(this.toolStripLabelOutput, "toolStripLabelOutput");
//

View File

@@ -256,26 +256,6 @@ namespace JDP {
if (_reducePriority)
Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.Idle;
//fileSystemTreeView1.CheckBoxes = FileBrowserState == FileBrowserStateEnum.Checkboxes;
//fileSystemTreeView1.IconManager = m_icon_mgr;
//if (InputPath != "")
//{
// TreeNode node = null;
// try
// {
// node = fileSystemTreeView1.LookupNode(InputPath) ??
// fileSystemTreeView1.LookupNode(Path.GetDirectoryName(InputPath));
// }
// catch
// {
// }
// if (node != null)
// {
// fileSystemTreeView1.SelectedNode = node;
// node.Expand();
// }
//}
motdImage = null;
if (File.Exists(MOTDImagePath))
using (FileStream imageStream = new FileStream(MOTDImagePath, FileMode.Open, FileAccess.Read))
@@ -495,6 +475,8 @@ namespace JDP {
CUEToolsScript script = (CUEToolsScript)p[6];
DialogResult dlgRes = DialogResult.OK;
string status = null;
bool outputAudio = action == CUEAction.Encode && audioEncoderType != AudioEncoderType.NoAudio;
bool useAR = action == CUEAction.Verify || (outputAudio && checkBoxUseAccurateRip.Checked);
try
{
@@ -743,7 +725,6 @@ namespace JDP {
}
else if (File.Exists(pathIn) || IsCDROM(pathIn))
{
bool convertAction = action == CUEAction.Convert || action == CUEAction.VerifyAndConvert;
string pathOut = null;
List<object> releases = null;
@@ -753,12 +734,14 @@ namespace JDP {
cueSheet.Action = action;
cueSheet.OutputStyle = cueStyle;
cueSheet.Open(pathIn);
if (action != CUEAction.Convert)
cueSheet.DataTrackLengthMSF = txtDataTrackLength.Text;
cueSheet.PreGapLengthMSF = txtPreGapLength.Text;
cueSheet.Lookup();
if (useAR)
{
cueSheet.DataTrackLengthMSF = txtDataTrackLength.Text;
cueSheet.UseAccurateRip();
}
if (_batchPaths.Count == 0 && convertAction)
if (_batchPaths.Count == 0 && action == CUEAction.Encode)
{
if (checkBoxUseFreeDb.Checked || checkBoxUseMusicBrainz.Checked)
releases = cueSheet.LookupAlbumInfo(checkBoxUseFreeDb.Checked, checkBoxUseMusicBrainz.Checked);
@@ -766,7 +749,7 @@ namespace JDP {
this.Invoke((MethodInvoker)delegate()
{
toolStripStatusLabelAR.Visible = action != CUEAction.Convert;// && cueSheet.ArVerify.ARStatus == null;
toolStripStatusLabelAR.Visible = useAR;// && cueSheet.ArVerify.ARStatus == null;
toolStripStatusLabelAR.Text = cueSheet.ArVerify.ARStatus == null ? cueSheet.ArVerify.WorstTotal().ToString() : "?";
toolStripStatusLabelAR.ToolTipText = "AccurateRip: " + (cueSheet.ArVerify.ARStatus ?? "found") + ".";
if (releases != null)
@@ -792,31 +775,10 @@ namespace JDP {
if (dlgRes == DialogResult.Cancel)
return;
bool outputAudio = convertAction && audioEncoderType != AudioEncoderType.NoAudio;
bool outputCUE = convertAction && (cueStyle != CUEStyle.SingleFileWithCUE || _profile._config.createCUEFileWhenEmbedded);
cueSheet.GenerateFilenames(audioEncoderType, outputFormat, pathOut);
string outDir = Path.GetDirectoryName(pathOut);
if (cueStyle == CUEStyle.SingleFileWithCUE)
cueSheet.SingleFilename = Path.GetFileName(pathOut);
if (outDir == "")
outDir = ".";
bool outputExists = false;
if (outputCUE)
outputExists = File.Exists(pathOut);
if (outputAudio)
{
if (cueStyle == CUEStyle.SingleFile || cueStyle == CUEStyle.SingleFileWithCUE)
outputExists |= File.Exists(Path.Combine(outDir, cueSheet.SingleFilename));
else
{
if (cueStyle == CUEStyle.GapsAppended && _profile._config.preserveHTOA)
outputExists |= File.Exists(Path.Combine(outDir, cueSheet.HTOAFilename));
for (int i = 0; i < cueSheet.TrackCount; i++)
outputExists |= File.Exists(Path.Combine(outDir, cueSheet.TrackFilenames[i]));
}
}
bool outputExists = cueSheet.OutputExists();
dlgRes = DialogResult.Cancel;
if (outputExists)
{
@@ -872,8 +834,7 @@ namespace JDP {
//reportForm.Message = _batchReport.ToString();
//reportForm.ShowDialog(this);
}
else if (cueSheet.Action == CUEAction.Verify ||
(cueSheet.Action == CUEAction.VerifyAndConvert && audioEncoderType != AudioEncoderType.NoAudio))
else if (useAR)
{
using (StringWriter sw = new StringWriter())
{
@@ -963,8 +924,8 @@ namespace JDP {
}
private void SetupControls(bool running) {
bool converting = (SelectedAction == CUEAction.Convert || SelectedAction == CUEAction.VerifyAndConvert);
bool verifying = (SelectedAction == CUEAction.Verify || SelectedAction == CUEAction.VerifyAndConvert);
bool converting = (SelectedAction == CUEAction.Encode);
bool verifying = (SelectedAction == CUEAction.Verify || (SelectedAction == CUEAction.Encode && SelectedOutputAudioType != AudioEncoderType.NoAudio && checkBoxUseAccurateRip.Checked));
//grpInput.Enabled = !running;
toolStripMenu.Enabled = !running;
fileSystemTreeView1.Enabled = !running;
@@ -979,10 +940,10 @@ namespace JDP {
grpOutputPathGeneration.Enabled = !running;
grpAudioOutput.Enabled = !running && converting;
grpAction.Enabled = !running;
checkBoxUseFreeDb.Enabled =
checkBoxUseMusicBrainz.Enabled =
checkBoxUseAccurateRip.Enabled =
!running && !(FileBrowserState == FileBrowserStateEnum.DragDrop || FileBrowserState == FileBrowserStateEnum.Checkboxes) && converting;
//checkBoxUseFreeDb.Enabled =
// checkBoxUseMusicBrainz.Enabled =
// checkBoxUseAccurateRip.Enabled =
// !(FileBrowserState == FileBrowserStateEnum.DragDrop || FileBrowserState == FileBrowserStateEnum.Checkboxes) && converting;
txtDataTrackLength.Enabled = !running && verifying;
txtPreGapLength.Enabled = !running;
btnConvert.Visible = !running;
@@ -1350,6 +1311,7 @@ namespace JDP {
? toolStripMenuItemOutputManual : toolStripMenuItemOutputBrowse;
toolStripSplitButtonOutputBrowser.Text = toolStripSplitButtonOutputBrowser.DefaultItem.Text;
toolStripSplitButtonOutputBrowser.Image = toolStripSplitButtonOutputBrowser.DefaultItem.Image;
toolStripSplitButtonOutputBrowser.Enabled = toolStripSplitButtonOutputBrowser.DefaultItem.Enabled;
UpdateOutputPath();
}
}
@@ -1375,6 +1337,7 @@ namespace JDP {
set
{
ToolStripMenuItem inputBtn = FileBrowserStateButton(value);
if (inputBtn == null) { value = FileBrowserStateEnum.Hidden; inputBtn = toolStripMenuItemInputBrowserHide; }
ToolStripMenuItem defaultBtn = FileBrowserStateButton(value != FileBrowserStateEnum.Hidden
? FileBrowserStateEnum.Hidden : _fileBrowserControlState == FileBrowserStateEnum.Hidden
? FileBrowserStateEnum.Tree : _fileBrowserControlState);
@@ -1465,8 +1428,7 @@ namespace JDP {
rbActionVerify.Checked ? CUEAction.Verify :
rbActionCorrectFilenames.Checked ? CUEAction.CorrectFilenames :
rbActionCreateCUESheet.Checked ? CUEAction.CreateDummyCUE :
checkBoxUseAccurateRip.Checked ? CUEAction.VerifyAndConvert :
CUEAction.Convert;
CUEAction.Encode;
}
set
{
@@ -1707,9 +1669,10 @@ namespace JDP {
}
set
{
CUEAction action = SelectedAction;
comboBoxScript.Items.Clear();
foreach (KeyValuePair<string, CUEToolsScript> script in _profile._config.scripts)
if (script.Value.conditions.Contains(SelectedAction))
if (script.Value.conditions.Contains(action))
comboBoxScript.Items.Add(script.Value);
comboBoxScript.Enabled = btnConvert.Enabled && comboBoxScript.Items.Count > 1;
comboBoxScript.SelectedItem =
@@ -1725,9 +1688,8 @@ namespace JDP {
case CUEAction.Verify:
SelectedScript = _profile._config.defaultVerifyScript;
break;
case CUEAction.Convert:
case CUEAction.VerifyAndConvert:
SelectedScript = _profile._config.defaultVerifyAndConvertScript;
case CUEAction.Encode:
SelectedScript = _profile._config.defaultEncodeScript;
break;
default:
SelectedScript = null;
@@ -1742,9 +1704,8 @@ namespace JDP {
case CUEAction.Verify:
_profile._config.defaultVerifyScript = SelectedScript;
break;
case CUEAction.Convert:
case CUEAction.VerifyAndConvert:
_profile._config.defaultVerifyAndConvertScript = SelectedScript;
case CUEAction.Encode:
_profile._config.defaultEncodeScript = SelectedScript;
break;
}
}
@@ -1756,7 +1717,7 @@ namespace JDP {
if (sender == rbActionVerify && comboBoxScript.SelectedItem != null)
SaveScripts(CUEAction.Verify);
if (sender == rbActionEncode && comboBoxScript.SelectedItem != null)
SaveScripts(CUEAction.VerifyAndConvert);
SaveScripts(CUEAction.Encode);
return;
}
UpdateOutputPath();

View File

@@ -348,7 +348,7 @@
<value>E&amp;ingabe:</value>
</data>
<data name="toolStripLabelOutput.Text" xml:space="preserve">
<value>Aus&gabe:</value>
<value>Aus&amp;gabe:</value>
</data>
<data name="toolStripMenuItemCorrectorModeChangeExtension.Text" xml:space="preserve">
<value>Neue Erweiterung</value>

File diff suppressed because it is too large Load Diff

View File

@@ -927,4 +927,7 @@
<data name="toolStripMenuItemCorrectorModeLocateFiles.ToolTipText" xml:space="preserve">
<value>Автоматический поиск переименованных файлов</value>
</data>
<data name="groupBoxMode.Text" xml:space="preserve">
<value>Настройки</value>
</data>
</root>

View File

@@ -497,6 +497,8 @@ namespace JDP {
//
// txtSingleFilenameFormat
//
this.txtSingleFilenameFormat.AutoCompleteCustomSource.AddRange(new string[] {
resources.GetString("txtSingleFilenameFormat.AutoCompleteCustomSource")});
resources.ApplyResources(this.txtSingleFilenameFormat, "txtSingleFilenameFormat");
this.txtSingleFilenameFormat.Name = "txtSingleFilenameFormat";
this.toolTip1.SetToolTip(this.txtSingleFilenameFormat, resources.GetString("txtSingleFilenameFormat.ToolTip"));
@@ -826,7 +828,12 @@ namespace JDP {
this.textBoxARLogExtension.AutoCompleteCustomSource.AddRange(new string[] {
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource"),
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource1"),
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource2")});
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource2"),
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource3"),
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource4"),
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource5"),
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource6"),
resources.GetString("textBoxARLogExtension.AutoCompleteCustomSource7")});
this.textBoxARLogExtension.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.textBoxARLogExtension.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
this.textBoxARLogExtension.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.cUEConfigBindingSource, "ArLogFilenameFormat", true));

View File

@@ -45,7 +45,7 @@ namespace JDP {
numEncodeWhenPercent.Value = _config.encodeWhenPercent;
chkEncodeWhenZeroOffset.Checked = _config.encodeWhenZeroOffset;
chkFLACVerify.Checked = _config.flacVerify;
chkWriteArTagsOnConvert.Checked = _config.writeArTagsOnConvert;
chkWriteArTagsOnConvert.Checked = _config.writeArTagsOnEncode;
chkWriteARTagsOnVerify.Checked = _config.writeArTagsOnVerify;
chkWVExtraMode.Checked = (_config.wvExtraMode != 0);
if (_config.wvExtraMode != 0) numWVExtraMode.Value = _config.wvExtraMode;
@@ -151,7 +151,7 @@ namespace JDP {
listViewScriptConditions.Items.Add(resources.GetString("rbActionVerify.Text").Replace("&", ""));
listViewScriptConditions.Items.Add(resources.GetString("rbActionEncode.Text").Replace("&", ""));
listViewScriptConditions.Items[0].Tag = CUEAction.Verify;
listViewScriptConditions.Items[1].Tag = CUEAction.VerifyAndConvert;
listViewScriptConditions.Items[1].Tag = CUEAction.Encode;
EnableDisable();
}
@@ -207,7 +207,7 @@ namespace JDP {
_config.encodeWhenConfidence = (uint)numEncodeWhenConfidence.Value;
_config.encodeWhenZeroOffset = chkEncodeWhenZeroOffset.Checked;
_config.flacVerify = chkFLACVerify.Checked;
_config.writeArTagsOnConvert = chkWriteArTagsOnConvert.Checked;
_config.writeArTagsOnEncode = chkWriteArTagsOnConvert.Checked;
_config.writeArTagsOnVerify = chkWriteARTagsOnVerify.Checked;
if (!chkWVExtraMode.Checked) _config.wvExtraMode = 0;
else _config.wvExtraMode = (int) numWVExtraMode.Value;

File diff suppressed because it is too large Load Diff