Added the watch and scheduler systems
This commit is contained in:
@@ -27,5 +27,6 @@ dirs = "6"
|
||||
regex = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
shanty-data = { path = "../shanty-data" }
|
||||
tokio = { version = "1", features = ["full", "test-util"] }
|
||||
tempfile = "3"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use chrono::Utc;
|
||||
use sea_orm::ActiveValue::Set;
|
||||
|
||||
use shanty_data::DataResult;
|
||||
use shanty_db::{Database, queries};
|
||||
use shanty_tag::error::TagResult;
|
||||
use shanty_tag::provider::{
|
||||
ArtistSearchResult, DiscographyEntry, MetadataProvider, RecordingDetails, RecordingMatch,
|
||||
ReleaseMatch, ReleaseRef,
|
||||
@@ -13,7 +13,7 @@ use shanty_tag::{TagConfig, run_tagging};
|
||||
struct MockProvider;
|
||||
|
||||
impl MetadataProvider for MockProvider {
|
||||
async fn search_recording(&self, artist: &str, title: &str) -> TagResult<Vec<RecordingMatch>> {
|
||||
async fn search_recording(&self, artist: &str, title: &str) -> DataResult<Vec<RecordingMatch>> {
|
||||
// Return a match for "Pink Floyd - Time"
|
||||
if artist.contains("Pink Floyd") && title.contains("Time") {
|
||||
Ok(vec![RecordingMatch {
|
||||
@@ -34,11 +34,11 @@ impl MetadataProvider for MockProvider {
|
||||
}
|
||||
}
|
||||
|
||||
async fn search_release(&self, _artist: &str, _album: &str) -> TagResult<Vec<ReleaseMatch>> {
|
||||
async fn search_release(&self, _artist: &str, _album: &str) -> DataResult<Vec<ReleaseMatch>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
async fn get_recording(&self, mbid: &str) -> TagResult<RecordingDetails> {
|
||||
async fn get_recording(&self, mbid: &str) -> DataResult<RecordingDetails> {
|
||||
if mbid == "rec-123" {
|
||||
Ok(RecordingDetails {
|
||||
mbid: "rec-123".into(),
|
||||
@@ -56,11 +56,15 @@ impl MetadataProvider for MockProvider {
|
||||
secondary_artists: vec![],
|
||||
})
|
||||
} else {
|
||||
Err(shanty_tag::TagError::Other("not found".into()))
|
||||
Err(shanty_data::DataError::Other("not found".into()))
|
||||
}
|
||||
}
|
||||
|
||||
async fn search_artist(&self, _query: &str, _limit: u32) -> TagResult<Vec<ArtistSearchResult>> {
|
||||
async fn search_artist(
|
||||
&self,
|
||||
_query: &str,
|
||||
_limit: u32,
|
||||
) -> DataResult<Vec<ArtistSearchResult>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
@@ -68,21 +72,21 @@ impl MetadataProvider for MockProvider {
|
||||
&self,
|
||||
_artist_mbid: &str,
|
||||
_limit: u32,
|
||||
) -> TagResult<Vec<DiscographyEntry>> {
|
||||
) -> DataResult<Vec<DiscographyEntry>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
async fn get_release_tracks(
|
||||
&self,
|
||||
_release_mbid: &str,
|
||||
) -> TagResult<Vec<shanty_tag::provider::ReleaseTrack>> {
|
||||
) -> DataResult<Vec<shanty_tag::provider::ReleaseTrack>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
async fn get_artist_release_groups(
|
||||
&self,
|
||||
_artist_mbid: &str,
|
||||
) -> TagResult<Vec<shanty_tag::provider::ReleaseGroupEntry>> {
|
||||
) -> DataResult<Vec<shanty_tag::provider::ReleaseGroupEntry>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user