(_env: JNIEnv, _class: JClass)
| 52 | |
| 53 | #[no_mangle] |
| 54 | pub extern "system" fn getTrackDuration(_env: JNIEnv, _class: JClass) -> jlong { |
| 55 | let result = std::panic::catch_unwind(|| { |
| 56 | block_on(async { |
| 57 | match get_spotify_session()? { |
| 58 | Some(session) => { |
| 59 | let timeline = session.GetTimelineProperties()?; |
| 60 | let duration = timeline.EndTime()?.Duration; |
| 61 | Ok((duration / 10_000) as jlong) |
| 62 | } |
| 63 | _ => Err(Error::new(E_FAIL, "Spotify session not found")), |
| 64 | } |
| 65 | }) |
| 66 | }); |
| 67 | |
| 68 | match result { |
| 69 | Ok(Ok(duration)) => duration, |
| 70 | _ => -1, |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | #[no_mangle] |
| 75 | pub extern "system" fn getTrackTitle(_env: JNIEnv, _class: JClass) -> *const c_char { |
nothing calls this directly
no test coverage detected