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
14pub use anikoto::{
15    AnikotoClient, AnikotoClientBuilder, provider_from_show_id,
16    requires_hls_relay as anikoto_requires_hls_relay,
17};
18pub use anikoto_cz::{
19    AnikotoCzClient, AnikotoCzClientBuilder, requires_hls_relay as anikoto_cz_requires_hls_relay,
20};
21
22/// Unified function to check if a stream requires HLS relay
23/// This checks both anikoto and anikoto_cz domains
24pub fn requires_hls_relay(stream: &StreamLink) -> bool {
25    anikoto_requires_hls_relay(stream) || anikoto_cz_requires_hls_relay(stream)
26}
27
28/// Force all streams through HLS relay regardless of host allowlist
29pub fn force_hls_relay(stream: &StreamLink) -> bool {
30    stream.hls
31}
32pub use download::{DownloadOptions, download_stream};
33pub use error::{AniError, ErrorCode, ErrorReport, ErrorVerbosity, Result};
34pub use history::{HistoryEntry, HistoryStore};
35pub use hls_relay::{HlsRelay, relay_stream, relay_stream_without_hls_subtitles};
36pub use i18n::{I18n, Locale};
37pub use models::{
38    CatalogProvider, RequestHeaders, SearchOptions, SearchResult, SearchSort, StreamLink,
39    SubtitleTrack, TranslationType, choose_quality, expand_episode_selection,
40};
41pub use player::{Player, PlayerKind, PlayerOptions};