feat: add artist sync flow and stub torrent client
- Add DownloadService to orchestrate metadata → indexer → torrent flow - Add POST /api/sync/artist endpoint for syncing artist albums - Add StubTorrentClient for testing (logs requests to file) - Refactor TorrentConfig to tagged enum (client_type: qbittorrent|stub|none) - Add POST /api/reload endpoint for hot config reload - Add chrono dependency for timestamps
This commit is contained in:
+18
-15
@@ -54,23 +54,25 @@ async fn main() {
|
||||
}
|
||||
};
|
||||
|
||||
let torrent_service = if let Some(qbit_config) = &config.torrent.qbittorrent {
|
||||
match TorrentService::from_qbittorrent_config(qbit_config).await {
|
||||
Ok(svc) => {
|
||||
tracing::info!("connected to qBittorrent at {}", qbit_config.url);
|
||||
svc
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
"failed to connect to qBittorrent: {} (continuing without torrent client)",
|
||||
e
|
||||
);
|
||||
TorrentService::new()
|
||||
let torrent_service = match TorrentService::from_config(&config.torrent).await {
|
||||
Ok(svc) => {
|
||||
match &config.torrent {
|
||||
config::TorrentConfig::QBittorrent { url, .. } => {
|
||||
tracing::info!("connected to qBittorrent at {}", url);
|
||||
}
|
||||
config::TorrentConfig::Stub { log_path, .. } => {
|
||||
tracing::info!("using stub torrent client, logging to {}", log_path);
|
||||
}
|
||||
config::TorrentConfig::None => {
|
||||
tracing::info!("no torrent client configured");
|
||||
}
|
||||
}
|
||||
svc
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!("failed to init torrent client: {} (continuing without)", e);
|
||||
TorrentService::new()
|
||||
}
|
||||
} else {
|
||||
tracing::info!("no torrent client configured");
|
||||
TorrentService::new()
|
||||
};
|
||||
|
||||
let mut metadata_service = MetadataService::new(&config.metadata.endpoint);
|
||||
@@ -93,6 +95,7 @@ async fn main() {
|
||||
indexer_service,
|
||||
torrent_service,
|
||||
metadata_service,
|
||||
args.config.clone(),
|
||||
)));
|
||||
|
||||
let cors = CorsLayer::new()
|
||||
|
||||
Reference in New Issue
Block a user