Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,416

    Raspberry PI,Jivelite and a Griffin Powermate

    One more question... are you using the WQVGA skin like the Touch? That
    display is slightly higher (in number of lines) than the one of the
    Touch (320x480 vs. 272x480). Are you using it with some black borders
    top/bottom?

    --

    Michael

  2. #12
    Junior Member
    Join Date
    Aug 2005
    Posts
    21
    Quote Originally Posted by mherger View Post
    One more question... are you using the WQVGA skin like the Touch? That
    display is slightly higher (in number of lines) than the one of the
    Touch (320x480 vs. 272x480). Are you using it with some black borders
    top/bottom?

    --

    Michael
    Hi

    Yes there are black borders at the top and bottom. On the jivelite skin selection page it says "WQVGA small print skin" is selected

    Thanks
    San

  3. #13
    Junior Member
    Join Date
    Aug 2005
    Posts
    21

    Now Playing Overlay Code

    Hi

    Here are the code changes I made to the Jivelite's Now Playing Applet to allow an overlay be displayed and controlled by alternative devices e.g. keyboard, Powermate or an appropriately programmed IR controller via LIRC (sending the same keycodes). I'm not a lua expert so this can probably be done much more elegantly.

    1. Add a listener to NowPlaying s o that overlay window can be displayed when Down Arrow is pressed.
    In jivelite/share/jive/applets/NowPlaying/NowPlayingApplet.Lua amend the function at line 1165 to add a listener for down arrow key. This is inside the _installListeners Function.

    Before
    Code:
     -- FIXME: hack to deal with removing actions from left/right - fix this in more generic way?
            window:addListener(EVENT_KEY_PRESS,
                    function(event)
                            local keycode = event:getKeycode()
                            if keycode == KEY_LEFT then
                                    Framework:pushAction("back")
                                    return EVENT_CONSUME
                            end
                            if keycode == KEY_RIGHT then
                                    Framework:pushAction("go")
                                    return EVENT_CONSUME
                            end
                            return EVENT_UNUSED
                    end
            )
    After

    Code:
    -- FIXME: hack to deal with removing actions from left/right - fix this in more generic way?
    	window:addListener(EVENT_KEY_PRESS,
    		function(event)
                            local keycode = event:getKeycode()
                            if keycode == KEY_LEFT then
    				Framework:pushAction("back")
                                    return EVENT_CONSUME
                            end
                            if keycode == KEY_RIGHT then
    				Framework:pushAction("go")
    				return EVENT_CONSUME
    			end
    			if keycode == 8 then   -- Down Arrow pressed
    				local playerStatus = self.player and self.player:getPlayerStatus()
    				_powermate(playerStatus['playlist repeat'], playerStatus['playlist shuffle'])				
    				return EVENT_CONSUME
    			end
    			return EVENT_UNUSED
    		end
    	)
    2. Add the function that displays the overlay and processes keypresses to display icons. The icons are from the existing set as I can't draw. I added this after the _installListeners function in NowPlayingApplet.Lua

    The function just adds an overlay and puts the icon on the screen.

    Use up and down to navigate through the options, Press enter to select.


    Code:
    function _powermate(repeatMode, shuffleMode)
    	local popup = Window("window","Powermate Controller")
    
    
    	pmateActions = {
    		{icon='icon_popup_rew',			        action='jump_rew',		       popupclose=true},
    		{icon='icon_popup_fwd',			        action='jump_fwd',		       popupclose=true},
    		{icon='icon_popup_pause',			        action='pause',			       popupclose=true},
    		{icon='icon_popup_stop',			        action='stop',			       popupclose=true},		
    		{icon='icon_popup_play',			        action='play',			       popupclose=true},
    		{icon='icon_popup_repeat' .. repeatMode,	action='repeat_toggle', 	       popupclose=false, submodes=true},
    		{icon='icon_popup_shuffle'.. shuffleMode,	action='shuffle_toggle',	       popupclose=false, submodes=true},
    		{icon='icon_popup_volume',			action='volume_up',		       popupclose=true},
    		{icon='icon_popup_mute',			        action='mute',			       popupclose=true},
    		{icon='icon_popup_current_track_info',	action='go_current_track_info',  popupclose=true},
    	}
    
    	popup.transparent = true
    	popup.bgImg = ""
    	iconindex = 1
    	icon_name = pmateActions[1].icon
    	action_txt = pmateActions[1].action
    	pmateButton = Button( 
    		Icon(icon_name),
    		function() 
    			Framework:pushAction(action_txt)
    			return EVENT_CONSUME
    		end
    	)
    
    	popup:addActionListener("back", self, _goHomeAction)
    	popup:addActionListener("go_home", self, _goHomeAction)
    
    	popup:addListener(EVENT_KEY_PRESS,
    			function(event)
    				local keycode = event:getKeycode()
    	
    	                        if keycode == KEY_LEFT  then      -- Left Key pressed, so exit
    					Framework:pushAction("back")
    					popup:close()
                    	                return EVENT_CONSUME
                            	end
    	                        if keycode == KEY_HOME  then      -- HOME  Key pressed, so exit
    					Framework:pushAction("go_home")
    					popup:close()
                    	                return EVENT_CONSUME
                            	end
    				
    				if (keycode == KEY_ENTER or keycode == 1) and pmateActions[iconindex].popupclose then  -- Enter pressed, do something and close window
    					Framework:pushAction(action_txt)
    					popup:hide()
    					return EVENT_CONSUME
    				end
    				
    				if (keycode == KEY_ENTER or keycode == 1)  and  pmateActions[iconindex].submodes then  -- Enter pressed and sub mode exists
    				   mode = (tonumber(icon_name:sub(-1))+1) % 3
    				   icon_name = icon_name:sub(1,-2) .. mode
    				   pmateActions[iconindex].icon = icon_name
    				   action_txt = pmateActions[iconindex].action
    				   Framework:pushAction(action_txt)
    
    				end
    			
    				popup:show()
    				
    				if keycode  == 4 then 		-- up 
    					iconindex  = (iconindex - 1) %(#pmateActions+1)
    					if  iconindex == 0 then 
    					    iconindex = #pmateActions
    					end
    					icon_name = pmateActions[iconindex].icon
    
    				end
    
    				if keycode  == 8 then 		-- down 
    					iconindex  = (iconindex + 1) %(#pmateActions+1)
    					if  iconindex ==  0 then 
    					    iconindex = 1
    					end
    					icon_name = pmateActions[iconindex].icon
    				end
    
    				action_txt = pmateActions[iconindex].action
    	
    				newButton = Button( 
    					Icon(icon_name),
    					function() 
    						Framework:pushAction(action_txt)
    						return EVENT_CONSUME
    					end
    				)
    				popup:removeWidget(pmateButton)
    				pmateButton = newButton
    	
    				popup:addWidget(pmateButton)
    				popup:focusWidget(pmateButton)
    
                                    return EVENT_CONSUME
    
    
    			end
    			)
    
    	popup:addWidget(pmateButton)
    	popup:focusWidget(pmateButton)
            popup:show()
    	return EVENT_CONSUME
    
    end

    Hope this helps
    San
    Last edited by San; 2015-02-06 at 05:24.

  4. #14
    Member
    Join Date
    Nov 2014
    Location
    Cologne, Germany
    Posts
    33
    Using the the Griffin powermate to control jivelite/Squezelite seems to be pretty interesting. Is it possible to turn off the LED Light by software control?

  5. #15
    Junior Member
    Join Date
    Aug 2005
    Posts
    21
    Quote Originally Posted by Snyder View Post
    Using the the Griffin powermate to control jivelite/Squezelite seems to be pretty interesting. Is it possible to turn off the LED Light by software control?


    Hi,

    I couldn't see a setting to completely disable the LED on the powermate. However on the raspberry pi the powermate is controlled by Gizmo Daemon (gizmod). Gizmod lets you script control and allows control of the LED. So you can add a statement such as

    Gizmod.Powermates[0].LEDPercent = 0

    into the relevant gizmod python script to turn the LED off. Of course this only works once the script is running, so the LED is on until the script initialises.

    Hope this helps
    San
    Last edited by San; 2015-09-11 at 11:00.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •