Implement MonitorAlbum: search, parse, filter by quality, add best to qbittorrent

This commit is contained in:
Alexander
2026-05-07 23:21:21 +02:00
parent 79f3f145de
commit 8ad2734964
16 changed files with 1479 additions and 59 deletions
+28
View File
@@ -0,0 +1,28 @@
package torrent
import (
"fmt"
"github.com/rs/zerolog/log"
"homelab.lan/music-agregator/internal/config"
)
func NewTorrentClient(cfg config.Config) (TorrentClient, error) {
var client TorrentClient
switch cfg.Torrent.ClientType {
case config.TorrentClientQbittorrent:
client = NewQbittorrentClient(cfg.Torrent.Url)
default:
return nil, fmt.Errorf("unknown torrent client type: %s", cfg.Torrent.ClientType)
}
if _, err := client.Login(cfg.Torrent.Username, cfg.Torrent.Password); err != nil {
return nil, fmt.Errorf("torrent client login failed: %w", err)
}
log.Info().Str("client", string(cfg.Torrent.ClientType)).Str("url", cfg.Torrent.Url).Msg("torrent client connected")
return client, nil
}