Add support for different folder naming; minor bug fixes

This commit is contained in:
Mukhtar Akere
2025-03-24 12:12:38 +01:00
parent 8c13da5d30
commit 9469c98df7
14 changed files with 249 additions and 210 deletions

View File

@@ -273,7 +273,7 @@ func (tb *Torbox) GenerateDownloadLinks(t *types.Torrent) error {
return nil
}
func (tb *Torbox) GetDownloadLink(t *types.Torrent, file *types.File) *types.File {
func (tb *Torbox) GetDownloadLink(t *types.Torrent, file *types.File) (string, error) {
url := fmt.Sprintf("%s/api/torrents/requestdl/", tb.Host)
query := gourl.Values{}
query.Add("torrent_id", t.Id)
@@ -283,19 +283,17 @@ func (tb *Torbox) GetDownloadLink(t *types.Torrent, file *types.File) *types.Fil
req, _ := http.NewRequest(http.MethodGet, url, nil)
resp, err := tb.client.MakeRequest(req)
if err != nil {
return nil
return "", err
}
var data DownloadLinksResponse
if err = json.Unmarshal(resp, &data); err != nil {
return nil
return "", err
}
if data.Data == nil {
return nil
return "", fmt.Errorf("error getting download links")
}
link := *data.Data
file.DownloadLink = link
file.Generated = time.Now()
return file
return link, nil
}
func (tb *Torbox) GetDownloadingStatus() []string {
@@ -336,10 +334,6 @@ func New(dc config.Debrid) *Torbox {
}
}
func (tb *Torbox) ConvertLinksToFiles(links []string) []types.File {
return nil
}
func (tb *Torbox) GetDownloads() (map[string]types.DownloadLinks, error) {
return nil, nil
}