transmission-rss 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb9c56c39e910b2887fc0125df3ccec3870ec9b42bc36ec40440f72dce9cf4d4
4
- data.tar.gz: cfe742ea19cf4ff7f22bace81c5f24d14f70e6c25bb123e5b0d4d6f8693c261b
3
+ metadata.gz: 48c08a8eb75a7ce3cfebf177e7aab2c0e90306ade0ba55160f3a15aeedf564ec
4
+ data.tar.gz: c438995f60f9ebb6bf4f58545872e2e951fb73fdffe8ea291cc134982b4102d5
5
5
  SHA512:
6
- metadata.gz: 7234a61c9cf5fb97b53484007d0e475f6349161cf022b95784cc7fc3a85b5f304060d3a9ac34470da6d85d5ed6325001b4f653eb0144020d8056994c62d5871d
7
- data.tar.gz: d2ff27c562b7db9f2e161337065e8e69301df5a624608704adf0f8296abbd68ff24575abfc3a7ecaa5166b43b878833185bd8e3ab6d0248fe52c4153197149ea
6
+ metadata.gz: ec075911c8d8580a1717f70e960fba7962467ba1f51dad18a9a515b29c8442be4c22d5c5a868f879b97268fd1e5ee1cbf6b961738a5a9577798c420590827703
7
+ data.tar.gz: d8376330285b34ea11186bef4b74dc39e6ace47b27c5cee36647d595d0d7533619828625ffe52ca310aba3cdd0aa6a24caa15327a77a0e33b07771861dd8404d
data/README.md CHANGED
@@ -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,9 +1,10 @@
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
@@ -12,7 +13,6 @@ module TransmissionRSS
12
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.2'
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.2
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: 2022-06-19 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.32
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.