Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ sha-1 = "0.10"
tokio = {version = "1.44.2", features = ["signal", "rt-multi-thread", "process", "io-std"] }
tokio-stream = "0.1.7"
url = "2.2.2"
librespot-audio = { version = "0.7.1", default-features = false }
librespot-playback = { version = "0.7.1", default-features = false }
librespot-core = "0.7.1"
librespot-discovery = "0.7.1"
librespot-connect = "0.7.1"
librespot-metadata = "0.7.1"
librespot-protocol = "0.7.1"
librespot-oauth = "0.7.1"
librespot-audio = { git = "https://github.com/librespot-org/librespot.git", default-features = false }
librespot-playback = { git = "https://github.com/librespot-org/librespot.git", default-features = false }
librespot-core = { git = "https://github.com/librespot-org/librespot.git" }
librespot-discovery = { git = "https://github.com/librespot-org/librespot.git" }
librespot-connect = { git = "https://github.com/librespot-org/librespot.git" }
librespot-metadata = { git = "https://github.com/librespot-org/librespot.git" }
librespot-protocol = { git = "https://github.com/librespot-org/librespot.git" }
librespot-oauth = { git = "https://github.com/librespot-org/librespot.git" }
toml = "0.8.19"
color-eyre = "0.6"
directories = "6.0.0"
Expand Down
27 changes: 15 additions & 12 deletions src/dbus_mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use futures::{
task::{Context, Poll},
};
use librespot_connect::{LoadContextOptions, LoadRequest, LoadRequestOptions, Spirc};
use librespot_core::{Session, SpotifyId, spotify_id::SpotifyItemType};
use librespot_core::{Session, SpotifyId, SpotifyUri};
use librespot_metadata::audio::AudioItem;
use librespot_playback::player::PlayerEvent;
use log::{debug, error, warn};
Expand Down Expand Up @@ -331,6 +331,9 @@ impl CurrentStateInner {

use librespot_metadata::audio::UniqueFields::*;
match &audio_item.unique_fields {
Local { .. } => {
// TODO:
}
Track {
artists,
album,
Expand Down Expand Up @@ -683,7 +686,7 @@ fn register_player_interface(
.read()?
.audio_item
.as_ref()
.map(|item| (item.track_id, item.duration_ms))
.map(|item| (item.track_id.clone(), item.duration_ms))
else {
return Err(dbus::MethodErr::failed(
"can set position while nothing is playing",
Expand Down Expand Up @@ -713,7 +716,7 @@ fn register_player_interface(
let local_spirc = spirc.clone();
let local_state = current_state.clone();
b.method("OpenUri", ("uri",), (), move |_, _, (uri,): (String,)| {
let id = SpotifyId::from_uri(&uri).map_err(|e| MethodErr::invalid_arg(&e))?;
let spotify_uri = SpotifyUri::from_uri(&uri).map_err(|e| MethodErr::invalid_arg(&e))?;
let CurrentStateInner {
shuffle, repeat, ..
} = *local_state.read()?;
Expand All @@ -723,17 +726,17 @@ fn register_player_interface(
let (playing_track_index, context_uri) = Handle::current()
.block_on(async move {
use librespot_metadata::*;
Ok::<_, librespot_core::Error>(match id.item_type {
SpotifyItemType::Track => {
let track = Track::get(&session, &id).await?;
Ok::<_, librespot_core::Error>(match spotify_uri {
SpotifyUri::Track{..} => {
let track = Track::get(&session, &spotify_uri).await?;
(track.number as u32, track.album.id.to_uri()?)
}
SpotifyItemType::Album
| SpotifyItemType::Artist
| SpotifyItemType::Playlist
| SpotifyItemType::Episode
| SpotifyItemType::Show => (0, uri),
SpotifyItemType::Local | SpotifyItemType::Unknown => {
SpotifyUri::Album{..}
| SpotifyUri::Artist{..}
| SpotifyUri::Playlist{..}
| SpotifyUri::Episode{..}
| SpotifyUri::Show{..} => (0, uri),
SpotifyUri::Local{..} | SpotifyUri::Unknown{..} => {
return Err(librespot_core::Error::unimplemented(
"this type of uri is not supported",
));
Expand Down
Loading