Skip to content
This repository has been archived by the owner on Apr 13, 2018. It is now read-only.

Commit

Permalink
make announce contain the full list of trackers
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Apr 5, 2014
1 parent 4970b4e commit 58be718
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ module.exports = function (torrent) {
if (torrent['creation date'])
result.created = new Date(torrent['creation date'] * 1000)

result.announce = (torrent['announce-list'] || [torrent.announce]).map(function (obj) {
return obj.toString().split(',')[0]
})
result.announceList = (torrent['announce-list'] || [[torrent.announce]]).map(function (urls) {
return urls.map(function (url) {
return url.toString()
})
})

result.announce = [].concat.apply([], result.announceList)

var files = torrent.info.files || [torrent.info]
result.files = files.map(function (file, i) {
var parts = [].concat(file.name || result.name, file.path || []).map(function (p) {
Expand Down
3 changes: 2 additions & 1 deletion test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ var leavesParsed = {
'udp://tracker.openbittorrent.com:80',
'udp://tracker.ccc.de:80',
'udp://tracker.publicbt.com:80',
'udp://fr33domtracker.h33t.com:3310/announce'
'udp://fr33domtracker.h33t.com:3310/announce',
'http://tracker.bittorrent.am/announce'
],
announceList: [
['http://tracker.thepiratebay.org/announce'],
Expand Down

0 comments on commit 58be718

Please sign in to comment.