🆕 pathMappings -> rewrites

This commit is contained in:
steelbrain
2024-02-15 07:17:48 +02:00
parent 957dc6072d
commit 563ba9f3f5
3 changed files with 8 additions and 6 deletions

View File

@@ -17,7 +17,7 @@ The server and the client are both configured using JSONC (JSON with comments) c
of these files can be flexible. To identify which paths are being used, you can invoke either with `--debug-print-search-paths`.
Template/example configuration files are provided in this repository for your convinience. Unless the server and the client
share the same filesystem, you may have to specify `pathMappings` in the server configuration file.
share the same filesystem, you may have to specify `rewrites` in the server configuration file.
## Usage

View File

@@ -19,7 +19,7 @@ const configSchemaServer = z
listenPort: z.number(),
authSecret: z.string().min(15).max(100),
ffmpegPath: z.string(),
pathMappings: z.array(z.tuple([z.string(), z.string()])),
rewrites: z.array(z.tuple([z.string(), z.string()])),
})
.strict()
@@ -100,7 +100,7 @@ export function rewriteArgsInServer(
): string[] {
return args.slice().map(item => {
let arg = item
for (const [from, to] of config.pathMappings) {
for (const [from, to] of config.rewrites) {
arg = arg.replace(from, to)
}
return arg

View File

@@ -22,10 +22,12 @@
"ffmpegPath": "/usr/bin/ffmpeg", // type: string
// ^ For windows, you may have to use slash twice because of how strings in JSON work, so C:\Windows would be "C:\\Windows" etc
"pathMappings": [
"rewrites": [
["/data/movies/", "M:\\movies\\"],
["/data/tv/", "M:\\tv\\"],
["/config/data/transcodes/", "N:\\transcodes\\"]
// ^ VERY IMPORTANT! BOTH input and output MUST have trailing slashes
["/config/data/transcodes/", "N:\\transcodes\\"],
// ^ VERY IMPORTANT! For path rewrites BOTH input and output MUST have trailing slashes
// You can also use rewrites to map codecs, ie:
["libfdk_aac", "aac"]
]
}