diff --git a/README.md b/README.md index d255878..c6ba610 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ Hoarder ======== +Uploads .torrent files from a local "blackhole" to a remote (SSH) rtorrent watch folder. From there, rtorrent is polled over XMLRPC as to whether the torrent is completed. Finally, the files are downloaded over a multithreaded SSH connection and saved to the local machine. The blackhole is used as a queue and will have its .torrent files deleted. Requirements ------------ @@ -7,3 +8,13 @@ Go Install ------- +1. `go get github.com/tblyler/hoarder` +2. `go install github.com/tblyler/hoarder` + +Configuration +------------- +Make sure you make a copy of the conf file in the repo to suit your needs. + +Running +------- +After installation, just run the hoarder executable with the --config flag to specify where the config file is. diff --git a/hoarder.go b/hoarder.go index cd003f8..80e35a1 100644 --- a/hoarder.go +++ b/hoarder.go @@ -3,6 +3,7 @@ package main import ( "errors" + "flag" "github.com/adampresley/sigint" "io/ioutil" "log" @@ -214,8 +215,18 @@ func main() { os.Exit(1) }) + var config_path string + flag.StringVar(&config_path, "config", "", "Location of the config file") + flag.Parse() + + if config_path == "" { + log.Println("Missing argument for configuration file path") + flag.PrintDefaults() + os.Exit(1) + } + log.Println("Reading configuration file") - config, err := loadConfig("hoarder.conf") + config, err := loadConfig(config_path) if err != nil { log.Println(err) os.Exit(1)