transmission-rss 1.1.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +119 -91
- data/lib/transmission-rss/aggregator.rb +21 -9
- data/lib/transmission-rss/client.rb +1 -1
- data/lib/transmission-rss/core_ext/URI.rb +9 -0
- data/lib/transmission-rss/feed.rb +1 -1
- data/lib/transmission-rss/seen_file.rb +9 -30
- data/lib/transmission-rss/version.rb +1 -1
- data/lib/transmission-rss.rb +1 -0
- metadata +27 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb9c56c39e910b2887fc0125df3ccec3870ec9b42bc36ec40440f72dce9cf4d4
|
4
|
+
data.tar.gz: cfe742ea19cf4ff7f22bace81c5f24d14f70e6c25bb123e5b0d4d6f8693c261b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7234a61c9cf5fb97b53484007d0e475f6349161cf022b95784cc7fc3a85b5f304060d3a9ac34470da6d85d5ed6325001b4f653eb0144020d8056994c62d5871d
|
7
|
+
data.tar.gz: d2ff27c562b7db9f2e161337065e8e69301df5a624608704adf0f8296abbd68ff24575abfc3a7ecaa5166b43b878833185bd8e3ab6d0248fe52c4153197149ea
|
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
|
-
|
35
|
+
```sh
|
36
|
+
gem install transmission-rss
|
37
|
+
```
|
32
38
|
|
33
39
|
### From source
|
34
40
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
51
|
+
```sh
|
52
|
+
docker run -t \
|
53
|
+
-v $(pwd)/transmission-rss.conf:/etc/transmission-rss.conf \
|
54
|
+
nning2/transmission-rss:v1.2.1
|
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
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
91
|
-
|
92
|
-
|
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
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
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
|
-
|
172
|
-
|
173
|
-
|
197
|
+
```ini
|
198
|
+
[Unit]
|
199
|
+
Description=Transmission RSS daemon.
|
200
|
+
After=network.target transmission-daemon.service
|
174
201
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
202
|
+
[Service]
|
203
|
+
Type=forking
|
204
|
+
ExecStart=/usr/local/bin/transmission-rss -f
|
205
|
+
ExecReload=/bin/kill -s HUP $MAINPID
|
179
206
|
|
180
|
-
|
181
|
-
|
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
|
@@ -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 =
|
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 =
|
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.
|
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))
|
@@ -9,7 +9,7 @@ module TransmissionRSS
|
|
9
9
|
when Hash
|
10
10
|
@config = config
|
11
11
|
|
12
|
-
@url = URI.
|
12
|
+
@url = URI.escape(URI.unescape(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']
|
@@ -7,22 +7,19 @@ module TransmissionRSS
|
|
7
7
|
# Persist seen torrent URLs
|
8
8
|
class SeenFile
|
9
9
|
extend ::Forwardable
|
10
|
-
|
11
|
-
def_delegators :@seen, :size, :to_a
|
12
10
|
|
13
|
-
|
14
|
-
@legacy_path = legacy_path || default_legacy_path
|
15
|
-
@path = path || default_path
|
11
|
+
def_delegators :@seen, :size, :to_a
|
16
12
|
|
17
|
-
|
18
|
-
|
13
|
+
def initialize(path = nil)
|
14
|
+
@path = path || default_path
|
15
|
+
initialize_path!(@path)
|
19
16
|
|
20
17
|
@seen = Set.new(file_to_array(@path))
|
21
18
|
end
|
22
19
|
|
23
20
|
def add(url)
|
24
21
|
hash = digest(url)
|
25
|
-
|
22
|
+
|
26
23
|
return if @seen.include?(hash)
|
27
24
|
|
28
25
|
@seen << hash
|
@@ -43,10 +40,6 @@ module TransmissionRSS
|
|
43
40
|
|
44
41
|
private
|
45
42
|
|
46
|
-
def default_legacy_path
|
47
|
-
File.join(Etc.getpwuid.dir, '.config/transmission/seen-torrents.conf')
|
48
|
-
end
|
49
|
-
|
50
43
|
def default_path
|
51
44
|
File.join(Etc.getpwuid.dir, '.config/transmission/seen')
|
52
45
|
end
|
@@ -59,25 +52,11 @@ module TransmissionRSS
|
|
59
52
|
open(path, 'r').readlines.map(&:chomp)
|
60
53
|
end
|
61
54
|
|
62
|
-
def initialize_path!
|
63
|
-
return if File.exist?(
|
64
|
-
|
65
|
-
FileUtils.mkdir_p(File.dirname(@path))
|
66
|
-
FileUtils.touch(@path)
|
67
|
-
end
|
68
|
-
|
69
|
-
def migrate!
|
70
|
-
return unless File.exist?(@legacy_path)
|
71
|
-
|
72
|
-
legacy_seen = file_to_array(@legacy_path)
|
73
|
-
hashes = legacy_seen.map { |url| digest(url) }
|
74
|
-
|
75
|
-
open(@path, 'w') do |f|
|
76
|
-
f.write(hashes.join("\n"))
|
77
|
-
f.write("\n")
|
78
|
-
end
|
55
|
+
def initialize_path!(path)
|
56
|
+
return if File.exist?(path)
|
79
57
|
|
80
|
-
FileUtils.
|
58
|
+
FileUtils.mkdir_p(File.dirname(path))
|
59
|
+
FileUtils.touch(path)
|
81
60
|
end
|
82
61
|
end
|
83
62
|
end
|
data/lib/transmission-rss.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transmission-rss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- henning mueller
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rss
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.2.9
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.2.9
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: open_uri_redirections
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +92,7 @@ files:
|
|
72
92
|
- lib/transmission-rss/core_ext/Array.rb
|
73
93
|
- lib/transmission-rss/core_ext/Hash.rb
|
74
94
|
- lib/transmission-rss/core_ext/Object.rb
|
95
|
+
- lib/transmission-rss/core_ext/URI.rb
|
75
96
|
- lib/transmission-rss/feed.rb
|
76
97
|
- lib/transmission-rss/log.rb
|
77
98
|
- lib/transmission-rss/seen_file.rb
|
@@ -81,7 +102,7 @@ homepage: https://rubygems.org/gems/transmission-rss
|
|
81
102
|
licenses:
|
82
103
|
- GPL-3.0
|
83
104
|
metadata: {}
|
84
|
-
post_install_message:
|
105
|
+
post_install_message:
|
85
106
|
rdoc_options: []
|
86
107
|
require_paths:
|
87
108
|
- lib
|
@@ -96,8 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
117
|
- !ruby/object:Gem::Version
|
97
118
|
version: '0'
|
98
119
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
100
|
-
signing_key:
|
120
|
+
rubygems_version: 3.2.32
|
121
|
+
signing_key:
|
101
122
|
specification_version: 4
|
102
123
|
summary: Adds torrents from rss feeds to transmission web frontend.
|
103
124
|
test_files: []
|