robut 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ end
11
11
  group :plugin do
12
12
  gem 'calc'
13
13
  gem 'twss'
14
- gem 'rdio'
14
+ gem 'rdio', '0.0.91' # .92 is horked
15
15
  gem 'sinatra'
16
16
  gem 'meme_generator'
17
17
  end
@@ -93,7 +93,7 @@ class Robut::Connection
93
93
  rsp = plugin.handle(time, nick, message)
94
94
  break if rsp == true
95
95
  rescue => e
96
- reply("I just pooped myself trying to run #{plugin.class.name}. AWK-WAAAARD!")
96
+ reply("UH OH! #{plugin.class.name} just crashed!")
97
97
  if config.logger
98
98
  config.logger.error e
99
99
  config.logger.error e.backtrace.join("\n")
@@ -19,6 +19,20 @@ class Robut::Plugin::Rdio < Robut::Plugin::Base
19
19
 
20
20
  # The host the Rdio web player will run on. Defaults to localhost.
21
21
  attr_accessor :host
22
+
23
+ # The playback token for +domain+. If you're accessing Rdio on
24
+ # localhost, you shouldn't need to change this. Otherwise,
25
+ # download the rdio-python plugin:
26
+ #
27
+ # https://github.com/rdio/rdio-python
28
+ #
29
+ # and generate a new token for your domain:
30
+ #
31
+ # ./rdio-call --consumer-key=YOUR_CONSUMER_KEY --consumer-secret=YOUR_CONSUMER_SECRET getPlaybackToken domain=YOUR_DOMAIN
32
+ attr_accessor :token
33
+
34
+ # The domain associated with +token+. Defaults to localhost.
35
+ attr_accessor :domain
22
36
  end
23
37
 
24
38
  # Starts a Robut::Plugin::Rdio::Server server for communicating with
@@ -26,6 +40,8 @@ class Robut::Plugin::Rdio < Robut::Plugin::Base
26
40
  # you plan on using this gem.
27
41
  def self.start_server
28
42
  @server = Thread.new { Server.run! :host => (host || "localhost"), :port => (port || 4567) }
43
+ Server.token = self.token || "GAlNi78J_____zlyYWs5ZG02N2pkaHlhcWsyOWJtYjkyN2xvY2FsaG9zdEbwl7EHvbylWSWFWYMZwfc="
44
+ Server.domain = self.domain || "localhost"
29
45
  end
30
46
 
31
47
  # Queues songs into the Rdio web player. @nick play search query
@@ -34,7 +34,8 @@
34
34
 
35
35
  <script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
36
36
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
37
- <script src="/js/rdio.js"></script>
37
+ <script src="/js/vars.js"></script>
38
+ <script src="/js/rdio.js"></script>
38
39
  <!--[if lt IE 7 ]>
39
40
  <script src="js/libs/dd_belatedpng.js"></script>
40
41
  <script> DD_belatedPNG.fix('img, .png_bg');</script>
@@ -120,8 +120,8 @@ RdioPlayer = (function () {
120
120
 
121
121
  $(document).ready(function () {
122
122
  window.rdio = new RdioPlayer({
123
- token: "GAlNi78J_____zlyYWs5ZG02N2pkaHlhcWsyOWJtYjkyN2xvY2FsaG9zdEbwl7EHvbylWSWFWYMZwfc=",
124
- domain: "localhost",
123
+ token: rdio_token,
124
+ domain: rdio_domain,
125
125
  elementId: 'apiswf',
126
126
  callbackName: 'rdio_callback'
127
127
  });
@@ -15,6 +15,20 @@ class Robut::Plugin::Rdio < Robut::Plugin::Base
15
15
  # A list of items that haven't been fetched by the web playback
16
16
  # API yet.
17
17
  attr_accessor :queue
18
+
19
+ # The playback token for +domain+. If you're accessing Rdio over
20
+ # localhost, you shouldn't need to change this. Otherwise,
21
+ # download the rdio-python plugin:
22
+ #
23
+ # https://github.com/rdio/rdio-python
24
+ #
25
+ # and generate a new token for your domain:
26
+ #
27
+ # ./rdio-call --consumer-key=YOUR_CONSUMER_KEY --consumer-secret=YOUR_CONSUMER_SECRET getPlaybackToken domain=YOUR_DOMAIN
28
+ attr_accessor :token
29
+
30
+ # The domain associated with +token+. Defaults to localhost.
31
+ attr_accessor :domain
18
32
  end
19
33
  self.queue = []
20
34
 
@@ -23,6 +37,14 @@ class Robut::Plugin::Rdio < Robut::Plugin::Base
23
37
  File.read(File.expand_path('public/index.html', File.dirname(__FILE__)))
24
38
  end
25
39
 
40
+ get '/js/vars.js' do
41
+ content_type 'text/javascript'
42
+ <<END
43
+ var rdio_token = '#{self.class.token}';
44
+ var rdio_domain = '#{self.class.domain}';
45
+ END
46
+ end
47
+
26
48
  # Returns the sources that haven't been fetched yet.
27
49
  get '/queue.json' do
28
50
  queue = self.class.queue.dup
data/lib/robut/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Robut # :nodoc:
2
2
  # Robut's version number.
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: robut
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Justin Weiss
@@ -10,11 +10,12 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-18 00:00:00 -07:00
13
+ date: 2011-05-19 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: xmpp4r
18
+ prerelease: false
18
19
  requirement: &id001 !ruby/object:Gem::Requirement
19
20
  none: false
20
21
  requirements:
@@ -22,7 +23,6 @@ dependencies:
22
23
  - !ruby/object:Gem::Version
23
24
  version: 0.5.0
24
25
  type: :runtime
25
- prerelease: false
26
26
  version_requirements: *id001
27
27
  description: A simple plugin-enabled HipChat bot
28
28
  email:
@@ -99,23 +99,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- hash: -555971066717655202
103
- segments:
104
- - 0
105
102
  version: "0"
106
103
  required_rubygems_version: !ruby/object:Gem::Requirement
107
104
  none: false
108
105
  requirements:
109
106
  - - ">="
110
107
  - !ruby/object:Gem::Version
111
- hash: -555971066717655202
112
- segments:
113
- - 0
114
108
  version: "0"
115
109
  requirements: []
116
110
 
117
111
  rubyforge_project: robut
118
- rubygems_version: 1.5.2
112
+ rubygems_version: 1.6.2
119
113
  signing_key:
120
114
  specification_version: 3
121
115
  summary: A simple plugin-enabled HipChat bot