Added the playlist generator

This commit is contained in:
Connor Johnstone
2026-03-20 18:09:47 -04:00
parent cbd0243516
commit b39dd6cc8e

View File

@@ -1,5 +1,6 @@
use shanty_data::MetadataFetcher; use shanty_data::MetadataFetcher;
use shanty_data::MusicBrainzFetcher; use shanty_data::MusicBrainzFetcher;
use shanty_data::http::RateLimiter;
use crate::error::SearchResult; use crate::error::SearchResult;
use crate::provider::{ use crate::provider::{
@@ -17,6 +18,13 @@ impl MusicBrainzSearch {
.map_err(|e| crate::error::SearchError::Provider(e.to_string()))?; .map_err(|e| crate::error::SearchError::Provider(e.to_string()))?;
Ok(Self { client }) Ok(Self { client })
} }
/// Create with a shared rate limiter (to coordinate with other MB clients).
pub fn with_limiter(limiter: RateLimiter) -> SearchResult<Self> {
let client = MusicBrainzFetcher::with_limiter(limiter)
.map_err(|e| crate::error::SearchError::Provider(e.to_string()))?;
Ok(Self { client })
}
} }
impl SearchProvider for MusicBrainzSearch { impl SearchProvider for MusicBrainzSearch {