transmission-rss 1.0.0 → 1.1.0

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: 86674854af597f08a987f01786a9adb516f43581532170e293c27876169696f6
4
- data.tar.gz: 055c6b2604df5c1ef936b38c6e5d8922b38aca4381744e93d14f29b914e8bab0
3
+ metadata.gz: ac9f76bca685a810ed32c80d1e43b7252d10a0088d33d4826d5b4e6c1496d753
4
+ data.tar.gz: b400a88f22877be316284d9edc0a3f13b73c014f16557adacaf2dc7fd9bc4004
5
5
  SHA512:
6
- metadata.gz: ee0b8baab5caa033668694b782c70c52e76df166f35add66faa0b934a2d62da9dc9958c1dc35ff45ef5925958325f294b89d618cb17c2ff76b44049b6cc0e383
7
- data.tar.gz: 2f4e5719d2d4aa2346c93b53d78bfc162645cfecfee478963f04c78b88f24a93f9a9e0ec5afd5c72ffd2a634ec1b8443b57d6ca3d3ce392bb040421a638cafa1
6
+ metadata.gz: 5c34f47be84831505bfdeacf16ec7ea07b38b520e86b0c25222583a667edc956a4846394355949780151cd26f180bfeac26583f437c5f2f4c7a641c7a2e748b3
7
+ data.tar.gz: 27952ef90a8ca35e7fc1897a36610dc93c735d50be9a3f926821af141f2a241a85f6dbc5d19e45d0e42960f9579a1c1f7b0f6a2e434a81a0025edd04b5231d4a
data/README.md CHANGED
@@ -40,9 +40,9 @@ Installation
40
40
 
41
41
  ### Via Docker
42
42
 
43
- docker run \
43
+ docker run -t \
44
44
  -v $(pwd)/transmission-rss.conf:/etc/transmission-rss.conf \
45
- nning2/transmission-rss
45
+ nning2/transmission-rss:v1.0.0
46
46
 
47
47
  Configuration
48
48
  -------------
@@ -94,7 +94,7 @@ is true:
94
94
  ### All available options
95
95
 
96
96
  The following configuration file example contains every existing option
97
- (although `update_interval`, `add_paused`, `server`, `log`, `fork`, and
97
+ (although `update_interval`, `add_paused`, `server`, `log`, `fork`, `single`, and
98
98
  `pid_file` are default values and could be omitted). The default `log.target` is
99
99
  STDERR. `privileges` is not defined by default, so the script runs as current
100
100
  user/group. `login` is also not defined by default. It has to be defined, if
@@ -133,6 +133,7 @@ See `./transmission-rss.conf.example` for more documentation.
133
133
  server:
134
134
  host: localhost
135
135
  port: 9091
136
+ tls: false
136
137
  rpc_path: /transmission/rpc
137
138
 
138
139
  login:
@@ -152,6 +153,8 @@ See `./transmission-rss.conf.example` for more documentation.
152
153
 
153
154
  fork: false
154
155
 
156
+ single: false
157
+
155
158
  pid_file: false
156
159
 
157
160
  seen_file: ~/.config/transmission/seen
@@ -159,6 +162,8 @@ See `./transmission-rss.conf.example` for more documentation.
159
162
  Daemonized Startup
160
163
  ------------------
161
164
 
165
+ ### As a systemd service
166
+
162
167
  The following content can be saved into
163
168
  `/etc/systemd/system/transmission-rss.service` to create a systemd unit.
164
169
  Remember checking the path in `ExecStart`.
@@ -178,3 +183,9 @@ Remember checking the path in `ExecStart`.
178
183
  The unit files are reloaded by `systemctl daemon-reload`. You can then start
179
184
  transmission-rss by running `systemctl start transmission-rss`. Starting on
180
185
  boot, can be enabled `systemctl enable transmission-rss`.
186
+
187
+ ### As a cronjob
188
+
189
+ `transmission-rss` can also be started in a single run mode, in which it runs a single loop and then exits. To do so, `transmission-rss` needs to be started with the `-s` flag. An example crontab line for running every 10 minutes can be:
190
+
191
+ `*/10 * * * * /usr/local/bin/transmission-rss -s`
data/bin/transmission-rss CHANGED
@@ -20,6 +20,9 @@ end
20
20
  # Do not fork by default.
21
21
  dofork = false
22
22
 
23
+ # Do not run single time by default.
24
+ dosingle = false
25
+
23
26
  # No PID file by default.
24
27
  pid_file = false
25
28
 
@@ -33,6 +36,7 @@ Adds torrents from rss feeds to transmission web frontend.
33
36
 
34
37
  -c <file> Custom config file path. Default: #{config_file}
35
38
  -f Fork into background after startup.
39
+ -s Single run mode.
36
40
  -h This help.
37
41
  -p <file> Write PID to file.
38
42
  -r Reset seenfile on startup.
@@ -46,6 +50,7 @@ end
46
50
  options = GetoptLong.new \
47
51
  ['-c', GetoptLong::REQUIRED_ARGUMENT],
48
52
  ['-f', GetoptLong::NO_ARGUMENT],
53
+ ['-s', GetoptLong::NO_ARGUMENT],
49
54
  ['-h', GetoptLong::NO_ARGUMENT],
50
55
  ['-p', GetoptLong::REQUIRED_ARGUMENT],
51
56
  ['-r', GetoptLong::NO_ARGUMENT],
@@ -59,6 +64,8 @@ options.each do |option, argument|
59
64
  custom_config = true
60
65
  when '-f'
61
66
  dofork = true
67
+ when '-s'
68
+ dosingle = true
62
69
  when '-h'
63
70
  usage_message(config_file)
64
71
  when '-p'
@@ -106,6 +113,9 @@ log.debug(config)
106
113
  # Fork value from command line.
107
114
  config.fork = dofork if dofork
108
115
 
116
+ # Run a single time.
117
+ config.single = dosingle if dosingle
118
+
109
119
  # PID file path from command line.
110
120
  config.pid_file = pid_file if pid_file
111
121
 
@@ -174,6 +184,8 @@ begin
174
184
  log.debug('wrote pid to ' + config.pid_file)
175
185
  File.write(config.pid_file, pid)
176
186
  end
187
+ elsif config.single
188
+ aggregator.run(-1)
177
189
  else
178
190
  log.debug('pid ' + Process.pid.to_s)
179
191
 
@@ -74,6 +74,11 @@ module TransmissionRSS
74
74
  end
75
75
  end
76
76
 
77
+ if interval == -1
78
+ @log.debug('single run mode, exiting')
79
+ break
80
+ end
81
+
77
82
  sleep(interval)
78
83
  end
79
84
  end
@@ -17,6 +17,7 @@ module TransmissionRSS
17
17
 
18
18
  @host = server.host || 'localhost'
19
19
  @port = server.port || 9091
20
+ @tls = !!server.tls
20
21
  @rpc_path = server.rpc_path || '/transmission/rpc'
21
22
  @login = login
22
23
 
@@ -47,6 +48,7 @@ module TransmissionRSS
47
48
 
48
49
  case type
49
50
  when :url
51
+ file = URI.encode(file) if URI.decode(file) == file
50
52
  arguments.filename = file
51
53
  when :file
52
54
  arguments.metainfo = Base64.encode64(File.read(file))
@@ -112,7 +114,7 @@ module TransmissionRSS
112
114
  end
113
115
 
114
116
  def http_request(data)
115
- Net::HTTP.new(@host, @port).start do |http|
117
+ Net::HTTP.start(@host, @port, use_ssl: @tls) do |http|
116
118
  http.request(data)
117
119
  end
118
120
  end
@@ -52,6 +52,7 @@ module TransmissionRSS
52
52
  'server' => {
53
53
  'host' => 'localhost',
54
54
  'port' => 9091,
55
+ 'tls' => false,
55
56
  'rpc_path' => '/transmission/rpc'
56
57
  },
57
58
  'login' => nil,
@@ -60,6 +61,7 @@ module TransmissionRSS
60
61
  'level' => :debug
61
62
  },
62
63
  'fork' => false,
64
+ 'single' => false,
63
65
  'pid_file' => false,
64
66
  'privileges' => {},
65
67
  'seen_file' => nil
@@ -1,3 +1,3 @@
1
1
  module TransmissionRSS
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -77,6 +77,10 @@ feeds:
77
77
 
78
78
  #fork: false
79
79
 
80
+ # Single run mode?
81
+
82
+ # single: false
83
+
80
84
  # Save PID.
81
85
 
82
86
  #pid_file: false
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.0.0
4
+ version: 1.1.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: 2018-08-24 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open_uri_redirections
@@ -96,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubyforge_project:
100
- rubygems_version: 2.7.6
99
+ rubygems_version: 3.0.3
101
100
  signing_key:
102
101
  specification_version: 4
103
102
  summary: Adds torrents from rss feeds to transmission web frontend.