MCPcopy
hub / github.com/stemdeckapp/stemdeck / _run_common

Function _run_common

app/pipeline/runner.py:122–157  ·  view source on GitHub ↗

Analyze → separate → collect → mix. Shared by both YouTube and local upload pipelines after their respective source acquisition steps.

(job: Job, source: Path, job_dir: Path)

Source from the content-addressed store, hash-verified

120
121
122def _run_common(job: Job, source: Path, job_dir: Path) -> None:
123 """Analyze → separate → collect → mix. Shared by both YouTube and local
124 upload pipelines after their respective source acquisition steps."""
125 _check_cancel(job)
126 analyze(job, source)
127 _check_cancel(job)
128 stems_root = separate(job, source, job_dir)
129 found = collect(job, stems_root, job_dir)
130 stems_dir = job_dir / "stems"
131 job.stem_presence = compute_stem_presence(stems_dir, found)
132 # Source (100-300 MB or the local upload) is no longer needed after
133 # collect; delete it before the ffmpeg amix steps in case scratch space
134 # is tight.
135 cleanup_source(job_dir)
136 job.stems = [{"name": name, "url": f"/api/jobs/{job.id}/stems/{name}.wav"} for name in found]
137 _check_cancel(job)
138 _set(job, stage="Mixing tracks...")
139 original_path = make_original_track(job, job_dir, stems_dir)
140 if original_path is not None:
141 job.stems.insert(
142 0,
143 {
144 "name": "original",
145 "url": f"/api/jobs/{job.id}/stems/original.wav",
146 },
147 )
148 _check_cancel(job)
149 mix_path = make_selected_mix(job, stems_dir, found)
150 if mix_path is not None:
151 job.mix_url = f"/api/jobs/{job.id}/stems/{mix_path.name}"
152 _check_cancel(job)
153
154 all_stem_names = [s["name"] for s in job.stems]
155 if mix_path is not None and mix_path.stem not in all_stem_names:
156 all_stem_names.append(mix_path.stem)
157 compute_stem_peaks(stems_dir, all_stem_names)
158
159
160def _run_blocking(job: Job, url: str, job_dir: Path) -> None:

Callers 2

_run_blockingFunction · 0.85
_run_local_blockingFunction · 0.85

Calls 10

analyzeFunction · 0.90
separateFunction · 0.90
collectFunction · 0.90
compute_stem_presenceFunction · 0.90
cleanup_sourceFunction · 0.90
_setFunction · 0.90
make_original_trackFunction · 0.90
make_selected_mixFunction · 0.90
compute_stem_peaksFunction · 0.90
_check_cancelFunction · 0.85

Tested by

no test coverage detected