tuned default precene fetch
This commit is contained in:
11
.idea/go.imports.xml
generated
Normal file
11
.idea/go.imports.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GoImports">
|
||||||
|
<option name="excludedPackages">
|
||||||
|
<array>
|
||||||
|
<option value="github.com/pkg/errors" />
|
||||||
|
<option value="golang.org/x/net/context" />
|
||||||
|
</array>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -2,7 +2,7 @@ role: console
|
|||||||
endpoint: https://scnlog.me/music/flac/
|
endpoint: https://scnlog.me/music/flac/
|
||||||
endpoint-next: page/%s/
|
endpoint-next: page/%s/
|
||||||
sleep-before-next-iteration: 5s
|
sleep-before-next-iteration: 5s
|
||||||
levels-to-scrape: 5
|
levels-to-scrape: 6
|
||||||
groups:
|
groups:
|
||||||
tags:
|
tags:
|
||||||
neformat:
|
neformat:
|
||||||
|
|||||||
@@ -13,23 +13,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) Prescene() string {
|
func (h *Handler) Prescene() string {
|
||||||
pagesToScrape := []string{"1"}
|
currMinute := time.Now().Minute()
|
||||||
levels := viper.GetInt(constant.CfgKeyLevelsToScrape)
|
levels := viper.GetInt(constant.CfgKeyLevelsToScrape)
|
||||||
|
initPage := strconv.Itoa(currMinute/(60/levels) + 1)
|
||||||
|
pagesToScrape := []string{initPage}
|
||||||
|
|
||||||
if levels > 1 {
|
if levels > 1 {
|
||||||
var q = (60.0 / 100.0) * (100.0 / viper.GetFloat64(constant.CfgKeyLevelsToScrape))
|
var q = (60.0 / 100.0) * (100.0 / float64(levels))
|
||||||
minute := float64(time.Now().Minute())
|
minute := float64(currMinute + 1)
|
||||||
if minute < 1 {
|
|
||||||
minute = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("FLOAT: %f, %f, %v\n", minute, q, math.Ceil(minute/q))
|
fmt.Printf("FLOAT: %f, %f, %v\n", minute, q, math.Ceil(minute/q))
|
||||||
|
|
||||||
hour := time.Now().Hour()
|
hour := time.Now().Hour() + levels
|
||||||
if hour == 1 {
|
|
||||||
hour = 25
|
|
||||||
} else if hour == 0 {
|
|
||||||
hour = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
page := hour * int(math.Ceil(minute/q))
|
page := hour * int(math.Ceil(minute/q))
|
||||||
pagesToScrape = append(pagesToScrape, strconv.Itoa(page))
|
pagesToScrape = append(pagesToScrape, strconv.Itoa(page))
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ type ShareTheBrutality interface {
|
|||||||
GetMail(email string) ([]model.ExternalSources, *mail.EmailService)
|
GetMail(email string) ([]model.ExternalSources, *mail.EmailService)
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetalArchiveInterface interface{}
|
type MetalArchiveInterface interface {
|
||||||
|
GetSearchResults(searchResults []model.ExternalSources) ([]model.ExternalSources, error)
|
||||||
|
}
|
||||||
|
|
||||||
type Info interface{}
|
type Info interface{}
|
||||||
|
|||||||
Reference in New Issue
Block a user