Skip to content

Commit

Permalink
update readme, rename event start-now to force
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy committed Feb 15, 2013
1 parent e406d20 commit 9fa4917
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -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) { }`

Expand Down
12 changes: 7 additions & 5 deletions lib/transmission.js
Expand Up @@ -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]]
Expand All @@ -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,
Expand All @@ -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) {
Expand Down Expand Up @@ -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
}))
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -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"
Expand Down

0 comments on commit 9fa4917

Please sign in to comment.