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
7#![forbid(unsafe_code)]
8
9mod album_art;
10mod area;
11mod auth;
12mod backoff;
13mod civil;
14mod client;
15mod clock;
16pub mod config;
17mod consts;
18pub mod desired;
19mod downloadable;
20mod error;
21mod executor;
22mod extras;
23mod ffmpeg;
24mod fs;
25mod graph;
26mod hash;
27mod http;
28mod identity;
29mod limiter;
30mod lineage;
31mod lyrics;
32mod manifest;
33mod model;
34mod naming;
35mod orphans;
36mod pathkey;
37pub mod reconcile;
38mod roots;
39pub mod select;
40mod synced;
41mod tag;
42mod tag_alac;
43mod textfmt;
44mod tracks;
45mod vocab;
46mod wire;
47
48#[cfg(test)]
49mod testutil;
50
51#[cfg(test)]
52mod sync_chaos;
53
54pub use album_art::{AlbumArt, PlaylistState};
55pub use area::{
56    AreaKind, AreaListing, adoption_enumerated, area_enumerated, area_mode, build_modes_by_id,
57    build_scoped_playlist_desired, library_authoritative, playlists_enumerated, source_statuses,
58    union_clips,
59};
60pub use auth::{ClerkAuth, TOKEN_EXPIRY_WARN_DAYS, TokenExpiry, classify_token_expiry};
61pub use civil::days_to_civil;
62pub use client::SunoClient;
63pub use clock::Clock;
64#[cfg(feature = "schema")]
65pub use config::config_schema_json;
66pub use config::{
67    AccountConfig, AreaMode, AreasConfig, Config, Defaults, EffectiveSettings, FlagOverrides,
68    Settings, SourceConfig,
69};
70pub use desired::{
71    ArtifactToggles, LIKED_PLAYLIST_ID, PlaylistInput, album_desired, build_desired,
72    build_playlist_desired, clip_stems,
73};
74pub use downloadable::is_downloadable;
75pub use error::{Error, Result};
76pub use executor::{ExecOptions, ExecOutcome, Failure, Ports, RunStatus, execute};
77pub use extras::{
78    INDEX_SCHEMA_VERSION, M3u8Entry, render_clip_details, render_library_index, render_m3u8,
79};
80pub use ffmpeg::{Ffmpeg, FfmpegError, FfmpegErrorKind};
81pub use fs::{FileStat, Filesystem, FsError, FsErrorKind};
82pub use graph::{CacheEntry, LineageStore, Node, StoredEdge};
83pub use hash::{
84    SYNCED_LRC_VERSION, art_hash, art_url_hash, content_hash, meta_hash, synced_lrc_source_hash,
85};
86pub use http::{Http, HttpRequest, HttpResponse, Method, TransportError};
87pub use identity::{AdoptDecision, Owner, OwnerGate, adopt_decision, owner_gate};
88pub use lineage::{
89    AttributionEdge, Edge, EdgeRole, EdgeType, LineageContext, Resolution, ResolveStatus, RootInfo,
90    attribution_edges, edge_type, immediate_parent, lineage_edges,
91};
92pub use lyrics::{
93    AlignedLine, AlignedLineWord, AlignedLyrics, AlignedWord, render_clip_lrc, render_clip_lyrics,
94    render_synced_lrc,
95};
96pub use manifest::{ArtifactState, Manifest, ManifestEntry, SyncedLyricsCheck};
97pub use model::{BillingInfo, Clip, ClipRoot, HistoryEntry, MediaUrl, Playlist, Stem};
98pub use naming::{
99    CharacterSet, DEFAULT_TEMPLATE, NamingConfig, NamingRequest, RenderedName, render_clip_name,
100    render_clip_names, sanitise_name, stem_file_path, stems_folder,
101};
102pub use orphans::untracked_audio;
103pub use reconcile::{
104    Action, AlbumDesired, Desired, DesiredArtifact, DesiredStem, LocalFile, Plan, PlaylistDesired,
105    SourceStatus, area_authoritative, area_fully_enumerated, deletion_allowed, narrows_downloads,
106    plan_album_artifacts, plan_playlist_artifacts, reconcile,
107};
108pub use roots::{ResolveOpts, resolve_roots};
109pub use synced::{
110    PendingCheck, SYNCED_LRC_RECHECK_SECS, apply_synced_lrc, preview_synced_lrc,
111    synced_lyrics_targets,
112};
113pub use tag::{Cover, TrackMetadata, flac_picture_data_budget, tag_flac, tag_mp3};
114pub use tag_alac::tag_alac;
115pub use tracks::{LeadResolution, TrackAssignment, assign_track_numbers, resolve_lead_ids};
116pub use vocab::{
117    ArtifactKind, AudioFormat, SourceMode, StemFormat, VideoCoverRetention, WebpEncodeSettings,
118};