diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2014-02-26 12:03:15 +0400 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2014-02-26 12:03:15 +0400 |
commit | 948d2ce7f28093a5f8e91a6fc1572046028fff50 (patch) | |
tree | f7918cad9857bda8a189ceb8e2b7912e0ed024a0 | |
parent | 96c634df2339569232f07c147b3f2e9568e80040 (diff) |
torrent.title -> torrent.name (for consistency)
-rw-r--r-- | lib/app.js | 10 | ||||
-rw-r--r-- | lib/torrent.js | 12 | ||||
-rw-r--r-- | views/torrent.html | 2 |
3 files changed, 11 insertions, 13 deletions
@@ -135,17 +135,15 @@ App.prototype.updateTorrentUI = function ($torrent, torrent) { else $torrent.removeClass('has-metadata') - $torrent.find('.title').text(torrent.title) + $torrent.find('.name').text(torrent.name) $torrent.find('.downloaded').text(humanize.filesize(torrent.swarm.downloaded)) $torrent.find('.uploaded').text(humanize.filesize(torrent.swarm.uploaded)) $torrent.find('.ratio').text(torrent.swarm.ratio) $torrent.find('progress').attr('value', torrent.progress) $torrent.find('.numPeers').text(torrent.swarm.numConns + torrent.swarm.numQueued) $torrent.find('.numActivePeers').text(torrent.swarm.numPeers) - $torrent.find('.downloadSpeed') - .text(humanize.filesize(torrent.swarm.downloadSpeed())) - $torrent.find('.uploadSpeed') - .text(humanize.filesize(torrent.swarm.uploadSpeed())) + $torrent.find('.downloadSpeed').text(humanize.filesize(torrent.swarm.downloadSpeed())) + $torrent.find('.uploadSpeed').text(humanize.filesize(torrent.swarm.uploadSpeed())) } App.prototype.downloadTorrentFile = function (torrent) { @@ -159,7 +157,7 @@ App.prototype.downloadTorrentFile = function (torrent) { chrome.fileSystem.chooseEntry({ type: 'saveFile', - suggestedName: torrent.title + '.torrent' + suggestedName: torrent.name + '.torrent' }, function (fileEntry) { if (!fileEntry) return diff --git a/lib/torrent.js b/lib/torrent.js index 7e65178..cb314a2 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -26,16 +26,16 @@ function Torrent (uri, opts) { throw new Error('invalid torrent uri') self.infoHash = info.infoHash - self.title = info.title - - self.metadataRaw = null - self.metadata = null self.file = null + self.name = info.name self.peerId = opts.peerId self.torrentPort = opts.torrentPort self.dhtPort = opts.dhtPort + self.metadataRaw = null + self.metadata = null + self.swarm = new Swarm(self.infoHash, self.peerId, { dht: true }) if (self.torrentPort) { @@ -212,14 +212,14 @@ Torrent.prototype.onMetadata = function () { // /** - * Given a magnet URI, return infoHash and title + * Given a magnet URI, return infoHash and name * @param {string} uri * @return {Object} */ function parseMagnetUri (uri) { var parsed = magnet(uri) return { - title: parsed.dn, // displayName + name: parsed.dn, // displayName infoHash: parsed.xt && parsed.xt.split('urn:btih:')[1] } } diff --git a/views/torrent.html b/views/torrent.html index 76208cb..596d6c3 100644 --- a/views/torrent.html +++ b/views/torrent.html @@ -3,7 +3,7 @@ <img class="image" src="img/folder.png"> </div> <div class="right"> - <div class="title"></div> + <div class="name"></div> <div class="stats"> <span class="if-metadata"> <span class="downloaded"></span>, uploaded <span class="uploaded"></span> (Ratio: <span class="ratio"></span>) |