Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pause/resume, refactored code, improved command line interface (and more) #515

Closed
wants to merge 31 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
53d6335
got tests for pause/resume to pass
whitef0x0 Nov 27, 2015
cd1d84c
added nice cli for seed quitting interface
whitef0x0 Nov 27, 2015
61d1afb
added resume/pause support for audio/video streaming
whitef0x0 Nov 27, 2015
c68d39d
got gracefulExit to stop hanging
whitef0x0 Nov 27, 2015
67c9c47
added disableSeeding option for torrent
whitef0x0 Nov 27, 2015
01a685a
added getBySearch method
whitef0x0 Nov 27, 2015
b003801
added documentation for getBySearch
whitef0x0 Nov 27, 2015
9f4768f
fixed cli for search
whitef0x0 Nov 27, 2015
9ceac78
added tests for addBySearch()
whitef0x0 Nov 27, 2015
2415418
got all tests to pass but one
whitef0x0 Nov 30, 2015
be0b718
got download /path/to/file cmd.js test to pass
whitef0x0 Dec 1, 2015
b1430c8
updated browser code
whitef0x0 Dec 2, 2015
3db0dad
fixed cmd
whitef0x0 Dec 2, 2015
488bcc9
updated minified build
whitef0x0 Dec 2, 2015
10f9cc2
added unit tests for torrent.js
whitef0x0 Dec 3, 2015
53ea5f1
added tests for appendTo
whitef0x0 Dec 4, 2015
af023ce
added .npmignore
whitef0x0 Dec 4, 2015
74382ee
got zuul tests to run
whitef0x0 Dec 4, 2015
341ed30
removed extraneous user stories
whitef0x0 Dec 4, 2015
428a9ac
added documentation for new methods to the README
whitef0x0 Dec 4, 2015
8752393
added test cli interface
whitef0x0 Dec 5, 2015
2737d3f
updated travis-ci build
whitef0x0 Dec 5, 2015
9067381
started travis-ci
whitef0x0 Dec 5, 2015
254eae0
fixed package.json and travis.yml; got travis-ci to pass
whitef0x0 Dec 5, 2015
7f03f39
added main property to bower.json
whitef0x0 Dec 5, 2015
cb9849c
added ignore to bower.json
whitef0x0 Dec 5, 2015
d82559d
removed search functionality
whitef0x0 Dec 5, 2015
7610325
removed bower
whitef0x0 Dec 5, 2015
4d44ccd
Create description.md
whitef0x0 Dec 11, 2015
9f56b0c
Update test.js
whitef0x0 Dec 11, 2015
82fffad
Added description of changes
whitef0x0 Dec 11, 2015
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

got zuul tests to run

  • Loading branch information
whitef0x0 committed Dec 4, 2015
commit 74382ee42130cc4f1e47357aa54bd471c43124dc
@@ -1,5 +1,4 @@
node_modules
webtorrent.debug.js
coverage
content
examples/npm-debug.log
@@ -59,46 +59,42 @@ function Torrent (torrentId, opts) {

this.client = opts.client

self.parsedTorrent = null
this.parsedTorrent = null

self.announce = opts.announce
self.urlList = opts.urlList
this.announce = opts.announce
this.urlList = opts.urlList

this.path = opts.path
this._store = opts.store || FSChunkStore

self.shouldSeed = opts.shouldSeed || true
this.shouldSeed = opts.shouldSeed || true

self.strategy = opts.strategy || 'sequential'
this.strategy = opts.strategy || 'sequential'

this._rechokeNumSlots = (opts.uploads === false || opts.uploads === 0)
? 0
: (+opts.uploads || 10)
self._rechokeOptimisticWire = null
self._rechokeOptimisticTime = 0
self._rechokeIntervalId = null

self.ready = false
self.paused = false
self.resumed = false
self.destroyed = false
self.metadata = null
self.store = null
self.numBlockedPeers = 0
self.files = null
self.done = false

self._amInterested = false
self._selections = []
self._critical = []
this._rechokeOptimisticWire = null
this._rechokeOptimisticTime = 0
this._rechokeIntervalId = null

this.ready = false
this.destroyed = false
this.metadata = null
this.store = null
this.numBlockedPeers = 0
this.files = null
this.done = false

this._amInterested = false
this._selections = []
this._critical = []

// for cleanup
this._servers = []

if (torrentId) {
self.torrentId = torrentId
self._onTorrentId(torrentId)
}
if (torrentId) this._onTorrentId(torrentId)
}

// Time remaining (in milliseconds)
@@ -25,8 +25,8 @@
"dependencies": {
"addr-to-ip-port": "^1.0.1",
"bitfield": "^1.0.2",
"bittorrent-dht": "^4.0.4",
"bittorrent-swarm": "^5.0.0",
"bittorrent-dht": "^5.0.0",
"bittorrent-swarm": "^6.0.0",
"choices": "^0.1.3",
"chunk-store-stream": "^2.0.0",
"clivas": "^0.2.0",
@@ -117,10 +117,10 @@
"size": "npm run build && cat webtorrent.min.js | gzip | wc -c",
"test-local": "standard && node ./bin/test.js",
"coverage": "istanbul cover -- tape test/*.js && istanbul-coveralls",
"coverage-local": "istanbul cover -- tape test/*.js && http-server coverage/client/report-html/ -p 6000 && echo 'Istanbul coverage report available at 127.0.0.1:6000'",
"test": "standard && node ./bin/test.js && coverage",
"test-browser": "zuul -- test/basic.js",
"test-browser-local": "zuul --local -- test/basic.js",
"test-node": "tape test/*.js",
"test-append": "zuul --local -- test/browser/append-to.js"
"test-browser": "zuul -- test/browser/*.js",
"test-browser-local": "zuul --local 4000 -- test/browser/*.js",
"test-node": "tape test/*.js"
}
}
@@ -1,13 +1,12 @@
var path = require('path')
var fs = require('fs')
var extend = require('xtend')
var parseTorrent = require('parse-torrent')
var test = require('tape')
var WebTorrent = require('../')

var leaves = fs.readFileSync(path.resolve(__dirname, 'torrents', 'leaves.torrent'))
var leaves = fs.readFileSync(__dirname + '/torrents/leaves.torrent')
var leavesTorrent = parseTorrent(leaves)
var leavesBook = fs.readFileSync(path.resolve(__dirname, 'content', 'Leaves of Grass by Walt Whitman.epub'))
var leavesBook = fs.readFileSync(__dirname + 'content/Leaves of Grass by Walt Whitman.epub')

var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80'

@@ -6,7 +6,7 @@ var AppendTo = require('../../lib/append-to')
var bigBuckFile = fs.readFileSync(__dirname + '/big-buck-bunny.mp4')

test('AppendTo should append and stream if file is video', function (t) {
t.plan(2)
t.plan(4)

//Start Seeding file
var client = new WebTorrent()
@@ -18,14 +18,14 @@ test('AppendTo should append and stream if file is video', function (t) {
console.log(file.name)
AppendTo(file, window.document.getElementsByTagName('body')[0], function (err, currElem) {
if(err) t.fail(err)

currElem.style.visibility = 'hidden'
console.log(currElem)

t.pass('appended video to html element')
t.equal(window.document.getElementsByName('video')[0], currElem)
t.equal(window.document.getElementsByName('video').length, 1)
t.equal(window.document.getElementsByTagName('video')[0], currElem)
t.equal(window.document.getElementsByTagName('video').length, 1)

t.equal(currElem.nodeName, "VIDEO")
t.equal(currElem.nodeName, 'VIDEO')
})
})
})

Large diffs are not rendered by default.

You are viewing a condensed version of this merge commit. You can view the full changes here.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.