Fix hash detection on download
Start adding a score function for sorting
This commit is contained in:
parent
3acdb54b62
commit
8bf4f5bf5c
7
main.go
7
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 {
|
||||
|
14
type.go
14
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)
|
||||
|
Loading…
Reference in New Issue
Block a user