Skip to content

Commit

Permalink
torrent creation functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonymous committed May 16, 2017
1 parent 488a9ce commit 8f0c6ed
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions magic.json.default
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"ffmpeg" : "/usr/bin/ffmpeg",
"sox" : "/usr/bin/sox",
"mktorrent" : "/usr/bin/mktorrent",

"app_secret" : "your_secret",
"app_id" : "your_id",
Expand Down
24 changes: 21 additions & 3 deletions source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,36 @@ int main(string[] args)
string choice;
while (choice != "n" && choice != "y") {
write("Generate spectrals? [y/n] ");
stdout.flush;
choice = readln().chomp;
}
if (choice == "y") {
auto full = 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"]);
auto zoom = execute([magic["sox"].str, dirName~"/01 "~tracks[0]["title"].str~".flac", "-n", "remix", "1", "spectrogram",
"-X", "500", "-y", "1025", "-z", "120", "-w", "Kaiser", "-S", "0:30", "-d", "0:04", "-o", "SpecZoom.png"]);
if (full.status != 0 || zoom.status != 0) {
if (full.status != 0 || zoom.status != 0)
writeln("Generating spectrals failed! Is sox configured properly?");
} else {
else
writeln("SpecFull.png and SpecZoom.png written.");
}
}

choice = null;
while (choice != "n" && choice != "y") {
write("Create .torrent file? [y/n] ");
stdout.flush;
choice = readln().chomp;
}
if (choice == "y") {
write("Announce URL: ");
stdout.flush;
string announce = readln().chomp;

auto t = execute([magic["mktorrent"].str, "-l", "20", "-a", announce, dirName]);
if (t.status != 0)
writeln("Creating .torrent file failed! Is mktorrent configured properly?");
else
writeln("'"~dirName~".torrent' created.");
}

writeln("All done, exiting.");
Expand Down

0 comments on commit 8f0c6ed

Please sign in to comment.