From 2faca86315b787e5a41a672f0e767854c4760eef Mon Sep 17 00:00:00 2001 From: lordwelch Date: Thu, 30 Nov 2017 19:20:20 -0700 Subject: [PATCH] Too lazy --- main.go | 7 ++++--- type.go | 14 +++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 5e33325..0b974b6 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ func main() { args struct { RES string `arg:"help:Resolution preference [480/720/1080]"` RELEASE []string `arg:"-r,help:Release group preference order."` + TAGS []string `arg:"-t, help:Tags to prefer -t internal would choose an internal over another"` Series []string `arg:"required,positional,help:TV series to download"` NEW bool `arg:"-n,help:Only modify new torrents"` PATH string `arg:"-P,help:Path to torrent files"` @@ -30,7 +31,7 @@ func main() { ) arg.MustParse(&args) - if len(args.PATH < 1) { + if len(args.PATH) < 1 { args.PATH, _ = os.Getwd() } unselectedDir = filepath.Clean(args.PATH + "/unselected/") @@ -56,9 +57,9 @@ func process(torrentFile string) *SceneVideoTorrent { ) f, _ := os.OpenFile(torrentFile, os.O_RDONLY, 755) mt.ReadFile(f) - fmt.Printf("%+v\n", mt) + //fmt.Printf("%+v\n", mt) vt.Torrent = NewTorrent(*mt) vt.Parse(vt.Name) - fmt.Printf("%+v\n", *vt) + fmt.Printf("%v\n", *vt) return vt } diff --git a/type.go b/type.go index 4f1389b..887392c 100644 --- a/type.go +++ b/type.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "io" "github.com/lordwelch/SceneParse" @@ -38,7 +39,10 @@ type SceneVideoTorrent struct { Scene.Scene } -type EpisodeTorrent []SceneVideoTorrent +type EpisodeTorrent struct { + Episode []SceneVideoTorrent + Release string +} type SeriesTorrent []EpisodeTorrent @@ -66,6 +70,10 @@ func (Mt *MetaTorrent) ReadFile(r io.Reader) error { return bencode.NewDecoder(r).Decode(Mt) } -func (s SeriesTorrent) Title() string { - return s[0][0].Title +func (Vt SceneVideoTorrent) String() string { + return fmt.Sprint("Original: ", Vt.Original, "\nName: ", Vt.Name, "\nEpisode: ", Vt.Season, Vt.Episode, "\nTags: ", Vt.Tags) +} + +func (s SeriesTorrent) Title() string { + return s[0].Episode[0].Title }