podcast-dl 9.2.0 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/async.js +1 -1
- package/bin/commander.js +2 -1
- package/bin/util.js +17 -1
- package/bin/version.js +2 -0
- package/package.json +3 -2
package/bin/async.js
CHANGED
package/bin/commander.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AUDIO_ORDER_TYPES, ITEM_LIST_FORMATS } from "./util.js";
|
|
2
2
|
import { createParseNumber, hasFfmpeg } from "./validate.js";
|
|
3
3
|
import { logErrorAndExit } from "./logger.js";
|
|
4
|
+
import { version } from "./version.js";
|
|
4
5
|
|
|
5
6
|
export const setupCommander = (commander, argv) => {
|
|
6
7
|
commander
|
|
7
|
-
.version(
|
|
8
|
+
.version(version)
|
|
8
9
|
.option("--url <string>", "url to podcast rss feed")
|
|
9
10
|
.option(
|
|
10
11
|
"--out-dir <path>",
|
package/bin/util.js
CHANGED
|
@@ -10,6 +10,22 @@ import { getArchiveFilename, getItemFilename } from "./naming.js";
|
|
|
10
10
|
|
|
11
11
|
const execWithPromise = util.promisify(exec);
|
|
12
12
|
|
|
13
|
+
/*
|
|
14
|
+
Escape arguments for a shell command used with exec.
|
|
15
|
+
Borrowed from shell-escape: https://github.com/xxorax/node-shell-escape/
|
|
16
|
+
*/
|
|
17
|
+
const escapeArgForShell = (arg) => {
|
|
18
|
+
let result = arg;
|
|
19
|
+
if (/[^A-Za-z0-9_/:=-]/.test(result)) {
|
|
20
|
+
result = "'" + result.replace(/'/g, "'\\''") + "'";
|
|
21
|
+
result = result
|
|
22
|
+
.replace(/^(?:'')+/g, "") // unduplicate single-quote at the beginning
|
|
23
|
+
.replace(/\\'''/g, "\\'"); // remove non-escaped single-quote if there are enclosed between 2 escaped
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
|
|
13
29
|
const getTempPath = (path) => {
|
|
14
30
|
return `${path}.tmp`;
|
|
15
31
|
};
|
|
@@ -507,7 +523,7 @@ const runFfmpeg = async ({
|
|
|
507
523
|
const metadataString = Object.keys(metaKeysToValues)
|
|
508
524
|
.map((key) =>
|
|
509
525
|
metaKeysToValues[key]
|
|
510
|
-
? `-metadata ${key}
|
|
526
|
+
? `-metadata ${key}=${escapeArgForShell(metaKeysToValues[key])}`
|
|
511
527
|
: null
|
|
512
528
|
)
|
|
513
529
|
.filter((segment) => !!segment)
|
package/bin/version.js
ADDED
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podcast-dl",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.1",
|
|
4
4
|
"description": "A CLI for downloading podcasts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./bin/bin.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rimraf ./binaries && rimraf ./dist && node build.cjs",
|
|
9
|
-
"lint": "eslint ./bin"
|
|
9
|
+
"lint": "eslint ./bin",
|
|
10
|
+
"version:generate": "npx genversion --es6 --semi ./bin/version.js"
|
|
10
11
|
},
|
|
11
12
|
"lint-staged": {
|
|
12
13
|
"*.{js,json,md}": [
|