I've been working on a plugin for lastfm support, using the shell-fm command
line client.
I've done this because the existing web based client isn't connecting to lastfm
properly
and I don't have enough knowledge about the lastfm API to get it working.
Since the
shell-fm program works fine and has a socket control interface, it works well
as a player.
This much I have been able to accomplish. It's working fine, I need to clean
it up a bit
and hope to submit for the 1.9.2 release in the next couple of weeks.
The one feature that I need to complete is to implement the "ban" and "love"
buttons.
I'd like to use the "1" and "3" keys (or similar). I'm struggling to figure
out how
to get the number buttons to cause an event to be propagated to the
eventhandler.
What would be even better is if I could add another menu while the
ShellfmPlayer is
operating. If someone can point me to an example of how I might do that, I
would
prefer to use menu. I haven't seen this in the past.
Snipets of the code are below. I register ShellfmPlayer as a player. The
eventhandler
only get certain key commands, STOP, PLAY_END, PLAYLIST_NEXT, SEEK. It never
gets
any messages when a number key is pressed. Where is the "glue" which binds
events
to the eventhandler in a AUDIO_PLAYER class?
Thanks,
Jim
from event import *
...
class PluginInterface(plugin.DaemonPlugin):
"""
This is the player plugin for the shell-fm. This class interacts with
the shell-fm deamon using the socket interface.
"""
def __init__(self):
plugin.Plugin.__init__(self)
print('%s.__init__()' % (self.__class__,))
# register it as the object to play audio
plugin.register(ShellfmPlayer(), plugin.AUDIO_PLAYER, True)
class ShellfmPlayer:
...
def eventhandler(self, event, menuw=None):
"""
eventhandler for mplayer control. If an event is not bound in this
function it will be passed over to the items eventhandler
"""
print('ShellfmPlayer event handler %s' % event)
if event in (STOP, PLAY_END, USER_END):
self.playerGUI.stop()
return self.item.eventhandler(event)
elif event in (PLAYLIST_NEXT,SEEK):
self.skip()
return True
elif event == INPUT_1:
self.ban()
return True
elif event == INPUT_3:
self.love()
return True
else:
# everything else: give event to the items eventhandler
return self.item.eventhandler(event)
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Freevo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-users