Aurora SpotiRip desktop and web app
- Spotify playlist, library, album and artist browsing with in-app playback - Song, playlist and album downloads via spotdl with YouTube and Bandcamp fallbacks - Electron desktop app (castLabs Widevine) with a permanent sidebar layout - Linux and Windows packaging scripts
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { app } from "electron";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { PORT } from "./constants";
|
||||
|
||||
app.setName("Aurora SpotiRip");
|
||||
|
||||
export const ENV_FILE = join(app.getPath("userData"), "env.json");
|
||||
|
||||
for (const file of [ENV_FILE, join(app.getAppPath(), "env.json")]) {
|
||||
if (!existsSync(file)) continue;
|
||||
const values = JSON.parse(readFileSync(file, "utf8")) as Record<string, string>;
|
||||
for (const [key, value] of Object.entries(values)) {
|
||||
if (process.env[key] === undefined) process.env[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
process.env.SPOTIRIP_DESKTOP = "1";
|
||||
process.env.SPOTIRIP_BASE_URL = `http://127.0.0.1:${PORT}`;
|
||||
process.env.SPOTIRIP_DOWNLOAD_USERS = "*";
|
||||
|
||||
const exe = process.platform === "win32" ? ".exe" : "";
|
||||
|
||||
if (app.isPackaged) {
|
||||
process.env.SPOTIRIP_DOWNLOADER_BIN = join(process.resourcesPath, "downloader", "spotify_downloader" + exe);
|
||||
process.env.SPOTIRIP_FFMPEG = join(process.resourcesPath, "ffmpeg", "ffmpeg" + exe);
|
||||
} else {
|
||||
process.env.SPOTIRIP_PYTHON ??=
|
||||
process.platform === "win32"
|
||||
? join(app.getAppPath(), "venv", "Scripts", "python.exe")
|
||||
: join(app.getAppPath(), "venv", "bin", "python");
|
||||
process.env.SPOTIRIP_DOWNLOADER ??= join(app.getAppPath(), "spotify_downloader.py");
|
||||
}
|
||||
Reference in New Issue
Block a user