=== applets/SlimBrowser/SlimBrowserApplet.lua ================================================================== --- applets/SlimBrowser/SlimBrowserApplet.lua (revision 36636) +++ applets/SlimBrowser/SlimBrowserApplet.lua (local) @@ -1154,7 +1154,7 @@ _renderSlider(step, data.item_loop[1]) -- avoid infinite request loop on count == 0 - elseif step.menu and data and data.count and data.count == 0 then + elseif step.menu and data and data.count and tonumber(data.count) == 0 then -- this will render a blank menu, which is typically undesirable -- but we don't want to reach the next clause -- count == 0 responses should not be typical @@ -1471,8 +1471,13 @@ return EVENT_CONSUME end - _player:presetPress(number) - _goNowPlayingAction() + if _player and _player:isPresetDefined(tonumber(number)) then + _player:presetPress(number) + _goNowPlayingAction() + else + Framework:playSound("BUMP") + Window:getTopNonTransientWindow():bumpLeft() + end return EVENT_CONSUME end @@ -1634,7 +1639,7 @@ _actionHandler = function(menu, menuItem, db, dbIndex, event, actionName, item, selectedIndex) log:debug("_actionHandler(", actionName, ")") - if logd:isDebug() then + if log:isDebug() then debug.dump(item, 4) end @@ -1799,6 +1804,8 @@ end -- elseif bAction -- now we may have found a command + -- TODO: go into this control structure if we have a jsonAction or if we have a bare nextWindow (no json action anywhere) + -- this is bug 13516 if jsonAction or nextWindow then log:debug("_actionHandler(", actionName, "): json action") if menuItem and not (nextWindow and nextWindow == "home") then === jive/slim/Player.lua ================================================================== --- jive/slim/Player.lua (revision 36636) +++ jive/slim/Player.lua (local) @@ -188,6 +188,7 @@ return nil end + function getLastBrowse(self, key) if self.browseHistory[key] then return self.browseHistory[key] @@ -1098,7 +1099,7 @@ iconbar:setRepeat(nil) iconbar:setShuffle(nil) iconbar:setPlaylistMode(nil) - + -- unsubscribe from playerstatus and displaystatus events self.slimServer.comet:startBatch() self.slimServer.comet:unsubscribe('/slim/playerstatus/' .. self.id) @@ -1182,6 +1183,7 @@ self.playlistSize = tonumber(event.data.playlist_tracks) -- add 1 to playlist_cur_index to get 1-based place in playlist self.playlistCurrentIndex = event.data.playlist_cur_index and tonumber(event.data.playlist_cur_index) + 1 + self.definedPresets = event.data.preset_loop -- update our player state, and send notifications -- create a playerInfo table, to allow code reuse @@ -1431,6 +1433,15 @@ end +function isPresetDefined(self, preset) + if self.definedPresets and tonumber(self.definedPresets[preset]) == 0 then + return false + else + return true + end +end + + function getAlarmState(self) return self.alarmState end