transmission-rss 1.2.1 → 1.2.3

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: e93a561f40bd628318cf507101b393624547251369fc6cc0557f280afaabf194
4
- data.tar.gz: f743d335aac56c1130ae2fd6c85f6d6a2f8ee0cd91ad8128df0309d97b880de9
3
+ metadata.gz: 48c08a8eb75a7ce3cfebf177e7aab2c0e90306ade0ba55160f3a15aeedf564ec
4
+ data.tar.gz: c438995f60f9ebb6bf4f58545872e2e951fb73fdffe8ea291cc134982b4102d5
5
5
  SHA512:
6
- metadata.gz: af81937243076628a610f49f6f28dfccbfeba3377964705c976e870f1e9c496ae9c03c50d16fb834823ccb258ccbe78bafd33502670e49900935ab1f0971d81f
7
- data.tar.gz: c0e00180d4c23177d92d004ca08a8b53a40cb22bd09e6e3231acc7f0b60865c1750e236f72bcbc58aa1935193dd6364e82ef8ff408c1edc7af41c99e12e299b1
6
+ metadata.gz: ec075911c8d8580a1717f70e960fba7962467ba1f51dad18a9a515b29c8442be4c22d5c5a868f879b97268fd1e5ee1cbf6b961738a5a9577798c420590827703
7
+ data.tar.gz: d8376330285b34ea11186bef4b74dc39e6ace47b27c5cee36647d595d0d7533619828625ffe52ca310aba3cdd0aa6a24caa15327a77a0e33b07771861dd8404d
data/README.md CHANGED
@@ -51,7 +51,7 @@ gem install transmission-rss-*.gem
51
51
  ```sh
52
52
  docker run -t \
53
53
  -v $(pwd)/transmission-rss.conf:/etc/transmission-rss.conf \
54
- nning2/transmission-rss:v1.0.0
54
+ nning2/transmission-rss:v1.2.1
55
55
  ```
56
56
 
57
57
  Configuration
@@ -114,6 +114,15 @@ feeds:
114
114
  validate_cert: false
115
115
  ```
116
116
 
117
+ Using the GUID instead of the link for tracking seen torrents is also available,
118
+ useful for changing URLs such as Prowlarr's proxy links. Default is false:
119
+
120
+ ```yaml
121
+ feeds:
122
+ - url: http://example.com/feed1
123
+ seen_by_guid: true
124
+ ```
125
+
117
126
  ### All available options
118
127
 
119
128
  The following configuration file example contains every existing option
@@ -150,6 +159,7 @@ feeds:
150
159
  download_path: /home/user/match2
151
160
  - url: http://example.com/feed9
152
161
  validate_cert: false
162
+ seen_by_guid: true
153
163
 
154
164
  update_interval: 600
155
165
 
data/bin/transmission-rss CHANGED
@@ -133,7 +133,8 @@ unless config.privileges.empty?
133
133
  ':' +
134
134
  config.privileges.group
135
135
  else
136
- log.debug('no privilege dropping')
136
+ user = Etc.getpwuid(Process.euid).name
137
+ log.debug('no privilege dropping, running as user ' + user)
137
138
  end
138
139
 
139
140
  # Warn if no feeds are given.
@@ -112,11 +112,14 @@ module TransmissionRSS
112
112
  # Link is not a String directly.
113
113
  link = link.href if link.class != String
114
114
 
115
+ # Determine whether to use guid or link as seen hash
116
+ seen_value = feed.seen_by_guid ? (item.guid.content rescue item.guid || link).to_s : link
117
+
115
118
  # The link is not in +@seen+ Array.
116
- unless @seen.include?(link)
119
+ unless @seen.include?(seen_value)
117
120
  # Skip if filter defined and not matching.
118
- unless feed.matches_regexp?(item.title)
119
- @seen.add(link)
121
+ unless feed.matches_regexp?(item.title) && !feed.exclude?(item.title)
122
+ @seen.add(seen_value)
120
123
  return
121
124
  end
122
125
 
@@ -129,7 +132,7 @@ module TransmissionRSS
129
132
  rescue Client::Unauthorized, Errno::ECONNREFUSED, Timeout::Error
130
133
  @log.debug('not added to seen file ' + link)
131
134
  else
132
- @seen.add(link)
135
+ @seen.add(seen_value)
133
136
  end
134
137
  end
135
138
 
@@ -64,10 +64,16 @@ module TransmissionRSS
64
64
  @log.debug(log_message)
65
65
 
66
66
  if id && options[:seed_ratio_limit]
67
- set_torrent(id, {
68
- 'seedRatioLimit' => options[:seed_ratio_limit].to_f,
69
- 'seedRatioMode' => 1
70
- })
67
+ if options[:seed_ratio_limit].to_f < 0
68
+ set_torrent(id, {
69
+ 'seedRatioMode' => 2
70
+ })
71
+ else
72
+ set_torrent(id, {
73
+ 'seedRatioLimit' => options[:seed_ratio_limit].to_f,
74
+ 'seedRatioMode' => 1
75
+ })
76
+ end
71
77
  end
72
78
 
73
79
  response
@@ -1,18 +1,18 @@
1
1
  module TransmissionRSS
2
2
  class Feed
3
- attr_reader :url, :regexp, :config, :validate_cert
3
+ attr_reader :url, :regexp, :config, :validate_cert, :seen_by_guid
4
4
 
5
5
  def initialize(config = {})
6
6
  @download_paths = {}
7
+ @excludes = {}
7
8
 
8
9
  case config
9
10
  when Hash
10
11
  @config = config
11
12
 
12
- @url = URI.escape(config['url'] || config.keys.first)
13
+ @url = URI.escape(URI.unescape(config['url'] || config.keys.first))
13
14
 
14
15
  @download_path = config['download_path']
15
- @validate_cert = config['validate_cert'].nil? || config['validate_cert']
16
16
 
17
17
  matchers = Array(config['regexp']).map do |e|
18
18
  e.is_a?(String) ? e : e['matcher']
@@ -20,11 +20,14 @@ module TransmissionRSS
20
20
 
21
21
  @regexp = build_regexp(matchers)
22
22
 
23
- initialize_download_paths(config['regexp'])
23
+ initialize_download_paths_and_excludes(config['regexp'])
24
24
  else
25
25
  @config = {}
26
26
  @url = config.to_s
27
27
  end
28
+
29
+ @validate_cert = @config['validate_cert'].nil? || !!@config['validate_cert']
30
+ @seen_by_guid = !!@config['seen_by_guid']
28
31
  end
29
32
 
30
33
  def download_path(title = nil)
@@ -41,6 +44,14 @@ module TransmissionRSS
41
44
  @regexp.nil? || !(title =~ @regexp).nil?
42
45
  end
43
46
 
47
+ def exclude?(title)
48
+ @excludes.each do |regexp, exclude|
49
+ return true if title =~ to_regexp(exclude)
50
+ end
51
+
52
+ return false
53
+ end
54
+
44
55
  private
45
56
 
46
57
  def build_regexp(matchers)
@@ -48,14 +59,16 @@ module TransmissionRSS
48
59
  matchers.empty? ? nil : Regexp.union(matchers)
49
60
  end
50
61
 
51
- def initialize_download_paths(regexps)
62
+ def initialize_download_paths_and_excludes(regexps)
52
63
  return unless regexps.is_a?(Array)
53
64
 
54
65
  regexps.each do |regexp|
55
66
  matcher = regexp['matcher']
56
67
  path = regexp['download_path']
68
+ exclude = regexp['exclude']
57
69
 
58
70
  @download_paths[matcher] = path if matcher && path
71
+ @excludes[matcher] = exclude if matcher && exclude
59
72
  end
60
73
  end
61
74
 
@@ -1,3 +1,3 @@
1
1
  module TransmissionRSS
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.3'
3
3
  end
@@ -27,10 +27,12 @@ feeds:
27
27
  regexp:
28
28
  - matcher: match1
29
29
  download_path: /home/user/match1
30
+ exclude: dontmatch
30
31
  - matcher: match2
31
32
  download_path: /home/user/match2
32
33
  - url: http://example.com/feed8
33
34
  validate_cert: false
35
+ seen_by_guid: true
34
36
 
35
37
  # Feed probing interval in seconds. Default is 600.
36
38
 
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.2.1
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - henning mueller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2022-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rss
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
- rubygems_version: 3.2.22
120
+ rubygems_version: 3.3.7
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Adds torrents from rss feeds to transmission web frontend.