Expand description
Core engine for rs-suno: library selection, sync reconciliation, and tagging.
Runtime-agnostic and free of direct IO. Network access happens through the
Http port, which a CLI adapter implements, so the engine stays testable
in isolation.
Re-exports§
pub use config::AccountConfig;pub use config::AudioFormat;pub use config::Config;pub use config::Defaults;pub use config::EffectiveSettings;pub use config::FlagOverrides;pub use config::SourceConfig;pub use reconcile::Action;pub use reconcile::AlbumDesired;pub use reconcile::ArtifactKind;pub use reconcile::Desired;pub use reconcile::DesiredArtifact;pub use reconcile::LocalFile;pub use reconcile::Plan;pub use reconcile::PlaylistDesired;pub use reconcile::SourceMode;pub use reconcile::SourceStatus;pub use reconcile::album_desired;pub use reconcile::deletion_allowed;pub use reconcile::plan_album_artifacts;pub use reconcile::plan_playlist_artifacts;pub use reconcile::reconcile;
Modules§
- config
- Configuration model and precedence resolution.
- reconcile
- The pure reconcile engine: it decides what to download, retag, rename, reformat, and delete.
- select
- Pure clip selection and filtering.
Structs§
- Album
Art - The reconciled folder-art state for one album (one stable root id).
- Artifact
State - The prior known state of one external sidecar artifact for a clip.
- Cache
Entry - A cached root resolution for one clip: the O(1) album lookup, kept monotonic.
- Clerk
Auth - Manages the Clerk cookie and the JWT lifecycle for one account.
- Clip
- One finished Suno track, flattened from the API’s nested response shape.
- Edge
- One parent link of a clip, for the later lineage graph store.
- Exec
Options - Tunables for one
executerun. - Exec
Outcome - The result of applying a
Plan: per-action counts and the failure list. - Failure
- One action that could not be applied, for the run summary and failure log.
- Ffmpeg
Error - An ffmpeg transcode failure, carrying a human-readable, secret-free reason.
- File
Stat - On-disk facts about one path, as probed by
Filesystem::metadata. - FsError
- A filesystem failure, carrying a human-readable, secret-free reason.
- History
Entry - One entry in a clip’s
historyorconcat_history, mirroring the API’s per-segment lineage record. Ids are stored verbatim (anym_prefix is left for the resolver to strip). - Http
Request - A request the engine wants an adapter to perform.
- Http
Response - The response an adapter returns to the engine.
- Lineage
Context - The resolved lineage of a single clip, threaded into naming, tagging, and change detection.
- Lineage
Store - The whole lineage graph, kept relational for a clean SQLite migration.
- M3u8
Entry - One ordered entry in an extended-M3U8 playlist.
- Manifest
- The full prior download state, keyed by clip id.
- Manifest
Entry - One manifest record: the prior known state of a single downloaded clip.
- Naming
Config - Naming
Request - Node
- One clip in the graph. Mirrors the fields lineage needs to survive a purge: enough to name and date the clip long after Suno deletes it.
- Playlist
- One of the account’s own playlists, as listed by
/api/playlist/me. - Playlist
State - The reconciled
.m3u8state for one playlist. - Ports
- The IO ports the executor drives, grouped so one value threads them through.
- Rendered
Name - Resolution
- The outcome of
resolve_roots: a root for every input clip, plus the ancestor clips fetched to bridge gaps. - Resolve
Opts - Tunables bounding how hard
resolve_rootsworks per call. - Root
Info - The resolved root ancestor of a clip.
- Stored
Edge - One parent link, keyed (for upsert) by
(child_id, parent_id, edge_type, role, ordinal). A flat row, not nested under its child, so it maps directly to alineage_edgestable. - Suno
Client - A client for the Suno library API, owning the account’s
ClerkAuth. - Track
Metadata - The metadata tags written into a downloaded audio file.
- Transport
Error - A failure to complete a request at the transport level.
- Webp
Encode Settings - Encoder settings for the animated WebP cover derived from a clip’s MP4 preview.
Enums§
- Character
Set - Edge
Role - Whether an
Edgeis the clip’s primary parent or a supporting one. - Edge
Type - How one clip relates to its immediate parent.
- Error
- An error raised by the engine.
- Method
- The HTTP method for a request. Clerk and Suno only need these two.
- Resolve
Status - The outcome of resolving a clip’s root ancestor.
- RunStatus
- How an
executerun ended.
Constants§
- DEFAULT_
TEMPLATE - The default relative path template.
Traits§
- Clock
- The delay port the executor waits through.
- Ffmpeg
- The ffmpeg port the executor transcodes through.
- Filesystem
- The disk port the executor writes the plan through.
- Http
- The HTTP port an adapter implements for the engine.
Functions§
- art_
hash - A sentinel for the embedded cover art: a digest of the selected art URL, or the empty string when the clip carries no art. A mismatch against the manifest means the file on disk holds stale art even if its tags are current.
- art_
url_ hash - A stable digest of an artifact source URL (FNV-1a), or the empty string when
urlis empty. - content_
hash - A stable sentinel over an arbitrary generated text artefact.
- edge_
type - Classify a clip’s relationship to its parent, purely from its structure.
- execute
- Apply
planto disk, updatingmanifestandalbumsin place, and return the outcome. - immediate_
parent - The clip’s primary parent id and the edge that links them.
- lineage_
edges - Every parent link of a clip: the primary parent plus any secondaries.
- meta_
hash - A sentinel for the clip’s tag-bearing metadata and chosen art.
- render_
clip_ name - render_
clip_ names - render_
m3u8 - Render an extended-M3U8 playlist named
namefromentries, preserving their order. - resolve_
roots - Resolve the root ancestor of every clip in
clips. - sanitise_
name - Sanitise a free-form playlist name into a single safe path component.
- tag_
flac - Tag
audio(a FLAC byte stream) withmeta, returning the tagged bytes. - tag_mp3
- Tag
audio(an MP3 byte stream) withmeta, returning the tagged bytes.