pub struct JellyfinClient {
config: Arc<JellyfinConfig>,
http_client: Client,
}Expand description
Jellyfin API client for playback reporting
Fields§
§config: Arc<JellyfinConfig>§http_client: ClientImplementations§
Source§impl JellyfinClient
impl JellyfinClient
Sourcepub fn new(config: JellyfinConfig) -> Result<Self, String>
pub fn new(config: JellyfinConfig) -> Result<Self, String>
Create a new Jellyfin API client
Sourcefn get_device_name() -> &'static str
fn get_device_name() -> &'static str
Get device name based on platform
Sourcefn get_auth_header(&self) -> String
fn get_auth_header(&self) -> String
Build the X-Emby-Authorization header value
Sourceasync fn get<T: for<'de> Deserialize<'de>>(
&self,
endpoint: &str,
) -> Result<T, String>
async fn get<T: for<'de> Deserialize<'de>>( &self, endpoint: &str, ) -> Result<T, String>
Make a GET request to the Jellyfin API
Sourceasync fn post<T: Serialize>(
&self,
endpoint: &str,
body: &T,
) -> Result<(), String>
async fn post<T: Serialize>( &self, endpoint: &str, body: &T, ) -> Result<(), String>
Make a POST request to the Jellyfin API
Sourcepub async fn report_playback_start(
&self,
item_id: String,
position_ticks: i64,
play_session_id: Option<String>,
) -> Result<(), String>
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
Sourcepub async fn report_playback_stopped(
&self,
item_id: String,
position_ticks: i64,
play_session_id: Option<String>,
) -> Result<(), String>
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
Sourcepub async fn report_playback_progress(
&self,
item_id: String,
position_ticks: i64,
is_paused: bool,
play_session_id: Option<String>,
) -> Result<(), String>
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
Sourcepub async fn play_on_session(
&self,
session_id: String,
item_ids: Vec<String>,
start_index: usize,
start_position_ticks: Option<i64>,
) -> Result<(), String>
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)
Sourcepub async fn send_session_command(
&self,
session_id: String,
command: &str,
) -> Result<(), String>
pub async fn send_session_command( &self, session_id: String, command: &str, ) -> Result<(), String>
Send a playback command to a remote session
Sourcepub async fn session_seek(
&self,
session_id: String,
position_ticks: i64,
) -> Result<(), String>
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.
Sourceasync fn send_general_command(
&self,
session_id: &str,
command_name: &str,
arguments: Option<Value>,
) -> Result<(), String>
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).
Sourcepub async fn session_set_volume(
&self,
session_id: String,
volume: i32,
) -> Result<(), String>
pub async fn session_set_volume( &self, session_id: String, volume: i32, ) -> Result<(), String>
Set volume on a remote session
Sourcepub async fn session_toggle_mute(
&self,
session_id: String,
) -> Result<(), String>
pub async fn session_toggle_mute( &self, session_id: String, ) -> Result<(), String>
Toggle mute on a remote session
Sourcepub async fn get_sessions(&self) -> Result<Vec<SessionInfo>, String>
pub async fn get_sessions(&self) -> Result<Vec<SessionInfo>, String>
Get all active sessions
Sourcepub async fn get_session(
&self,
session_id: &str,
) -> Result<Option<SessionInfo>, String>
pub async fn get_session( &self, session_id: &str, ) -> Result<Option<SessionInfo>, String>
Get a specific session by ID
Sourcepub async fn lms_get_sync_groups(&self) -> Result<Vec<LmsSyncGroup>, String>
pub async fn lms_get_sync_groups(&self) -> Result<Vec<LmsSyncGroup>, String>
List current LMS sync groups.
Sourcepub async fn lms_create_sync_group(
&self,
master_mac: &str,
slave_macs: Vec<String>,
) -> Result<(), String>
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.
Sourcepub async fn lms_unsync_player(&self, mac: &str) -> Result<(), String>
pub async fn lms_unsync_player(&self, mac: &str) -> Result<(), String>
Remove a single LMS player from whatever sync group it’s in.
Trait Implementations§
Source§impl Clone for JellyfinClient
impl Clone for JellyfinClient
Source§fn clone(&self) -> JellyfinClient
fn clone(&self) -> JellyfinClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more