diff --git a/.idea/go.imports.xml b/.idea/go.imports.xml new file mode 100644 index 0000000..d7202f0 --- /dev/null +++ b/.idea/go.imports.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/config/scope/prescene.yaml b/config/scope/prescene.yaml index 4e650ee..394a34c 100644 --- a/config/scope/prescene.yaml +++ b/config/scope/prescene.yaml @@ -2,7 +2,7 @@ role: console endpoint: https://scnlog.me/music/flac/ endpoint-next: page/%s/ sleep-before-next-iteration: 5s -levels-to-scrape: 5 +levels-to-scrape: 6 groups: tags: neformat: diff --git a/pkg/handler/prescene.go b/pkg/handler/prescene.go index dfdf05c..b0f6fbf 100644 --- a/pkg/handler/prescene.go +++ b/pkg/handler/prescene.go @@ -13,23 +13,18 @@ import ( ) func (h *Handler) Prescene() string { - pagesToScrape := []string{"1"} + currMinute := time.Now().Minute() levels := viper.GetInt(constant.CfgKeyLevelsToScrape) + initPage := strconv.Itoa(currMinute/(60/levels) + 1) + pagesToScrape := []string{initPage} + if levels > 1 { - var q = (60.0 / 100.0) * (100.0 / viper.GetFloat64(constant.CfgKeyLevelsToScrape)) - minute := float64(time.Now().Minute()) - if minute < 1 { - minute = 1 - } + var q = (60.0 / 100.0) * (100.0 / float64(levels)) + minute := float64(currMinute + 1) fmt.Printf("FLOAT: %f, %f, %v\n", minute, q, math.Ceil(minute/q)) - hour := time.Now().Hour() - if hour == 1 { - hour = 25 - } else if hour == 0 { - hour = 1 - } + hour := time.Now().Hour() + levels page := hour * int(math.Ceil(minute/q)) pagesToScrape = append(pagesToScrape, strconv.Itoa(page)) diff --git a/types/interface/interfaces.go b/types/interface/interfaces.go index 26e9ef9..dd1f81e 100644 --- a/types/interface/interfaces.go +++ b/types/interface/interfaces.go @@ -17,6 +17,8 @@ type ShareTheBrutality interface { GetMail(email string) ([]model.ExternalSources, *mail.EmailService) } -type MetalArchiveInterface interface{} +type MetalArchiveInterface interface { + GetSearchResults(searchResults []model.ExternalSources) ([]model.ExternalSources, error) +} type Info interface{}