catch errors

This commit is contained in:
Anonymous 2017-05-16 17:11:56 +01:00
parent 8f0c6ed139
commit a7b5f9eba7
1 changed files with 15 additions and 9 deletions

View File

@ -103,14 +103,17 @@ int main(string[] args)
choice = readln().chomp; choice = readln().chomp;
} }
if (choice == "y") { if (choice == "y") {
auto full = execute([magic["sox"].str, dirName~"/01 "~tracks[0]["title"].str~".flac", "-n", "remix", "1", "spectrogram", try {
"-x", "3000", "-y", "513", "-z", "120", "-w", "Kaiser", "-o", "SpecFull.png"]); auto full = execute([magic["sox"].str, dirName~"/01 "~tracks[0]["title"].str~".flac", "-n", "remix", "1", "spectrogram",
auto zoom = execute([magic["sox"].str, dirName~"/01 "~tracks[0]["title"].str~".flac", "-n", "remix", "1", "spectrogram", "-x", "3000", "-y", "513", "-z", "120", "-w", "Kaiser", "-o", "SpecFull.png"]);
"-X", "500", "-y", "1025", "-z", "120", "-w", "Kaiser", "-S", "0:30", "-d", "0:04", "-o", "SpecZoom.png"]); auto zoom = execute([magic["sox"].str, dirName~"/01 "~tracks[0]["title"].str~".flac", "-n", "remix", "1", "spectrogram",
if (full.status != 0 || zoom.status != 0) "-X", "500", "-y", "1025", "-z", "120", "-w", "Kaiser", "-S", "0:30", "-d", "0:04", "-o", "SpecZoom.png"]);
writeln("Generating spectrals failed! Is sox configured properly?"); if (full.status != 0 || zoom.status != 0)
else throw new Exception();
writeln("SpecFull.png and SpecZoom.png written."); writeln("SpecFull.png and SpecZoom.png written.");
} catch (Exception e) {
writeln("Generating spectrals failed! Is sox configured properly?");
}
} }
choice = null; choice = null;
@ -124,11 +127,14 @@ int main(string[] args)
stdout.flush; stdout.flush;
string announce = readln().chomp; string announce = readln().chomp;
try {
auto t = execute([magic["mktorrent"].str, "-l", "20", "-a", announce, dirName]); auto t = execute([magic["mktorrent"].str, "-l", "20", "-a", announce, dirName]);
if (t.status != 0) if (t.status != 0)
throw new Exception();
writeln("'"~dirName~".torrent' created.");
} catch (Exception e) {
writeln("Creating .torrent file failed! Is mktorrent configured properly?"); writeln("Creating .torrent file failed! Is mktorrent configured properly?");
else }
writeln("'"~dirName~".torrent' created.");
} }
writeln("All done, exiting."); writeln("All done, exiting.");