update for flac metadata on iphone/rpi

This commit is contained in:
2026-05-17 12:29:13 -07:00
parent 38e825cf28
commit 7b0224a45a
4 changed files with 80 additions and 397 deletions
+25 -3
View File
@@ -156,22 +156,43 @@ function resolveRoot(options) {
}
if (process.platform === 'linux') {
fail('Could not find a Linux mpv-handler release. Download and extract the upstream archive, then pass --root /path/to/extracted/mpv-handler-linux-amd64.')
const archHint = process.arch === 'x64'
? 'Download and extract the upstream archive, then pass --root /path/to/extracted/mpv-handler-linux-amd64.'
: `The upstream project only publishes an official linux-amd64 archive. On ${process.arch}, build or obtain a compatible mpv-handler binary and pass --root /path/to/extracted/mpv-handler.`
fail(`Could not find a Linux mpv-handler release. ${archHint}`)
}
fail('Automatic setup is not available for this platform yet.')
}
function getLinuxConfigDir() {
const xdgConfigHome = process.env.XDG_CONFIG_HOME?.trim()
return xdgConfigHome
? path.join(xdgConfigHome, 'mpv-handler')
: path.join(os.homedir(), '.config', 'mpv-handler')
}
function getConfigPath(rootPath) {
if (process.platform === 'linux') {
return path.join(getLinuxConfigDir(), 'config.toml')
}
return path.join(rootPath, 'config.toml')
}
function ensureConfig(rootPath, options) {
const configPath = path.join(rootPath, 'config.toml')
const configPath = getConfigPath(rootPath)
if (options.skipConfig) {
return { configPath, changed: false, mpvPath: '', ytdlPath: '' }
}
const configExists = existsSync(configPath)
const bundledConfigPath = path.join(rootPath, 'config.toml')
const content = configExists
? readFileSync(configPath, 'utf8')
: readFileSync(templateConfigPath, 'utf8')
: existsSync(bundledConfigPath)
? readFileSync(bundledConfigPath, 'utf8')
: readFileSync(templateConfigPath, 'utf8')
const detectedMpv = options.mpv || resolveOnPath(process.platform === 'win32' ? ['mpv.com', 'mpv.exe', 'mpv'] : ['mpv'])
const detectedYtdl = options.ytdl || resolveOnPath(process.platform === 'win32' ? ['yt-dlp.exe', 'yt-dlp'] : ['yt-dlp'])
@@ -192,6 +213,7 @@ function ensureConfig(rootPath, options) {
}
if (changed && !options.dryRun) {
mkdirSync(path.dirname(configPath), { recursive: true })
writeFileSync(configPath, nextContent, 'utf8')
}