spotifyd icon indicating copy to clipboard operation
spotifyd copied to clipboard

D-Bus mpris metadata for Podcast Playback

Open seabassapologist opened this issue 5 years ago • 1 comments

Is your feature request related to a problem? Please describe. Playing podcasts with spotifyd via Spotify Connect functions as expected, but the metadata property in the mpris d-bus interface isn't being populated at all

$ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotifyd /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:'Metadata'
method return time=1631217407.298348 sender=:1.12 -> destination=:1.104 serial=44 reply_serial=2
   variant       array [
      ]

Describe the solution you'd like The metadata response from the Spotify API appears to vary slightly for podcasts, from regular tracks. Support for podcast metadata was added into version 0.10.0 of the rspotify library, in the rspotify::client::Spotify current_playing() method, via the "AdditionalTypes" parameter (https://docs.rs/rspotify/0.10.0/rspotify/client/struct.Spotify.html#method.current_playing). However, spotifyd fails to build when rspotify is bumped up to version 0.10.0, appears to be a number of changes to the API that break the current build.

$ cargo build --release --features dbus_mpris 
   Compiling spotifyd v0.3.2 (/home/matt/Code/spotifyd)
error[E0433]: failed to resolve: could not find `spotify` in `rspotify`
  --> src/dbus_mpris.rs:22:15
   |
22 | use rspotify::spotify::{
   |               ^^^^^^^ could not find `spotify` in `rspotify`

error[E0433]: failed to resolve: use of undeclared type `RspotifyToken`
  --> src/dbus_mpris.rs:58:24
   |
58 |             api_token: RspotifyToken::default(),
   |                        ^^^^^^^^^^^^^ use of undeclared type `RspotifyToken`

error[E0433]: failed to resolve: use of undeclared type `RspotifyToken`
  --> src/dbus_mpris.rs:83:38
   |
83 |                     self.api_token = RspotifyToken::default()
   |                                      ^^^^^^^^^^^^^ use of undeclared type `RspotifyToken`

error[E0433]: failed to resolve: use of undeclared type `RepeatState`
   --> src/dbus_mpris.rs:449:21
    |
449 |                     RepeatState::Off => "None",
    |                     ^^^^^^^^^^^ use of undeclared type `RepeatState`

error[E0433]: failed to resolve: use of undeclared type `RepeatState`
   --> src/dbus_mpris.rs:450:21
    |
450 |                     RepeatState::Track => "Track",
    |                     ^^^^^^^^^^^ use of undeclared type `RepeatState`

error[E0433]: failed to resolve: use of undeclared type `RepeatState`
   --> src/dbus_mpris.rs:451:21
    |
451 |                     RepeatState::Context => "Playlist",
    |                     ^^^^^^^^^^^ use of undeclared type `RepeatState`

error[E0412]: cannot find type `RspotifyToken` in this scope
  --> src/dbus_mpris.rs:33:16
   |
33 |     api_token: RspotifyToken,
   |                ^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `datetime_to_timestamp` in this scope
  --> src/dbus_mpris.rs:86:37
   |
86 |                         .expires_at(datetime_to_timestamp(token.expires_in));
   |                                     ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing this function
   |
1  | use rspotify::util::datetime_to_timestamp;
   |

error[E0412]: cannot find type `RspotifyToken` in this scope
   --> src/dbus_mpris.rs:113:31
    |
113 | fn create_spotify_api(token: &RspotifyToken) -> Spotify {
    |                               ^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `Spotify` in this scope
   --> src/dbus_mpris.rs:113:49
    |
113 | fn create_spotify_api(token: &RspotifyToken) -> Spotify {
    |                                                 ^^^^^^^ not found in this scope
    |
help: consider importing this struct
    |
1   | use rspotify::client::Spotify;
    |

error[E0433]: failed to resolve: use of undeclared type `Spotify`
   --> src/dbus_mpris.rs:114:5
    |
114 |     Spotify::default().access_token(&token.access_token).build()
    |     ^^^^^^^ not found in this scope
    |
help: consider importing this struct
    |
1   | use rspotify::client::Spotify;
    |

error[E0412]: cannot find type `RspotifyToken` in this scope
   --> src/dbus_mpris.rs:119:16
    |
119 |     api_token: RspotifyToken,
    |                ^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `for_position` in this scope
   --> src/dbus_mpris.rs:366:81
    |
366 |                     let _ = sp.start_playback(device_id, None, Some(vec![uri]), for_position(0), None);
    |                                                                                 ^^^^^^^^^^^^ not found in this scope
    |
help: consider importing this function
    |
1   | use rspotify::model::offset::for_position;
    |

error[E0425]: cannot find function `for_position` in this scope
   --> src/dbus_mpris.rs:368:75
    |
368 |                     let _ = sp.start_playback(device_id, Some(uri), None, for_position(0), None);
    |                                                                           ^^^^^^^^^^^^ not found in this scope
    |
help: consider importing this function
    |
1   | use rspotify::model::offset::for_position;
    |

warning: unnecessary trailing semicolon
   --> src/config.rs:422:10
    |
422 |         };
    |          ^ help: remove this semicolon
    |
    = note: `#[warn(redundant_semicolons)]` on by default

error: aborting due to 14 previous errors; 1 warning emitted

Some errors have detailed explanations: E0412, E0425, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `spotifyd`

To learn more, run the command again with --verbose.

So ideally dbus_mpris.rs needs to be updated accordingly to support rspotify 0.10.0 and property_metadata updated to call current_playing() with the new AdditionalTypes parameter

Describe alternatives you've considered None that I am aware. Podcast Metadata appears to be a somewhat new addition to the Spotify API.

Additional context Confirmed this isn't a problem with my setup, since playing music populates the metadata just fine. Not sure if updating to rspotify 0.10.0 was already on the development roadmap or not.

seabassapologist avatar Sep 09 '21 22:09 seabassapologist

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 08 '21 22:12 stale[bot]