| 170 | |
| 171 | |
| 172 | def _write_metadata(job: Job, job_dir: Path) -> None: |
| 173 | meta = { |
| 174 | "title": job.title, |
| 175 | "thumbnail": job.thumbnail, |
| 176 | "duration_sec": job.duration_sec, |
| 177 | "bpm": job.bpm, |
| 178 | "key": job.key, |
| 179 | "scale": job.scale, |
| 180 | "key_confidence": job.key_confidence, |
| 181 | "lufs": job.lufs, |
| 182 | "peak_db": job.peak_db, |
| 183 | "dynamic_range": job.dynamic_range, |
| 184 | "tempo_stability": job.tempo_stability, |
| 185 | "stem_presence": job.stem_presence, |
| 186 | "tags": job.tags, |
| 187 | "has_video": job.has_video, |
| 188 | } |
| 189 | try: |
| 190 | (job_dir / "metadata.json").write_text(json.dumps(meta, indent=2) + "\n", encoding="utf-8") |
| 191 | except OSError: |
| 192 | logger.warning("could not write metadata.json for job %s", job.id, exc_info=True) |
| 193 | |
| 194 | |
| 195 | async def _run_async( |