Skip to content

Commit

Permalink
Add support for -n/--name to specify torrent name/output
Browse files Browse the repository at this point in the history
  • Loading branch information
canibanoglu committed Nov 23, 2019
1 parent 422290b commit e5f73f2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bin/mkt.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,27 @@ const sanitizedAnnounceUURL = CAN_TRACKER_ANNOUNCE_URL.endsWith("/")

INFO("Creating torrent...");
DEBUG(argv._);

const torrentFileName = `can_tracker_${path.basename(argv._[0])}.torrent`;
const verbose = argv.v || argv.verbose || false;
createTorrent({
const name = argv.n || argv.name;

const options = {
private: true,
announceUrls: [sanitizedAnnounceUURL],
webSeedUrls: [CAN_TRACKER_WEB_SEED_URL],
comment: "Created by can-tracker",
output: torrentFileName,
sourcePath: argv._[0],
verbose
}).then(() => {
};

if (name) {
options.name = name;
options.output = `can_tracker_${name}.torrent`;
}

createTorrent(options).then(() => {
const filePath = path.join(process.cwd(), torrentFileName);
DEBUG("torrent path:", filePath);
const parsedTorrent = parseTorrent(readFileSync(filePath));
Expand Down

0 comments on commit e5f73f2

Please sign in to comment.