]>
Commit | Line | Data |
---|---|---|
1 | use std::io::Result; | |
2 | ||
3 | // #[cfg(target_os = "macos")] | |
4 | // mod applie_music; | |
5 | // #[cfg(target_os = "macos")] | |
6 | // mod spotify; | |
7 | // #[cfg(not(target_os = "macos"))] | |
8 | // mod rhythmbox; | |
9 | // #[cfg(not(target_os = "macos"))] | |
10 | // mod quod_libe; | |
11 | // #[cfg(not(target_os = "macos"))] | |
12 | // mod strawberry; | |
13 | // #[cfg(not(target_os = "macos"))] | |
14 | // mod tauon; | |
15 | ||
16 | // #[cfg(target_os = "macos")] | |
17 | // use apple_music::AppleMusic; | |
18 | // #[cfg(target_os = "macos")] | |
19 | // use spotify::Spotify; | |
20 | ||
21 | // #[cfg(not(target_os = "macos"))] | |
22 | // use rhythmbox::Rhythmbox; | |
23 | // #[cfg(not(target_os = "macos"))] | |
24 | // use quod_libet::QuodLibet; | |
25 | // #[cfg(not(target_os = "macos"))] | |
26 | // use strawberry::Strawberry; | |
27 | // #[cfg(not(target_os = "macos"))] | |
28 | // use tauon::Tauon; | |
29 | ||
30 | use crate::Track; | |
31 | ||
32 | pub trait LyricsSource { | |
33 | fn name(&self) -> String; | |
34 | ||
35 | fn current_track(&self) -> Option<Track>; | |
36 | ||
37 | fn disable(&self) -> Result<()>; | |
38 | fn enable(&self) -> Result<()>; | |
39 | fn reset(&self) -> Result<()>; | |
40 | } | |
41 | ||
42 | pub fn list() -> Result<()> { | |
43 | Ok(()) | |
44 | } | |
45 | ||
46 | pub fn enable(source_name: String) -> Result<()> { | |
47 | println!("Enabling {}", source_name); | |
48 | Ok(()) | |
49 | } | |
50 | ||
51 | pub fn disable(source_name: String) -> Result<()> { | |
52 | println!("Disabling {}", source_name); | |
53 | Ok(()) | |
54 | } | |
55 | ||
56 | pub fn reset(source_name: String) -> Result<()> { | |
57 | println!("Reset {}", source_name); | |
58 | Ok(()) | |
59 | } | |
60 | ||
61 | pub fn get_track() -> Option<Track> { | |
62 | return None | |
63 | } | |
64 | ||
65 | pub fn available_sources() -> Vec<Box<dyn LyricsSource>> { | |
66 | let mut sources: Vec<Box<dyn LyricsSource>> = Vec::new(); | |
67 | #[cfg(target_os = "macos")] | |
68 | { | |
69 | // sources.push(Box::new(AppleMusic::new())); | |
70 | // sources.push(Box::new(Spotify::new())); | |
71 | } | |
72 | ||
73 | #[cfg(not(target_os = "macos"))] | |
74 | { | |
75 | // sources.push(Box::new(Rhythmbox::new())); | |
76 | // sources.push(Box::new(QuodLibet::new())); | |
77 | // sources.push(Box::new(Strawberry::new())); | |
78 | // sources.push(Box::new(Tauon::new())); | |
79 | } | |
80 | ||
81 | sources | |
82 | } |