Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

4.8 KB
Raw Blame
#[derive(Debug, Clone)]
pub enum Action {
    FocusChange,
    Tick,
    Key(crossterm::event::KeyEvent),
    MouseClick(u16, u16),
    Quit,
    GoBack,
    SelectLanguage(usize),
    Resize(u16, u16),
    ToggleHelp,
    SwitchToTvMode,
    SwitchToStreamingMode,
    SwitchProvider(crate::providers::models::ProviderKind),
    ShowTvConfig,
    TvChannelsLoaded(Vec<crate::providers::tv::Channel>, usize),
    TvPlaylistAdd(String),
    TvPlaylistRemove(usize),
    TvReloadPlaylists,
    TvInputToggle(bool),
    ShowAddonManager,
    AddonAddManifest(String),
    AddonToggleEnabled(usize),
    AddonRemove(usize),
    AddonInputToggle(bool),
    Search {
        query: String,
        force_refresh: bool,
    },
    SelectSuggestion {
        query: String,
    },
    SearchSuccess {
        context: crate::providers::models::RequestContext,
        request_id: u64,
        query: String,
        page: usize,
        items: Vec<crate::providers::models::CatalogItem>,
    },
    SearchFailure(crate::providers::models::RequestContext, u64, usize, String),
    FetchHomepage {
        tab_id: String,
        page: usize,
    },
    HomepageSuccess {
        request_id: u64,
        tab_id: String,
        page: usize,
        items: Vec<crate::providers::models::CatalogItem>,
        metrics: std::collections::HashMap<String, crate::models::BrowseMetrics>,
    },
    HomepageFailure(u64, String),
    Suggest(String),
    SuggestSuccess(u64, String, Vec<String>),
    MoveUp,
    MoveDown,
    MoveLeft,
    MoveRight,
    WheelScroll {
        up: bool,
    },
    Submit,
    TabPane,
    BackTabPane,
    FetchPreview(String),
    PreviewSuccess(u64, String, Box<crate::providers::models::MediaDetails>),
    PreviewFailure(u64, String),
    PlayStream,
    ShowSubtitlePopup(String, Vec<crate::providers::models::SubtitleOption>),
    ShowDownloadSubtitlePopup(Vec<crate::providers::models::SubtitleOption>),
    ToggleThemePopup,
    SelectTheme(String),
    ToggleSettingsPopup,
    SelectSettingsCategory(crate::tui::state::SettingsCategory),
    SettingsAdjustValue(bool),
    SettingsActivateRow,
    SettingsResetDownloadDir,
    ShowBrowseMenu,
    SelectBrowse(crate::tui::state::BrowsePreset),
    SelectAddonCatalog(crate::providers::addons::models::AddonCatalogTarget),
    DownloadStream(Option<String>),
    StartDownload(
        Option<String>,
        Option<String>,
        Vec<(String, String)>,
        Option<u64>,
    ),
    UpdateDownload(Option<f64>, Option<String>),
    DownloadCompleted(String),
    DownloadFailed(String),
    DownloadPaused(String),
    ClearDownload,
    CancelDownload,
    DownloadEpisode,
    DownloadSeason,
    ProcessDownloadQueue,
    FetchDetails(String, bool),
    DetailsSuccess(
        crate::providers::models::RequestContext,
        u64,
        String,
        Box<crate::providers::models::MediaDetails>,
    ),
    DetailsFailure(crate::providers::models::RequestContext, u64, String),
    InitStreamPool(String),
    StreamPoolInitialized(String, Vec<u32>),
    FetchEpisodeStreams {
        subject_id: String,
        season: usize,
        episode: usize,
        force_refresh: bool,
    },
    EpisodeStreamsReady(
        crate::providers::models::RequestContext,
        u64,
        String,
        usize,
        usize,
        Vec<crate::providers::models::Release>,
    ),
    EpisodeStreamsFailed(
        crate::providers::models::RequestContext,
        u64,
        String,
        usize,
        usize,
        String,
    ),
    PosterSuccess(String, std::sync::Arc<image::DynamicImage>),
    SearchPosterLoaded(String, Option<std::sync::Arc<image::DynamicImage>>),
    UpdateAvailable(Result<Option<crate::updater::Release>, String>),
    CheckForUpdates,
    StartSelfUpdate,
    SelfUpdateProgress(String),
    SelfUpdateComplete(Result<crate::updater::SelfUpdateOutcome, String>),
    SetStatus(String),
    Refresh,
    ClearCache,
    CacheCleared(Result<(), String>),
    LaunchPlayback(
        crate::tui::state::PlayerKind,
        crate::providers::models::PlaybackSource,
    ),
    DispatchPlayback(crate::providers::models::PlaybackSource),
    MarkWatched(Box<crate::history::WatchHistoryItem>),
    UpdateProgress {
        item: Box<crate::history::WatchHistoryItem>,
        progress: u64,
        duration: Option<u64>,
        completed: bool,
    },
    ReconcileHistory,
    PlayerCrashed(Option<i32>, String),
    PlayerExited,
    ToggleFavorite,
    ShowFavorites,
    OpenFavorite(usize),
    OpenContinueWatching(usize),
    ToggleProvider(crate::providers::models::ProviderKind),
    CheckBdixNetwork,
    BdixProbeResult {
        circleftp: bool,
        dhakaflix: bool,
    },
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_action_enum_size_bounded() {
        let size = std::mem::size_of::<Action>();
        assert!(size <= 128, "Action size is {size} bytes, expected <= 128");
    }
}