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

Function getTrackDuration

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

Source from the content-addressed store, hash-verified

52
53#[no_mangle]
54pub 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]
75pub extern "system" fn getTrackTitle(_env: JNIEnv, _class: JClass) -> *const c_char {

Callers

nothing calls this directly

Calls 1

get_spotify_sessionFunction · 0.85

Tested by

no test coverage detected