mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-27 13:07:47 +08:00
feat: change logic
This commit is contained in:
@@ -20,18 +20,18 @@ func SearchSeasonPackage(db1 *db.Client, seriesId, seasonNum int, checkResolutio
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isNumberedSeries(detail *db.MediaDetails) bool {
|
func isNumberedSeries(detail *db.MediaDetails) bool {
|
||||||
epCount := 0
|
hasSeason2 := false
|
||||||
seSeen := make(map[int]int, 0)
|
season2HasEpisode1 := false
|
||||||
for _, ep := range detail.Episodes {
|
for _, ep := range detail.Episodes {
|
||||||
if ep.SeasonNumber == 0 {
|
if ep.SeasonNumber == 2 {
|
||||||
continue
|
hasSeason2 = true
|
||||||
|
if ep.EpisodeNumber == 1 {
|
||||||
|
season2HasEpisode1 = true
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if ep.EpisodeNumber == 1 {
|
|
||||||
epCount++
|
|
||||||
}
|
|
||||||
seSeen[ep.SeasonNumber]++
|
|
||||||
}
|
}
|
||||||
return epCount == 1 && len(seSeen) > 2//only one 1st episode
|
return hasSeason2 && !season2HasEpisode1//only one 1st episode
|
||||||
}
|
}
|
||||||
|
|
||||||
func SearchEpisode(db1 *db.Client, seriesId, seasonNum, episodeNum int, checkResolution bool) ([]torznab.Result, error) {
|
func SearchEpisode(db1 *db.Client, seriesId, seasonNum, episodeNum int, checkResolution bool) ([]torznab.Result, error) {
|
||||||
@@ -60,7 +60,7 @@ func SearchEpisode(db1 *db.Client, seriesId, seasonNum, episodeNum int, checkRes
|
|||||||
//should not want season
|
//should not want season
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if episodeNum != -1 && meta.Episode != episodeNum { //not season pack, episode number equals
|
if episodeNum != -1 && meta.Episode != episodeNum { //not season pack, episode number equals
|
||||||
continue
|
continue
|
||||||
} else if seasonNum == -1 && !meta.IsSeasonPack { //want season pack, but not season pack
|
} else if seasonNum == -1 && !meta.IsSeasonPack { //want season pack, but not season pack
|
||||||
|
|||||||
Reference in New Issue
Block a user