aboutsummaryrefslogtreecommitdiff
path: root/src/sources/spotify.rs
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-01-26 17:04:00 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2025-01-26 17:04:00 +0100
commit4064639d3c3e25760ef43781feca77332cfbe5eb (patch)
tree77ce2883e5569bd4de5e1408b41c9d6d556a11c6 /src/sources/spotify.rs
parentfda55240fb06c55a7552ef7ded8c17ee56ce9f49 (diff)
Run lint / format
Diffstat (limited to 'src/sources/spotify.rs')
-rw-r--r--src/sources/spotify.rs25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/sources/spotify.rs b/src/sources/spotify.rs
index e4bf19c..bd627db 100644
--- a/src/sources/spotify.rs
+++ b/src/sources/spotify.rs
@@ -1,8 +1,15 @@
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;
@@ -18,7 +25,6 @@ impl Spotify {
}
impl LyricsSource for Spotify {
-
fn name(&self) -> String {
"spotify".to_string()
}
@@ -27,17 +33,18 @@ impl LyricsSource for Spotify {
unsafe {
let app: Id<Object> = {
let cls = class!(SBApplication);
- let bundle_identifier = NSString::alloc(nil).init_str("com.spotify.Client");
+ let bundle_identifier = NSString::alloc(nil).init_str("com.spotify.Client");
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 {
- return None
+ return None;
}
};
@@ -53,11 +60,7 @@ impl LyricsSource for Spotify {
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 });
}
}
}