Skip to main content

suno_core/
lib.rs

1//! Core engine for rs-suno: library selection, sync reconciliation, and tagging.
2//!
3//! Runtime-agnostic and free of direct IO. Network access happens through the
4//! [`Http`] port, which a CLI adapter implements, so the engine stays testable
5//! in isolation.
6
7mod auth;
8mod backoff;
9mod client;
10mod clock;
11pub mod config;
12mod consts;
13pub mod desired;
14mod downloadable;
15mod error;
16mod executor;
17mod extras;
18mod ffmpeg;
19mod fs;
20mod graph;
21mod hash;
22mod http;
23mod limiter;
24mod lineage;
25mod lyrics;
26mod manifest;
27mod model;
28mod naming;
29mod orphans;
30pub mod reconcile;
31pub mod select;
32mod synced;
33mod tag;
34
35#[cfg(test)]
36mod testutil;
37
38#[cfg(test)]
39mod sync_chaos;
40
41pub use auth::{ClerkAuth, TOKEN_EXPIRY_WARN_DAYS, TokenExpiry, classify_token_expiry};
42pub use client::{BillingInfo, Playlist, Stem, SunoClient};
43pub use clock::Clock;
44pub use config::{
45    AccountConfig, AreaMode, AreasConfig, AudioFormat, Config, Defaults, EffectiveSettings,
46    FlagOverrides, SourceConfig, StemFormat, VideoCoverRetention,
47};
48pub use desired::{
49    ArtifactToggles, LIKED_PLAYLIST_ID, PlaylistInput, build_desired, build_playlist_desired,
50    clip_stems,
51};
52pub use downloadable::is_downloadable;
53pub use error::{Error, Result};
54pub use executor::{ExecOptions, ExecOutcome, Failure, Ports, RunStatus, execute};
55pub use extras::{
56    INDEX_SCHEMA_VERSION, M3u8Entry, render_clip_details, render_clip_lrc, render_clip_lyrics,
57    render_library_index, render_m3u8, render_synced_lrc,
58};
59pub use ffmpeg::{Ffmpeg, FfmpegError, FfmpegErrorKind, WebpEncodeSettings};
60pub use fs::{FileStat, Filesystem, FsError, FsErrorKind};
61pub use graph::{
62    AdoptDecision, AlbumArt, CacheEntry, LineageStore, Node, Owner, OwnerGate, PlaylistState,
63    StoredEdge, adopt_decision, owner_gate,
64};
65pub use hash::{
66    SYNCED_LRC_VERSION, art_hash, art_url_hash, content_hash, meta_hash, synced_lrc_source_hash,
67};
68pub use http::{Http, HttpRequest, HttpResponse, Method, TransportError};
69pub use lineage::{
70    Edge, EdgeRole, EdgeType, LineageContext, Resolution, ResolveOpts, ResolveStatus, RootInfo,
71    edge_type, immediate_parent, lineage_edges, resolve_roots,
72};
73pub use lyrics::{AlignedLine, AlignedLineWord, AlignedLyrics, AlignedWord};
74pub use manifest::{ArtifactState, Manifest, ManifestEntry, SyncedLyricsCheck};
75pub use model::{Clip, HistoryEntry};
76pub use naming::{
77    CharacterSet, DEFAULT_TEMPLATE, NamingConfig, NamingRequest, RenderedName, render_clip_name,
78    render_clip_names, sanitise_name, stem_file_path, stems_folder,
79};
80pub use orphans::untracked_audio;
81pub use reconcile::{
82    Action, AlbumDesired, ArtifactKind, Desired, DesiredArtifact, DesiredStem, LocalFile, Plan,
83    PlaylistDesired, SourceMode, SourceStatus, album_desired, area_fully_enumerated,
84    deletion_allowed, narrows_downloads, plan_album_artifacts, plan_playlist_artifacts,
85    playlist_authoritative, reconcile,
86};
87pub use synced::{
88    PendingCheck, SYNCED_LRC_RECHECK_SECS, apply_synced_lrc, preview_synced_lrc,
89    synced_lyrics_targets,
90};
91pub use tag::{TrackMetadata, tag_flac, tag_mp3};