saber 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +8 -1
  3. data/Gemfile +6 -1
  4. data/Gemfile.lock +58 -14
  5. data/README.md +40 -125
  6. data/bin/saber +4 -2
  7. data/bin/saber.bb +3 -0
  8. data/bin/saber.stp +3 -0
  9. data/lib/saber.rb +5 -0
  10. data/lib/saber/autofetcher/server.rb +1 -1
  11. data/lib/saber/book.rb +36 -0
  12. data/lib/saber/cli.rb +45 -19
  13. data/lib/saber/core_ext.rb +68 -0
  14. data/lib/saber/fetcher.rb +2 -2
  15. data/lib/saber/rc.rb +6 -0
  16. data/lib/saber/task.rb +3 -0
  17. data/lib/saber/task/base.rb +6 -1
  18. data/lib/saber/task/chd.rb +10 -2
  19. data/lib/saber/task/clean.rb +2 -2
  20. data/lib/saber/task/find_uploads.rb +53 -0
  21. data/lib/saber/task/generate.rb +37 -20
  22. data/lib/saber/task/make.rb +20 -8
  23. data/lib/saber/task/send.rb +1 -1
  24. data/lib/saber/task/upload.rb +29 -19
  25. data/lib/saber/tracker.rb +8 -4
  26. data/lib/saber/tracker/base.rb +36 -15
  27. data/lib/saber/tracker/bb.rb +4 -10
  28. data/lib/saber/tracker/bib.rb +27 -11
  29. data/lib/saber/tracker/chd.rb +4 -4
  30. data/lib/saber/tracker/gazelle.rb +7 -0
  31. data/lib/saber/tracker/ptp.rb +2 -2
  32. data/lib/saber/tracker/stp.rb +53 -0
  33. data/lib/saber/tracker/what.rb +2 -2
  34. data/lib/saber/tracker2.rb +31 -0
  35. data/lib/saber/tracker2/base.rb +126 -0
  36. data/lib/saber/tracker2/bb.rb +211 -0
  37. data/lib/saber/tracker2/bib.rb +162 -0
  38. data/lib/saber/tracker2/gazelle.rb +52 -0
  39. data/lib/saber/tracker2/stp.rb +136 -0
  40. data/lib/saber/tracker2/what.rb +51 -0
  41. data/lib/saber/version.rb +1 -1
  42. data/lib/saber/watir_ext.rb +95 -0
  43. data/saber.gemspec +6 -1
  44. data/spec/saber/autofetcher/server_spec.rb +1 -1
  45. data/spec/saber/task_spec.rb +1 -1
  46. data/systemd/saber-chd@.service +12 -0
  47. data/systemd/saber-client@.service +12 -0
  48. data/systemd/saber-server@.service +12 -0
  49. data/templates/_saberrc +29 -8
  50. data/templates/article.yml +18 -0
  51. data/templates/bib/application.yml +8 -8
  52. data/templates/bib/audiobook.yml +12 -14
  53. data/templates/comic.yml +25 -0
  54. data/templates/ebook.yml +35 -0
  55. data/templates/journal.yml +19 -0
  56. data/templates/magazine.yml +41 -0
  57. data/templates/manual.yml +6 -0
  58. data/templates/newspaper.yml +6 -0
  59. metadata +109 -13
  60. data/templates/bb/comic.yml +0 -7
  61. data/templates/bb/ebook.yml +0 -8
  62. data/templates/bb/magazine.yml +0 -6
  63. data/templates/bib/article.yml +0 -18
  64. data/templates/bib/comic.yml +0 -22
  65. data/templates/bib/ebook.yml +0 -20
  66. data/templates/bib/journal.yml +0 -18
  67. data/templates/bib/magazine.yml +0 -18
  68. data/templates/what/ebook.yml +0 -6
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  /rfrom/
2
2
  /*.gem
3
3
  /test
4
+ test.yml
@@ -1,8 +1,15 @@
1
+ ## 1.2.0 (xx)
2
+
3
+ **Improvements**
4
+
5
+ - add watir (javascript) support.
6
+ - add bB, STP
7
+
1
8
  ## 1.1.0 (Sep 12, 2012)
2
9
 
3
10
  **Improvements**
4
11
 
5
- - Replace 'xmpp4r' with beeter one 'blather'
12
+ - Replace 'xmpp4r' with beeter one 'blather' *Guten Ye*
6
13
 
7
14
  ## 1.0.2 (Sep 12, 2012)
8
15
 
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gem "pd"
4
4
  gem "tagen", "~>2.0.1"
5
5
  gem "optimism", "~>3.3.1"
6
- gem "pa", "~>1.3.2"
6
+ gem "pa", "~>1.3.3"
7
7
  gem "retort", "~>0.0.6"
8
8
  gem "thor", "~>0.16.0"
9
9
  gem "net-ssh", "~>2.5.2"
@@ -11,6 +11,11 @@ gem "blather", "~>0.8.0"
11
11
  gem "mechanize", "~>2.5.1"
12
12
  gem "highline", "~>1.6.14"
13
13
  gem "reverse_markdown", "~>0.3.0"
14
+ gem "watir", "~>4.0.1"
15
+ gem "faraday", "~>0.8.4"
16
+ gem "faraday_middleware", "~>0.8.8"
17
+ gem "isbn", "~>2.0.7"
18
+ gem "sys-filesystem", "~>1.0.0"
14
19
 
15
20
  group :development do
16
21
  gem "rspec"
@@ -1,3 +1,9 @@
1
+ PATH
2
+ remote: /home/guten/dev/one/pa
3
+ specs:
4
+ pa (1.3.3)
5
+ pd
6
+
1
7
  GEM
2
8
  remote: https://rubygems.org/
3
9
  specs:
@@ -5,30 +11,45 @@ GEM
5
11
  i18n (~> 0.6)
6
12
  multi_json (~> 1.0)
7
13
  addressable (2.3.2)
8
- blather (0.8.0)
14
+ blather (0.8.1)
9
15
  activesupport (>= 2.3.11)
10
16
  eventmachine (>= 0.12.6)
11
17
  girl_friday
12
18
  niceogiri (~> 1.0)
13
19
  nokogiri (~> 1.5.5)
20
+ childprocess (0.3.6)
21
+ ffi (~> 1.0, >= 1.0.6)
22
+ coderay (1.0.8)
23
+ commonwatir (4.0.0)
14
24
  connection_pool (0.9.2)
15
25
  crack (0.3.1)
16
26
  diff-lcs (1.1.3)
17
- domain_name (0.5.3)
27
+ domain_name (0.5.4)
18
28
  unf (~> 0.0.3)
19
29
  eventmachine (1.0.0)
30
+ faraday (0.8.4)
31
+ multipart-post (~> 1.1)
32
+ faraday_middleware (0.8.8)
33
+ faraday (>= 0.7.4, < 0.9)
20
34
  ffi (1.1.5)
21
35
  girl_friday (0.10.0)
22
36
  connection_pool (~> 0.9.0)
23
- guard (1.3.2)
37
+ guard (1.5.0)
24
38
  listen (>= 0.4.2)
39
+ lumberjack (>= 1.0.2)
40
+ pry (>= 0.9.10)
25
41
  thor (>= 0.14.6)
26
- guard-rspec (1.2.1)
42
+ guard-rspec (2.1.0)
27
43
  guard (>= 1.1)
28
- highline (1.6.14)
44
+ rspec (~> 2.11)
45
+ highline (1.6.15)
29
46
  i18n (0.6.1)
47
+ isbn (2.0.7)
30
48
  json (1.7.5)
31
- listen (0.5.0)
49
+ libwebsocket (0.1.5)
50
+ addressable
51
+ listen (0.5.3)
52
+ lumberjack (1.0.2)
32
53
  mechanize (2.5.1)
33
54
  domain_name (~> 0.5, >= 0.5.1)
34
55
  mime-types (~> 1.17, >= 1.17.2)
@@ -37,10 +58,12 @@ GEM
37
58
  nokogiri (~> 1.4)
38
59
  ntlm-http (~> 0.1, >= 0.1.1)
39
60
  webrobots (~> 0.0, >= 0.0.9)
61
+ method_source (0.8.1)
40
62
  mime-types (1.19)
41
63
  multi_json (1.3.6)
64
+ multipart-post (1.1.5)
42
65
  net-http-digest_auth (1.2.1)
43
- net-http-persistent (2.7)
66
+ net-http-persistent (2.8)
44
67
  net-ssh (2.5.2)
45
68
  niceogiri (1.0.2)
46
69
  nokogiri (~> 1.4)
@@ -49,9 +72,11 @@ GEM
49
72
  optimism (3.3.1)
50
73
  json
51
74
  pd
52
- pa (1.3.2)
53
- pd
54
75
  pd (1.1.0)
76
+ pry (0.9.10)
77
+ coderay (~> 1.0.5)
78
+ method_source (~> 0.8)
79
+ slop (~> 3.3.1)
55
80
  rb-inotify (0.8.8)
56
81
  ffi (>= 0.5.0)
57
82
  retort (0.0.6)
@@ -62,9 +87,18 @@ GEM
62
87
  rspec-expectations (~> 2.11.0)
63
88
  rspec-mocks (~> 2.11.0)
64
89
  rspec-core (2.11.1)
65
- rspec-expectations (2.11.2)
90
+ rspec-expectations (2.11.3)
66
91
  diff-lcs (~> 1.1.3)
67
- rspec-mocks (2.11.2)
92
+ rspec-mocks (2.11.3)
93
+ rubyzip (0.9.9)
94
+ selenium-webdriver (2.25.0)
95
+ childprocess (>= 0.2.5)
96
+ libwebsocket (~> 0.1.3)
97
+ multi_json (~> 1.0)
98
+ rubyzip
99
+ slop (3.3.3)
100
+ sys-filesystem (1.0.0)
101
+ ffi (>= 1.0.0)
68
102
  tagen (2.0.1)
69
103
  activesupport
70
104
  pd
@@ -72,8 +106,13 @@ GEM
72
106
  unf (0.0.5)
73
107
  unf_ext
74
108
  unf_ext (0.0.5)
75
- vcr (2.2.4)
76
- webmock (1.8.9)
109
+ vcr (2.2.5)
110
+ watir (4.0.1)
111
+ commonwatir (~> 4)
112
+ watir-webdriver
113
+ watir-webdriver (0.6.1)
114
+ selenium-webdriver (>= 2.18.0)
115
+ webmock (1.8.11)
77
116
  addressable (>= 2.2.7)
78
117
  crack (>= 0.1.7)
79
118
  webrobots (0.0.13)
@@ -83,19 +122,24 @@ PLATFORMS
83
122
 
84
123
  DEPENDENCIES
85
124
  blather (~> 0.8.0)
125
+ faraday
126
+ faraday_middleware
86
127
  guard
87
128
  guard-rspec
88
129
  highline (~> 1.6.14)
130
+ isbn
89
131
  mechanize (~> 2.5.1)
90
132
  net-ssh (~> 2.5.2)
91
133
  optimism (~> 3.3.1)
92
- pa (~> 1.3.2)
134
+ pa!
93
135
  pd
94
136
  rb-inotify
95
137
  retort (~> 0.0.6)
96
138
  reverse_markdown (~> 0.3.0)
97
139
  rspec
140
+ sys-filesystem
98
141
  tagen (~> 2.0.1)
99
142
  thor (~> 0.16.0)
100
143
  vcr
144
+ watir
101
145
  webmock
data/README.md CHANGED
@@ -1,73 +1,76 @@
1
1
  Saber, a complete solution for PT users. [![Build Status](https://secure.travis-ci.org/SaberSalv/saber.png)](http://travis-ci.org/SaberSalv/saber)
2
2
  ==========================================
3
3
 
4
- | | |
5
- |----------------|-----------------------------------------|
4
+ | | |
5
+ |----------------|-------------------------------------------|
6
6
  | Homepage: | https://github.com/SaberSalv/saber |
7
- | Author: | Saber |
8
- | License: | MIT-LICENSE |
7
+ | Author: | Saber |
8
+ | License: | MIT-LICENSE |
9
9
  | Documentation: | https://github.com/SaberSalv/saber/wiki |
10
10
  | Issue Tracker: | https://github.com/SaberSalv/saber/issues |
11
+ | Operation Systems: | Linux, Mac OS X |
11
12
 
12
13
  **Features:**
13
14
 
14
- * Add Torrent: send a torrent file from website to rutorrent.
15
- * Fetch: automatically/manually fetch files from seedbox to home-laptop.
16
- * Upload: upload a torrent file from command line to the site.
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.
15
+ * **Add Torrent**: send a torrent file from website to rutorrent.
16
+ * **Upload**: upload a torrent file from command line to the site.
17
+ * **Fetch**: automatically/manually fetch files from seedbox to home-laptop.
18
+ * **Other Tasks**:
19
+ - **Make**: make a torrent file and copy it to local and remote watch directory.
20
+ - **Send**: send files from home-laptop to seedbox.
21
+ - **Clean**: remove files which are not seeded in rtorrent.
21
22
 
22
23
  you can find more tools at [here](https://github.com/SaberSalv/saber/wiki/Tools).
23
24
 
24
25
  Getting Started
25
26
  ----------------
26
27
 
27
- Create ~/.saberrc configuration file from [template](https://github.com/SaberSalv/saber/blob/master/templates/_saberrc). More detail will be explained below.
28
+ Create `~/.saberrc` configuration file from [template](https://github.com/SaberSalv/saber/blob/master/templates/_saberrc).
28
29
 
29
30
  ### Add Torrent
30
31
 
31
32
  See [saber-addtorrent](https://github.com/SaberSalv/saber-addtorrent) project.
32
33
 
34
+ ### Upload
33
35
 
34
- ### Fetch
36
+ 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. :)
35
37
 
36
- #### AutoFetch
38
+ > Support sites: BIB, bB, STP
39
+
40
+ > Support upload types: ebook, magazine
41
+
42
+ Manual fill \<info-data>.yml file and upload it.
37
43
 
38
- Configure ~/.saberrc
44
+ $ saber.bib g magazine hello.pdf
45
+ > create hello.yml
46
+ $ edit hello.yml
39
47
 
40
- p:
41
- fetcher_download = Pa("~/download")
48
+ type: magazines
49
+ title: Hello
50
+ description: Hello World
51
+ ...
42
52
 
43
- server:
44
- ftp = "ftp://seedbox/bt"
53
+ $ saber.bib upload pdf hello.yml
54
+ > it opens a firefox browser
55
+ > it fills data and submit it
56
+ > upload complete
45
57
 
46
- xmpp:
47
- jid = "x1@gmail.com" # need register a gtalk account.
48
- password = "y1"
49
- host = nil
50
- port = nil
58
+ Auto fill \<info-data>.yml file from ISBN.
51
59
 
52
- client:
53
- xmpp:
54
- jid = "x2@gmail.com"
55
- password = "y2"
56
- host = nil
57
- port = nil
60
+ $ saber.bib g ebook hello.epub:1781100055
61
+ > create hello.yml
58
62
 
59
- Start saber-server at server side.
63
+ ### Fetch
60
64
 
61
- # ~/.rtorrent.rc
65
+ #### AutoFetch
62
66
 
63
- method.set_key = event.download.finished, saber-fetch, "execute= saber-drb_add, (d.get_hash), (d.get_custom1)"
67
+ Start saber-server at server side.
64
68
 
65
69
  $ saber server -V
66
70
 
67
71
  Start saber-client at client side.
68
72
 
69
73
  $ aria2c --enable-rpc --save-session session.lock -i session.lock
70
-
71
74
  $ saber client -V
72
75
 
73
76
  Test if it works
@@ -81,115 +84,34 @@ Manually fetch: right click 'Saber Fetch' in rutorrent web ui, then it'll add to
81
84
 
82
85
  Or from command line, send a download file to client: `saber drb_add <hash_id> saber`, sometime the client need a long time(2 minutes) to recive the file list sent by server.
83
86
 
84
- For ArchLinux, you can install `saber-server-daemon`, `user-saber-client-daemon`, `user-aria2-daemon` packages.
85
-
86
87
  #### ManualFetch
87
88
 
88
- Configure ~/.saberrc
89
-
90
- p:
91
- fetcher_download = Pa("~/download")
92
- remote_download = Pa("~/bt")
93
-
94
- server:
95
- user = "x"
96
- host = "seedbox"
97
- ftp = "ftp://seedbox/bt"
98
-
99
89
  Begin fetch a file from seedbox
100
90
 
101
91
  $ saber fetch foo
102
92
  > begin to download ftp://seedbox/bt/foo/a.epub via aria2
103
93
  > begin to download ftp://seedbox/bt/foo/b.epub via aria2
104
94
 
105
- ### Upload
106
-
107
- 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. :)
108
-
109
- > Support sites: BIB
110
-
111
- Configure ~/.saberrc
112
-
113
- p:
114
- watch = Pa("~/bt/watch")
115
- remote_watch = Pa("bt/watch")
116
-
117
- username = "foo"
118
- bib:
119
- username = "bar"
120
- announce_url = "x"
121
-
122
- server:
123
- user = "x"
124
- host = "y"
125
-
126
- Fill \<info-data>.yml file and upload it.
127
-
128
- $ saber.bib g magazine hello.pdf
129
- > create hello.pdf.yml
130
- $ vim hello.pdf.yml
131
-
132
- type: magazines
133
- Title: Hello
134
- Description: Hello World
135
- ...
136
-
137
- $ saber.bib upload hello.pdf.torrent
138
- > Upload Complete
139
-
140
- $ saber.bib upload hello.pdf # short cut
141
- > make hello.pdf.torrent
142
- > Upload Complete
143
-
144
- Auto fill \<info-data>.yml file from isbn.
145
-
146
- $ saber.bib g ebook hello.epub 1781100055
147
- > create hello.epub.yml
148
-
149
95
  ### Tasks
150
96
 
151
97
  #### Make
152
98
 
153
- Configure ~/.saberrc
154
-
155
- p:
156
- watch = Pa("~/bt/watch")
157
- remote_watch = Pa("bt/watch")
158
-
159
- bib:
160
- announce_url = "x"
161
-
162
- server:
163
- user = "x"
164
- host = "y"
165
-
166
99
  Make a torrent
167
100
 
168
- $ saber make hello.epub
169
- > mktorrent -p -a x hello.epub
101
+ $ saber.bib make hello.epub
102
+ > mktorrent -p -a ANNOUNCE_URL hello.epub
170
103
  > cp hello.epub.torrent ~/bt/watch
171
104
  > rsync -Phr hello.epub.torrent user@host:bt/watch
172
105
 
173
106
  #### Send
174
107
 
175
- Configure ~/.saberrc
176
-
177
- server:
178
- user = "x"
179
- host = "y"
180
-
181
108
  Send files to seedbox
182
109
 
183
110
  $ saber send1 hello.epub bt
184
- > rsync -Phr hello.epub user@host:bt
111
+ > rsync -ahP hello.epub user@host:bt
185
112
 
186
113
  #### Clean
187
114
 
188
- Configure ~/.saberrc
189
-
190
- p:
191
- download = Pa("~/bt")
192
-
193
115
  Clean up unseeded files in rtorrent.
194
116
 
195
117
  $ saber clean
@@ -216,13 +138,6 @@ Please see [Contibution Documentation](https://github.com/SaberSalv/saber/blob/m
216
138
 
217
139
  A list of [Contributors](https://github.com/SaberSalv/saber/contributors).
218
140
 
219
- Resources
220
- ---------
221
-
222
- * [Archlinux](http://www.archlinux.org): A simple, lightweight linux distribution.
223
- * [pacaur](https://github.com/Spyhawk/pacaur): An AUR helper for ArchLinux.
224
- * [YAAW](https://github.com/binux/yaaw): Yet Another Aria2 Web Frontend in pure HTML/CSS/Javascirpt.
225
-
226
141
  Copyright
227
142
  ---------
228
143
 
data/bin/saber CHANGED
@@ -4,11 +4,13 @@ require_relative "../lib/saber"
4
4
  begin
5
5
  Saber::CLI.start
6
6
  rescue Interrupt => e
7
- Saber.ui.error "\nQuitting..."
7
+ Saber.ui.say "\nQuitting..."
8
8
  Saber.ui.debug e.backtrace.join("\n")
9
9
  exit 1
10
+ rescue SyntaxError
11
+ raise
10
12
  rescue Exception => e
11
13
  Saber.ui.error "#{e.class.name}: #{e.message}"
12
- Saber.ui.debug e.backtrace.join("\n")
14
+ Saber.ui.say e.backtrace.join("\n")
13
15
  exit 1
14
16
  end