diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2014-10-14 11:13:51 +0400 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2014-10-14 11:13:51 +0400 |
commit | 0eb35e63b71e72857637e1bc86e213aed0ff4175 (patch) | |
tree | 9c9f8353159b62a08c9f6ec90ebc61148194ad33 /index.js | |
parent | b02c8ba10883d961897719d53583637215607c92 (diff) |
Use --index to pick video file to stream (fix #150)
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 24 |
1 files changed, 0 insertions, 24 deletions
@@ -152,9 +152,6 @@ WebTorrent.prototype.download = function (torrentId, opts, ontorrent) { opts.client = self opts.storage = opts.storage || self.storage - // TODO: fix this to work with multiple torrents. this should probably be in cmd.js - self.index = opts.index - var torrent = new Torrent(torrentId, extend({ client: self }, opts)) self.torrents.push(torrent) @@ -178,7 +175,6 @@ WebTorrent.prototype.download = function (torrentId, opts, ontorrent) { // Emit 'torrent' when a torrent is ready to be used debug('torrent') self.emit('torrent', torrent) - self._onTorrent(torrent) }) return torrent @@ -280,23 +276,3 @@ WebTorrent.prototype.destroy = function (cb) { parallel(tasks, cb) } - -// TODO: this probably belongs in cmd.js -WebTorrent.prototype._onTorrent = function (torrent) { - var self = this - debug('on torrent') - - // if no index specified, use largest file - if (typeof torrent.index !== 'number') { - var largestFile = torrent.files.reduce(function (a, b) { - return a.length > b.length ? a : b - }) - torrent.index = torrent.files.indexOf(largestFile) - } - - torrent.files[torrent.index].select() - - // TODO: this won't work with multiple torrents - self.index = torrent.index - self.torrent = torrent -} |