{
 "use_case": "mix-cue-sheet",
 "title": "Find the songs in your mix: the Studio demo mix with its track files",
 "about": "A 6-minute mix of eight songs made with Decosa Studio's Make a song, joined with cuts, crossfades and bass-swap blends, plus the eight track files that were played. The run must place all eight songs in order, each within 6 s of where it really starts, write a chaptered .m4a and a timestamped tracklist, and end in a signed cue sheet that verifies and fails once edited. The same mix with its tracklist as titles only must also give eight songs in order.",
 "licence": "All audio is Decosa's own: eight songs generated with Make a song (ACE-Step 1.5, MIT licence; each cleared by the similarity check) and mixed by Decosa. It is served by the API itself (GET /cue/samples/demo-1/audio), so this bundle has no input files.",
 "inputs": [],
 "steps": [
  {
   "id": "mark",
   "method": "POST",
   "path": "/cue/mark",
   "timeout": 60,
   "body": {
    "sample": "demo-1-files",
    "stream": false
   }
  },
  {
   "id": "run",
   "method": "GET",
   "path": "/cue/runs/${mark.run_id}",
   "until": {
    "path": "status",
    "in": [
     "done",
     "failed"
    ]
   },
   "interval": 2,
   "max_wait": 120
  },
  {
   "id": "tracklist",
   "method": "GET",
   "path": "/cue/runs/${mark.run_id}/tracklist.txt",
   "as": "text"
  },
  {
   "id": "record",
   "method": "GET",
   "path": "/cue/runs/${mark.run_id}/record"
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "record"
    }
   }
  },
  {
   "id": "tampered",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "record"
    }
   },
   "tamper": {
    "at": "record.entries[2].text",
    "set": "Edited title"
   }
  },
  {
   "id": "titles",
   "method": "POST",
   "path": "/cue/mark",
   "timeout": 60,
   "body": {
    "sample": "demo-1",
    "stream": false
   }
  },
  {
   "id": "titles_run",
   "method": "GET",
   "path": "/cue/runs/${titles.run_id}",
   "until": {
    "path": "status",
    "in": [
     "done",
     "failed"
    ]
   },
   "interval": 2,
   "max_wait": 120
  }
 ],
 "checks": [
  {
   "says": "the run finishes",
   "path": "run.status",
   "equals": "done"
  },
  {
   "says": "eight songs are found",
   "path": "run.songs",
   "equals": 8
  },
  {
   "says": "the first song is Mirrorball Sunday at 0:00",
   "path": "run.markers[0].start",
   "min": 0,
   "max": 0.5
  },
  {
   "says": "Rapid Orchard starts near 0:36",
   "path": "run.markers[1].start",
   "min": 30.1,
   "max": 42.1
  },
  {
   "says": "the cut to Slap Happy is placed near 4:31",
   "path": "run.markers[6].start",
   "min": 265.4,
   "max": 277.4
  },
  {
   "says": "Chop Shop Groove starts near 5:17",
   "path": "run.markers[7].start",
   "min": 311.3,
   "max": 323.3
  },
  {
   "says": "every song was placed from its own track file",
   "path": "run.markers[source=own_refs]",
   "count_min": 8
  },
  {
   "says": "the mix and the track files were deleted when the run ended",
   "path": "run.inputs_deleted",
   "equals": true
  },
  {
   "says": "the tracklist starts with the first song at 0:00",
   "path": "tracklist",
   "contains": "0:00 Mirrorball Sunday"
  },
  {
   "says": "the signed cue sheet verifies",
   "path": "verify.ok",
   "equals": true
  },
  {
   "says": "an edited cue sheet fails",
   "path": "tampered.ok",
   "equals": false
  },
  {
   "says": "with titles only, eight songs are found in the tracklist's order",
   "path": "titles_run.songs",
   "equals": 8
  }
 ]
}