mumbletune 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mumbletune (0.1.0)
4
+ mumbletune (0.1.1)
5
5
  eventmachine
6
6
  meta-spotify
7
7
  mumble-ruby
data/README.md CHANGED
@@ -4,12 +4,12 @@ MUMBLETUNE is an amiable bot that connects to a mumble server and allows users t
4
4
 
5
5
  ## Installation
6
6
 
7
- First, install Hexxeh's (spotify-websocket-api)[https://github.com/Hexxeh/spotify-websocket-api].
7
+ First, install Hexxeh's [spotify-websocket-api](https://github.com/Hexxeh/spotify-websocket-api).
8
8
 
9
9
  git clone git://github.com/Hexxeh/spotify-websocket-api.git
10
10
  cd spotify-websocket-api
11
11
  python setup.py build
12
- puthon setup.py install
12
+ python setup.py install
13
13
 
14
14
  Then, add this line to your application's Gemfile:
15
15
 
data/conf.example.yaml ADDED
@@ -0,0 +1,15 @@
1
+ spotify:
2
+ username: "sp_username"
3
+ password: "sp_password"
4
+ region: "us"
5
+ mumble:
6
+ host: "mumble-server.example.com"
7
+ port: 64738
8
+ username: "mumbletune"
9
+ password: "server_password"
10
+ channel: "Music Room"
11
+ mpd:
12
+ host: "localhost"
13
+ port: 6600
14
+ fifo_out: "/tmp/mumble.fifo"
15
+ default_volume: 60
@@ -14,14 +14,15 @@ module Mumbletune
14
14
  @history = Array.new
15
15
  @prev_id = 0
16
16
 
17
- self.default_volume
17
+ self.defaults
18
18
  self.establish_callbacks
19
19
  end
20
20
 
21
21
  # Setup
22
22
 
23
- def default_volume
23
+ def defaults
24
24
  @mpd.volume = Mumbletune.config["mpd"]["default_volume"] || 100
25
+ @mpd.consume = true
25
26
  end
26
27
 
27
28
  def establish_callbacks
@@ -91,13 +92,20 @@ module Mumbletune
91
92
  end
92
93
 
93
94
  def queue
94
- # associate known Tracks with Queue items
95
- mapped_queue = @mpd.queue.map do |mpd_song|
95
+ # Combine the future queue with the current track.
96
+ # MPD puts the current track in its queue only if
97
+ # other tracks are queued to play. Account for this.
98
+ queue = @mpd.queue.unshift @mpd.current_song
99
+ queue.delete_at(0) if queue[1] && queue[0] == queue[1]
100
+
101
+ # Associate known Tracks with Queue items.
102
+ mapped_queue = queue.map do |mpd_song|
96
103
  t = Track.retreive_from_mpd_id(mpd_song.id)
97
- t.queue_pos = mpd_song.pos
98
- t
104
+ if t
105
+ t.queue_pos = mpd_song.pos
106
+ t
107
+ end
99
108
  end
100
- # mapped_queue.delete_if { |t| t == current_song }
101
109
  mapped_queue
102
110
  end
103
111
 
@@ -126,37 +134,6 @@ module Mumbletune
126
134
  end
127
135
  end
128
136
 
129
-
130
- =begin
131
- # Deprecated add methods. Time to remove?
132
-
133
- def add(track)
134
- id = @mpd.addid track.url
135
- track.mpd_id = id
136
- end
137
-
138
- def add_batch(tracks)
139
- tracks.each do |t|
140
- id = @mpd.addid t.url
141
- t.mpd_id = id
142
- end
143
- end
144
-
145
- def add_now(track)
146
- id = @mpd.addid track.url, 1
147
- track.mpd_id = id
148
- @mpd.next
149
- end
150
-
151
- def add_now_batch(tracks)
152
- tracks.each do |t|
153
- id = @mpd.addid t.url, tracks.index(t)+1
154
- t.mpd_id = id
155
- end
156
- @mpd.next
157
- end
158
- =end
159
-
160
137
  # Playback commands
161
138
 
162
139
  def play
@@ -1,3 +1,3 @@
1
1
  module Mumbletune
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -203,6 +203,7 @@ files:
203
203
  - README.md
204
204
  - Rakefile
205
205
  - bin/mumbletune
206
+ - conf.example.yaml
206
207
  - docs/commands.md
207
208
  - lib/mumbletune.rb
208
209
  - lib/mumbletune/collection.rb