diff --git a/magic.json.default b/magic.json.default index 1417214..b013af2 100644 --- a/magic.json.default +++ b/magic.json.default @@ -1,5 +1,6 @@ { "sessionId" : "insert", "ffmpeg" : "ffmpeg", - "sox" : "sox" + "sox" : "sox", + "mktorrent" : "mktorrent" } diff --git a/wimp-get.go b/wimp-get.go index d7fb147..3cfc47a 100644 --- a/wimp-get.go +++ b/wimp-get.go @@ -203,4 +203,29 @@ func main() { println("SpecZoom.png written") } } + + // Make .torrent file + choice = "" + for !(choice == "y" || choice == "n") { + print("Create .torrent file? [y/n] ") + fmt.Scanln(&choice) + choice = strings.TrimRight(choice, "\n") + } + + if choice == "y" { + print("Announce URL: ") + var announce string + fmt.Scanln(&announce) + announce = strings.TrimRight(announce, "\n") + + torrent := exec.Command(magic["mktorrent"].(string), "-l", "20", "-a", announce, dirName) + e = torrent.Run() + if e != nil { + println("Error creating .torrent file!") + } else { + fmt.Printf("%s.torrent created\n", dirName) + } + } + + println("All done, exiting") }