transmission-rss 1.1.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac9f76bca685a810ed32c80d1e43b7252d10a0088d33d4826d5b4e6c1496d753
4
- data.tar.gz: b400a88f22877be316284d9edc0a3f13b73c014f16557adacaf2dc7fd9bc4004
3
+ metadata.gz: 6f26bb03512a57f35a06bfccceb95883c33b7338af3d00420a017d4b64f80a5d
4
+ data.tar.gz: 6ab7a09ef74a105b0621325fc2d07562c3f9f6d960ac6ddddb1bd08b0e82c07a
5
5
  SHA512:
6
- metadata.gz: 5c34f47be84831505bfdeacf16ec7ea07b38b520e86b0c25222583a667edc956a4846394355949780151cd26f180bfeac26583f437c5f2f4c7a641c7a2e748b3
7
- data.tar.gz: 27952ef90a8ca35e7fc1897a36610dc93c735d50be9a3f926821af141f2a241a85f6dbc5d19e45d0e42960f9579a1c1f7b0f6a2e434a81a0025edd04b5231d4a
6
+ metadata.gz: 96941ea4244382e2410e90b087262894441bfaa8c8f6236807c03396d2218ea692446b85c96db52607ce196757e5a230e8730ce366f97d5c39c78632648f16b9
7
+ data.tar.gz: c7fa37fb891daf7d9afd40f178ec0cf2aba1e7db3d067fa5ca3ffd657577653356ca9f5423a7351e137529416b967f97ded8b63a5b84d8b82b5b2e40b1b2163a
data/README.md CHANGED
@@ -23,26 +23,36 @@ code to the single most delightful human being: Ann.
23
23
  The minimum supported Ruby version is 2.1. (You will need `rbenv` if your
24
24
  os does not support Ruby >= 2.1, e.g. on Debian wheezy.)
25
25
 
26
+ **Note, that this README is for the current development branch!** You can find
27
+ a link to a suitable README for your version
28
+ [on the releases page](https://github.com/nning/transmission-rss/releases).
29
+
26
30
  Installation
27
31
  ------------
28
32
 
29
33
  ### Latest stable version from rubygems.org
30
34
 
31
- gem install transmission-rss
35
+ ```sh
36
+ gem install transmission-rss
37
+ ```
32
38
 
33
39
  ### From source
34
40
 
35
- git clone https://github.com/nning/transmission-rss
36
- cd transmission-rss
37
- bundle
38
- gem build transmission-rss.gemspec
39
- gem install transmission-rss-*.gem
41
+ ```sh
42
+ git clone https://github.com/nning/transmission-rss
43
+ cd transmission-rss
44
+ bundle
45
+ gem build transmission-rss.gemspec
46
+ gem install transmission-rss-*.gem
47
+ ```
40
48
 
41
49
  ### Via Docker
42
50
 
43
- docker run -t \
44
- -v $(pwd)/transmission-rss.conf:/etc/transmission-rss.conf \
45
- nning2/transmission-rss:v1.0.0
51
+ ```sh
52
+ docker run -t \
53
+ -v $(pwd)/transmission-rss.conf:/etc/transmission-rss.conf \
54
+ nning2/transmission-rss:v1.0.0
55
+ ```
46
56
 
47
57
  Configuration
48
58
  -------------
@@ -60,36 +70,49 @@ have to explicitly specify the others like `log.level`. (True for categories
60
70
 
61
71
  It should at least contain a list of feeds:
62
72
 
63
- feeds:
64
- - url: http://example.com/feed1
65
- - url: http://example.com/feed2
73
+ ```yaml
74
+ feeds:
75
+ - url: http://example.com/feed1
76
+ - url: http://example.com/feed2
77
+ ```
66
78
 
67
79
  Feed item titles can be filtered by a regular expression:
68
80
 
69
- feeds:
70
- - url: http://example.com/feed1
71
- regexp: foo
72
- - url: http://example.com/feed2
73
- regexp: (foo|bar)
81
+ ```yaml
82
+ feeds:
83
+ - url: http://example.com/feed1
84
+ regexp: foo
85
+ - url: http://example.com/feed2
86
+ regexp: (foo|bar)
87
+ ```
74
88
 
75
89
  Feeds can also be configured to download files to specific directory:
76
90
 
77
- feeds:
78
- - url: http://example.com/feed1
79
- download_path: /home/user/Downloads
91
+
92
+ ```yaml
93
+ feeds:
94
+ - url: http://example.com/feed1
95
+ download_path: /home/user/Downloads
96
+ ```
80
97
 
81
98
  Setting the seed ratio limit is supported per feed:
82
99
 
83
- feeds:
84
- - url: http://example.com/feed1
85
- seed_ratio_limit: 0
100
+
101
+ ```yaml
102
+ feeds:
103
+ - url: http://example.com/feed1
104
+ seed_ratio_limit: 0
105
+ ```
86
106
 
87
107
  Configurable certificate validation, good for self-signed certificates. Default
88
108
  is true:
89
109
 
90
- feeds:
91
- - url: http://example.com/feed1
92
- validate_cert: false
110
+
111
+ ```yaml
112
+ feeds:
113
+ - url: http://example.com/feed1
114
+ validate_cert: false
115
+ ```
93
116
 
94
117
  ### All available options
95
118
 
@@ -102,62 +125,65 @@ transmission is configured for HTTP basic authentication.
102
125
 
103
126
  See `./transmission-rss.conf.example` for more documentation.
104
127
 
105
- feeds:
106
- - url: http://example.com/feed1
107
- - url: http://example.com/feed2
108
- - url: http://example.com/feed3
109
- regexp: match1
110
- - url: http://example.com/feed4
111
- regexp: (match1|match2)
112
- - url: http://example.com/feed5
113
- download_path: /home/user/Downloads
114
- - url: http://example.com/feed6
115
- seed_ratio_limit: 1
116
- - url: http://example.com/feed7
117
- regexp:
118
- - match1
119
- - match2
120
- - url: http://example.com/feed8
121
- regexp:
122
- - matcher: match1
123
- download_path: /home/user/match1
124
- - matcher: match2
125
- download_path: /home/user/match2
126
- - url: http://example.com/feed9
127
- validate_cert: false
128
-
129
- update_interval: 600
130
-
131
- add_paused: false
132
-
133
- server:
134
- host: localhost
135
- port: 9091
136
- tls: false
137
- rpc_path: /transmission/rpc
138
-
139
- login:
140
- username: transmission
141
- password: transmission
142
-
143
- log:
144
- target: /var/log/transmissiond-rss.log
145
- level: debug
146
-
147
- privileges:
148
- user: nobody
149
- group: nobody
150
-
151
- client:
152
- timeout: 5
153
-
154
- fork: false
155
-
156
- single: false
157
-
158
- pid_file: false
159
-
160
- seen_file: ~/.config/transmission/seen
128
+
129
+ ```yaml
130
+ feeds:
131
+ - url: http://example.com/feed1
132
+ - url: http://example.com/feed2
133
+ - url: http://example.com/feed3
134
+ regexp: match1
135
+ - url: http://example.com/feed4
136
+ regexp: (match1|match2)
137
+ - url: http://example.com/feed5
138
+ download_path: /home/user/Downloads
139
+ - url: http://example.com/feed6
140
+ seed_ratio_limit: 1
141
+ - url: http://example.com/feed7
142
+ regexp:
143
+ - match1
144
+ - match2
145
+ - url: http://example.com/feed8
146
+ regexp:
147
+ - matcher: match1
148
+ download_path: /home/user/match1
149
+ - matcher: match2
150
+ download_path: /home/user/match2
151
+ - url: http://example.com/feed9
152
+ validate_cert: false
153
+
154
+ update_interval: 600
155
+
156
+ add_paused: false
157
+
158
+ server:
159
+ host: localhost
160
+ port: 9091
161
+ tls: false
162
+ rpc_path: /transmission/rpc
163
+
164
+ login:
165
+ username: transmission
166
+ password: transmission
167
+
168
+ log:
169
+ target: /var/log/transmissiond-rss.log
170
+ level: debug
171
+
172
+ privileges:
173
+ user: nobody
174
+ group: nobody
175
+
176
+ client:
177
+ timeout: 5
178
+
179
+ fork: false
180
+
181
+ single: false
182
+
183
+ pid_file: false
184
+
185
+ seen_file: ~/.config/transmission/seen
186
+ ```
161
187
 
162
188
  Daemonized Startup
163
189
  ------------------
@@ -168,17 +194,19 @@ The following content can be saved into
168
194
  `/etc/systemd/system/transmission-rss.service` to create a systemd unit.
169
195
  Remember checking the path in `ExecStart`.
170
196
 
171
- [Unit]
172
- Description=Transmission RSS daemon.
173
- After=network.target transmission-daemon.service
197
+ ```ini
198
+ [Unit]
199
+ Description=Transmission RSS daemon.
200
+ After=network.target transmission-daemon.service
174
201
 
175
- [Service]
176
- Type=forking
177
- ExecStart=/usr/local/bin/transmission-rss -f
178
- ExecReload=/bin/kill -s HUP $MAINPID
202
+ [Service]
203
+ Type=forking
204
+ ExecStart=/usr/local/bin/transmission-rss -f
205
+ ExecReload=/bin/kill -s HUP $MAINPID
179
206
 
180
- [Install]
181
- WantedBy=multi-user.target
207
+ [Install]
208
+ WantedBy=multi-user.target
209
+ ```
182
210
 
183
211
  The unit files are reloaded by `systemctl daemon-reload`. You can then start
184
212
  transmission-rss by running `systemctl start transmission-rss`. Starting on
@@ -5,6 +5,7 @@ end
5
5
 
6
6
  require 'transmission-rss/core_ext/Array'
7
7
  require 'transmission-rss/core_ext/Object'
8
+ require 'transmission-rss/core_ext/URI'
8
9
 
9
10
  Dir.glob($:.first + '/**/*.rb').each do |lib|
10
11
  require lib
@@ -44,15 +44,8 @@ module TransmissionRSS
44
44
  @feeds.each do |feed|
45
45
  @log.debug('aggregate ' + feed.url)
46
46
 
47
- options = {allow_redirections: :safe}
48
-
49
- unless feed.validate_cert
50
- @log.debug('aggregate certificate validation: false')
51
- options[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE
52
- end
53
-
54
47
  begin
55
- content = open(feed.url, options).read
48
+ content = fetch(feed)
56
49
  rescue StandardError => e
57
50
  @log.debug("retrieval error (#{e.class}: #{e.message})")
58
51
  next
@@ -62,7 +55,7 @@ module TransmissionRSS
62
55
  # Ruby 1.9.3.
63
56
  content = decompress(content) if RUBY_VERSION == '1.9.3'
64
57
  begin
65
- items = RSS::Parser.parse(content, false).items
58
+ items = parse(content)
66
59
  rescue StandardError => e
67
60
  @log.debug("parse error (#{e.class}: #{e.message})")
68
61
  next
@@ -85,6 +78,25 @@ module TransmissionRSS
85
78
 
86
79
  private
87
80
 
81
+ def fetch(feed)
82
+ options = {
83
+ allow_redirections: :safe,
84
+ 'User-Agent' => 'transmission-rss'
85
+ }
86
+
87
+ unless feed.validate_cert
88
+ @log.debug('aggregate certificate validation: false')
89
+ options[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE
90
+ end
91
+
92
+ # open for URIs is obsolete, URI.open does not work in 2.4
93
+ URI.send(:open, feed.url, options).read
94
+ end
95
+
96
+ def parse(content)
97
+ RSS::Parser.parse(content, false).items
98
+ end
99
+
88
100
  def decompress(string)
89
101
  Zlib::GzipReader.new(StringIO.new(string)).read
90
102
  rescue Zlib::GzipFile::Error, Zlib::Error
@@ -48,7 +48,7 @@ module TransmissionRSS
48
48
 
49
49
  case type
50
50
  when :url
51
- file = URI.encode(file) if URI.decode(file) == file
51
+ file = URI.escape(file) if URI.unescape(file) == file
52
52
  arguments.filename = file
53
53
  when :file
54
54
  arguments.metainfo = Base64.encode64(File.read(file))
@@ -0,0 +1,9 @@
1
+ module URI
2
+ def self.escape(*arg)
3
+ URI::DEFAULT_PARSER.escape(*arg)
4
+ end
5
+
6
+ def self.unescape(*arg)
7
+ URI::DEFAULT_PARSER.unescape(*arg)
8
+ end
9
+ end
@@ -9,7 +9,7 @@ module TransmissionRSS
9
9
  when Hash
10
10
  @config = config
11
11
 
12
- @url = URI.encode(config['url'] || config.keys.first)
12
+ @url = URI.escape(config['url'] || config.keys.first)
13
13
 
14
14
  @download_path = config['download_path']
15
15
  @validate_cert = config['validate_cert'].nil? || config['validate_cert']
@@ -1,3 +1,3 @@
1
1
  module TransmissionRSS
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transmission-rss
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - henning mueller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-30 00:00:00.000000000 Z
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open_uri_redirections
@@ -72,6 +72,7 @@ files:
72
72
  - lib/transmission-rss/core_ext/Array.rb
73
73
  - lib/transmission-rss/core_ext/Hash.rb
74
74
  - lib/transmission-rss/core_ext/Object.rb
75
+ - lib/transmission-rss/core_ext/URI.rb
75
76
  - lib/transmission-rss/feed.rb
76
77
  - lib/transmission-rss/log.rb
77
78
  - lib/transmission-rss/seen_file.rb
@@ -96,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
97
  - !ruby/object:Gem::Version
97
98
  version: '0'
98
99
  requirements: []
99
- rubygems_version: 3.0.3
100
+ rubygems_version: 3.1.2
100
101
  signing_key:
101
102
  specification_version: 4
102
103
  summary: Adds torrents from rss feeds to transmission web frontend.