cargo fmt
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::library::Library;
|
|||||||
use crate::playable::Playable;
|
use crate::playable::Playable;
|
||||||
use crate::queue::Queue;
|
use crate::queue::Queue;
|
||||||
use crate::traits::{ListItem, ViewExt};
|
use crate::traits::{ListItem, ViewExt};
|
||||||
use rspotify::model::show::{SimplifiedEpisode, FullEpisode};
|
use rspotify::model::show::{FullEpisode, SimplifiedEpisode};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
|||||||
12
src/mpris.rs
12
src/mpris.rs
@@ -9,14 +9,14 @@ use dbus::tree::{Access, Factory};
|
|||||||
use dbus::{Path, SignalArgs};
|
use dbus::{Path, SignalArgs};
|
||||||
|
|
||||||
use crate::album::Album;
|
use crate::album::Album;
|
||||||
|
use crate::episode::Episode;
|
||||||
use crate::playable::Playable;
|
use crate::playable::Playable;
|
||||||
use crate::playlist::Playlist;
|
use crate::playlist::Playlist;
|
||||||
use crate::show::Show;
|
|
||||||
use crate::queue::{Queue, RepeatSetting};
|
use crate::queue::{Queue, RepeatSetting};
|
||||||
|
use crate::show::Show;
|
||||||
use crate::spotify::{PlayerEvent, Spotify, URIType};
|
use crate::spotify::{PlayerEvent, Spotify, URIType};
|
||||||
use crate::track::Track;
|
use crate::track::Track;
|
||||||
use crate::traits::ListItem;
|
use crate::traits::ListItem;
|
||||||
use crate::episode::Episode;
|
|
||||||
|
|
||||||
type Metadata = HashMap<String, Variant<Box<dyn RefArg>>>;
|
type Metadata = HashMap<String, Variant<Box<dyn RefArg>>>;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ fn get_playbackstatus(spotify: Arc<Spotify>) -> String {
|
|||||||
PlayerEvent::Paused => "Paused",
|
PlayerEvent::Paused => "Paused",
|
||||||
_ => "Stopped",
|
_ => "Stopped",
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_metadata(playable: Option<Playable>) -> Metadata {
|
fn get_metadata(playable: Option<Playable>) -> Metadata {
|
||||||
@@ -130,7 +130,7 @@ fn run_dbus_server(spotify: Arc<Spotify>, queue: Arc<Queue>, rx: mpsc::Receiver<
|
|||||||
"org.mpris.MediaPlayer2.ncspot",
|
"org.mpris.MediaPlayer2.ncspot",
|
||||||
dbus::NameFlag::ReplaceExisting as u32,
|
dbus::NameFlag::ReplaceExisting as u32,
|
||||||
)
|
)
|
||||||
.expect("Failed to register dbus player name");
|
.expect("Failed to register dbus player name");
|
||||||
|
|
||||||
let f = Factory::new_fn::<()>();
|
let f = Factory::new_fn::<()>();
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ fn run_dbus_server(spotify: Arc<Spotify>, queue: Arc<Queue>, rx: mpsc::Receiver<
|
|||||||
RepeatSetting::RepeatTrack => "Track",
|
RepeatSetting::RepeatTrack => "Track",
|
||||||
RepeatSetting::RepeatPlaylist => "Playlist",
|
RepeatSetting::RepeatPlaylist => "Playlist",
|
||||||
}
|
}
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
@@ -573,7 +573,7 @@ fn run_dbus_server(spotify: Arc<Spotify>, queue: Arc<Queue>, rx: mpsc::Receiver<
|
|||||||
conn.send(
|
conn.send(
|
||||||
changed.to_emit_message(&Path::new("/org/mpris/MediaPlayer2".to_string()).unwrap()),
|
changed.to_emit_message(&Path::new("/org/mpris/MediaPlayer2".to_string()).unwrap()),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use crate::queue::Queue;
|
|||||||
use crate::spotify::Spotify;
|
use crate::spotify::Spotify;
|
||||||
use crate::traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
use crate::traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||||
use crate::ui::show::ShowView;
|
use crate::ui::show::ShowView;
|
||||||
use rspotify::model::show::{SimplifiedShow, FullShow};
|
use rspotify::model::show::{FullShow, SimplifiedShow};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ use crate::events::{Event, EventManager};
|
|||||||
use crate::playable::Playable;
|
use crate::playable::Playable;
|
||||||
use crate::queue;
|
use crate::queue;
|
||||||
use crate::track::Track;
|
use crate::track::Track;
|
||||||
use rspotify::model::show::{Show, SimplifiedEpisode, FullShow, FullEpisode};
|
use rspotify::model::show::{FullEpisode, FullShow, Show, SimplifiedEpisode};
|
||||||
|
|
||||||
pub const VOLUME_PERCENT: u16 = ((u16::max_value() as f64) * 1.0 / 100.0) as u16;
|
pub const VOLUME_PERCENT: u16 = ((u16::max_value() as f64) * 1.0 / 100.0) as u16;
|
||||||
|
|
||||||
@@ -913,7 +913,7 @@ pub enum URIType {
|
|||||||
Track,
|
Track,
|
||||||
Playlist,
|
Playlist,
|
||||||
Show,
|
Show,
|
||||||
Episode
|
Episode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl URIType {
|
impl URIType {
|
||||||
@@ -926,9 +926,9 @@ impl URIType {
|
|||||||
Some(URIType::Track)
|
Some(URIType::Track)
|
||||||
} else if s.starts_with("spotify:") && s.contains(":playlist:") {
|
} else if s.starts_with("spotify:") && s.contains(":playlist:") {
|
||||||
Some(URIType::Playlist)
|
Some(URIType::Playlist)
|
||||||
} else if s.starts_with("spotify:show:"){
|
} else if s.starts_with("spotify:show:") {
|
||||||
Some(URIType::Show)
|
Some(URIType::Show)
|
||||||
} else if s.starts_with("spotify:episode:"){
|
} else if s.starts_with("spotify:episode:") {
|
||||||
Some(URIType::Episode)
|
Some(URIType::Episode)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use crate::album::Album;
|
|||||||
use crate::artist::Artist;
|
use crate::artist::Artist;
|
||||||
use crate::command::{Command, MoveMode};
|
use crate::command::{Command, MoveMode};
|
||||||
use crate::commands::CommandResult;
|
use crate::commands::CommandResult;
|
||||||
|
use crate::episode::Episode;
|
||||||
use crate::events::EventManager;
|
use crate::events::EventManager;
|
||||||
use crate::library::Library;
|
use crate::library::Library;
|
||||||
use crate::playlist::Playlist;
|
use crate::playlist::Playlist;
|
||||||
@@ -25,7 +26,6 @@ use crate::ui::listview::{ListView, Pagination};
|
|||||||
use crate::ui::tabview::TabView;
|
use crate::ui::tabview::TabView;
|
||||||
use rspotify::model::search::SearchResult;
|
use rspotify::model::search::SearchResult;
|
||||||
use rspotify::senum::SearchType;
|
use rspotify::senum::SearchType;
|
||||||
use crate::episode::Episode;
|
|
||||||
|
|
||||||
pub struct SearchView {
|
pub struct SearchView {
|
||||||
results_tracks: Arc<RwLock<Vec<Track>>>,
|
results_tracks: Arc<RwLock<Vec<Track>>>,
|
||||||
@@ -333,7 +333,7 @@ impl SearchView {
|
|||||||
let e = vec![result.into()];
|
let e = vec![result.into()];
|
||||||
let mut r = episodes.write().unwrap();
|
let mut r = episodes.write().unwrap();
|
||||||
*r = e;
|
*r = e;
|
||||||
return 1
|
return 1;
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user