transmission-rss 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3c11b602e6a66bd0132908b8416400e6dd420c14
4
+ data.tar.gz: 6116b43e914804ecad78a5a289b58ce3e09c6edf
5
+ SHA512:
6
+ metadata.gz: 6efeb92778403ebec06625b136acba6a715e36a9e128f5d4cfc5a5d8f9819f87110481e9bb790ab9b49625b979956478d0de12395f15fbb685caa4a4c4473372
7
+ data.tar.gz: 10a50b08539173cb863f1f9ab17ec028b466ca7d60648ee861dcb0650e0019253075d1035dbacca9b3c1ce656dbe38045961c10dce0253073b9561f9317042b2
data/bin/transmission-rss CHANGED
@@ -11,9 +11,6 @@ include TransmissionRSS
11
11
  # Default config file path.
12
12
  config_file = '/etc/transmission-rss.conf'
13
13
 
14
- # Do not edit config file in Gtk GUI by default.
15
- edit_config = false
16
-
17
14
  # Do not fork by default.
18
15
  dofork = false
19
16
 
@@ -23,7 +20,6 @@ def usage_message( config_file )
23
20
  Adds torrents from rss feeds to transmission web frontend.
24
21
 
25
22
  -c <file> Custom config file path. Default: #{config_file}
26
- -e Edit config file with Gtk GUI.
27
23
  -f Fork into background after startup.
28
24
  -h This help.
29
25
 
@@ -34,7 +30,6 @@ end
34
30
  # Define command-line options.
35
31
  options = GetoptLong.new(
36
32
  [ '-c', GetoptLong::REQUIRED_ARGUMENT ],
37
- [ '-e', GetoptLong::NO_ARGUMENT ],
38
33
  [ '-f', GetoptLong::NO_ARGUMENT ],
39
34
  [ '-h', GetoptLong::NO_ARGUMENT ]
40
35
  )
@@ -44,8 +39,6 @@ options.each do |option, argument|
44
39
  case(option)
45
40
  when '-c'
46
41
  config_file = argument
47
- when '-e'
48
- edit_config = true
49
42
  when '-f'
50
43
  dofork = true
51
44
  when '-h'
@@ -112,18 +105,6 @@ if(config.feeds.empty?)
112
105
  log.warn('no feeds given')
113
106
  end
114
107
 
115
- # Start GUI if config edit option is given.
116
- if(edit_config)
117
- require 'transmission-rss/config-editor'
118
-
119
- Gtk.init
120
-
121
- ConfigEditor.new(config_file, config)
122
- Gtk.main
123
-
124
- exit(0)
125
- end
126
-
127
108
  # Connect reload of config file to SIGHUP.
128
109
  trap('HUP') do
129
110
  config.load(config_file)
@@ -1,19 +1,9 @@
1
1
  $:.unshift(File.dirname(__FILE__))
2
2
 
3
3
  module TransmissionRSS
4
- VERSION = '0.1.10'
4
+ VERSION = '0.1.11'
5
5
  end
6
6
 
7
- dir = 'transmission-rss'
8
-
9
- blacklist = %w(
10
- config-editor
11
- )
12
-
13
- blacklist.map! do |name|
14
- $:.first + '/' + dir + '/' + name + '.rb'
15
- end
16
-
17
- (Dir.glob($:.first + '/' + dir + '/*.rb') - blacklist).each do |lib|
7
+ Dir.glob($:.first + '/**/*.rb').each do |lib|
18
8
  require lib
19
9
  end
@@ -1,11 +1,6 @@
1
1
  require 'singleton'
2
2
  require 'yaml'
3
3
 
4
- # In ruby 1.9.3, Psych is used as YAML engine. Psych maps YAML to a class
5
- # automatically when deserializing, which it does by calling the "new"
6
- # method in that process. This fails with Singleton classes.
7
- YAML::ENGINE.yamler = 'syck'
8
-
9
4
  # Class handles configuration parameters.
10
5
  class TransmissionRSS::Config < Hash
11
6
  # This is a singleton class.
@@ -23,15 +18,8 @@ class TransmissionRSS::Config < Hash
23
18
  end
24
19
  end
25
20
 
26
- # Merge Config Hash with Hash in YAML file.
21
+ # Merge Config Hash with Hash from YAML file.
27
22
  def merge_yaml!(path)
28
- self.merge!(load_file(path))
29
- end
30
-
31
- # Load YAML file and work around tabs not working for identation.
32
- def load_file(path)
33
- YAML.load_stream(
34
- File.new(path).read.gsub(/\t/, ' ')
35
- ).documents.first
23
+ self.merge!(YAML.load_file(path))
36
24
  end
37
25
  end
metadata CHANGED
@@ -1,72 +1,57 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: transmission-rss
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.10
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.11
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - henning mueller
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2012-12-31 00:00:00 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
14
12
  dependencies: []
15
-
16
13
  description: |-
17
14
  transmission-rss is basically a workaround for
18
15
  transmission's lack of the ability to monitor RSS feeds and
19
16
  automatically add enclosed torrent links. Devoted to Ann.
20
17
  email: henning@orgizm.net
21
- executables:
18
+ executables:
22
19
  - transmission-add-file
23
20
  - transmission-rss
24
21
  extensions: []
25
-
26
22
  extra_rdoc_files: []
27
-
28
- files:
23
+ files:
29
24
  - bin/transmission-add-file
30
25
  - bin/transmission-rss
31
26
  - lib/transmission-rss.rb
32
- - lib/transmission-rss/hash.rb
33
- - lib/transmission-rss/config-editor.rb
34
- - lib/transmission-rss/config-editor/main.rb
35
- - lib/transmission-rss/config-editor/listbox.rb
36
- - lib/transmission-rss/config-editor/listbox-original.rb
37
- - lib/transmission-rss/config-editor/main.glade
38
27
  - lib/transmission-rss/config.rb
39
- - lib/transmission-rss/aggregator.rb
40
- - lib/transmission-rss/client.rb
41
28
  - lib/transmission-rss/log.rb
29
+ - lib/transmission-rss/client.rb
30
+ - lib/transmission-rss/hash.rb
31
+ - lib/transmission-rss/aggregator.rb
42
32
  - README.rdoc
43
33
  homepage: https://rubygems.org/gems/transmission-rss
44
34
  licenses: []
45
-
35
+ metadata: {}
46
36
  post_install_message:
47
37
  rdoc_options: []
48
-
49
- require_paths:
38
+ require_paths:
50
39
  - lib
51
- required_ruby_version: !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: "0"
57
- required_rubygems_version: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: "0"
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
63
50
  requirements: []
64
-
65
51
  rubyforge_project:
66
- rubygems_version: 1.8.23
52
+ rubygems_version: 2.0.3
67
53
  signing_key:
68
- specification_version: 3
54
+ specification_version: 4
69
55
  summary: Adds torrents from rss feeds to transmission web frontend.
70
56
  test_files: []
71
-
72
57
  has_rdoc:
@@ -1,17 +0,0 @@
1
- $:.unshift(File.dirname(__FILE__))
2
-
3
- require 'libglade2'
4
-
5
- dir = 'config-editor'
6
-
7
- blacklist = %w(
8
- listbox-original
9
- )
10
-
11
- blacklist.map! do |name|
12
- $:.first + '/' + dir + '/' + name + '.rb'
13
- end
14
-
15
- (Dir.glob($:.first + '/' + dir + '/*.rb') - blacklist).each do |lib|
16
- require lib
17
- end
@@ -1,233 +0,0 @@
1
- # ListBox - A GTK Listbox
2
- #--
3
- ###################################################################################
4
- #
5
- # ListBox - A GTK Listbox
6
- # Copyright (C) 2007 Lake Information Works
7
- #
8
- # This program is free software: you can redistribute it and/or modify
9
- # it under the terms of the GNU General Public License as published by
10
- # the Free Software Foundation, either version 3 of the License, or
11
- # (at your option) any later version.
12
- #
13
- # This program is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU General Public License
19
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
- #
21
- # Contact: alan.lake AT lakeinfoworks DOT com
22
- # Lake Information Works
23
- # Kalervonkatu 13 A 2
24
- # 20400 Jyväskylä
25
- # Finland
26
- #
27
- ###################################################################################
28
- #++
29
- =begin rdoc
30
- Sample usage
31
- Gtk.init
32
- @main_window = Gtk::Window.new
33
- @main_window.set_default_size 500,300
34
- lb_left = ListBox.new
35
- lb_left.header = 'Ad Groups'
36
- lb_left.append('ulkomaanpuhelut')
37
- lb_left.append('kaukopuhelut')
38
- lb_left.append('suuntanumerot')
39
- lb_right = ListBox.new
40
- lb_right.header = 'State Nicknames'
41
- lb_right.fill(['Empire','Golden','Silver','Sooner','Hoosier','Razorback','Buckeye','Lone Star'])
42
- box = Gtk::HBox.new
43
- @main_window.add(box)
44
- box.pack_start(lb_left,true)
45
- box.pack_start(lb_right,true)
46
- @main_window.show_all
47
- @main_window.signal_connect("destroy") { Gtk.main_quit }
48
- lb_left.signal_connect('button_release_event') do |widget,event|
49
- puts lb_left.button_release(widget,event)
50
- end
51
- lb_left.signal_connect('key-release-event') do |widget,event|
52
- selection = lb_left.key_release(widget,event)
53
- puts "#{selection}" if selection.class == String
54
- end
55
- # Note that no signal_connect code has been written for lb_right, so a selection cannot be made.
56
- Gtk.main
57
- =end
58
- =begin rdoc
59
- Purpose:
60
- 1. Document how to create a GTK widget in Ruby.
61
- 2. Create a general purpose listbox.
62
- Credit:
63
- Mathieu Blondel responded to my post on the Ruby Forum to teach me how to
64
- create a valid widget. http://www.ruby-forum.com/topic/126951
65
- Assumptions:
66
- This document doesn't attempt to teach Ruby or GTK programming (or the
67
- combination. Therefore, we assume that the reader knows how to create a
68
- Ruby Class.
69
- What's a widget?
70
- http://www.webopedia.com/TERM/W/widget.html defines a widget. The listbox shown
71
- here provides a way for the user to interface with an application by using the
72
- mouse or keyboard to select an item in the list, whereupon the listbox
73
- communicates the selection to the application.
74
- What is provided here:
75
- The following is in two parts: The class that creates the listbox widget and a
76
- piece of code that illustrates the use of it. I will include comments in the
77
- code that shows what needs to be done to make a class into a widget, but will
78
- not completely comment the code. I am commenting the parts involved with
79
- inheritance because it is the inheritance that makes ListBox a widget.
80
-
81
- This listbox is extremely basic. The minimalistic design meets my need for a
82
- listbox and makes it easier to highlight what it is that makes it a widget.
83
- Furthermore, the fact that it is basic will allow me or another programmer to
84
- easily modify it to include more sophisticated features.
85
- =end
86
- =begin rdoc
87
- ListBox inherits Gtk::ScrolledWindow. ScrolledWindow was chosen because
88
- (1) ScrolledWindow is a widget. This fact can be shown with interactive ruby
89
- (irb) by doing (a) or (b):
90
- (a)
91
- [alan@erie ~]$ irb
92
- irb(main):001:0> require 'gtk2'
93
- => true
94
- irb(main):002:0> sw = Gtk::ScrolledWindow.new
95
- => #<Gtk::ScrolledWindow:0x2aaab008d088 ptr=0xac4bd0>
96
- irb(main):003:0> sw.is_a? Gtk::Widget
97
- => true
98
- (b)
99
- [alan@erie ~]$ irb
100
- irb(main):001:0> require 'gtk2'
101
- => true
102
- irb(main):002:0> Gtk::ScrolledWindow.ancestors
103
- => [Gtk::ScrolledWindow, Gtk::Bin, Gtk::Container, Gtk::Widget, Atk::Implementor, GLib::Interface, GLib::MetaInterface, Gtk::Object, GLib::InitiallyUnowned, GLib::Object, GLib::Instantiatable, Object, Kernel]
104
- Note that Gtk::Widget is among ScrolledWindow's ancestors.
105
- (2) the scrolled window part of this widget is the part that the user adds
106
- to the GUI application.
107
- =end
108
- class ListBox < Gtk::ScrolledWindow
109
- =begin rdoc
110
- "super()" is needed because the Listbox class is inherited.
111
- "self" refers to the ListBox, but because ListBox inherits ScrolledWindow, references to this scrolled window are also made with "self".
112
- =end
113
- def initialize
114
- super()
115
-
116
- tbl = Gtk::Table.new(2,2,false) # 2 rows, 2 columns, not homogeneous
117
- self.hscrollbar_policy = Gtk::PolicyType::AUTOMATIC
118
- self.vscrollbar_policy = Gtk::PolicyType::AUTOMATIC
119
- self.shadow_type = Gtk::ShadowType::NONE
120
- self.window_placement= Gtk::CornerType::TOP_LEFT
121
-
122
- @renderer=Gtk::CellRendererText.new
123
- @renderer.set_property( 'background', 'lavender' )
124
- @renderer.set_property( 'foreground', 'black' )
125
-
126
- @list_store = Gtk::ListStore.new(String)
127
- @tree_view = Gtk::TreeView.new(@list_store)
128
-
129
- col_hdr = ''
130
- @tree_view_col1 = Gtk::TreeViewColumn.new(col_hdr, @renderer, {:text => 0})
131
- @tree_view_col1.sizing = Gtk::TreeViewColumn::AUTOSIZE
132
- @text_col = 0
133
- @tree_view.append_column(@tree_view_col1)
134
- @tree_view.headers_visible = false
135
- @tree_view.selection.mode = Gtk::SELECTION_SINGLE
136
-
137
- tbl.attach_defaults(@tree_view,0,2,0,2) # widget, left, right, top, bottom
138
- self.add_with_viewport(tbl)
139
- end # def initialize
140
-
141
- =begin rdoc
142
- Appends a string to ListBox's list.
143
- =end
144
- def append(str)
145
- iter = @list_store.append
146
- iter.set_value(0, str)
147
- end
148
-
149
- =begin rdoc
150
- This is a significant part of the widget, providing communication from it to the application.
151
- Called by a signal connect mouse button_release_event:
152
- lb_left.signal_connect('button_release_event') do |widget,event|
153
- puts lb_left.button_release(widget,event)
154
- end
155
- Returns: The string that is selected.
156
- =end
157
- def button_release(widget,event,type='text')
158
- path, column, cell_x, cell_y = @tree_view.get_path_at_pos(event.x, event.y)
159
- return path if type == 'line_nbr'
160
- @tree_view.selection.selected[@tree_view.columns.index(column)] if type == 'text'
161
- end
162
-
163
- =begin rdoc
164
- Clears the ListBox's list
165
- =end
166
- def clear
167
- @list_store.clear
168
- end
169
-
170
- =begin rdoc
171
- Fills the ListBox's list from the array of "items".
172
- =end
173
- def fill(items)
174
- items.each { |item| self.append(item) }
175
- end
176
-
177
- =begin rdoc
178
- Provides a header for the list.
179
- =end
180
- def header=(hdr)
181
- @tree_view.headers_visible = true unless @tree_view.headers_visible?
182
- @tree_view_col1.title = hdr
183
- end
184
-
185
- =begin rdoc
186
- This is a significant part of the widget, providing communication from it to the application.
187
- Called by a signal connect key_release_event, which occurs when the user uses keys to navigate:
188
- lb_left.signal_connect('key-release-event') do |widget,event|
189
- selection = lb_left.key_release(widget,event)
190
- puts "#{selection}" if selection.class == String
191
- end
192
- Returns: Selected string if the Enter or Return key is pressed; nil if any other key is pressed. The up and down keys navigate the list.
193
- =end
194
- def key_release(widget,event)
195
- return nil unless event.keyval == 65293 # Enter
196
- column = @tree_view.get_column(0)
197
- @tree_view.selection.selected[@tree_view.columns.index(column)]
198
- end
199
-
200
- =begin rdoc
201
- Select the item in the list that is equal to text
202
- =end
203
- def select(text)
204
- iter = @list_store.iter_first
205
- begin
206
- if iter[@text_col] == text
207
- @tree_view.selection.select_iter(iter)
208
- return true
209
- end
210
- end while iter.next!
211
- return false
212
- end
213
-
214
- =begin rdoc
215
- Synonym for the header=(hdr) method.
216
- =end
217
- def set_header(hdr)
218
- self.header = hdr
219
- end
220
-
221
- =begin rdoc
222
- Returns the text of line <nbr>.
223
- =end
224
- def text_at_line(nbr)
225
- iter = @list_store.iter_first
226
- line_nbr = 0
227
- begin
228
- return iter.get_value(@text_col) if line_nbr == nbr
229
- line_nbr += 1
230
- end while iter.next!
231
- return []
232
- end
233
- end