Skip to content

Commit

Permalink
update for bittorrent-client changes
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Aug 18, 2014
1 parent 07de2f8 commit 81b8d93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var http = require('http')
var inherits = require('inherits')
var mime = require('mime')
var parallel = require('run-parallel')
var parseTorrent = require('parse-torrent')
var pump = require('pump')
var rangeParser = require('range-parser')
var url = require('url')
Expand Down Expand Up @@ -86,10 +87,11 @@ WebTorrent.prototype.add = function (torrentId, opts, ontorrent) {
})
}

if (Client.toInfoHash(torrentId)) {
var parsed = parseTorrent(torrentId)
if (parsed && parsed.infoHash) {
// magnet uri, info hash, torrent file, or parsed torrent can be handled by bittorrent-client
process.nextTick(function () {
onTorrentId(torrentId)
onTorrentId(parsed)
})
} else if (/^https?:/.test(torrentId)) {
// http or https url to torrent file
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"network-address": "0.0.4",
"numeral": "^1.5.3",
"once": "^1.3.0",
"parse-torrent": "^2.0.0",
"pump": "^0.3.2",
"random-access-file": "^0.3.1",
"range-parser": "^1.0.0",
Expand Down

0 comments on commit 81b8d93

Please sign in to comment.