From e7cb044a5c0415bece72c079728e886894ec071c Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Sat, 25 Feb 2023 22:14:40 -0500 Subject: [PATCH] Remove or disable a lot of warnings --- music-player/server/src/audio.rs | 56 +++--------------------- music-player/server/src/bin/server.rs | 9 ++-- music-player/server/src/music_scanner.rs | 12 +---- 3 files changed, 9 insertions(+), 68 deletions(-) diff --git a/music-player/server/src/audio.rs b/music-player/server/src/audio.rs index 46ec41f..e109506 100644 --- a/music-player/server/src/audio.rs +++ b/music-player/server/src/audio.rs @@ -10,15 +10,8 @@ Luminescent Dreams Tools is distributed in the hope that it will be useful, but You should have received a copy of the GNU General Public License along with Lumeto. If not, see . */ -use dbus::ffidisp::Connection; -use mpris::{FindingError, PlaybackStatus, Player, PlayerFinder, ProgressTick}; use serde::Serialize; -use std::{ - path::PathBuf, - sync::mpsc::{channel, Receiver, Sender, TryRecvError}, - thread, - time::Duration, -}; +use std::time::Duration; use thiserror::Error; pub enum Message { @@ -39,17 +32,6 @@ pub struct DeviceInformation { pub name: String, } -pub fn list_devices(conn: Connection) -> Result, FindingError> { - Ok(PlayerFinder::for_connection(conn) - .find_all()? - .into_iter() - .map(|player| DeviceInformation { - address: player.unique_name().to_owned(), - name: player.identity().to_owned(), - }) - .collect()) -} - #[derive(Debug, Error)] pub enum AudioError { #[error("DBus device was not found")] @@ -122,38 +104,6 @@ pub struct TrackInfo { pub artist: Option, } -/* -#[derive(Clone, Debug, PartialEq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Track { - pub id: TrackId, - pub track_number: Option, - pub name: Option, - pub album: Option, - pub artist: Option, -} -*/ - -/* -impl From<&mpris::Metadata> for Track { - fn from(data: &mpris::Metadata) -> Self { - Self { - id: data.track_id().unwrap(), - track_number: data.track_number(), - name: data.title().map(|s| s.to_owned()), - album: data.album_name().map(|s| s.to_owned()), - artist: None, - } - } -} - -impl From for Track { - fn from(data: mpris::Metadata) -> Self { - Self::from(&data) - } -} -*/ - #[derive(Clone, Debug, Serialize)] #[serde(rename_all = "camelCase")] pub enum State { @@ -162,10 +112,12 @@ pub enum State { Stopped, } +/* pub struct CurrentlyPlaying { track: TrackInfo, position: Duration, } +*/ #[derive(Clone, Debug, Serialize)] #[serde(rename_all = "camelCase")] @@ -183,6 +135,7 @@ pub trait AudioPlayer { fn play_pause(&self) -> Result; } +/* pub struct GStreamerPlayer { url: url::Url, } @@ -204,6 +157,7 @@ impl AudioPlayer for GStreamerPlayer { unimplemented!() } } +*/ /* pub struct MprisDevice { diff --git a/music-player/server/src/bin/server.rs b/music-player/server/src/bin/server.rs index 434deea..836bb3e 100644 --- a/music-player/server/src/bin/server.rs +++ b/music-player/server/src/bin/server.rs @@ -1,16 +1,13 @@ use flow::Flow; use std::{ - io::stdin, net::{IpAddr, Ipv4Addr, SocketAddr}, path::PathBuf, sync::Arc, - thread, - time::Duration, }; -use warp::{Filter, Reply}; +use warp::Filter; use music_player::{ - audio::{TrackId, TrackInfo}, + audio::TrackInfo, core::Core, database::{MemoryIndex, MusicIndex}, music_scanner::FileScanner, @@ -58,7 +55,7 @@ pub async fn main() { let index = Arc::new(MemoryIndex::new()); let scanner = FileScanner::new(vec![music_root.clone()]); - let core = match Core::new(index.clone(), scanner) { + let _core = match Core::new(index.clone(), scanner) { Flow::Ok(core) => core, Flow::Err(error) => panic!("error: {}", error), Flow::Fatal(error) => panic!("fatal: {}", error), diff --git a/music-player/server/src/music_scanner.rs b/music-player/server/src/music_scanner.rs index 19d464b..8db6338 100644 --- a/music-player/server/src/music_scanner.rs +++ b/music-player/server/src/music_scanner.rs @@ -1,17 +1,7 @@ -use crate::{ - audio::{TrackId, TrackInfo}, - core::{ControlMsg, TrackMsg}, - database::MusicIndex, - FatalError, -}; +use crate::audio::{TrackId, TrackInfo}; use std::{ fs::{DirEntry, ReadDir}, path::PathBuf, - sync::{ - mpsc::{Receiver, RecvTimeoutError, Sender}, - Arc, - }, - time::{Duration, Instant}, }; use thiserror::Error;