Re-organized providers and added a few
This commit is contained in:
@@ -7,6 +7,7 @@ description = "Online music search for Shanty"
|
||||
repository = "ssh://connor@git.rcjohnstone.com:2222/Shanty/search.git"
|
||||
|
||||
[dependencies]
|
||||
shanty-data = { path = "../shanty-data" }
|
||||
shanty-db = { path = "../shanty-db" }
|
||||
shanty-tag = { path = "../shanty-tag" }
|
||||
sea-orm = { version = "1", features = ["sqlx-sqlite", "runtime-tokio-native-tls"] }
|
||||
|
||||
@@ -15,6 +15,12 @@ pub enum SearchError {
|
||||
Other(String),
|
||||
}
|
||||
|
||||
impl From<shanty_data::DataError> for SearchError {
|
||||
fn from(e: shanty_data::DataError) -> Self {
|
||||
SearchError::Provider(e.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<shanty_tag::TagError> for SearchError {
|
||||
fn from(e: shanty_tag::TagError) -> Self {
|
||||
SearchError::Provider(e.to_string())
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
use shanty_tag::MusicBrainzClient;
|
||||
use shanty_tag::provider::MetadataProvider;
|
||||
use shanty_data::MetadataFetcher;
|
||||
use shanty_data::MusicBrainzFetcher;
|
||||
|
||||
use crate::error::SearchResult;
|
||||
use crate::provider::{
|
||||
AlbumResult, ArtistResult, Discography, DiscographyEntry, SearchProvider, TrackResult,
|
||||
};
|
||||
|
||||
/// MusicBrainz implementation of `SearchProvider`, wrapping shanty-tag's client.
|
||||
/// MusicBrainz implementation of `SearchProvider`, wrapping shanty-data's fetcher.
|
||||
pub struct MusicBrainzSearch {
|
||||
client: MusicBrainzClient,
|
||||
client: MusicBrainzFetcher,
|
||||
}
|
||||
|
||||
impl MusicBrainzSearch {
|
||||
pub fn new() -> SearchResult<Self> {
|
||||
let client = MusicBrainzClient::new()
|
||||
let client = MusicBrainzFetcher::new()
|
||||
.map_err(|e| crate::error::SearchError::Provider(e.to_string()))?;
|
||||
Ok(Self { client })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user