Skip to main content

ani_lib/
lib.rs

1// src/lib.rs
2//! Reusable Anikoto clients and cross-platform ani-cli support modules.
3
4mod anikoto;
5mod anikoto_cz;
6mod download;
7mod error;
8mod history;
9mod hls_relay;
10mod i18n;
11mod models;
12mod player;
13
14#[cfg(feature = "gui")]
15pub mod gui;
16
17pub use anikoto::{
18    AnikotoClient, AnikotoClientBuilder, provider_from_show_id,
19    requires_hls_relay as anikoto_requires_hls_relay,
20};
21pub use anikoto_cz::{
22    AnikotoCzClient, AnikotoCzClientBuilder, requires_hls_relay as anikoto_cz_requires_hls_relay,
23};
24
25/// Unified function to check if a stream requires HLS relay
26/// This checks both anikoto and anikoto_cz domains
27pub fn requires_hls_relay(stream: &StreamLink) -> bool {
28    anikoto_requires_hls_relay(stream) || anikoto_cz_requires_hls_relay(stream)
29}
30
31/// Force all streams through HLS relay regardless of host allowlist
32pub fn force_hls_relay(stream: &StreamLink) -> bool {
33    stream.hls
34}
35pub use download::{DownloadOptions, download_stream};
36pub use error::{AniError, ErrorCode, ErrorReport, ErrorVerbosity, Result};
37pub use history::{HistoryEntry, HistoryStore};
38pub use hls_relay::{HlsRelay, relay_stream, relay_stream_without_hls_subtitles};
39pub use i18n::{I18n, Locale};
40pub use models::{
41    CatalogProvider, RequestHeaders, SearchOptions, SearchResult, SearchSort, StreamLink,
42    SubtitleTrack, TranslationType, choose_quality, expand_episode_selection,
43};
44pub use player::{Player, PlayerKind, PlayerOptions};