RSS logging, extra title information processing

This commit is contained in:
Kenneth Jao 2024-08-08 13:10:26 -04:00
parent 59a7231224
commit 7b32722607

22
main.go
View File

@ -156,12 +156,23 @@ func GetRSS(rssURL string) ([]Anime, error) {
return animes, e.If(err).Then(func() {
for _, item := range feed.Items {
title := strings.Split(item.Title, "[Magnet] ")[1]
title = strings.Split(title, " [1080p]")[0]
if title[len(title)-6:] != "(HEVC)" {
if strings.Contains(title, "(HEVC)") {
title = strings.Split(title, " (HEVC)")[0]
} else {
continue
}
title = title[:len(title)-7]
var newVersion bool
if strings.Contains(title, "(AAC 2.0)") {
title = strings.Split(title, " (AAC 2.0)")[0]
} else if strings.Contains(title, "(Repack)") {
newVersion = true
title = strings.Split(title, " (Repack)")[0]
}
anime := NewAnime(item.Link)
if newVersion {
anime.Version += 1
}
e.LogIf(anime.InfoFromTitle(title))
animes = append(animes, anime)
}
@ -204,6 +215,8 @@ func GetAllAvailable(name string) ([]Anime, error) {
title = strings.Split(title, "[Erai-raws] ")[1]
if strings.Contains(title, "(AAC 2.0)") {
title = strings.Split(title, " (AAC 2.0)")[0]
} else if strings.Contains(title, "(Repack)") {
title = strings.Split(title, " (Repack)")[0]
} else {
title = strings.Split(title, " [1080p]")[0]
}
@ -298,10 +311,11 @@ func NewDaemon(server string, polling int, download string, socket net.Listener,
}
func (d *Daemon) Serve() {
//d.CheckRSS()
d.CheckRSS()
for {
select {
case <-time.After(d.PollingRate * time.Minute):
e.Log("Checking RSS", LogStd())
d.CheckRSS()
case <-time.After(10 * time.Second):
d.CheckTorrents()