MCPcopy Index your code
hub / github.com/LabyStudio/java-spotify-api / getArtistName

Function getArtistName

rust/src/lib.rs:97–115  ·  view source on GitHub ↗
(_env: JNIEnv, _class: JClass)

Source from the content-addressed store, hash-verified

95
96#[no_mangle]
97pub extern "system" fn getArtistName(_env: JNIEnv, _class: JClass) -> *const c_char {
98 let result = std::panic::catch_unwind(|| {
99 block_on(async {
100 match get_spotify_session()? {
101 Some(session) => {
102 let props = session.TryGetMediaPropertiesAsync()?.get()?;
103 let artist = props.Artist()?.to_string();
104 Ok(CString::new(artist).unwrap_or_default().into_raw())
105 }
106 _ => Err(Error::new(E_FAIL, "Spotify session not found")),
107 }
108 })
109 });
110
111 match result {
112 Ok(Ok(ptr)) => ptr,
113 _ => std::ptr::null(),
114 }
115}
116
117#[no_mangle]
118pub extern "system" fn isPlaying(_env: JNIEnv, _class: JClass) -> jint {

Callers

nothing calls this directly

Calls 2

get_spotify_sessionFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected