transmission-rss 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: adc5b70e9c7cff82b8db6cabe9fc924b4630cabe
4
+ data.tar.gz: 51140c286b43766af87b95b121ba992f41f56567
5
+ SHA512:
6
+ metadata.gz: c3fc99c0f45b4bdd46af4d16561f5143f0930acb1ba42589edb0f6ef415b450fc26e98d44d68c9c79a30a817c17d60ace8ea50924d8a846dce1726ba310b3750
7
+ data.tar.gz: f118fc0e62173649f464e2524bba2779287feb82ea8cd860aa4d485d6c2f077ded7b0cd3b784a835d5c72a069629abd10e896a2f2f0d2350e31b33dd6e8ab070
data/README.md CHANGED
@@ -25,7 +25,7 @@ Installation
25
25
 
26
26
  ### From source
27
27
 
28
- git clone git://git.orgizm.net/transmission-rss.git
28
+ git clone https://github.com/nning/transmission-rss
29
29
  cd transmission-rss
30
30
  gem build transmission-rss.gemspec
31
31
  gem install transmission-rss-*.gem
@@ -89,9 +89,3 @@ transmission is configured for HTTP basic authentication.
89
89
  fork: false
90
90
 
91
91
  pid_file: false
92
-
93
- TODO
94
- ----
95
-
96
- * Option to stop seeding after full download.
97
- * Configurable log level.
@@ -9,7 +9,8 @@ require 'transmission-rss'
9
9
  include TransmissionRSS
10
10
 
11
11
  # Default config file path.
12
- config_file = '/etc/transmission-rss.conf'
12
+ config_file = '/etc/transmission-rss.conf'
13
+ custom_config = false
13
14
 
14
15
  # Do not fork by default.
15
16
  dofork = false
@@ -44,7 +45,8 @@ options = GetoptLong.new \
44
45
  options.each do |option, argument|
45
46
  case option
46
47
  when '-c'
47
- config_file = argument
48
+ config_file = argument
49
+ custom_config = true
48
50
  when '-f'
49
51
  dofork = true
50
52
  when '-h'
@@ -77,7 +79,7 @@ defaults = {
77
79
  'privileges' => {},
78
80
  'seen_file' => nil
79
81
  }
80
- config.load defaults
82
+ config.load(defaults)
81
83
 
82
84
  # Initialize a log instance and configure it.
83
85
  log = Log.instance
@@ -92,9 +94,22 @@ begin
92
94
  config.load(config_file)
93
95
  log.target = config.log_target
94
96
  rescue Errno::ENOENT
95
- log.error config_file + ' not found'
97
+ log.error(config_file + ' not found')
96
98
  end
97
- log.debug config
99
+
100
+ # Check for user configuration and load if existing.
101
+ unless custom_config
102
+ prefix = ENV['XDG_CONFIG_HOME'] || File.join(ENV['HOME'], '.config')
103
+ path = File.join(prefix, 'transmission-rss', 'config.yml')
104
+
105
+ if File.exists? path
106
+ log.debug('loading user config ' + path)
107
+ config.load(path)
108
+ end
109
+ end
110
+
111
+ # Print current config.
112
+ log.debug(config)
98
113
 
99
114
  # Fork value from command line.
100
115
  config.fork = dofork if dofork
@@ -116,15 +131,15 @@ unless config.privileges.empty?
116
131
  ':' +
117
132
  config.privileges.group
118
133
  else
119
- log.debug 'no privilege dropping'
134
+ log.debug('no privilege dropping')
120
135
  end
121
136
 
122
137
  # Warn if no feeds are given.
123
- log.warn 'no feeds given' if config.feeds.empty?
138
+ log.warn('no feeds given') if config.feeds.empty?
124
139
 
125
140
  # Connect reload of config file to SIGHUP.
126
141
  trap 'HUP' do
127
- config.load config_file rescue nil
142
+ config.load(config_file) rescue nil
128
143
  end
129
144
 
130
145
  # Initialize feed aggregator.
@@ -140,7 +155,7 @@ end
140
155
 
141
156
  # Save PID.
142
157
  if config.pid_file
143
- log.debug 'wrote pid to ' + config.pid_file
158
+ log.debug('wrote pid to ' + config.pid_file)
144
159
  File.write(config.pid_file, Process.pid)
145
160
  end
146
161
 
@@ -148,13 +163,13 @@ end
148
163
  begin
149
164
  if config.fork
150
165
  pid = fork { aggregator.run(config.update_interval) }
151
- log.debug 'forked ' + pid.to_s
166
+ log.debug('forked ' + pid.to_s)
152
167
  else
153
- log.debug 'pid ' + Process.pid.to_s
168
+ log.debug('pid ' + Process.pid.to_s)
154
169
  aggregator.run(config.update_interval)
155
170
  end
156
171
  rescue Interrupt
157
- log.info 'interrupt caught'
172
+ log.info('interrupt caught')
158
173
  end
159
174
 
160
175
  log.close
@@ -95,7 +95,7 @@ module TransmissionRSS
95
95
 
96
96
  begin
97
97
  on_new_item(link)
98
- rescue Errno::ECONNREFUSED, Client::Unauthorized
98
+ rescue Client::Unauthorized, Errno::ECONNREFUSED, Timeout::Error
99
99
  # Do not add to seen file.
100
100
  else
101
101
  add_seen(link)
@@ -84,7 +84,10 @@ module TransmissionRSS
84
84
  end
85
85
 
86
86
  def request(data)
87
+ c ||= 0
88
+
87
89
  Timeout.timeout(@timeout) do
90
+ @log.debug("request #@host:#@port")
88
91
  Net::HTTP.new(@host, @port).start do |http|
89
92
  http.request(data)
90
93
  end
@@ -93,7 +96,13 @@ module TransmissionRSS
93
96
  @log.debug('connection refused')
94
97
  raise
95
98
  rescue Timeout::Error
96
- @log.debug('connection timeout')
99
+ s = 'connection timeout'
100
+ s += " (retry #{c})" if c > 0
101
+ @log.debug(s)
102
+
103
+ c += 1
104
+ retry unless c > 2
105
+
97
106
  raise
98
107
  end
99
108
  end
@@ -1,3 +1,3 @@
1
1
  module TransmissionRSS
2
- VERSION = '0.1.20'
2
+ VERSION = '0.1.21'
3
3
  end
metadata CHANGED
@@ -1,41 +1,39 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transmission-rss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
5
- prerelease:
4
+ version: 0.1.21
6
5
  platform: ruby
7
6
  authors:
8
7
  - henning mueller
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-12-02 00:00:00.000000000 Z
11
+ date: 2015-06-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: open_uri_redirections
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0.1'
22
- - - ! '>='
20
+ - - ">="
23
21
  - !ruby/object:Gem::Version
24
22
  version: 0.1.4
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ~>
27
+ - - "~>"
31
28
  - !ruby/object:Gem::Version
32
29
  version: '0.1'
33
- - - ! '>='
30
+ - - ">="
34
31
  - !ruby/object:Gem::Version
35
32
  version: 0.1.4
36
- description: ! "transmission-rss is basically a workaround for\n transmission's
37
- lack of the ability to monitor RSS feeds and\n automatically add enclosed torrent
38
- links. Devoted to Ann."
33
+ description: |-
34
+ transmission-rss is basically a workaround for
35
+ transmission's lack of the ability to monitor RSS feeds and
36
+ automatically add enclosed torrent links. Devoted to Ann.
39
37
  email: henning@orgizm.net
40
38
  executables:
41
39
  - transmission-add-file
@@ -43,42 +41,40 @@ executables:
43
41
  extensions: []
44
42
  extra_rdoc_files: []
45
43
  files:
44
+ - README.md
46
45
  - bin/transmission-add-file
47
46
  - bin/transmission-rss
48
47
  - lib/transmission-rss.rb
49
- - lib/transmission-rss/hash.rb
50
- - lib/transmission-rss/config.rb
51
48
  - lib/transmission-rss/aggregator.rb
52
- - lib/transmission-rss/client.rb
53
49
  - lib/transmission-rss/callback.rb
50
+ - lib/transmission-rss/client.rb
51
+ - lib/transmission-rss/config.rb
52
+ - lib/transmission-rss/hash.rb
54
53
  - lib/transmission-rss/log.rb
55
54
  - lib/transmission-rss/version.rb
56
- - README.md
57
55
  - transmission-rss.conf.example
58
56
  homepage: https://rubygems.org/gems/transmission-rss
59
57
  licenses:
60
58
  - GPL-3.0
59
+ metadata: {}
61
60
  post_install_message:
62
61
  rdoc_options: []
63
62
  require_paths:
64
63
  - lib
65
64
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
65
  requirements:
68
- - - ! '>='
66
+ - - ">="
69
67
  - !ruby/object:Gem::Version
70
68
  version: '0'
71
69
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
70
  requirements:
74
- - - ! '>='
71
+ - - ">="
75
72
  - !ruby/object:Gem::Version
76
73
  version: '0'
77
74
  requirements: []
78
75
  rubyforge_project:
79
- rubygems_version: 1.8.23.2
76
+ rubygems_version: 2.4.5
80
77
  signing_key:
81
- specification_version: 3
78
+ specification_version: 4
82
79
  summary: Adds torrents from rss feeds to transmission web frontend.
83
80
  test_files: []
84
- has_rdoc: