From 5028dc49b151205b1e1b9e9e972cebe5eec59e53 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Sun, 16 Jul 2017 23:48:06 -0700 Subject: [PATCH] Start interface started implementing main func --- main.go | 13 ++++++++++++- type.go | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 0890051..1c48a4a 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,11 @@ package main import ( + "bufio" "fmt" "os" + "os/exec" + "path" "github.com/alexflint/go-arg" ) @@ -21,9 +24,17 @@ func main() { RELEASE string `arg:"-r,help:Release group preference order. Comma seperated."` SHOW []string `arg:"positional,help:TV show to download"` NEW bool `arg:"-n,help:Only modify new torrents"` + PATH string `arg:"-P,help:Path to torrent files"` } arg.MustParse(&args) - fmt.Println("Hello, World!!!") + scnr := bufio.NewScanner(os.Stdin) + for err == nil { + if !scnr.scan() { + panic("fail") + } + exec.Command("wget", scnr.Text(), "-o", args.PATH+'/') + process(args.PATH + '/' + path.Base(scnr.Text())) + } } func process(torrentFile string) *TorrentVideo { diff --git a/type.go b/type.go index 08870f8..5416ac7 100644 --- a/type.go +++ b/type.go @@ -65,6 +65,13 @@ type TorrentEpisode struct { Season string } +type Interface interface { + ReleaseGroup() string + Len() int + Swap(i, j int) + Less(i, j int) bool +} + func NewTorrent(mt MetaTorrent) (T *Torrent) { T = new(Torrent) if mt.Info.Length == 0 { @@ -140,7 +147,6 @@ func (T *TorrentVideo) Process() error { T.Release = match[1] T.Creator = match[2] } - } else { if re[0].MatchString(str) { tag = true