]> git.r.bdr.sh - rbdr/lyricli/blobdiff - src/sources/apple_music.rs
Run format
[rbdr/lyricli] / src / sources / apple_music.rs
index 06412b88a02a7cbf114c9f746c17eb678b94cafb..6279a509db3be2fc33cf77dfcc433a83c6d74d46 100644 (file)
@@ -1,8 +1,15 @@
 use std::ffi::CStr;
 use std::io::Result;
 
 use std::ffi::CStr;
 use std::io::Result;
 
-use cocoa::{base::{nil, id}, foundation::NSString};
-use objc::{class, msg_send, sel, sel_impl, runtime::{Class, Object}};
+use cocoa::{
+    base::{id, nil},
+    foundation::NSString,
+};
+use objc::{
+    class, msg_send,
+    runtime::{Class, Object},
+    sel, sel_impl,
+};
 use objc_id::Id;
 
 use crate::Track;
 use objc_id::Id;
 
 use crate::Track;
@@ -18,7 +25,6 @@ impl AppleMusic {
 }
 
 impl LyricsSource for AppleMusic {
 }
 
 impl LyricsSource for AppleMusic {
-
     fn name(&self) -> String {
         "apple_music".to_string()
     }
     fn name(&self) -> String {
         "apple_music".to_string()
     }
@@ -27,17 +33,18 @@ impl LyricsSource for AppleMusic {
         unsafe {
             let app: Id<Object> = {
                 let cls = class!(SBApplication);
         unsafe {
             let app: Id<Object> = {
                 let cls = class!(SBApplication);
-                let bundle_identifier = NSString::alloc(nil).init_str("com.apple.Music"); 
+                let bundle_identifier = NSString::alloc(nil).init_str("com.apple.Music");
 
                 let workspace_class = Class::get("NSWorkspace").unwrap();
                 let shared_workspace: id = msg_send![workspace_class, sharedWorkspace];
                 let app_url: id = msg_send![shared_workspace, URLForApplicationWithBundleIdentifier:bundle_identifier];
 
                 if app_url != nil {
 
                 let workspace_class = Class::get("NSWorkspace").unwrap();
                 let shared_workspace: id = msg_send![workspace_class, sharedWorkspace];
                 let app_url: id = msg_send![shared_workspace, URLForApplicationWithBundleIdentifier:bundle_identifier];
 
                 if app_url != nil {
-                    let app: *mut Object = msg_send![cls, applicationWithBundleIdentifier:bundle_identifier];
+                    let app: *mut Object =
+                        msg_send![cls, applicationWithBundleIdentifier:bundle_identifier];
                     Id::from_ptr(app)
                 } else {
                     Id::from_ptr(app)
                 } else {
-                    return None
+                    return None;
                 }
             };
 
                 }
             };
 
@@ -53,11 +60,7 @@ impl LyricsSource for AppleMusic {
                     let name = CStr::from_ptr(name_ptr).to_string_lossy().into_owned();
                     let artist = CStr::from_ptr(artist_ptr).to_string_lossy().into_owned();
 
                     let name = CStr::from_ptr(name_ptr).to_string_lossy().into_owned();
                     let artist = CStr::from_ptr(artist_ptr).to_string_lossy().into_owned();
 
-
-                    return Some(Track {
-                        name,
-                        artist
-                    })
+                    return Some(Track { name, artist });
                 }
             }
         }
                 }
             }
         }
@@ -76,5 +79,3 @@ impl LyricsSource for AppleMusic {
         Ok(())
     }
 }
         Ok(())
     }
 }
-
-