Skip to content

Split any YouTube song into stems

TypeScript

setup: consumer-friendly first run - no python/ffmpeg/pip jargon in UI

Daniel Ravina275c40adbcd9
diff --git a/src/main/env.ts b/src/main/env.ts
index 2b4ab72..30429b0 100644
--- a/src/main/env.ts
+++ b/src/main/env.ts
@@ -360,9 +360,9 @@ export async function ensureRuntimePython(): Promise<boolean> {
if (existsSync(runtimePython())) return true
try {
const archive = runtimeArchivePath()
- sendEnvEvent('Downloading a private Python runtime (~35MB)')
- await downloadTo(runtimeDownloadUrl(), archive, 'python')
- sendEnvEvent('Unpacking python runtime')
+ sendEnvEvent('Downloading components (~35MB)')
+ await downloadTo(runtimeDownloadUrl(), archive, 'components')
+ sendEnvEvent('Unpacking components')
await extractArchive(archive, runtimeDir())
unlinkSync(archive)
if (!existsSync(runtimePython())) throw new Error('runtime python missing after extract')
@@ -373,7 +373,7 @@ export async function ensureRuntimePython(): Promise<boolean> {
return true
} catch (err) {
sendEnvEvent(
- `python runtime setup failed: ${err instanceof Error ? err.message : String(err)}`,
+ `Setup failed: ${err instanceof Error ? err.message : String(err)}`,
'error'
)
try {
@@ -403,7 +403,7 @@ export async function bootstrap(): Promise<boolean> {
const venv = venvDir()
const pip = venvPip()
- sendEnvEvent(`Creating virtual environment with ${state.python.path}`)
+ sendEnvEvent('Preparing workspace')
await new Promise<void>((resolve, reject) => {
const child = spawn(state.python.path as string, ['-m', 'venv', venv])
child.on('close', (code) =>
@@ -412,7 +412,6 @@ export async function bootstrap(): Promise<boolean> {
child.on('error', reject)
})
- sendEnvEvent('Upgrading pip')
await new Promise<void>((resolve, reject) => {
const child = spawn(pip, ['install', '-q', '-U', 'pip', 'wheel', 'setuptools'])
child.on('close', (code) =>
@@ -421,7 +420,8 @@ export async function bootstrap(): Promise<boolean> {
child.on('error', reject)
})
- sendEnvEvent('Installing demucs + torch (~2GB, one time only). Grab a coffee.')
+ sendEnvEvent('Downloading the separation engine (~2GB, one time) — grab a coffee')
+ let lastGeneric = 0
await new Promise<void>((resolve, reject) => {
const child = spawn(pip, [
'install',
@@ -440,9 +440,16 @@ export async function bootstrap(): Promise<boolean> {
buffer = lines.pop() ?? ''
for (const line of lines) {
const t = line.trim()
- if (t && !t.startsWith('Looking in') && !t.startsWith('Using cached')) {
- sendEnvEvent(t.length > 120 ? t.slice(0, 117) + '...' : t)
+ if (!t || /^(Looking in|Using cached)/.test(t)) continue
+ if (/^(Collecting|Downloading|Installing collected|Successfully installed)/i.test(t)) {
+ const now = Date.now()
+ if (now - lastGeneric > 8000) {
+ lastGeneric = now
+ sendEnvEvent('Still downloading — this happens only once')
+ }
+ continue
}
+ sendEnvEvent(t.length > 120 ? t.slice(0, 117) + '...' : t)
}
})
child.stderr?.on('data', (chunk: Buffer) => {
@@ -455,7 +462,6 @@ export async function bootstrap(): Promise<boolean> {
child.on('error', reject)
})
- sendEnvEvent('Installing yt-dlp challenge solver')
await new Promise<void>((resolve, reject) => {
const child = spawn(pip, ['install', '-q', 'yt-dlp-ejs'])
child.on('close', (code) =>
diff --git a/src/main/pipeline.ts b/src/main/pipeline.ts
index 19d21b5..74936bc 100644
--- a/src/main/pipeline.ts
+++ b/src/main/pipeline.ts
@@ -177,7 +177,7 @@ export async function startJob(
progress(job, 'convert', 0, 'Converting to WAV')
const ffmpeg = getStatus().ffmpeg.path
- if (!ffmpeg) bail('ffmpeg not found — install it with: brew install ffmpeg')
+ if (!ffmpeg) bail('Something went wrong with the built-in audio tools. Try reinstalling StemKit.')
await runProcess(job, ffmpeg as string, [
'-y',
'-i',
diff --git a/src/renderer/src/components/Setup.tsx b/src/renderer/src/components/Setup.tsx
index 2ad291a..8021725 100644
--- a/src/renderer/src/components/Setup.tsx
+++ b/src/renderer/src/components/Setup.tsx
@@ -15,19 +15,6 @@ export function Setup({ status, logs, onInstall }: Props): React.ReactElement {
logRef.current?.scrollTo({ top: logRef.current.scrollHeight })
}, [logs])
- const checks = [
- {
- ok: status.python.found,
- label: 'Python 3',
- detail: status.python.path ?? 'not installed — StemKit will fetch its own (~35MB)'
- },
- {
- ok: status.ffmpeg.found,
- label: 'ffmpeg',
- detail: status.ffmpeg.path ?? 'not found — bundled with StemKit'
- }
- ]
-
return (
<div className="h-full flex items-center justify-center px-8">
<div className="w-full max-w-lg rise-in">
@@ -36,35 +23,17 @@ export function Setup({ status, logs, onInstall }: Props): React.ReactElement {
<h1 className="text-xl font-bold tracking-tight">Welcome to StemKit</h1>
</div>
<p className="text-center text-white/45 text-sm mt-3 leading-relaxed">
- One-time setup fetches everything StemKit needs — its own Python if
- you don&apos;t have one, plus the separation engine.
+ One-time setup downloads the separation engine (~2 GB).
<br />
- Everything runs locally after that.
+ After that everything works offline, right on your machine.
</p>
- <div className="mt-7 space-y-2">
- {checks.map((c) => (
- <div key={c.label} className="glass rounded-xl px-4 py-3 flex items-center gap-3">
- <span
- className={`w-5 h-5 rounded-full flex items-center justify-center text-[11px] font-bold ${
- c.ok ? 'bg-emerald-400 text-black' : 'bg-white/10 text-white/40'
- }`}
- >
- {c.ok ? '✓' : '·'}
- </span>
- <span className="text-sm font-medium w-20">{c.label}</span>
- <span className="text-xs text-white/35 truncate font-mono">{c.detail}</span>
- </div>
- ))}
- </div>
-
{!status.bootstrapping && (
<button
onClick={onInstall}
- disabled={!status.ffmpeg.found}
- className="mt-6 w-full py-3.5 rounded-xl bg-white text-black font-semibold text-sm hover:bg-white/90 active:scale-[0.99] transition-all disabled:opacity-40 disabled:hover:bg-white"
+ className="mt-7 w-full py-3.5 rounded-xl bg-white text-black font-semibold text-sm hover:bg-white/90 active:scale-[0.99] transition-all"
>
- Install separation engine · ~2 GB, one time
+ Get started · ~2 GB, once
</button>
)}