grumblr 2.3.1 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +8 -0
- data/README +10 -1
- data/VERSION +1 -1
- data/bin/grumblr +5 -2
- data/data/grumblr.desktop +1 -1
- data/data/pixmaps/grumblr-plain.svg +87 -0
- data/data/pixmaps/grumblr.svg +982 -15
- data/grumblr.gemspec +3 -3
- data/lib/grumblr/ui.rb +45 -10
- data/lib/ppds/debug.rb +5 -0
- data/lib/ppds/tumblr.rb +30 -6
- data/setup.rb +48 -0
- metadata +15 -12
data/grumblr.gemspec
CHANGED
@@ -2,17 +2,17 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'grumblr'
|
3
3
|
s.version = File.open('VERSION') { |f| f.read }
|
4
4
|
s.author = 'Paul Philippov'
|
5
|
-
s.description = "Grumblr is a message poster to Tumblr blogs
|
5
|
+
s.description = "Grumblr is a message poster to Tumblr blogs."
|
6
6
|
s.email = 'themactep@gmail.com'
|
7
7
|
s.bindir = "bin"
|
8
8
|
s.executables = ['grumblr']
|
9
9
|
s.extra_rdoc_files = ['README', 'LICENSE', 'VERSION', 'Changelog']
|
10
10
|
s.files = Dir.glob("{bin,data,lib,spec}/**/*") + \
|
11
|
-
%w(LICENSE README VERSION Changelog grumblr.gemspec)
|
11
|
+
%w(LICENSE README VERSION Changelog grumblr.gemspec setup.rb)
|
12
12
|
s.homepage = 'http://themactep.com/grumblr/'
|
13
13
|
s.require_path = "lib"
|
14
14
|
s.rubyforge_project = 'grumblr'
|
15
|
-
s.summary = "Tumblr companion
|
15
|
+
s.summary = "a Tumblr companion"
|
16
16
|
s.has_rdoc = false
|
17
17
|
s.add_dependency "ppds-libs"
|
18
18
|
s.add_dependency "libxml-ruby"
|
data/lib/grumblr/ui.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'gtk2'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'ftools'
|
2
4
|
|
3
5
|
module Grumblr
|
4
6
|
|
5
7
|
APP_NAME = 'Grumblr'
|
8
|
+
APP_MOTTO = 'a Tumblr companion'
|
6
9
|
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
7
10
|
DATA_ROOT = File.join(APP_ROOT, 'data')
|
8
11
|
VERSION = File.open(File.join(APP_ROOT,'VERSION')) { |f| f.read }
|
@@ -16,11 +19,11 @@ module Grumblr
|
|
16
19
|
|
17
20
|
filename = File.join(Grumblr::DATA_ROOT, 'pixmaps', 'grumblr.svg')
|
18
21
|
self.logo = Gdk::Pixbuf.new(filename, 128, 128)
|
19
|
-
|
22
|
+
|
20
23
|
set_size_request 440, 340
|
21
24
|
set_border_width 0
|
22
25
|
set_allow_shrink false
|
23
|
-
set_title Grumblr::APP_NAME
|
26
|
+
set_title "#{Grumblr::APP_NAME} #{Grumblr::VERSION}"
|
24
27
|
set_icon self.logo
|
25
28
|
set_default_width $cfg.get(:window_width).to_i
|
26
29
|
set_default_height $cfg.get(:window_height).to_i
|
@@ -140,11 +143,13 @@ module Grumblr
|
|
140
143
|
filter.add_mime_type "audio/*"
|
141
144
|
|
142
145
|
audio_data = file_chooser_button :audio_data, filter
|
146
|
+
@audio_externally_hosted_url = Gtk::LabeledEntry.new 'Externally Hosted MP3 URL'
|
143
147
|
@audio_caption = Gtk::LabeledTextView.new 'Caption (optional)'
|
144
148
|
|
145
149
|
page = Gtk::VBox.new false, 4
|
146
150
|
page.set_border_width 8
|
147
151
|
page.pack_start audio_data, false
|
152
|
+
page.pack_start @audio_externally_hosted_url, false
|
148
153
|
page.pack_start scrollable(@audio_caption), true
|
149
154
|
|
150
155
|
@notebook.add_page_with_tab page, 'Audio'
|
@@ -192,11 +197,25 @@ module Grumblr
|
|
192
197
|
end
|
193
198
|
toolbar.insert 1, item
|
194
199
|
|
195
|
-
|
200
|
+
### Blog selection combo
|
201
|
+
model = Gtk::ListStore.new(Gdk::Pixbuf, String)
|
202
|
+
combo = Gtk::ComboBox.new(model)
|
203
|
+
|
204
|
+
renderer = Gtk::CellRendererPixbuf.new
|
205
|
+
renderer.width = 24
|
206
|
+
combo.pack_start(renderer, false)
|
207
|
+
combo.set_attributes(renderer, :pixbuf => 0)
|
208
|
+
|
209
|
+
renderer = Gtk::CellRendererText.new
|
210
|
+
combo.pack_start(renderer, true)
|
211
|
+
combo.set_attributes(renderer, :text => 1)
|
212
|
+
|
196
213
|
active_blog = $cfg.get(:active_blog) || nil
|
197
214
|
active_blog_idx = nil
|
198
215
|
$api.blogs.each_with_index do |blog, idx|
|
199
|
-
|
216
|
+
iter = model.append
|
217
|
+
iter[0] = pixbuffer_from_url(blog.avatar_url)
|
218
|
+
iter[1] = blog.title
|
200
219
|
active_blog_idx = idx if blog.name.eql?(active_blog)
|
201
220
|
active_blog_idx = idx if active_blog_idx.nil? and blog.is_primary == "yes"
|
202
221
|
end
|
@@ -287,15 +306,19 @@ module Grumblr
|
|
287
306
|
tags = @tags.get_value.gsub(/\s+/,',').split(',').uniq.sort - ['']
|
288
307
|
|
289
308
|
data = {
|
290
|
-
:generator => 'Grumblr',
|
291
309
|
:email => $cfg.get(:email),
|
292
310
|
:password => $cfg.get(:password),
|
293
311
|
:channel_id => $app.blog.name,
|
294
|
-
:group => $app.blog.name + '.tumblr.com',
|
295
312
|
:type => message_type,
|
313
|
+
:generator => "#{Grumblr::APP_NAME} #{Grumblr::VERSION}",
|
314
|
+
:private => @private_button.active? ? 1 : 0,
|
296
315
|
:tags => tags.join(','),
|
297
316
|
:format => @format.active? ? 'markdown' : 'html',
|
298
|
-
:
|
317
|
+
:group => $app.blog.name + '.tumblr.com',
|
318
|
+
#:slug => ,
|
319
|
+
#:state => , # published, draft, submission, queue
|
320
|
+
#:publish_on => , # e.g. publish-on=2010-01-01T13:34:00
|
321
|
+
#:send-to-twitter => , # no, auto, "message"
|
299
322
|
}
|
300
323
|
|
301
324
|
data.merge! mandatory_data
|
@@ -304,6 +327,8 @@ module Grumblr
|
|
304
327
|
|
305
328
|
data.update({:data => File.read(data['data'])}) if data.has_key?('data') and data['data'] != ""
|
306
329
|
|
330
|
+
dump(data) if DEBUG
|
331
|
+
|
307
332
|
$api.query 'write', data
|
308
333
|
MessageDialog.new "Message posted", Gtk::Stock::DIALOG_INFO
|
309
334
|
reset_form message_type
|
@@ -362,6 +387,16 @@ module Grumblr
|
|
362
387
|
scroll.show_all
|
363
388
|
end
|
364
389
|
|
390
|
+
def pixbuffer_from_url(url)
|
391
|
+
cache_dir = File.expand_path(File.join('~', '.cache', Grumblr::APP_NAME.downcase))
|
392
|
+
FileUtils.mkdir_p(cache_dir) unless File.directory?(cache_dir)
|
393
|
+
file = File.join(cache_dir, File.basename(url))
|
394
|
+
File.open(file, 'w') { |f| f.write(open(url).read) } unless File.exists?(file)
|
395
|
+
pb = Gdk::PixbufLoader.new
|
396
|
+
pb.set_size 16, 16
|
397
|
+
pb.last_write(open(file) { |f| f.read })
|
398
|
+
pb.pixbuf
|
399
|
+
end
|
365
400
|
end
|
366
401
|
|
367
402
|
class MessageDialog < Gtk::Dialog
|
@@ -457,8 +492,8 @@ module Grumblr
|
|
457
492
|
self.logo = $gui.logo
|
458
493
|
self.program_name = Grumblr::APP_NAME
|
459
494
|
self.version = Grumblr::VERSION
|
495
|
+
self.comments = Grumblr::APP_MOTTO
|
460
496
|
self.copyright = "Copyright (c)2009, Paul Philippov"
|
461
|
-
self.comments = "Tumblr companion for GNOME"
|
462
497
|
self.license = "New BSD License.\nhttp://creativecommons.org/licenses/BSD/"
|
463
498
|
self.website = "http://themactep.com/grumblr/"
|
464
499
|
self.authors = ['Paul Philippov <themactep@gmail.com>']
|
@@ -470,8 +505,8 @@ module Grumblr
|
|
470
505
|
class StatusIcon < Gtk::StatusIcon
|
471
506
|
def initialize
|
472
507
|
super
|
473
|
-
self.
|
474
|
-
self.tooltip = "
|
508
|
+
self.icon_name = 'grumblr'
|
509
|
+
self.tooltip = "#{Grumblr::APP_NAME} #{Grumblr::VERSION}"
|
475
510
|
self.signal_connect(:activate) do
|
476
511
|
if $gui.visible?
|
477
512
|
$gui.minimize
|
data/lib/ppds/debug.rb
ADDED
data/lib/ppds/tumblr.rb
CHANGED
@@ -4,13 +4,36 @@ require 'xml'
|
|
4
4
|
|
5
5
|
module Ppds
|
6
6
|
class User < ClassFactory
|
7
|
-
attr_accessor :
|
8
|
-
:
|
7
|
+
attr_accessor :can_ask_question,
|
8
|
+
:can_upload_aiff,
|
9
|
+
:can_upload_audio,
|
10
|
+
:can_upload_video,
|
11
|
+
:default_post_format,
|
12
|
+
:liked_post_count,
|
13
|
+
:max_video_bytes_uploaded,
|
14
|
+
:vimeo_login_url
|
9
15
|
end
|
10
16
|
|
11
17
|
class Blog < ClassFactory
|
12
|
-
attr_accessor :
|
13
|
-
:
|
18
|
+
attr_accessor :avatar_url,
|
19
|
+
:backup_post_limit,
|
20
|
+
:draft_count,
|
21
|
+
:followers,
|
22
|
+
:is_admin,
|
23
|
+
:is_primary,
|
24
|
+
:messages_count,
|
25
|
+
:name,
|
26
|
+
:posts,
|
27
|
+
:private_id,
|
28
|
+
:queue_count,
|
29
|
+
:title,
|
30
|
+
:twitter_enabled,
|
31
|
+
:type,
|
32
|
+
:url,
|
33
|
+
# with include-theme=1:
|
34
|
+
:description,
|
35
|
+
:custom_css,
|
36
|
+
:theme_source
|
14
37
|
end
|
15
38
|
|
16
39
|
class Tumblr
|
@@ -23,7 +46,7 @@ module Ppds
|
|
23
46
|
'quote' => ['quote'],
|
24
47
|
'photo' => [],
|
25
48
|
'video' => [],
|
26
|
-
'audio' => [
|
49
|
+
'audio' => []
|
27
50
|
}
|
28
51
|
|
29
52
|
CONCURENT_FIELDS = {
|
@@ -33,7 +56,7 @@ module Ppds
|
|
33
56
|
'quote' => [],
|
34
57
|
'photo' => ['source', 'data'],
|
35
58
|
'video' => ['embed', 'data'],
|
36
|
-
'audio' => []
|
59
|
+
'audio' => ['data', 'externally-hosted-url']
|
37
60
|
}
|
38
61
|
|
39
62
|
OPTIONAL_FIELDS = {
|
@@ -56,6 +79,7 @@ module Ppds
|
|
56
79
|
def query(action, data)
|
57
80
|
raise 'Cannot authenticate without credentials' unless data[:email] and data[:password]
|
58
81
|
response = RestClient.post(API_URL + action, data)
|
82
|
+
dump(response) if DEBUG
|
59
83
|
response.to_str
|
60
84
|
rescue RestClient::RequestFailed => e
|
61
85
|
raise 'Query failed: %s' % e.response.body
|
data/setup.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ftools'
|
5
|
+
|
6
|
+
unless Process.uid == 0
|
7
|
+
puts "Must run as root"
|
8
|
+
exit
|
9
|
+
end
|
10
|
+
|
11
|
+
version = File.open('VERSION') { |f| f.read }
|
12
|
+
|
13
|
+
Gem.path.each do |path|
|
14
|
+
puts "Checking out #{path}"
|
15
|
+
path = File.join(path, 'gems', "grumblr-#{version}")
|
16
|
+
unless File.directory?(path)
|
17
|
+
puts " Gem not found\n\n"
|
18
|
+
next
|
19
|
+
end
|
20
|
+
puts " Gem found!"
|
21
|
+
puts " Copying data:"
|
22
|
+
|
23
|
+
target = '/usr/share/pixmaps/grumblr.svg'
|
24
|
+
if File.exists?(target)
|
25
|
+
puts " - #{target} exists, skipping."
|
26
|
+
else
|
27
|
+
puts " + #{target} does not exist. copying"
|
28
|
+
File.copy File.join(path, 'data', 'pixmaps', 'grumblr.svg'),
|
29
|
+
target, :verbose => true
|
30
|
+
end
|
31
|
+
|
32
|
+
target = '/usr/share/applications/grumblr.desktop'
|
33
|
+
if File.exists?(target)
|
34
|
+
puts " - #{target} exists, skipping."
|
35
|
+
else
|
36
|
+
puts " + #{target} does not exist, copying"
|
37
|
+
File.copy File.join(path, 'data', 'grumblr.desktop'),
|
38
|
+
target, :verbose => true
|
39
|
+
end
|
40
|
+
|
41
|
+
target = '/usr/local/bin/grumblr'
|
42
|
+
if File.exists?(target)
|
43
|
+
puts " - #{target} exists, linking."
|
44
|
+
else
|
45
|
+
puts " + #{target} does not exist, copying"
|
46
|
+
File.symlink File.join(path, 'bin', 'grumblr'), target
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grumblr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 3
|
10
|
+
version: 2.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paul Philippov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-02 00:00:00 +06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
version: 1.6.0
|
63
63
|
type: :runtime
|
64
64
|
version_requirements: *id003
|
65
|
-
description: Grumblr is a message poster to Tumblr blogs
|
65
|
+
description: Grumblr is a message poster to Tumblr blogs.
|
66
66
|
email: themactep@gmail.com
|
67
67
|
executables:
|
68
68
|
- grumblr
|
@@ -76,24 +76,27 @@ extra_rdoc_files:
|
|
76
76
|
files:
|
77
77
|
- bin/grumblr
|
78
78
|
- data/grumblr.desktop
|
79
|
+
- data/pixmaps/grumblr-plain.svg
|
80
|
+
- data/pixmaps/grumblr.svg
|
81
|
+
- data/pixmaps/video.bmp
|
79
82
|
- data/pixmaps/photo.bmp
|
80
83
|
- data/pixmaps/text.bmp
|
84
|
+
- data/pixmaps/spinner.gif
|
85
|
+
- data/pixmaps/link.bmp
|
86
|
+
- data/pixmaps/grumblr.png
|
81
87
|
- data/pixmaps/audio.bmp
|
82
88
|
- data/pixmaps/chat.bmp
|
83
89
|
- data/pixmaps/quote.bmp
|
84
|
-
- data/pixmaps/grumblr.png
|
85
|
-
- data/pixmaps/grumblr.svg
|
86
|
-
- data/pixmaps/link.bmp
|
87
|
-
- data/pixmaps/spinner.gif
|
88
|
-
- data/pixmaps/video.bmp
|
89
|
-
- lib/ppds/tumblr.rb
|
90
90
|
- lib/grumblr/core.rb
|
91
91
|
- lib/grumblr/ui.rb
|
92
|
+
- lib/ppds/tumblr.rb
|
93
|
+
- lib/ppds/debug.rb
|
92
94
|
- LICENSE
|
93
95
|
- README
|
94
96
|
- VERSION
|
95
97
|
- Changelog
|
96
98
|
- grumblr.gemspec
|
99
|
+
- setup.rb
|
97
100
|
has_rdoc: true
|
98
101
|
homepage: http://themactep.com/grumblr/
|
99
102
|
licenses: []
|
@@ -127,6 +130,6 @@ rubyforge_project: grumblr
|
|
127
130
|
rubygems_version: 1.3.7
|
128
131
|
signing_key:
|
129
132
|
specification_version: 3
|
130
|
-
summary: Tumblr companion
|
133
|
+
summary: a Tumblr companion
|
131
134
|
test_files: []
|
132
135
|
|