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, animated_covers_flag_overridden,
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, lyrics_txt_source_hash, meta_hash,
85    synced_lrc_source_hash,
86};
87pub use http::{Http, HttpRequest, HttpResponse, Method, TransportError};
88pub use identity::{AdoptDecision, Owner, OwnerGate, adopt_decision, owner_gate};
89pub use lineage::{
90    AttributionEdge, Edge, EdgeRole, EdgeType, LineageContext, Resolution, ResolveStatus, RootInfo,
91    attribution_edges, edge_type, immediate_parent, lineage_edges,
92};
93pub use lyrics::{
94    AlignedLine, AlignedLineWord, AlignedLyrics, AlignedWord, render_clip_lrc, render_clip_lyrics,
95    render_synced_lrc,
96};
97pub use manifest::{ArtifactState, Manifest, ManifestEntry, SyncedLyricsCheck};
98pub use model::{BillingInfo, Clip, ClipRoot, HistoryEntry, MediaUrl, Playlist, Stem};
99pub use naming::{
100    CharacterSet, DEFAULT_TEMPLATE, NamingConfig, NamingRequest, RenderedName, render_clip_name,
101    render_clip_names, sanitise_name, stem_file_path, stems_folder,
102};
103pub use orphans::untracked_audio;
104pub use reconcile::{
105    Action, AlbumDesired, Desired, DesiredArtifact, DesiredStem, LocalFile, Plan, PlaylistDesired,
106    SourceStatus, area_authoritative, area_fully_enumerated, deletion_allowed, narrows_downloads,
107    plan_album_artifacts, plan_playlist_artifacts, reconcile,
108};
109pub use roots::{ResolveOpts, resolve_roots};
110pub use synced::{
111    PendingCheck, SYNCED_LRC_RECHECK_SECS, apply_synced_lrc, preview_synced_lrc,
112    synced_lyrics_targets,
113};
114pub use tag::{Cover, TrackMetadata, flac_picture_data_budget, tag_flac, tag_mp3};
115pub use tag_alac::tag_alac;
116pub use tracks::{LeadResolution, TrackAssignment, assign_track_numbers, resolve_lead_ids};
117pub use vocab::{
118    ArtifactKind, AudioFormat, SourceMode, StemFormat, VideoCoverRetention, WebpEncodeSettings,
119};