Фикс отображения путей

This commit is contained in:
2026-06-14 19:09:50 +03:00
parent 5fb2f4df43
commit d4bf8a8cad
13 changed files with 178 additions and 18 deletions
+8 -4
View File
@@ -55,8 +55,11 @@ type Torrent struct {
InfohashV2 string `json:"infohash_v2"`
}
// File — элемент /torrents/files: путь файла относительно content_path и
// его размер.
// File — элемент /torrents/files: путь файла относительно save_path
// (включая корневую папку торрента для многофайловых раздач) и его размер.
// Абсолютный путь на диске = filepath.Join(save_path, Name) — НЕ content_path:
// для многофайловой раздачи это удвоило бы корневую папку, для однофайловой
// дало бы путь под самим файлом.
type File struct {
Name string `json:"name"`
Size int64 `json:"size"`
@@ -226,8 +229,9 @@ func (c *Client) Torrents(ctx context.Context, category string) ([]Torrent, erro
return ts, nil
}
// Files возвращает список файлов торрента (имена относительно content_path и
// размеры). Нужен распознаванию как один из сигналов.
// Files возвращает список файлов торрента (имена относительно save_path,
// включая корневую папку для многофайловых раздач, и размеры). Нужен
// распознаванию как один из сигналов; абсолютный путь — join(save_path, Name).
func (c *Client) Files(ctx context.Context, hash string) ([]File, error) {
resp, err := c.do(ctx, func() (*http.Request, error) {
u := c.endpoint("/api/v2/torrents/files?hash=" + url.QueryEscape(hash))