make torrent files

This commit is contained in:
Al Beano 2017-05-30 17:45:30 +01:00
parent 861b114968
commit 49446c4120
2 changed files with 27 additions and 1 deletions

View File

@ -1,5 +1,6 @@
{
"sessionId" : "insert",
"ffmpeg" : "ffmpeg",
"sox" : "sox"
"sox" : "sox",
"mktorrent" : "mktorrent"
}

View File

@ -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")
}