Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd time remaining estimate and minor fixes #56
Merged
+448
−73
Conversation
This comment has been minimized.
This comment has been minimized.
|
Note: the last 2 commits add VLC streaming and storing the results of a torrent download to the filesystem. Depends on PR to bittorrent-client. |
| var path = require('path') | ||
| var numeral = require('numeral') | ||
| var address = require('network-address') | ||
| var moment = require('moment') | ||
| var proc = require('child_process') |
This comment has been minimized.
This comment has been minimized.
| @@ -33,8 +32,12 @@ function usage () { | |||
| console.log('') | |||
| console.log(' -p, --port change the http port [default: 9000]') | |||
| console.log(' -l, --list list available files in torrent') | |||
| console.log(' -n, --no-quit do not quit peerflix on vlc exit') | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| client.add(torrentId, function (err, torrent) { | ||
| client.once('ready', function () { | ||
| client.server.once('error', function () { | ||
| client.server.listen(0) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
transitive-bullshit
May 18, 2014
Author
Member
I took it from peerflix; my assumption was that once the http server hits an error, it would close the server by telling it to listen on 0, but I'm not 100% sure that's the actual effect tbh.
This comment has been minimized.
This comment has been minimized.
|
|
||
| inherits(WebTorrent, Client) | ||
|
|
||
| function WebTorrent (opts) { | ||
| var self = this | ||
| opts = opts || {} | ||
| if (opts.blocklist) opts.blocklist = parseBlocklist(opts.blocklist) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -74,14 +89,94 @@ WebTorrent.prototype._onTorrent = function (torrent) { | |||
| var self = this | |||
|
|
|||
| // if no index specified, use largest file | |||
| // TODO: support torrent index selection correctly -- this doesn't work yet | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
| var pieceStart = index * pieceLength | ||
| var pieceEnd = pieceStart + piece.length | ||
|
|
||
| var from = (fileStart < pieceStart) ? 0 : fileStart - pieceStart |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
transitive-bullshit commentedMay 15, 2014
Also updating Webtorrent.add to match the opts update of Client.add for adding torrent-specific options.
Note: for this PR to be fully functional, it depends on my other PRs to bittorrent-client, bittorrent-tracker, bittorrent-swarm, and ut_metadata.