Добавлены страницы вики для GenAudioBookInfo: Home, Installation, Makefile, OpenRouter, Output Structure, TorrAPI и Sidebar.

Создана структура документации, описывающая функциональность, установку, использование CLI, архитектуру и интеграции с TorrAPI и OpenRouter.
Добавлены примеры конфигурации и метаданных, а также описание структуры выходных данных.
This commit is contained in:
Dmitriy Fofanov
2026-02-23 13:19:39 +03:00
parent 107f57d2cc
commit 41fb62f62e
31 changed files with 4181 additions and 1376 deletions
+18 -9
View File
@@ -19,9 +19,9 @@ import (
// TorrAPIClient реализует domain.TorrentSearcher.
type TorrAPIClient struct {
baseURL string
httpClient *http.Client
maxRetries int
baseURL string
httpClient *http.Client
maxRetries int
backoffBase time.Duration
backoffMax time.Duration
}
@@ -56,11 +56,16 @@ func (c *TorrAPIClient) SearchByQuery(ctx context.Context, query string) (map[do
}
func (c *TorrAPIClient) searchByRaw(ctx context.Context, query, year string) (map[domain.TrackerName][]domain.TorrentSearchResult, error) {
reqURL := fmt.Sprintf("%s/api/search/title/all?query=%s&page=all&category=0&year=%s&format=0",
c.baseURL,
url.QueryEscape(query),
url.QueryEscape(year),
)
params := url.Values{
"query": {query},
"page": {"all"},
"category": {"0"},
"format": {"0"},
}
if year != "" {
params.Set("year", year)
}
reqURL := c.baseURL + "/api/search/title/all?" + params.Encode()
var body []byte
var lastErr error
@@ -262,7 +267,11 @@ func (c *TorrAPIClient) shouldRetryTorrAPI(attempt int, err error, statusCode in
// nextTorrAPIBackoff вычисляет задержку перед повтором (exponential backoff).
func (c *TorrAPIClient) nextTorrAPIBackoff(attempt int) time.Duration {
delay := c.backoffBase << attempt
shift := attempt
if shift > 30 {
shift = 30
}
delay := c.backoffBase << shift
if delay <= 0 {
delay = c.backoffBase
}