use lofty to support formats different from mp3

This commit is contained in:
2026-04-05 01:41:47 +03:00
parent 02205f1cea
commit d9de6b3800
6 changed files with 174 additions and 43 deletions
+7 -2
View File
@@ -6,13 +6,18 @@ pub use lrclib::LrcLibSource;
use anyhow::{Result, anyhow};
use async_trait::async_trait;
use id3::Tag;
use lofty::{properties::FileProperties, tag::Tag};
use std::sync::Arc;
#[async_trait]
pub trait LyricsSource: Send + Sync {
fn name(&self) -> &'static str;
async fn fetch_lyrics(&self, tag: &Tag, allow_inaccurate: bool) -> Result<String>;
async fn fetch_lyrics(
&self,
tag: &Tag,
properties: &FileProperties,
allow_inaccurate: bool,
) -> Result<String>;
}
pub async fn create_source(name: &str) -> Result<Arc<dyn LyricsSource>> {