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-flix@1.0.2/bin/flix.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/torrent-flix@1.0.2/bin/flix.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\n\nvar program = require('commander');\nvar chalk = require('chalk');\nvar Promise = require('bluebird');\nvar childProcess = require('child_process');\nvar cliTable = require('cli-table');\nvar inquirer = require('inquirer');\n\nprogram\n    .arguments('<name>')\n    .option('-l, --sub-lang <lang>', 'Subtitles language', /^(he|en)$/i, 'he')\n    .option('-p, --player <player>', 'The player to stream to (vlc, airplay, mplayer, mpc, webplay)', /^(vlc|airplay|mplayer|mpc|webplay)$/i, 'vlc')\n    .option('--port <port>', 'The port to use [8888]', parseInt, '8888')\n    .option('-v, --verbose', 'Show download stats')\n    .action(function (name, options) {\n        console.log(chalk.green(`Searching piratebay for: ${name}...`));\n\n        childProcess.exec(`node ./node_modules/torrent-query/bin/index.js \"${name}\" --piratebay --format json`,\n            (err, stdout) => {\n            if (err) return console.log(err);\n            var torrents = JSON.parse(stdout);\n\n            if (torrents.length === 0) return console.log(`no results`);\n\n            var table = new cliTable({\n                head: [ 'ID', 'Name', 'Size', 'Seeds', 'Leeches' ]\n            });\n            \n            torrents\n                .map((t, i) => [i, t.name, t.size, t.seeds, t.leeches])\n                .forEach(t => table.push(t));\n            \n            console.log(table.toString());\n\n            inquirer.prompt({\n                type: 'input',\n                name: 'torrentId',\n                message: 'Which torrent to play?'\n            }, function (answer) {\n                var torrent = torrents[Number(answer.torrentId)];\n                var verbose = options.verbose ? \"\" : \"--quite\";\n\n                console.log(chalk.green(`Playing \"${torrent.name}\"`));\n                console.log(chalk.cyan(`you may need to wait a few moments for the stream to start.`));\n                \n                childProcess.spawn(`node`, [ \n                        `./node_modules/peerflix/app.js`, \n                        `\"${torrent.magnet}\"`, \n                        `--${options.player}`, \n                        `${verbose}`, \n                        `--port ${options.port}`\n                ], options.verbose ? { stdio: 'inherit' } : {});\n            });\n\n        });\n    })\n    .parse(process.argv);\n"]}