Skip to content

Commit

Permalink
Fixed #199
Browse files Browse the repository at this point in the history
  • Loading branch information
izu-co committed Dec 22, 2021
1 parent 0824d48 commit 546550b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions funi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,27 +585,29 @@ async function downloadStreams(epsiode: FunimationMediaDownload){
}


argv.q = argv.q < 1 || argv.q > plMaxLayer ? plMaxLayer : argv.q;

const plSelectedServer = plServerList[argv.x-1];
const plSelectedList = plStreams[plSelectedServer];
const videoUrl = argv.x < plServerList.length+1 && plSelectedList[argv.q] ? plSelectedList[argv.q] : '';

plLayersStr.sort();
console.log(`[INFO] Servers available:\n\t${plServerList.join('\n\t')}`);
console.log(`[INFO] Available qualities:\n\t${plLayersStr.join('\n\t')}`);


const selectedQuality = argv.q === 0 || argv.q > Object.keys(plLayersRes).length
? Object.keys(plLayersRes).pop() as string
: argv.q;
const videoUrl = argv.x < plServerList.length+1 && plSelectedList[selectedQuality] ? plSelectedList[selectedQuality] : '';

if(videoUrl != ''){
console.log(`[INFO] Selected layer: ${argv.q} (${plLayersRes[argv.q].width}x${plLayersRes[argv.q].height}) @ ${plSelectedServer}`);
console.log(`[INFO] Selected layer: ${selectedQuality} (${plLayersRes[selectedQuality].width}x${plLayersRes[selectedQuality].height}) @ ${plSelectedServer}`);
console.log('[INFO] Stream URL:',videoUrl);

fnOutput = parseFileName(argv.fileName, ([
['episode', isNaN(parseInt(fnEpNum as string)) ? fnEpNum : parseInt(fnEpNum as string)],
['title', epsiode.title],
['showTitle', epsiode.showTitle],
['season', season],
['width', plLayersRes[argv.q].width],
['height', plLayersRes[argv.q].height],
['width', plLayersRes[selectedQuality].width],
['height', plLayersRes[selectedQuality].height],
['service', 'Funimation']
] as [appYargs.AvailableFilenameVars, string|number][]).map((a): Variable => {
return {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "multi-downloader-nx",
"short_name": "aniDL",
"version": "2.0.13",
"version": "2.0.14",
"description": "Download videos from Funimation or Crunchyroll via cli",
"keywords": [
"download",
Expand Down

0 comments on commit 546550b

Please sign in to comment.