diff --git a/main.go b/main.go index 7bedc6e..afb32ce 100644 --- a/main.go +++ b/main.go @@ -130,7 +130,10 @@ func download() { for _, ep := range se { var CurrentHash bool for _, HASH := range hash { - CurrentHash = HASH == ep.Ep[0].Meta.Hash + if HASH == ep.Ep[0].Meta.Hash { + CurrentHash = HASH == ep.Ep[0].Meta.Hash + break + } } if !CurrentHash { fmt.Printf("Better file found for: %s S%sE%s\n", ep.Ep[0].Title, ep.Ep[0].Season, ep.Ep[0].Episode) @@ -197,7 +200,7 @@ func addtorrent(St SeriesTorrent, torrent *SceneVideoTorrent) { if i+1 == 0 { panic("You do not exist in a world that I know of") } - St[torrent.Season][torrent.Episode].Release[v] = i + 1000000 + St[torrent.Season][torrent.Episode].Release[v] = -1 } for i, v := range args.TAGS { if i+1 == 0 { diff --git a/type.go b/type.go index db53ed0..3dbfb62 100644 --- a/type.go +++ b/type.go @@ -202,6 +202,20 @@ func (Et *EpisodeTorrent) Less(i, j int) bool { return OrderedBy(Et.ByExt, Et.ByRes, Et.ByRelease, Et.ByTag)(i, j) } +func (Et *EpisodeTorrent) score(i int) int { + var score int + if filepath.Ext(Et.Ep[i].Meta.FilePath) == mkv { + score += 10000 + } + if Et.Ep[i].Resolution == Et.Res { + score += 9000 + } else { + score += Et.Ep[i].Resolution * 1000 + } + score += Et.Release[Et.Ep[i].Release] * 100 + score += Et.Tags[Et.Ep[i].Tags] +} + func (Et *EpisodeTorrent) Add(Vt *SceneVideoTorrent) { Et.Ep = append(Et.Ep, Vt) sort.Stable(Et)