class XmRadioItem(AudioItem): """ This is the class that actually runs the commands. Eventually hope to add actions for different ways of running commands and for displaying stdout and stderr of last command run. """ def actions(self): """ return a list of actions for this item """ items = [(self.play, _('Listen to XM Station'))] return items def play(self, arg=None, menuw=None): self.elapsed = 0 if not self.menuw: self.menuw = menuw self.player = PlayerGUI(self, menuw) error = self.player.play() if error and menuw: AlertBox(text=error).show() rc.post_event(rc.PLAY_END) def stop(self, arg=None, menuw=None): """ Stop the current playing """ print 'XmRadioItem stop' self.player.stop()
class XmRadioItem(AudioItem): """ This is the class that actually runs the commands. Eventually hope to add actions for different ways of running commands and for displaying stdout and stderr of last command run. """ def actions(self): """ return a list of actions for this item """ items = [ ( self.play , _( 'Listen to XM Station' ) ) ] return items def play(self, arg=None, menuw=None): logger.debug('%s.play(arg=%r, menuw=%r)', self.__class__, arg, menuw) self.elapsed = 0 if not self.menuw: self.menuw = menuw menuw = self.menuw self.player = PlayerGUI(self, menuw) error = self.player.play() if error and menuw: AlertBox(text=error).show() rc.post_event(rc.PLAY_END) def stop(self, arg=None, menuw=None): """ Stop the current playing """ print 'XmRadioItem stop' self.player.stop()
class RadioItem(Item): """ This is the class that actually runs the commands. Eventually hope to add actions for different ways of running commands and for displaying stdout and stderr of last command run. """ def actions(self): """ return a list of actions for this item """ items = [(self.play, _('Listen to Radio Station'))] return items def checktv(self): """ Check if something is recording """ self.tvlockfile = config.FREEVO_CACHEDIR + '/record.*' if len(glob.glob(self.tvlockfile)) > 0: return True return False def play(self, arg=None, menuw=None): _debug_('station=%r station_index=%r name=%r' % (self.station, self.station_index, self.name)) # self.parent.current_item = self self.elapsed = 0 if not self.menuw: self.menuw = menuw if self.checktv(): AlertBox(text=_('Cannot play - recording in progress'), handler=self.confirm).show() return 'Cannot play with RadioPlayer - recording in progress' self.player = PlayerGUI(self, menuw) error = self.player.play() if error and menuw: AlertBox(text=error).show() rc.post_event(rc.PLAY_END) def confirm(self, arg=None, menuw=None): _debug_('confirm (self, arg=%r, menuw=%r)' % (arg, menuw)) if menuw: menuw.menu_back() #menuw.refresh() def stop(self, arg=None, menuw=None): """ Stop the current playing """ _debug_('stop') self.player.stop()