qnap-download_station 0.0.2 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +27 -2
- data/lib/qnap/download_station.rb +6 -2
- data/qnap-download_station.gemspec +2 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8edd6d1df5e35026968775bcadeafc18732cda70f724eb9ebb8e38eab903b8ea
|
4
|
+
data.tar.gz: 6135d684cceca1cc61039b02d64fc9ff0d9d448cf8533a736de591bfaa95594d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 795824e716f88a14a2d2827d78d4c3721d0c44bd29d085e69851a18252d93c0c274c4374a122fa0735c1db8cfae4ed9c408f71429f63c7e04e221f16985f7dc9
|
7
|
+
data.tar.gz: d3baf6d6ab6d54df37cc1ea76bb8a5516f7708a79efb1fd7e72848afb73422c6ac93a17b8ad6ed4ca31837c2c065bce8f9d692b3f069c1ce583023e42c343b99
|
data/README.md
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
Qnap::DownloadStation
|
2
2
|
=======
|
3
3
|
|
4
|
+
> NOTE: This library works with older QNAP NAS models that use QTS 4.x. Newer models are now being released with QTS 5.x, and most likely this library will not work with them. Patches welcome.
|
5
|
+
|
4
6
|
This gem provides an interface to the Download Station app that comes installed by default on many QNAP NAS.
|
5
7
|
|
6
8
|
It provides access to all available endpoints, but only a few have been documented.
|
7
9
|
|
10
|
+
If you can help document the endpoints, and provide example use cases, please feel free to send pull requests.
|
11
|
+
|
12
|
+
This software is an unofficial client for the QNAP api, and is not endorsed by QNAP. Future updates to your QNAP could possibly break the functionality of this library without warning.
|
13
|
+
|
8
14
|
Installation
|
9
15
|
-------
|
10
16
|
|
@@ -14,20 +20,23 @@ Usage
|
|
14
20
|
-------
|
15
21
|
|
16
22
|
```ruby
|
23
|
+
# Download a Linux ISO from the web
|
17
24
|
require 'qnap/download_station'
|
18
25
|
|
19
|
-
|
26
|
+
ubuntu_iso = "http://de.releases.ubuntu.com/18.04/ubuntu-18.04-desktop-amd64.iso"
|
20
27
|
|
21
28
|
ds = Qnap::DownloadStation.new '192.168.1.100', 'username', 'password'
|
22
|
-
ds.task_add_url temp: 'Download', move: 'Multimedia/New', url:
|
29
|
+
ds.task_add_url temp: 'Download', move: 'Multimedia/New', url: ubuntu_iso
|
23
30
|
active_downloads = ds.task_query
|
24
31
|
ds.logout
|
25
32
|
```
|
26
33
|
|
27
34
|
```ruby
|
28
35
|
# Alternative syntax to guarantee logout
|
36
|
+
# Start downloading a file over BitTorrent using a Magnet link
|
29
37
|
|
30
38
|
Qnap::DownloadStation.session('192.168.1.100', 'username', 'password') do |ds|
|
39
|
+
magnet_link = "magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a&dn"
|
31
40
|
ds.task_add_url temp: 'Download', move: 'Multimedia/New', url: magnet_link
|
32
41
|
pp ds.task_query
|
33
42
|
# logout is automatically called, even if there was an exception
|
@@ -35,6 +44,21 @@ end
|
|
35
44
|
|
36
45
|
```
|
37
46
|
|
47
|
+
Alternatively, if the username and password are not provided, Qnap::DownloadStation will attempt to read them from environment variables.
|
48
|
+
```ruby
|
49
|
+
# ENV['QNAP_USERNAME']
|
50
|
+
# ENV['QNAP_PASSWORD']
|
51
|
+
|
52
|
+
ds = Qnap::DownloadStation.new '192.168.1.100'
|
53
|
+
# ...
|
54
|
+
ds.logout
|
55
|
+
|
56
|
+
# or...
|
57
|
+
Qnap::DownloadStation.session('192.168.1.100') do |ds|
|
58
|
+
# ...
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
38
62
|
Available methods
|
39
63
|
-------
|
40
64
|
|
@@ -80,6 +104,7 @@ Available methods
|
|
80
104
|
* task_add_url
|
81
105
|
* task_detail
|
82
106
|
* task_get_file
|
107
|
+
* task_get_torrent_file
|
83
108
|
* task_pause
|
84
109
|
* task_priority
|
85
110
|
* task_query
|
@@ -10,7 +10,7 @@ module Qnap
|
|
10
10
|
API_VERSION = 'V4'
|
11
11
|
API_METHODS = {
|
12
12
|
misc: [:dir, :env, :login, :logout, :socks_5],
|
13
|
-
task: [:status, :query, :detail, :add_url, :add_torrent, :start, :stop, :pause, :remove, :priority, :get_file, :set_file],
|
13
|
+
task: [:status, :query, :detail, :add_url, :add_torrent, :start, :stop, :pause, :remove, :priority, :get_file, :set_file, :get_torrent_file],
|
14
14
|
rss: [:add, :query, :update, :remove, :query_feed, :update_feed, :add_job, :query_job, :update_job, :remove_job],
|
15
15
|
config: [:get, :set],
|
16
16
|
account: [:add, :query, :update, :remove],
|
@@ -60,7 +60,11 @@ module Qnap
|
|
60
60
|
@sid ||= misc_login(user: @username, pass: Base64.encode64(@password))[:sid]
|
61
61
|
end
|
62
62
|
|
63
|
-
def initialize(host, username, password)
|
63
|
+
def initialize(host, username = ENV['QNAP_USERNAME'], password = ENV['QNAP_PASSWORD'])
|
64
|
+
|
65
|
+
raise ArgumentError.new("No username defined") if username.nil?
|
66
|
+
raise ArgumentError.new("No password defined") if password.nil?
|
67
|
+
|
64
68
|
@host = host
|
65
69
|
@username = username
|
66
70
|
@password = password
|
@@ -1,9 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "qnap-download_station"
|
3
|
-
s.version = "0.0.
|
4
|
-
s.date = "2016-09-21"
|
3
|
+
s.version = "0.0.5"
|
5
4
|
s.summary = "Interface to the Download Station API"
|
6
|
-
s.description = "Manage your downloads in Download Station"
|
5
|
+
s.description = "Manage your downloads in Download Station. (Compatible with older, QTS 4.x models)"
|
7
6
|
s.authors = "cyclotron3k"
|
8
7
|
s.files = ["lib/qnap/download_station.rb", "Rakefile", "qnap-download_station.gemspec", "README.md"]
|
9
8
|
s.test_files = ["test/test_download_station.rb"]
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qnap-download_station
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cyclotron3k
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Manage your downloads in Download Station
|
13
|
+
description: Manage your downloads in Download Station. (Compatible with older, QTS
|
14
|
+
4.x models)
|
14
15
|
email:
|
15
16
|
executables: []
|
16
17
|
extensions: []
|
@@ -40,8 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
41
|
- !ruby/object:Gem::Version
|
41
42
|
version: '0'
|
42
43
|
requirements: []
|
43
|
-
|
44
|
-
rubygems_version: 2.2.2
|
44
|
+
rubygems_version: 3.3.7
|
45
45
|
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Interface to the Download Station API
|