1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-17 05:22:18 +00:00

Breaking changes in CLI params

This commit is contained in:
snobu
2020-04-16 19:47:30 +03:00
parent 176fa6e214
commit c11c9b6334
6 changed files with 36 additions and 30 deletions

View File

@@ -23,6 +23,10 @@
"semi": [2, "always"], "semi": [2, "always"],
"no-unused-vars": "off", "no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-unused-vars": "error",
"quotes": [2, "single", { "avoidEscape": true }] "quotes": [2, "single", { "avoidEscape": true }],
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "return" }
]
} }
} }

View File

@@ -85,21 +85,33 @@ Options:
[boolean] [default: false] [boolean] [default: false]
``` ```
Make sure you use the right escape char for your shell if using line breaks (as this example shows). Make sure you use the right escape char for your shell if using line breaks.
For PowerShell your escape char is the backtick (`) instead of backslash (\\), for cmd.exe use caret (^). Bash —
```bash
``` ./destreamer.sh --username username@example.com --outputDirectory "videos" \
$ node destreamer.js --username username@example.com --outputDirectory "videos" \
--videoUrls "https://web.microsoftstream.com/video/VIDEO-1" \ --videoUrls "https://web.microsoftstream.com/video/VIDEO-1" \
"https://web.microsoftstream.com/video/VIDEO-2" \ "https://web.microsoftstream.com/video/VIDEO-2"
"https://web.microsoftstream.com/video/VIDEO-3" ```
PowerShell —
```powershell
.\destreamer.ps1 --username username@example.com --outputDirectory "videos" `
--videoUrls "https://web.microsoftstream.com/video/VIDEO-1" `
"https://web.microsoftstream.com/video/VIDEO-2"
```
cmd.exe —
```cmd
destreamer --username username@example.com --outputDirectory "videos" ^
--videoUrls "https://web.microsoftstream.com/video/VIDEO-1" ^
"https://web.microsoftstream.com/video/VIDEO-2"
``` ```
You can create a `.txt` file containing your video URLs, one video per line. The text file can have any name, followed by the `.txt` extension. Run destreamer as follows: You can create a `.txt` file containing your video URLs, one video per line. The text file can have any name, followed by the `.txt` extension. Run destreamer as follows:
``` ```
$ node destreamer.js --username username@example.com --outputDirectory "videos" \ ./destreamer.sh --username username@example.com --outputDirectory "videos" \
--videoUrls list.txt --videoUrlsFile list.txt
``` ```
Passing `--username` is optional. It's there to make logging in faster (the username field will be populated automatically on the login form). Passing `--username` is optional. It's there to make logging in faster (the username field will be populated automatically on the login form).
@@ -108,7 +120,6 @@ You can use an absolute path for `--outputDirectory`, for example `/mnt/videos`.
## RANDOM NOTE ## RANDOM NOTE
## IMPORTANT NOTE
Just ignore this error, we already have what we need to start the download, no time to deal with collaterals - Just ignore this error, we already have what we need to start the download, no time to deal with collaterals -
![image](https://user-images.githubusercontent.com/6472374/77905069-4c585000-728e-11ea-914e-26f1ce5e595b.png) ![image](https://user-images.githubusercontent.com/6472374/77905069-4c585000-728e-11ea-914e-26f1ce5e595b.png)

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "destreamer", "name": "destreamer",
"version": "1.0.0", "version": "2.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -4,14 +4,13 @@
"type": "git", "type": "git",
"url": "git://github.com/snobu/destreamer.git" "url": "git://github.com/snobu/destreamer.git"
}, },
"version": "1.0.0", "version": "2.0.0",
"description": "Save Microsoft Stream videos for offline enjoyment.", "description": "Save Microsoft Stream videos for offline enjoyment.",
"main": "build/src/destreamer.js", "main": "build/src/destreamer.js",
"bin": "build/src/destreamer.js", "bin": "build/src/destreamer.js",
"scripts": { "scripts": {
"build": "echo Transpiling TypeScript to JavaScript... & node node_modules/typescript/bin/tsc --listEmittedFiles", "build": "echo Transpiling TypeScript to JavaScript... & node node_modules/typescript/bin/tsc --listEmittedFiles",
"run": "node ./build/src/destreamer.js", "start": "node ./build/src/destreamer.js process.argv",
"start": "npm run -s build & npm run -s run",
"test": "mocha build/test" "test": "mocha build/test"
}, },
"keywords": [], "keywords": [],

View File

@@ -5,51 +5,43 @@ import colors from 'colors';
import fs from 'fs'; import fs from 'fs';
export const argv = yargs.options({ export const argv = yargs.options({
videoUrls: { url: {
alias: 'V',
describe: 'List of video urls', describe: 'List of video urls',
type: 'array', type: 'array',
demandOption: false demandOption: false
}, },
videoUrlsFile: { 'from-file': {
alias: 'F',
describe: 'Path to txt file containing the urls', describe: 'Path to txt file containing the urls',
type: 'string', type: 'string',
demandOption: false demandOption: false
}, },
username: { username: {
alias: 'u',
type: 'string', type: 'string',
demandOption: false demandOption: false
}, },
outputDirectory: { outdir: {
alias: 'o',
describe: 'The directory where destreamer will save your downloads [default: videos]', describe: 'The directory where destreamer will save your downloads [default: videos]',
type: 'string', type: 'string',
demandOption: false demandOption: false
}, },
outputDirectories: { 'out-dirs-from-file': {
alias: 'O',
describe: 'Path to a txt file containing one output directory per video', describe: 'Path to a txt file containing one output directory per video',
type: 'string', type: 'string',
demandOption: false demandOption: false
}, },
noThumbnails: { 'no-experiments': {
alias: 'nthumb', describe: `Disable experimental features (do not display video thumbnails)`,
describe: `Do not display video thumbnails`,
type: 'boolean', type: 'boolean',
default: false, default: false,
demandOption: false demandOption: false
}, },
simulate: { simulate: {
alias: 's',
describe: `Disable video download and print metadata information to the console`, describe: `Disable video download and print metadata information to the console`,
type: 'boolean', type: 'boolean',
default: false, default: false,
demandOption: false demandOption: false
}, },
verbose: { verbose: {
alias: 'v',
describe: `Print additional information to the console (use this before opening an issue on GitHub)`, describe: `Print additional information to the console (use this before opening an issue on GitHub)`,
type: 'boolean', type: 'boolean',
default: false, default: false,

View File

@@ -60,6 +60,6 @@ export async function getVideoMetadata(videoGuids: string[], session: Session, v
posterImage: posterImage posterImage: posterImage
}); });
})); }));
return metadata; return metadata;
} }