mumbletune 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +9 -1
- data/README.md +1 -9
- data/docs/commands.md +22 -13
- data/lib/mumbletune/messages.rb +7 -3
- data/lib/mumbletune/mpd_client.rb +19 -5
- data/lib/mumbletune/mumble_client.rb +5 -2
- data/lib/mumbletune/templates/commands.mustache +17 -5
- data/lib/mumbletune/version.rb +1 -1
- data/lib/mumbletune.rb +2 -0
- data/mumbletune.gemspec +1 -0
- metadata +18 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mumbletune (0.1.
|
4
|
+
mumbletune (0.1.2)
|
5
5
|
eventmachine
|
6
6
|
meta-spotify
|
7
7
|
mumble-ruby
|
@@ -21,7 +21,14 @@ GEM
|
|
21
21
|
blankslate (3.1.2)
|
22
22
|
celt-ruby (0.0.1)
|
23
23
|
ffi
|
24
|
+
columnize (0.3.6)
|
24
25
|
daemons (1.1.9)
|
26
|
+
debugger (1.5.0)
|
27
|
+
columnize (>= 0.3.1)
|
28
|
+
debugger-linecache (~> 1.2.0)
|
29
|
+
debugger-ruby_core_source (~> 1.2.0)
|
30
|
+
debugger-linecache (1.2.0)
|
31
|
+
debugger-ruby_core_source (1.2.0)
|
25
32
|
eventmachine (1.0.3)
|
26
33
|
ffi (1.4.0)
|
27
34
|
httparty (0.10.2)
|
@@ -62,5 +69,6 @@ PLATFORMS
|
|
62
69
|
|
63
70
|
DEPENDENCIES
|
64
71
|
bundler (~> 1.3)
|
72
|
+
debugger
|
65
73
|
mumbletune!
|
66
74
|
rake
|
data/README.md
CHANGED
@@ -11,15 +11,7 @@ First, install Hexxeh's [spotify-websocket-api](https://github.com/Hexxeh/spotif
|
|
11
11
|
python setup.py build
|
12
12
|
python setup.py install
|
13
13
|
|
14
|
-
Then,
|
15
|
-
|
16
|
-
gem 'mumbletune'
|
17
|
-
|
18
|
-
And then execute:
|
19
|
-
|
20
|
-
$ bundle
|
21
|
-
|
22
|
-
Or install it yourself as:
|
14
|
+
Then, install the gem:
|
23
15
|
|
24
16
|
$ gem install mumbletune
|
25
17
|
|
data/docs/commands.md
CHANGED
@@ -1,15 +1,24 @@
|
|
1
|
-
Command
|
2
|
-
|
3
|
-
play
|
4
|
-
play
|
5
|
-
play
|
6
|
-
play
|
7
|
-
what
|
8
|
-
next
|
9
|
-
undo
|
10
|
-
clear
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
| Command | Action |
|
2
|
+
|---------------------------------------|--------------------------------------------|
|
3
|
+
| play *track* | Queue this song. |
|
4
|
+
| play *artist* | Queue 10 tracks by this artist. |
|
5
|
+
| play *album* | Queue this entire album. |
|
6
|
+
| play *something now* | Play this shit right now! |
|
7
|
+
| what | Show what is playing, and what is queued. |
|
8
|
+
| next | Jump to the next song in the queue. |
|
9
|
+
| undo | Undo the last addition to the queue. |
|
10
|
+
| clear | Clear the queue. |
|
11
|
+
| pause | Pause. |
|
12
|
+
| unpause | Unpause. |
|
13
|
+
| volume? | Get the current volume level. |
|
14
|
+
| volume *0-100* | Set the volume. |
|
15
|
+
|
16
|
+
<br>
|
17
|
+
For example:
|
18
|
+
|
19
|
+
play coldplay
|
20
|
+
play nicki minaj starships
|
21
|
+
|
22
|
+
Mumbletune uses Spotify to find music.
|
14
23
|
|
15
24
|
<!-- Generate HTML with: $ pandoc -f markdown -->
|
data/lib/mumbletune/messages.rb
CHANGED
@@ -79,15 +79,19 @@ module Mumbletune
|
|
79
79
|
when /^next$/i
|
80
80
|
Mumbletune.player.next
|
81
81
|
current = Mumbletune.player.current_song
|
82
|
-
message.
|
82
|
+
message.respond_all "#{message.sender.name} skipped to #{current.artist} - #{current.name}" if current
|
83
83
|
|
84
84
|
when /^clear$/i
|
85
85
|
Mumbletune.player.clear_queue
|
86
|
-
message.
|
86
|
+
message.respond_all "#{message.sender.name} cleared the queue."
|
87
87
|
|
88
88
|
when /^undo$/i
|
89
89
|
removed = Mumbletune.player.undo
|
90
|
-
|
90
|
+
if message.sender.name == removed.user
|
91
|
+
message.respond_all "#{message.sender.name} removed #{removed.description}."
|
92
|
+
else
|
93
|
+
message.respond_all "#{message.sender.name} removed #{removed.description} at #{removed.user} added."
|
94
|
+
end
|
91
95
|
|
92
96
|
|
93
97
|
when /^(what|queue)$/i
|
@@ -8,8 +8,8 @@ module Mumbletune
|
|
8
8
|
|
9
9
|
def initialize(host=Mumbletune.config['mpd']['host'], port=Mumbletune.config['mpd']['port'])
|
10
10
|
@mpd = MPD.new(host, port)
|
11
|
-
|
12
|
-
|
11
|
+
self.connect
|
12
|
+
self.clear_all
|
13
13
|
|
14
14
|
@history = Array.new
|
15
15
|
@prev_id = 0
|
@@ -18,6 +18,17 @@ module Mumbletune
|
|
18
18
|
self.establish_callbacks
|
19
19
|
end
|
20
20
|
|
21
|
+
def connect
|
22
|
+
@disconnecting = false
|
23
|
+
@mpd.connect true # 'true' enables callbacks
|
24
|
+
end
|
25
|
+
|
26
|
+
def disconnect
|
27
|
+
@disconnecting = true
|
28
|
+
@mpd.disconnect
|
29
|
+
puts ">> Disconnected from MPD"
|
30
|
+
end
|
31
|
+
|
21
32
|
# Setup
|
22
33
|
|
23
34
|
def defaults
|
@@ -27,8 +38,8 @@ module Mumbletune
|
|
27
38
|
|
28
39
|
def establish_callbacks
|
29
40
|
@mpd.on :connection do |status|
|
30
|
-
if status == false
|
31
|
-
|
41
|
+
if status == false && !@disconnecting
|
42
|
+
self.connect
|
32
43
|
else
|
33
44
|
puts ">> MPD happens to be connected."
|
34
45
|
end
|
@@ -95,7 +106,10 @@ module Mumbletune
|
|
95
106
|
# Combine the future queue with the current track.
|
96
107
|
# MPD puts the current track in its queue only if
|
97
108
|
# other tracks are queued to play. Account for this.
|
98
|
-
queue = @mpd.queue
|
109
|
+
queue = @mpd.queue
|
110
|
+
queue.unshift @mpd.current_song if @mpd.current_song
|
111
|
+
|
112
|
+
# Delete index 0 if first queue position and current song are duplicates.
|
99
113
|
queue.delete_at(0) if queue[1] && queue[0] == queue[1]
|
100
114
|
|
101
115
|
# Associate known Tracks with Queue items.
|
@@ -17,7 +17,7 @@ module Mumbletune
|
|
17
17
|
end
|
18
18
|
|
19
19
|
@cli.on_text_message do |data|
|
20
|
-
if data[:session].include?(@cli.me[:
|
20
|
+
if data[:session].include?(@cli.me[:session]) # if message was sent to us
|
21
21
|
# interpret the message in a separate thread
|
22
22
|
Thread.new { Message.parse(@cli, data) }
|
23
23
|
end
|
@@ -41,7 +41,10 @@ module Mumbletune
|
|
41
41
|
@cli.stream_raw_audio(input)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
def disconnect
|
45
|
+
@cli.disconnect
|
46
|
+
puts ">> Disconnected from Mumble"
|
47
|
+
end
|
45
48
|
end
|
46
49
|
|
47
50
|
end
|
@@ -13,19 +13,19 @@
|
|
13
13
|
</thead>
|
14
14
|
<tbody>
|
15
15
|
<tr class="odd">
|
16
|
-
<td align="left">play
|
16
|
+
<td align="left">play <em>track</em></td>
|
17
17
|
<td align="left">Queue this song.</td>
|
18
18
|
</tr>
|
19
19
|
<tr class="even">
|
20
|
-
<td align="left">play
|
20
|
+
<td align="left">play <em>artist</em></td>
|
21
21
|
<td align="left">Queue 10 tracks by this artist.</td>
|
22
22
|
</tr>
|
23
23
|
<tr class="odd">
|
24
|
-
<td align="left">play
|
24
|
+
<td align="left">play <em>album</em></td>
|
25
25
|
<td align="left">Queue this entire album.</td>
|
26
26
|
</tr>
|
27
27
|
<tr class="even">
|
28
|
-
<td align="left">play
|
28
|
+
<td align="left">play <em>something now</em></td>
|
29
29
|
<td align="left">Play this shit right now!</td>
|
30
30
|
</tr>
|
31
31
|
<tr class="odd">
|
@@ -45,12 +45,24 @@
|
|
45
45
|
<td align="left">Clear the queue.</td>
|
46
46
|
</tr>
|
47
47
|
<tr class="odd">
|
48
|
+
<td align="left">pause</td>
|
49
|
+
<td align="left">Pause.</td>
|
50
|
+
</tr>
|
51
|
+
<tr class="even">
|
52
|
+
<td align="left">unpause</td>
|
53
|
+
<td align="left">Unpause.</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="odd">
|
48
56
|
<td align="left">volume?</td>
|
49
57
|
<td align="left">Get the current volume level.</td>
|
50
58
|
</tr>
|
51
59
|
<tr class="even">
|
52
|
-
<td align="left">volume
|
60
|
+
<td align="left">volume <em>0-100</em></td>
|
53
61
|
<td align="left">Set the volume.</td>
|
54
62
|
</tr>
|
55
63
|
</tbody>
|
56
64
|
</table>
|
65
|
+
<p><br> For example:</p>
|
66
|
+
<pre><code>play coldplay
|
67
|
+
play nicki minaj starships</code></pre>
|
68
|
+
<p>Mumbletune uses Spotify to find music.</p>
|
data/lib/mumbletune/version.rb
CHANGED
data/lib/mumbletune.rb
CHANGED
data/mumbletune.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumbletune
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -187,6 +187,22 @@ dependencies:
|
|
187
187
|
- - ! '>='
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: debugger
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
190
206
|
description: Mumbletune connects to a mumble server and allows users to interact with
|
191
207
|
and play a queue of music. Currently plays from Spotify alone.
|
192
208
|
email:
|