aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio.rs1
-rw-r--r--src/database.rs4
-rw-r--r--src/lib.rs7
-rw-r--r--src/playback.rs13
-rw-r--r--src/scrobbler.rs8
5 files changed, 21 insertions, 12 deletions
diff --git a/src/audio.rs b/src/audio.rs
index 93eb8e6..d716a23 100644
--- a/src/audio.rs
+++ b/src/audio.rs
@@ -21,6 +21,7 @@ pub struct AudioEngine {
21 volume: Arc<Mutex<f32>>, 21 volume: Arc<Mutex<f32>>,
22} 22}
23 23
24#[allow(clippy::new_without_default)]
24impl AudioEngine { 25impl AudioEngine {
25 pub fn new() -> Self { 26 pub fn new() -> Self {
26 let (tx, rx) = mpsc::channel(); 27 let (tx, rx) = mpsc::channel();
diff --git a/src/database.rs b/src/database.rs
index 9d1d5f2..b7b8e88 100644
--- a/src/database.rs
+++ b/src/database.rs
@@ -220,7 +220,7 @@ impl Database {
220 } 220 }
221} 221}
222 222
223fn is_audio_file(path: &Path) -> bool { 223pub fn is_audio_file(path: &Path) -> bool {
224 path.extension() 224 path.extension()
225 .and_then(|ext| ext.to_str()) 225 .and_then(|ext| ext.to_str())
226 .map(|ext| { 226 .map(|ext| {
@@ -232,7 +232,7 @@ fn is_audio_file(path: &Path) -> bool {
232 .unwrap_or(false) 232 .unwrap_or(false)
233} 233}
234 234
235fn extract_metadata(path: &Path) -> (String, String, String, Option<i32>, Option<u64>) { 235pub fn extract_metadata(path: &Path) -> (String, String, String, Option<i32>, Option<u64>) {
236 let file_stem = path 236 let file_stem = path
237 .file_stem() 237 .file_stem()
238 .and_then(|s| s.to_str()) 238 .and_then(|s| s.to_str())
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..9317bcd
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,7 @@
1pub mod audio;
2pub mod cli;
3pub mod config;
4pub mod daemon;
5pub mod database;
6pub mod playback;
7pub mod scrobbler;
diff --git a/src/playback.rs b/src/playback.rs
index 76c0f44..d9dd1f9 100644
--- a/src/playback.rs
+++ b/src/playback.rs
@@ -18,7 +18,7 @@ pub struct Track {
18 pub duration: Option<u64>, 18 pub duration: Option<u64>,
19} 19}
20 20
21#[derive(Debug, Clone)] 21#[derive(Debug, Clone, PartialEq)]
22#[allow(dead_code)] 22#[allow(dead_code)]
23pub enum ShuffleMode { 23pub enum ShuffleMode {
24 None, 24 None,
@@ -28,14 +28,15 @@ pub enum ShuffleMode {
28 28
29#[allow(dead_code)] 29#[allow(dead_code)]
30pub struct Player { 30pub struct Player {
31 state: PlaybackState, 31 pub state: PlaybackState,
32 current_track: Option<Track>, 32 pub current_track: Option<Track>,
33 queue: Vec<Track>, 33 pub queue: Vec<Track>,
34 volume: u8, 34 pub volume: u8,
35 shuffle: ShuffleMode, 35 pub shuffle: ShuffleMode,
36} 36}
37 37
38#[allow(dead_code)] 38#[allow(dead_code)]
39#[allow(clippy::new_without_default)]
39impl Player { 40impl Player {
40 pub fn new() -> Self { 41 pub fn new() -> Self {
41 Player { 42 Player {
diff --git a/src/scrobbler.rs b/src/scrobbler.rs
index 09a7f55..ddcbed9 100644
--- a/src/scrobbler.rs
+++ b/src/scrobbler.rs
@@ -2,10 +2,10 @@ use reqwest::Client;
2 2
3#[allow(dead_code)] 3#[allow(dead_code)]
4pub struct Scrobbler { 4pub struct Scrobbler {
5 lastfm_api_key: Option<String>, 5 pub lastfm_api_key: Option<String>,
6 lastfm_api_secret: Option<String>, 6 pub lastfm_api_secret: Option<String>,
7 lastfm_session_key: Option<String>, 7 pub lastfm_session_key: Option<String>,
8 listenbrainz_token: Option<String>, 8 pub listenbrainz_token: Option<String>,
9 client: Client, 9 client: Client,
10} 10}
11 11