Skip to main content

## SessionPollerManager

# Struct SessionPollerManager

Source

    pub struct SessionPollerManager {
        jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>,
        playback_mode_manager: Arc<PlaybackModeManager>,
        event_emitter: Arc<Mutex<Option<Arc<dyn PlayerEventEmitter>>>>,
        connectivity_reporter: Arc<Mutex<Option<ConnectivityReporter>>>,
        is_running: Arc<AtomicBool>,
        current_hint: Arc<RwLock<PollingHint>>,
        current_interval_ms: Arc<AtomicU64>,
        thread_handle: Arc<Mutex<Option<JoinHandle<()>>>>,
    }

Expand description

Manages background polling of Jellyfin sessions

## Fields§

§ `jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>` § `playback_mode_manager: Arc<PlaybackModeManager>` § `event_emitter: Arc<Mutex<Option<Arc<dyn PlayerEventEmitter>>>>` § `connectivity_reporter: Arc<Mutex<Option<ConnectivityReporter>>>`

Optional connectivity reporter. The session poller is the one piece of server traffic that runs continuously even when the user is idle (not browsing the library), so feeding its poll outcomes into the reporter is what lets the app detect going offline — and, crucially, recover when the server returns — without any user interaction. Repository traffic alone can’t do this because it only happens while browsing.

§ `is_running: Arc<AtomicBool>` § `current_hint: Arc<RwLock<PollingHint>>` § `current_interval_ms: Arc<AtomicU64>` § `thread_handle: Arc<Mutex<Option<JoinHandle<()>>>>`

## Implementations§

Source §

### impl SessionPollerManager

Source

#### pub fn new( jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>, playback_mode_manager: Arc<PlaybackModeManager>, ) -> Self

Create a new SessionPollerManager

Source

#### pub fn set_event_emitter(&self, emitter: Arc<dyn PlayerEventEmitter>)

Set event emitter for broadcasting session updates

Source

#### pub fn set_connectivity_reporter(&self, reporter: ConnectivityReporter)

Wire the connectivity reporter so each poll outcome updates reachability. A successful poll recovers the app to online instantly; sustained poll failures flip it offline (subject to the reporter’s debounce window).

Source

#### pub fn start(&self)

Start the background polling thread

Source

#### pub fn stop(&self)

Stop the polling thread

Source

#### pub fn set_polling_hint(&self, hint: PollingHint)

Set UI hint for polling frequency adjustment

Source

#### fn push_remote_lockscreen(sessions: &[SessionInfo], session_id: &str)

Push the remote session’s now-playing onto the Android lockscreen.

Looks up the active remote session by id and forwards its title/artist/ album, duration and position to the media notification. Silently does nothing if the session isn’t found or has no now-playing item (e.g. the remote stopped) - the next state change will refresh it.

Source

#### fn calculate_interval(mode: &PlaybackMode, hint: PollingHint) -> u64

Calculate polling interval based on mode and hint

Source

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

Manually trigger a poll (for frontend refresh button)

## Trait Implementations§

Source §

### impl Drop for SessionPollerManager

Source §

#### fn drop(&mut self)

Executes the destructor for this type. Read more
Source §

#### fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (`pin_ergonomics`)
Execute the destructor for this type, but different to `Drop::drop`, it requires `self` to be pinned. Read more

## Auto Trait Implementations§

§

### impl Freeze for SessionPollerManager

§

### impl !RefUnwindSafe for SessionPollerManager

§

### impl Send for SessionPollerManager

§

### impl Sync for SessionPollerManager

§

### impl Unpin for SessionPollerManager

§

### impl UnsafeUnpin for SessionPollerManager

§

### impl !UnwindSafe for SessionPollerManager

## 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> 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, 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