fix issues with empty playlist. fixes #4

This commit is contained in:
Andrew Kelley 2012-03-06 03:38:22 -08:00
parent a25fbbfb7c
commit bbffeb4271
3 changed files with 5 additions and 8 deletions

4
TODO
View file

@ -1,7 +1,3 @@
* when playlist is empty...
- alt right click broken
- arrow keys don't do anything in library
- dynamic mode doesn't work unless paused
* if you select the last track in blink 182 enema of the state and press down,
it goes to the wrong track next

View file

@ -455,8 +455,6 @@ nextRepeatState = ->
keyboard_handlers = do ->
upDownHandler = (event) ->
return unless mpd.playlist.item_list.length
if event.keyCode == 38 # up
default_index = mpd.playlist.item_list.length - 1
dir = -1

View file

@ -140,9 +140,10 @@ setDynamicMode = (value) ->
previous_ids = {}
checkDynamicMode = ->
return unless stickers_enabled
return unless my_mpd.status?.current_item?
return unless my_mpd.library.artists.length
return unless got_stickers
item_list = my_mpd.playlist.item_list
current_id = my_mpd.status.current_item.id
current_id = my_mpd.status.current_item?.id
current_index = -1
all_ids = {}
new_files = []
@ -203,6 +204,7 @@ scrubStaleUserNames = ->
sendStatus()
sticker_name = "groovebasin.last-queued"
got_stickers = false
updateStickers = ->
my_mpd.sendCommand "sticker find song \"/\" \"#{sticker_name}\"", (msg) ->
current_file = null
@ -217,6 +219,7 @@ updateStickers = ->
track.last_queued = new Date(value)
else
log.error "#{current_file} has a last-queued sticker of #{value} but we don't have it in our library cache."
got_stickers = true
getRandomSongFiles = (count) ->
return [] if count == 0