Permalink
Browse files

update readme, rename event start-now to force

  • Loading branch information...
1 parent e406d20 commit 9fa49178740b830f2918766d9bd31823287631e7 Timothy committed Feb 15, 2013
Showing with 14 additions and 12 deletions.
  1. +5 −5 README.md
  2. +7 −5 lib/transmission.js
  3. +2 −2 package.json
View
@@ -40,27 +40,27 @@ transmission.status =
```
##Events
-### Event: added ###
+### Event: "added" ###
`function (hash, id, name) { }`
Emits when a new torrent is added
-### Event: removed ###
+### Event: "removed" ###
`function (id) { }`
Emits when a torrent is removed
-### Event: stopped ###
+### Event: "stopped" ###
`function (id) { }`
Emits when a torrent is stopped
-### Event: start-now ###
+### Event: "force" ###
`function (id) { }`
Emits when a torrent is forced to start
-### Event: active ###
+### Event: "active" ###
`function (torrents) { }`
View
@@ -44,9 +44,9 @@ function onResult(error, callback) {
Transmission.prototype.add = function(path, options, callback) {
var self = this
var args = {
- filename : path
+ //filename : path
}
- if ( typeof dir === 'string') {
+ if ( typeof options === 'object') {
var keys = Object.keys(options)
for (var i = 0; i < keys.length; i++) {
args[keys[i]] = options[keys[i]]
@@ -55,6 +55,7 @@ Transmission.prototype.add = function(path, options, callback) {
callback = options;
}
args['filename'] = path
+
this.callServer({
arguments : args,
method : this.methods.torrents.add,
@@ -63,8 +64,9 @@ Transmission.prototype.add = function(path, options, callback) {
self.emit('error', err)
callback ? callback(err) : null
}, function(err, result) {
- self.emit('added', result['torrent-added'].hashString, result['torrent-added'].id, result['torrent-added'].name)
- callback(err, result['torrent-added'])
+ var torrent = result['torrent-added']
+ self.emit('added', torrent.hashString, torrent.id, torrent.name)
+ callback(err, torrent)
}))
}
Transmission.prototype.remove = function(ids, del, callback) {
@@ -203,7 +205,7 @@ Transmission.prototype.startNow = function(ids, callback) {
self.emit('error', err)
callback ? callback(err) : null
}, function(err, result) {
- self.emit('start-now', ids)
+ self.emit('force', ids)
callback ? callback(err) : null
}))
}
View
@@ -1,8 +1,8 @@
{
- "author": "Tim <price.timmy@gmail.com",
+ "author": "Tim <git@mangoraft.com",
"name": "transmission",
"description": "API client for transmissionbt",
- "version": "0.2.3",
+ "version": "0.2.4",
"repository": {
"type": "git",
"url": "git://github.com/FLYBYME/node-transmission.git"

0 comments on commit 9fa4917

Please sign in to comment.