Skip to main content

JellyfinClient

Struct JellyfinClient 

Source
pub struct JellyfinClient {
    config: Arc<JellyfinConfig>,
    http_client: Client,
}
Expand description

Jellyfin API client for playback reporting

Fields§

§config: Arc<JellyfinConfig>§http_client: Client

Implementations§

Source§

impl JellyfinClient

Source

pub fn new(config: JellyfinConfig) -> Result<Self, String>

Create a new Jellyfin API client

Source

fn get_device_name() -> &'static str

Get device name based on platform

Source

fn get_auth_header(&self) -> String

Build the X-Emby-Authorization header value

Source

async fn get<T: for<'de> Deserialize<'de>>( &self, endpoint: &str, ) -> Result<T, String>

Make a GET request to the Jellyfin API

Source

async fn post<T: Serialize>( &self, endpoint: &str, body: &T, ) -> Result<(), String>

Make a POST request to the Jellyfin API

Source

pub async fn report_playback_start( &self, item_id: String, position_ticks: i64, play_session_id: Option<String>, ) -> Result<(), String>

Report playback start to Jellyfin

Source

pub async fn report_playback_stopped( &self, item_id: String, position_ticks: i64, play_session_id: Option<String>, ) -> Result<(), String>

Report playback stopped to Jellyfin

Source

pub async fn report_playback_progress( &self, item_id: String, position_ticks: i64, is_paused: bool, play_session_id: Option<String>, ) -> Result<(), String>

Report playback progress to Jellyfin

Source

pub async fn play_on_session( &self, session_id: String, item_ids: Vec<String>, start_index: usize, start_position_ticks: Option<i64>, ) -> Result<(), String>

Play items on a remote session (casting)

Source

pub async fn send_session_command( &self, session_id: String, command: &str, ) -> Result<(), String>

Send a playback command to a remote session

Source

pub async fn session_seek( &self, session_id: String, position_ticks: i64, ) -> Result<(), String>

Seek on a remote session

Jellyfin’s /Sessions/{id}/Playing/Seek endpoint takes the target as the SeekPositionTicks query parameter, not a JSON body. Sending it in the body (as we used to) is silently ignored and the remote never seeks.

Source

async fn send_general_command( &self, session_id: &str, command_name: &str, arguments: Option<Value>, ) -> Result<(), String>

Send a full GeneralCommand to a remote session. Uses POST /Sessions/{id}/Command with a body containing Name and Arguments. This is required for commands that need arguments (e.g. SetVolume).

Source

pub async fn session_set_volume( &self, session_id: String, volume: i32, ) -> Result<(), String>

Set volume on a remote session

Source

pub async fn session_toggle_mute( &self, session_id: String, ) -> Result<(), String>

Toggle mute on a remote session

Source

pub async fn get_sessions(&self) -> Result<Vec<SessionInfo>, String>

Get all active sessions

Source

pub async fn get_session( &self, session_id: &str, ) -> Result<Option<SessionInfo>, String>

Get a specific session by ID

Source

pub async fn lms_get_sync_groups(&self) -> Result<Vec<LmsSyncGroup>, String>

List current LMS sync groups.

Source

pub async fn lms_create_sync_group( &self, master_mac: &str, slave_macs: Vec<String>, ) -> Result<(), String>

Fuse LMS zones: create a sync group with master_mac as the sync master and slave_macs joining it. The master keeps playing; slaves follow.

Source

pub async fn lms_unsync_player(&self, mac: &str) -> Result<(), String>

Remove a single LMS player from whatever sync group it’s in.

Source

pub async fn lms_dissolve_sync_group( &self, master_mac: &str, ) -> Result<(), String>

Dissolve an entire LMS sync group, identified by its master’s MAC.

Source

async fn delete(&self, endpoint: &str) -> Result<(), String>

Make a DELETE request to the Jellyfin API (used by the JellyLMS endpoints).

Trait Implementations§

Source§

impl Clone for JellyfinClient

Source§

fn clone(&self) -> JellyfinClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more