aboutsummaryrefslogtreecommitdiff
path: root/src/sources
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2024-03-13 22:43:47 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2024-03-13 22:43:47 +0100
commit738ec06d26a2a19bdda8a992d2250e731d954631 (patch)
treec963a76fc51d5d4712026efaf9e5ac6accba9526 /src/sources
parent4adf8d5182b7ad3720e3160e0f4530547625dbce (diff)
Add rust implementation test
Diffstat (limited to 'src/sources')
-rw-r--r--src/sources/mod.rs82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/sources/mod.rs b/src/sources/mod.rs
new file mode 100644
index 0000000..fb7af8f
--- /dev/null
+++ b/src/sources/mod.rs
@@ -0,0 +1,82 @@
+use std::io::Result;
+
+// #[cfg(target_os = "macos")]
+// mod applie_music;
+// #[cfg(target_os = "macos")]
+// mod spotify;
+// #[cfg(not(target_os = "macos"))]
+// mod rhythmbox;
+// #[cfg(not(target_os = "macos"))]
+// mod quod_libe;
+// #[cfg(not(target_os = "macos"))]
+// mod strawberry;
+// #[cfg(not(target_os = "macos"))]
+// mod tauon;
+
+// #[cfg(target_os = "macos")]
+// use apple_music::AppleMusic;
+// #[cfg(target_os = "macos")]
+// use spotify::Spotify;
+
+// #[cfg(not(target_os = "macos"))]
+// use rhythmbox::Rhythmbox;
+// #[cfg(not(target_os = "macos"))]
+// use quod_libet::QuodLibet;
+// #[cfg(not(target_os = "macos"))]
+// use strawberry::Strawberry;
+// #[cfg(not(target_os = "macos"))]
+// use tauon::Tauon;
+
+use crate::Track;
+
+pub trait LyricsSource {
+ fn name(&self) -> String;
+
+ fn current_track(&self) -> Option<Track>;
+
+ fn disable(&self) -> Result<()>;
+ fn enable(&self) -> Result<()>;
+ fn reset(&self) -> Result<()>;
+}
+
+pub fn list() -> Result<()> {
+ Ok(())
+}
+
+pub fn enable(source_name: String) -> Result<()> {
+ println!("Enabling {}", source_name);
+ Ok(())
+}
+
+pub fn disable(source_name: String) -> Result<()> {
+ println!("Disabling {}", source_name);
+ Ok(())
+}
+
+pub fn reset(source_name: String) -> Result<()> {
+ println!("Reset {}", source_name);
+ Ok(())
+}
+
+pub fn get_track() -> Option<Track> {
+ return None
+}
+
+pub fn available_sources() -> Vec<Box<dyn LyricsSource>> {
+ let mut sources: Vec<Box<dyn LyricsSource>> = Vec::new();
+ #[cfg(target_os = "macos")]
+ {
+ // sources.push(Box::new(AppleMusic::new()));
+ // sources.push(Box::new(Spotify::new()));
+ }
+
+ #[cfg(not(target_os = "macos"))]
+ {
+ // sources.push(Box::new(Rhythmbox::new()));
+ // sources.push(Box::new(QuodLibet::new()));
+ // sources.push(Box::new(Strawberry::new()));
+ // sources.push(Box::new(Tauon::new()));
+ }
+
+ sources
+}