Add credentials

Sort mkv files to top
Set seed ratio
This commit is contained in:
lordwelch 2018-01-06 23:33:08 -07:00
parent a5bf6ae19f
commit 4e30dd5404
2 changed files with 34 additions and 2 deletions

19
main.go
View File

@ -96,6 +96,21 @@ func download() {
}
}
}
time.Sleep(time.Second * 30)
tmap, _ := Transmission.GetTorrentMap()
for _, s := range CurrentTorrents {
for _, se := range s {
for _, ep := range se {
v, ok := tmap[ep.Ep[0].Meta.Hash]
if ok {
v.Set(transmission.SetTorrentArg{
SeedRatioMode: 1,
SeedRatioLimit: 1.0,
})
}
}
}
}
}
@ -216,7 +231,9 @@ func initialize() {
}
Transmission, err = transmission.New(transmission.Config{
Address: "http://timmy:9091/transmission/rpc",
User: "lordwelch",
Password: "hello",
Address: "http://timmy:9091/transmission/rpc",
HTTPClient: &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{

17
type.go
View File

@ -113,6 +113,21 @@ func (Vt SceneVideoTorrent) String() string {
return Vt.Torrent.Meta.FilePath
}
func (Et *EpisodeTorrent) ByExt(i, j int) bool {
var (
ii int
ij int
)
if filepath.Ext(Et.Ep[i].Meta.Info.Name) != "mkv" {
ii = 1
}
if filepath.Ext(Et.Ep[j].Meta.Info.Name) != "mkv" {
ij = 1
}
return ii < ij
}
func (Et *EpisodeTorrent) ByRelease(i, j int) bool {
var (
ii int
@ -184,7 +199,7 @@ func (Et *EpisodeTorrent) Swap(i, j int) {
}
func (Et *EpisodeTorrent) Less(i, j int) bool {
return OrderedBy(Et.ByRelease, Et.ByRes, Et.ByTag)(i, j)
return OrderedBy(Et.ByExt, Et.ByRelease, Et.ByRes, Et.ByTag)(i, j)
}
func (Et *EpisodeTorrent) Add(Vt *SceneVideoTorrent) {