feat: initial commit — unarr CLI
Search, inspect, stream, and download torrents from the terminal. Replaces the entire *arr stack with a single binary.
This commit is contained in:
commit
29cf0a0126
85 changed files with 10178 additions and 0 deletions
41
internal/engine/debrid.go
Normal file
41
internal/engine/debrid.go
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
tc "github.com/torrentclaw/go-client"
|
||||
)
|
||||
|
||||
// DebridDownloader downloads via debrid services (Real-Debrid, AllDebrid, etc.).
|
||||
// Currently a stub — Available() works, Download() returns not-implemented.
|
||||
type DebridDownloader struct {
|
||||
apiClient *tc.Client
|
||||
}
|
||||
|
||||
// NewDebridDownloader creates a debrid downloader stub.
|
||||
func NewDebridDownloader(apiClient *tc.Client) *DebridDownloader {
|
||||
return &DebridDownloader{apiClient: apiClient}
|
||||
}
|
||||
|
||||
func (d *DebridDownloader) Method() DownloadMethod { return MethodDebrid }
|
||||
|
||||
func (d *DebridDownloader) Available(ctx context.Context, task *Task) (bool, error) {
|
||||
if d.apiClient == nil {
|
||||
return false, nil
|
||||
}
|
||||
resp, err := d.apiClient.DebridCheckCache(ctx, "", "", []string{task.InfoHash})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
cached, ok := resp.Cached[task.InfoHash]
|
||||
return ok && cached, nil
|
||||
}
|
||||
|
||||
func (d *DebridDownloader) Download(_ context.Context, _ *Task, _ string, _ chan<- Progress) (*Result, error) {
|
||||
return nil, fmt.Errorf("debrid download not implemented yet (coming in a future release)")
|
||||
}
|
||||
|
||||
func (d *DebridDownloader) Pause(_ string) error { return nil }
|
||||
func (d *DebridDownloader) Cancel(_ string) error { return nil }
|
||||
func (d *DebridDownloader) Shutdown(_ context.Context) error { return nil }
|
||||
Loading…
Add table
Add a link
Reference in a new issue