// A label's upload page: each master's tags filled in from the catalogue before release, the cover art set, and a stripped copy for the press.
//
//   quillo run audio_tags.qwe      then open http://localhost:8080/release

use "audio_tags.qwer"

let MASTER = "audio_tags_sample.mp3"

route GET /release {
    let before = audio_tags_read(MASTER)?
    let after = audio_tags_write(MASTER, "data/audio_tags/release.mp3", {
        title: "Morning Tone",
        artist: "The Quillos",
        album: "First Light",
        album_artist: "The Quillos",
        year: 2026,
        track: 3,
        track_total: 10,
        genre: "Ambient",
        composer: "Ana Lima",
        bpm: 96,
        comment: null,
    })?
    let covered = audio_tags_set_cover("data/audio_tags/release.mp3", "data/audio_tags/release.mp3", "audio_tags_sample.png")?
    {
        before: { title: before.title, artist: before.artist, tags: before.tags },
        after: after,
        cover: audio_tags_read(covered)?.pictures,
        press: audio_tags_strip(covered, "data/audio_tags/press.mp3")?,
        press_after: audio_tags_read("data/audio_tags/press.mp3")?.tags,
        unknown: audio_tags_write(MASTER, "data/audio_tags/x.mp3", { mood: "calm" }).error,
    }
}
