saber 0.0.7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +18 -8
- data/Gemfile.lock +72 -33
- data/Guardfile +4 -0
- data/README.md +192 -52
- data/Rakefile +46 -0
- data/bin/1saber +5 -3
- data/bin/saber +4 -0
- data/bin/saber.bib +3 -0
- data/bin/saber.what +3 -0
- data/extconf.rb +4 -1
- data/lib/saber.rb +7 -13
- data/lib/saber/autofetcher.rb +8 -0
- data/lib/saber/autofetcher/client.rb +66 -0
- data/lib/saber/autofetcher/server.rb +78 -0
- data/lib/saber/cli.rb +65 -26
- data/lib/saber/{downloader.rb → fetcher.rb} +9 -11
- data/lib/saber/mechanize_ext.rb +136 -0
- data/lib/saber/rc.rb +3 -21
- data/lib/saber/task.rb +26 -11
- data/lib/saber/task/base.rb +18 -0
- data/lib/saber/task/clean.rb +18 -0
- data/lib/saber/task/generate.rb +38 -0
- data/lib/saber/task/make.rb +44 -0
- data/lib/saber/task/send.rb +21 -0
- data/lib/saber/task/upload.rb +37 -0
- data/lib/saber/tracker.rb +28 -0
- data/lib/saber/tracker/base.rb +115 -2
- data/lib/saber/tracker/bb.rb +244 -0
- data/lib/saber/tracker/bib.rb +225 -0
- data/lib/saber/tracker/ptp.rb +100 -0
- data/lib/saber/tracker/what.rb +55 -7
- data/lib/saber/ui.rb +65 -22
- data/lib/saber/version.rb +1 -1
- data/rutorrent/init.js +8 -9
- data/rutorrent/plugin.info +1 -1
- data/saber.gemspec +14 -10
- data/spec/data/_saber/.gitkeep +0 -0
- data/spec/saber/downloader_spec.rb +5 -2
- data/spec/saber/task_spec.rb +16 -0
- data/spec/saber/tracker/bib_spec.rb +24 -0
- data/spec/spec_helper.rb +25 -0
- data/templates/_saberrc +36 -0
- data/templates/bb/anime.yml +6 -0
- data/templates/bb/application.yml +7 -0
- data/templates/bb/audiobook.yml +12 -0
- data/templates/bb/comic.yml +7 -0
- data/templates/bb/documentary.yml +26 -0
- data/templates/bb/ebook.yml +8 -0
- data/templates/bb/elearning_video.yml +7 -0
- data/templates/bb/game_console.yml +6 -0
- data/templates/bb/game_pc.yml +6 -0
- data/templates/bb/magazine.yml +6 -0
- data/templates/bb/misc.yml +6 -0
- data/templates/bb/movie.yml +26 -0
- data/templates/bb/music.yml +21 -0
- data/templates/bb/tv.yml +6 -0
- data/templates/bib/application.yml +9 -0
- data/templates/bib/article.yml +18 -0
- data/templates/bib/audiobook.yml +17 -0
- data/templates/bib/comic.yml +22 -0
- data/templates/bib/ebook.yml +20 -0
- data/templates/bib/journal.yml +18 -0
- data/templates/bib/magazine.yml +18 -0
- data/templates/ptp/movie.yml +63 -0
- data/templates/ptp/movie_add.yml +35 -0
- data/templates/what/ebook.yml +6 -0
- data/templates/what/music.yml +2 -0
- data/templates/what/music_add.yml +2 -0
- metadata +182 -26
- data/doc/Development.md +0 -3
- data/lib/saber/client.rb +0 -58
- data/lib/saber/server.rb +0 -70
- data/saber.watchr +0 -23
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
@@ -1,17 +1,27 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem "
|
4
|
-
gem "
|
3
|
+
gem "pd"
|
4
|
+
gem "tagen", "~>2.0.1"
|
5
|
+
#gem "tagen", path: "/home/guten/dev/one/tagen"
|
6
|
+
gem "optimism", "~>3.3.1"
|
7
|
+
#gem "optimism", path: "/home/guten/dev/one/optimism"
|
8
|
+
gem "pa", "~>1.3.2"
|
9
|
+
#gem "pa", path: "/home/guten/dev/one/pa"
|
5
10
|
gem "retort", "~>0.0.6"
|
6
|
-
gem "thor", "~>0.
|
7
|
-
gem "net-ssh", "~>2.
|
11
|
+
gem "thor", "~>0.16.0"
|
12
|
+
gem "net-ssh", "~>2.5.2"
|
8
13
|
gem "xmpp4r", "~>0.5"
|
9
|
-
gem "
|
14
|
+
gem "mechanize", "~>2.5.1"
|
15
|
+
gem "highline", "~>1.6.14"
|
16
|
+
gem "reverse_markdown", "~>0.3.0"
|
10
17
|
|
11
18
|
group :development do
|
12
19
|
gem "rspec"
|
13
|
-
|
14
|
-
|
20
|
+
gem "vcr"
|
21
|
+
gem "webmock"
|
22
|
+
gem "guard"
|
23
|
+
gem "guard-rspec"
|
24
|
+
#gem "rag", path: "/home/guten/dev/one/rag"
|
15
25
|
end
|
16
26
|
|
17
27
|
# gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,47 +1,86 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (3.
|
4
|
+
activesupport (3.2.8)
|
5
|
+
i18n (~> 0.6)
|
5
6
|
multi_json (~> 1.0)
|
7
|
+
addressable (2.3.2)
|
8
|
+
crack (0.3.1)
|
6
9
|
diff-lcs (1.1.3)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
10
|
+
domain_name (0.5.3)
|
11
|
+
unf (~> 0.0.3)
|
12
|
+
guard (1.3.2)
|
13
|
+
listen (>= 0.4.2)
|
14
|
+
thor (>= 0.14.6)
|
15
|
+
guard-rspec (1.2.1)
|
16
|
+
guard (>= 1.1)
|
17
|
+
highline (1.6.14)
|
18
|
+
i18n (0.6.1)
|
19
|
+
json (1.7.5)
|
20
|
+
listen (0.5.0)
|
21
|
+
mechanize (2.5.1)
|
22
|
+
domain_name (~> 0.5, >= 0.5.1)
|
23
|
+
mime-types (~> 1.17, >= 1.17.2)
|
24
|
+
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
25
|
+
net-http-persistent (~> 2.5, >= 2.5.2)
|
26
|
+
nokogiri (~> 1.4)
|
27
|
+
ntlm-http (~> 0.1, >= 0.1.1)
|
28
|
+
webrobots (~> 0.0, >= 0.0.9)
|
29
|
+
mime-types (1.19)
|
30
|
+
multi_json (1.3.6)
|
31
|
+
net-http-digest_auth (1.2.1)
|
32
|
+
net-http-persistent (2.7)
|
33
|
+
net-ssh (2.5.2)
|
34
|
+
nokogiri (1.5.5)
|
35
|
+
ntlm-http (0.1.1)
|
36
|
+
optimism (3.3.1)
|
37
|
+
json
|
38
|
+
pd
|
39
|
+
pa (1.3.2)
|
40
|
+
pd
|
41
|
+
pd (1.1.0)
|
19
42
|
retort (0.0.6)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
rspec-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
rspec-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
43
|
+
reverse_markdown (0.3.0)
|
44
|
+
nokogiri
|
45
|
+
rspec (2.11.0)
|
46
|
+
rspec-core (~> 2.11.0)
|
47
|
+
rspec-expectations (~> 2.11.0)
|
48
|
+
rspec-mocks (~> 2.11.0)
|
49
|
+
rspec-core (2.11.1)
|
50
|
+
rspec-expectations (2.11.2)
|
51
|
+
diff-lcs (~> 1.1.3)
|
52
|
+
rspec-mocks (2.11.2)
|
53
|
+
tagen (2.0.1)
|
54
|
+
activesupport
|
55
|
+
pd
|
56
|
+
thor (0.16.0)
|
57
|
+
unf (0.0.5)
|
58
|
+
unf_ext
|
59
|
+
unf_ext (0.0.5)
|
60
|
+
vcr (2.2.4)
|
61
|
+
webmock (1.8.9)
|
62
|
+
addressable (>= 2.2.7)
|
63
|
+
crack (>= 0.1.7)
|
64
|
+
webrobots (0.0.13)
|
33
65
|
xmpp4r (0.5)
|
34
66
|
|
35
67
|
PLATFORMS
|
36
68
|
ruby
|
37
69
|
|
38
70
|
DEPENDENCIES
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
71
|
+
guard
|
72
|
+
guard-rspec
|
73
|
+
highline (~> 1.6.14)
|
74
|
+
mechanize (~> 2.5.1)
|
75
|
+
net-ssh (~> 2.5.2)
|
76
|
+
optimism (~> 3.3.1)
|
77
|
+
pa (~> 1.3.2)
|
78
|
+
pd
|
43
79
|
retort (~> 0.0.6)
|
80
|
+
reverse_markdown (~> 0.3.0)
|
44
81
|
rspec
|
45
|
-
|
46
|
-
|
82
|
+
tagen (~> 2.0.1)
|
83
|
+
thor (~> 0.16.0)
|
84
|
+
vcr
|
85
|
+
webmock
|
47
86
|
xmpp4r (~> 0.5)
|
data/Guardfile
ADDED
data/README.md
CHANGED
@@ -1,98 +1,238 @@
|
|
1
|
-
Saber, a complete solution for PT users.
|
2
|
-
|
1
|
+
Saber, a complete solution for PT users. [](http://travis-ci.org/GutenYe/saber)
|
2
|
+
==========================================
|
3
3
|
|
4
|
-
|
|
4
|
+
| | |
|
5
5
|
|----------------|-----------------------------------------|
|
6
|
+
| Homepage: | https://github.com/GutenYe/saber |
|
6
7
|
| Author: | Guten |
|
7
8
|
| License: | MIT-LICENSE |
|
9
|
+
| Documentation: | https://github.com/GutenYe/saber/wiki |
|
8
10
|
| Issue Tracker: | https://github.com/GutenYe/saber/issues |
|
9
11
|
|
10
|
-
|
12
|
+
**Features:**
|
11
13
|
|
12
|
-
|
14
|
+
* Add Torrent: send a torrent file from website to rutorrent.
|
15
|
+
* Upload: upload a torrent file from command line to the site.
|
16
|
+
* Fetch: automatically/manually fetch files from seedbox to home-laptop.
|
17
|
+
* Other Tasks:
|
18
|
+
- Make: make a torrent file and copy it to local and remote watch directory.
|
19
|
+
- Send: send files from home-laptop to seedbox.
|
20
|
+
- Clean: remove files which are not seeded in rtorrent.
|
13
21
|
|
14
|
-
|
22
|
+
you can find more tools at [here](https://github.com/GutenYe/saber/wiki/Tools).
|
15
23
|
|
16
|
-
|
24
|
+
Getting Started
|
25
|
+
----------------
|
17
26
|
|
18
|
-
|
27
|
+
Create ~/.saberrc configuration file from [template](https://github.com/GutenYe/saber/blob/master/templates/_saberrc). More detail will be explained below.
|
19
28
|
|
20
|
-
|
21
|
-
* download:
|
22
|
-
1. manually download a file to home laptop in rutorrent web ui.
|
23
|
-
2. automatically downlad files to home laptop when files are completed in seedbox.
|
24
|
-
* task:
|
25
|
-
1. cleanup files not in rtorrent.
|
29
|
+
### Add Torrent
|
26
30
|
|
27
|
-
|
28
|
-
-----
|
31
|
+
See [saber-addtorrent](https://github.com/GutenYe/saber-addtorrent) project.
|
29
32
|
|
30
|
-
###
|
33
|
+
### Upload
|
31
34
|
|
32
|
-
|
35
|
+
Because of lacking APIs in major PT sites, so I write this small script to help uploading a torrent from cmdline. Good news is BTN v2.0 will include API. And BTN already has an official autobot which grabs scene releases. :)
|
33
36
|
|
37
|
+
> Support sites: BIB
|
34
38
|
|
35
|
-
|
39
|
+
Configure ~/.saberrc
|
36
40
|
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
p:
|
42
|
+
watch = Pa("~/bt/watch")
|
43
|
+
remote_watch = Pa("bt/watch")
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
45
|
+
username = "foo"
|
46
|
+
bib:
|
47
|
+
username = "bar"
|
48
|
+
announce_url = "x"
|
49
|
+
|
50
|
+
server:
|
51
|
+
user = "x"
|
52
|
+
host = "y"
|
53
|
+
|
54
|
+
Fill \<info-data>.yml file and upload it.
|
55
|
+
|
56
|
+
$ saber.bib g magazine hello.pdf
|
57
|
+
> create hello.pdf.yml
|
58
|
+
$ vim hello.pdf.yml
|
59
|
+
|
60
|
+
type: magazines
|
61
|
+
Title: Hello
|
62
|
+
Description: Hello World
|
63
|
+
...
|
64
|
+
|
65
|
+
$ saber.bib upload hello.pdf.torrent
|
66
|
+
> Upload Complete
|
67
|
+
|
68
|
+
$ saber.bib upload hello.pdf # short cut
|
69
|
+
> make hello.pdf.torrent
|
70
|
+
> Upload Complete
|
71
|
+
|
72
|
+
Auto fill \<info-data>.yml file from isbn.
|
73
|
+
|
74
|
+
$ saber.bib g ebook hello.epub 1781100055
|
75
|
+
> create hello.epub.yml
|
76
|
+
|
77
|
+
### Fetch
|
78
|
+
|
79
|
+
#### AutoFetch
|
80
|
+
|
81
|
+
Configure ~/.saberrc
|
82
|
+
|
83
|
+
p:
|
84
|
+
fetcher_download = Pa("~/download")
|
85
|
+
|
86
|
+
server:
|
87
|
+
ftp = "ftp://seedbox/bt"
|
88
|
+
|
89
|
+
xmpp:
|
90
|
+
jid = "x1@gmail.com" # need register a gtalk account.
|
91
|
+
password = "y1"
|
92
|
+
host = nil
|
93
|
+
port = nil
|
94
|
+
|
95
|
+
client:
|
96
|
+
xmpp:
|
97
|
+
jid = "x2@gmail.com"
|
98
|
+
password = "y2"
|
99
|
+
host = nil
|
100
|
+
port = nil
|
101
|
+
|
102
|
+
And ~/.netrc, for ftp authenticate.
|
103
|
+
|
104
|
+
machine seedbox
|
105
|
+
login x
|
106
|
+
password y
|
107
|
+
|
108
|
+
Start saber-server at server side.
|
109
|
+
|
110
|
+
# ~/.rtorrent.rc
|
111
|
+
|
112
|
+
method.set_key = event.download.finished, saber-fetch, "execute= saber-drb_add, (d.get_hash), (d.get_custom1)"
|
113
|
+
|
114
|
+
$ saber server -V
|
115
|
+
|
116
|
+
Start saber-client at client side.
|
117
|
+
|
118
|
+
$ aria2c --enable-rpc --save-session session.lock -i session.lock
|
119
|
+
|
120
|
+
$ saber client -V
|
121
|
+
|
122
|
+
Automatically fetch: when a file is finished download in rutorrent with label 'saber', then it'll add to aria2.
|
123
|
+
|
124
|
+
Manually fetch: right click 'Saber Fetch' in rutorrent web ui, then it'll add to aria2.
|
44
125
|
|
45
|
-
|
46
|
-
|
126
|
+
For ArchLinux, you can install `saber-server-daemon`, `user-saber-client-daemon`, `user-aria2-daemon` packages.
|
127
|
+
|
128
|
+
#### ManualFetch
|
129
|
+
|
130
|
+
Configure ~/.saberrc
|
131
|
+
|
132
|
+
p:
|
133
|
+
fetcher_download = Pa("~/download")
|
134
|
+
remote_download = Pa("~/bt")
|
47
135
|
|
48
|
-
|
49
|
-
|
136
|
+
server:
|
137
|
+
user = "x"
|
138
|
+
host = "seedbox"
|
139
|
+
ftp = "ftp://seedbox/bt"
|
50
140
|
|
141
|
+
Begin fetch a file from seedbox
|
142
|
+
|
143
|
+
$ saber fetch foo
|
144
|
+
> download ftp://seedbox/bt/foo/a.epub
|
145
|
+
> download ftp://seedbox/bt/foo/b.epub
|
146
|
+
|
147
|
+
### Tasks
|
148
|
+
|
149
|
+
#### Make
|
150
|
+
|
151
|
+
Configure ~/.saberrc
|
152
|
+
|
153
|
+
p:
|
154
|
+
watch = Pa("~/bt/watch")
|
155
|
+
remote_watch = Pa("bt/watch")
|
156
|
+
|
157
|
+
bib:
|
158
|
+
announce_url = "x"
|
159
|
+
|
160
|
+
server:
|
161
|
+
user = "x"
|
162
|
+
host = "y"
|
163
|
+
|
164
|
+
Make a torrent
|
165
|
+
|
166
|
+
$ saber make hello.epub
|
167
|
+
> mktorrent -p -a x hello.epub
|
168
|
+
> cp hello.epub.torrent ~/bt/watch
|
169
|
+
> rsync -Phr hello.epub.torrent user@host:bt/watch
|
170
|
+
|
171
|
+
#### Send
|
172
|
+
|
173
|
+
Configure ~/.saberrc
|
174
|
+
|
175
|
+
server:
|
176
|
+
user = "x"
|
177
|
+
host = "y"
|
178
|
+
|
179
|
+
Send files to seedbox
|
180
|
+
|
181
|
+
$ saber send hello.epub bt
|
182
|
+
> rsync -Phr hello.epub user@host:bt
|
183
|
+
|
184
|
+
#### Clean
|
185
|
+
|
186
|
+
Configure ~/.saberrc
|
51
187
|
|
52
|
-
|
188
|
+
p:
|
189
|
+
download = Pa("~/bt")
|
53
190
|
|
54
|
-
|
191
|
+
Clean up unseeded files in rtorrent.
|
55
192
|
|
56
|
-
# server side
|
57
193
|
$ saber clean
|
58
194
|
|
195
|
+
use `saber help` to list all tasks.
|
196
|
+
|
59
197
|
Install
|
60
|
-
|
198
|
+
-------
|
61
199
|
|
62
|
-
|
200
|
+
_Main article_: [Install Saber](https://github.com/GutenYe/saber/wiki/Install)
|
63
201
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
202
|
+
$ [sudo] gem install saber
|
203
|
+
|
204
|
+
Resources
|
205
|
+
---------
|
206
|
+
|
207
|
+
* [Archlinux](http://www.archlinux.org): A simple, lightweight linux distribution.
|
208
|
+
* [pacaur](https://github.com/Spyhawk/pacaur): An AUR helper for ArchLinux.
|
209
|
+
* [YAAW](https://github.com/binux/yaaw): Yet Another Aria2 Web Frontend in pure HTML/CSS/Javascirpt.
|
210
|
+
|
211
|
+
Development [](https://gemnasium.com/GutenYe/saber) [](https://codeclimate.com/github/GutenYe/saber)
|
212
|
+
===========
|
71
213
|
|
72
214
|
Contributing
|
73
215
|
-------------
|
74
216
|
|
75
|
-
*
|
76
|
-
* Submit any bugs/features/ideas to issue tracker
|
77
|
-
* Coding Style Guide: https://gist.github.com/1105334
|
217
|
+
* Submit any bugs/features/ideas to github issue tracker.
|
78
218
|
|
79
|
-
|
80
|
-
--------
|
219
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
81
220
|
|
82
|
-
*
|
221
|
+
* Please create a topic branch for every separate change you make.
|
222
|
+
* Make sure your patches are well tested.
|
223
|
+
* Coding Style Guide: https://gist.github.com/1105334
|
83
224
|
|
84
|
-
|
85
|
-
|
225
|
+
Contributors
|
226
|
+
------------
|
86
227
|
|
87
|
-
|
88
|
-
* [TheBear](http://sourceforge.net/projects/thebear/): a web front end to aria2.
|
228
|
+
[https://github.com/GutenYe/saber/contributors](https://github.com/GutenYe/saber/contributors)
|
89
229
|
|
90
230
|
Copyright
|
91
231
|
---------
|
92
232
|
|
93
233
|
(the MIT License)
|
94
234
|
|
95
|
-
Copyright (c) 2011 Guten
|
235
|
+
Copyright (c) 2011-2012 Guten
|
96
236
|
|
97
237
|
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:
|
98
238
|
|