Harold 6 vuotta sitten
vanhempi
commit
00e89343fb
4 muutettua tiedostoa jossa 21 lisäystä ja 11 poistoa
  1. 2 1
      examples/play.rs
  2. 14 7
      metadata/src/lib.rs
  3. 4 2
      playback/src/player.rs
  4. 1 1
      protocol/files.rs

+ 2 - 1
examples/play.rs

@@ -33,7 +33,8 @@ fn main() {
     let backend = audio_backend::find(None).unwrap();
     let backend = audio_backend::find(None).unwrap();
 
 
     println!("Connecting ..");
     println!("Connecting ..");
-    let session = core.run(Session::connect(session_config, credentials, None, handle))
+    let session = core
+        .run(Session::connect(session_config, credentials, None, handle))
         .unwrap();
         .unwrap();
 
 
     let (player, _) = Player::new(player_config, session.clone(), None, move || (backend)(None));
     let (player, _) = Player::new(player_config, session.clone(), None, move || (backend)(None));

+ 14 - 7
metadata/src/lib.rs

@@ -110,13 +110,15 @@ impl Metadata for Track {
     fn parse(msg: &Self::Message, session: &Session) -> Self {
     fn parse(msg: &Self::Message, session: &Session) -> Self {
         let country = session.country();
         let country = session.country();
 
 
-        let artists = msg.get_artist()
+        let artists = msg
+            .get_artist()
             .iter()
             .iter()
             .filter(|artist| artist.has_gid())
             .filter(|artist| artist.has_gid())
             .map(|artist| SpotifyId::from_raw(artist.get_gid()).unwrap())
             .map(|artist| SpotifyId::from_raw(artist.get_gid()).unwrap())
             .collect::<Vec<_>>();
             .collect::<Vec<_>>();
 
 
-        let files = msg.get_file()
+        let files = msg
+            .get_file()
             .iter()
             .iter()
             .filter(|file| file.has_file_id())
             .filter(|file| file.has_file_id())
             .map(|file| {
             .map(|file| {
@@ -133,7 +135,8 @@ impl Metadata for Track {
             album: SpotifyId::from_raw(msg.get_album().get_gid()).unwrap(),
             album: SpotifyId::from_raw(msg.get_album().get_gid()).unwrap(),
             artists: artists,
             artists: artists,
             files: files,
             files: files,
-            alternatives: msg.get_alternative()
+            alternatives: msg
+                .get_alternative()
                 .iter()
                 .iter()
                 .map(|alt| SpotifyId::from_raw(alt.get_gid()).unwrap())
                 .map(|alt| SpotifyId::from_raw(alt.get_gid()).unwrap())
                 .collect(),
                 .collect(),
@@ -150,20 +153,23 @@ impl Metadata for Album {
     }
     }
 
 
     fn parse(msg: &Self::Message, _: &Session) -> Self {
     fn parse(msg: &Self::Message, _: &Session) -> Self {
-        let artists = msg.get_artist()
+        let artists = msg
+            .get_artist()
             .iter()
             .iter()
             .filter(|artist| artist.has_gid())
             .filter(|artist| artist.has_gid())
             .map(|artist| SpotifyId::from_raw(artist.get_gid()).unwrap())
             .map(|artist| SpotifyId::from_raw(artist.get_gid()).unwrap())
             .collect::<Vec<_>>();
             .collect::<Vec<_>>();
 
 
-        let tracks = msg.get_disc()
+        let tracks = msg
+            .get_disc()
             .iter()
             .iter()
             .flat_map(|disc| disc.get_track())
             .flat_map(|disc| disc.get_track())
             .filter(|track| track.has_gid())
             .filter(|track| track.has_gid())
             .map(|track| SpotifyId::from_raw(track.get_gid()).unwrap())
             .map(|track| SpotifyId::from_raw(track.get_gid()).unwrap())
             .collect::<Vec<_>>();
             .collect::<Vec<_>>();
 
 
-        let covers = msg.get_cover_group()
+        let covers = msg
+            .get_cover_group()
             .get_image()
             .get_image()
             .iter()
             .iter()
             .filter(|image| image.has_file_id())
             .filter(|image| image.has_file_id())
@@ -194,7 +200,8 @@ impl Metadata for Artist {
     fn parse(msg: &Self::Message, session: &Session) -> Self {
     fn parse(msg: &Self::Message, session: &Session) -> Self {
         let country = session.country();
         let country = session.country();
 
 
-        let top_tracks: Vec<SpotifyId> = match msg.get_top_track()
+        let top_tracks: Vec<SpotifyId> = match msg
+            .get_top_track()
             .iter()
             .iter()
             .find(|tt| !tt.has_country() || countrylist_contains(tt.get_country(), &country))
             .find(|tt| !tt.has_country() || countrylist_contains(tt.get_country(), &country))
         {
         {

+ 4 - 2
playback/src/player.rs

@@ -557,7 +557,8 @@ impl PlayerInternal {
             }
             }
         };
         };
 
 
-        let key = self.session
+        let key = self
+            .session
             .audio_key()
             .audio_key()
             .request(track.id, file_id)
             .request(track.id, file_id)
             .wait()
             .wait()
@@ -599,7 +600,8 @@ impl Drop for PlayerInternal {
 impl ::std::fmt::Debug for PlayerCommand {
 impl ::std::fmt::Debug for PlayerCommand {
     fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
     fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
         match *self {
         match *self {
-            PlayerCommand::Load(track, play, position, _) => f.debug_tuple("Load")
+            PlayerCommand::Load(track, play, position, _) => f
+                .debug_tuple("Load")
                 .field(&track)
                 .field(&track)
                 .field(&play)
                 .field(&play)
                 .field(&position)
                 .field(&position)

+ 1 - 1
protocol/files.rs

@@ -1,6 +1,6 @@
 // Autogenerated by build.sh
 // Autogenerated by build.sh
 
 
-pub const FILES : &'static [(&'static str, u32)] = &[
+pub const FILES: &'static [(&'static str, u32)] = &[
     ("proto/authentication.proto", 2098196376),
     ("proto/authentication.proto", 2098196376),
     ("proto/keyexchange.proto", 451735664),
     ("proto/keyexchange.proto", 451735664),
     ("proto/mercury.proto", 709993906),
     ("proto/mercury.proto", 709993906),