1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-24 08:52:18 +00:00

Merge branch 'master' of https://github.com/snobu/destreamer into aria2c_forRealNow

This commit is contained in:
Luca Armaroli
2020-10-11 21:52:20 +02:00
4 changed files with 97 additions and 23 deletions

View File

@@ -43,6 +43,11 @@ export class ApiClient {
});
}
/**
* Used to initialize/retrive the active ApiClient
*
* @param session used if initializing
*/
public static getInstance(session?: Session): ApiClient {
if (!ApiClient.instance) {
ApiClient.instance = new ApiClient(session);
@@ -51,6 +56,16 @@ export class ApiClient {
return ApiClient.instance;
}
public setSession(session: Session): void {
if (!ApiClient.instance) {
logger.warn("Trying to update ApiCient session when it's not initialized!");
}
this.session = session;
return;
}
/**
* Call Microsoft Stream API. Base URL is sourced from
* the session object and prepended automatically.

View File

@@ -13,12 +13,12 @@ export const argv: any = yargs.options({
username: {
alias: 'u',
type: 'string',
describe: 'The username used to log into Microsoft Stream (enabling this will fill in the email field for you)',
describe: 'The username used to log into Microsoft Stream (enabling this will fill in the email field for you).',
demandOption: false
},
videoUrls: {
alias: 'i',
describe: 'List of video urls',
describe: 'List of urls to videos or Microsoft Stream groups.',
type: 'array',
demandOption: false
},
@@ -30,7 +30,7 @@ export const argv: any = yargs.options({
},
outputDirectory: {
alias: 'o',
describe: 'The directory where destreamer will save your downloads',
describe: 'The directory where destreamer will save your downloads.',
type: 'string',
default: 'videos',
demandOption: false
@@ -44,28 +44,29 @@ export const argv: any = yargs.options({
},
keepLoginCookies: {
alias: 'k',
describe: 'Let Chromium cache identity provider cookies so you can use "Remember me" during login',
describe: 'Let Chromium cache identity provider cookies so you can use "Remember me" during login.\n' +
'Must be used every subsequent time you launch Destreamer if you want to log in automatically.',
type: 'boolean',
default: false,
demandOption: false
},
noExperiments: {
alias: 'x',
describe: 'Do not attempt to render video thumbnails in the console',
describe: 'Do not attempt to render video thumbnails in the console.',
type: 'boolean',
default: false,
demandOption: false
},
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',
default: false,
demandOption: false
},
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',
default: false,
demandOption: false
@@ -92,13 +93,13 @@ export const argv: any = yargs.options({
demandOption: false
},
format: {
describe: 'Output container format (mkv, mp4, mov, anything that FFmpeg supports)',
describe: 'Output container format (mkv, mp4, mov, anything that FFmpeg supports).',
type: 'string',
default: 'mkv',
demandOption: false
},
skip: {
describe: 'Skip download if file already exists',
describe: 'Skip download if file already exists.',
type: 'boolean',
default: false,
demandOption: false