Permalink
Browse files

First commit. Project structure + doc

  • Loading branch information...
0 parents commit a2b6ec7d179dc4bc66e98723061b1e0df0f1a586 @mathieuravaux committed Mar 2, 2011
Showing with 211 additions and 0 deletions.
  1. +23 −0 LICENSE
  2. +100 −0 README.md
  3. +11 −0 lib/jdownloader.js
  4. +29 −0 package.json
  5. +13 −0 src/jdownloader.coffee
  6. +16 −0 test-src/downloads-test.coffee
  7. +19 −0 test/downloads-test.js
23 LICENSE
@@ -0,0 +1,23 @@
+
+node-jdownloader
+
+Copyright (c) 2011 Mathieu Ravaux
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
100 README.md
@@ -0,0 +1,100 @@
+# node-jdownloader #
+
+## Why ? ##
+
+Control JDownloader from Nodejs via the 'Remote Control' plugin
+
+No more hassle with one-click download websites !
+
+## Getting started ##
+ npm install node-jdownloader
+then,
+
+ var JDownloader = require('node-jdownloader')
+ var jdownloader = new JDownloader.Client("localhost", 10025, "admin", "admin")
+ jdownloader.get_speed(function(speed){ console.log("Woohoo! " + speed + "Kbps !!"); })
+
+
+Run `npm test node-jdownloader` and read the output specs:
+
+# Developing node-jdownloader #
+
+### Editing, testing ###
+
+node-jdownloader is written in [CoffeeScript](http://jashkenas.github.com/coffee-script/), a nice little language that compiles to Javascript
+
+To get all the development and runtime dependencies installed, run `npm link`
+
+Edit the source files in `src/` and the tests in `test-src`.
+
+Then run `npm test` to compile the files and run the tests. You should see output like this:
+
+ npm info it worked if it ends with ok
+ npm info using npm@0.3.12
+ npm info using node@v0.4.1
+ npm info pretest node-jdownloader@0.1.0
+ npm info test node-jdownloader@0.1.0
+
+ ♢ node-jdownloader
+
+ when getting the RemoteControl help page
+ ✓ it should succeed and explain itself
+
+ ✓ OK » 1 honored (0.001s)
+ npm info posttest node-jdownloader@0.1.0
+ npm ok
+
+
+
+### Installing JDownloader on a Debian server: ###
+
+Download site: [https://launchpad.net/~jd-team](https://launchpad.net/~jd-team)
+
+ add-apt-repository ppa:jd-team/jdownloader
+ apt-get update
+ apt-get install jdownloader
+
+### Using VNC to visually check JDownloader status (port 5900 by default): ###
+ Xvfb :1 -screen 0 1024x768x16 &
+ export DISPLAY=:1
+ x11vnc -display :1 -usepw -xkb -ncache 10 &
+ fluxbox & # if necessary
+ jdownloader --hide &
+
+### Other tips : ###
+
+ * Launch JDownloader with `--hide` to prevent Linkgrabber confirmations blocking it:
+ `cd ~/.jdownloader; java -Xmx512M -jar JDownloader.jar --hide`
+ * JDownloader default ports: Webinterface => 8765, Remote control => 10025
+ * [JDownloader forums](http://board.jdownloader.org/)
+ * [JDownloader wiki](http://jdownloader.org:8081/knowledge/wiki/start)
+ * [Ruby bindings by JP Hastings-Spital](https://github.com/jphastings/jd-control/)
+ * `npm edit <dependency>`
+
+## TODO / Issues ##
+TBD
+
+## License ##
+
+(The MIT License)
+
+Copyright (c) 2011 Mathieu Ravaux
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,11 @@
+(function() {
+ var restler;
+ restler = require('restler-aaronblohowiak');
+ exports.Client = (function() {
+ function Client(host, port, login, password) {}
+ Client.prototype.get_help = function(callback) {
+ return callback(null, "/help is a great start to understand me");
+ };
+ return Client;
+ })();
+}).call(this);
@@ -0,0 +1,29 @@
+{
+ "name": "node-jdownloader",
+ "description": "Allows controlling JDownloader through it's RemoteControl plugin",
+ "version": "0.1.0",
+ "homepage": "http://github.com/mathieuravaux/node-jdownloader",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mathieuravaux/node-jdownloader.git"
+ },
+ "author": "Mathieu Ravaux <mathieu.ravaux@gmail.com> (http://twitter.com/mathieuravaux)",
+ "main": "lib/jdownloader.js",
+ "directories": {
+ "lib": "lib/"
+ },
+ "scripts": {
+ "pretest": "coffee -c -o lib src; coffee -c -o test test-src",
+ "test": "vows test/*-test.js --spec"
+ },
+ "dependencies": {
+ "restler-aaronblohowiak": "*"
+ },
+ "devDependencies": {
+ "coffee-script": "*",
+ "vows": "*"
+ },
+ "engines": {
+ "node": ">= 4.0.1"
+ }
+}
@@ -0,0 +1,13 @@
+
+restler = require('restler-aaronblohowiak')
+
+class exports.Client
+
+ constructor: (host, port, login, password) ->
+
+ get_help: (callback) ->
+ callback null, "/help is a great start to understand me"
+
+
+# exports.JDownloader = JDownloader
+
@@ -0,0 +1,16 @@
+vows = require 'vows'
+assert = require 'assert'
+
+tests = vows.describe('node-jdownloader').export module
+
+JDownloader = require '../lib/jdownloader'
+jdownloader = new JDownloader.Client
+
+tests.addBatch
+ 'when getting the RemoteControl help page':
+ topic: -> jdownloader.get_help @callback
+ 'it should succeed and explain itself': (err, usage) ->
+ assert.ifError err
+ assert.ok /\/help/i.test usage
+
+
@@ -0,0 +1,19 @@
+(function() {
+ var JDownloader, assert, jdownloader, tests, vows;
+ vows = require('vows');
+ assert = require('assert');
+ tests = vows.describe('node-jdownloader')["export"](module);
+ JDownloader = require('../lib/jdownloader');
+ jdownloader = new JDownloader.Client;
+ tests.addBatch({
+ 'when getting the RemoteControl help page': {
+ topic: function() {
+ return jdownloader.get_help(this.callback);
+ },
+ 'it should succeed and explain itself': function(err, usage) {
+ assert.ifError(err);
+ return assert.ok(/\/help/i.test(usage));
+ }
+ }
+ });
+}).call(this);

0 comments on commit a2b6ec7

Please sign in to comment.