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()
def __init__(self, item, menuw=None): """ Create an instance of a RadioPlayerGUI """ logger.log(9, "RadioPlayerGUI.__init__(item=%r, menuw=%r)", item, menu) PlayerGUI.__init__(self, item, menuw) self.start_time = time.time() self.item = item self.image = skin.get_icon("misc/radio") # self.item.image = imlib2.open(self.image) self.item.image = self.image
def __init__(self, item, menuw=None): """ Create an instance of a RadioPlayerGUI """ logger.log(9, 'RadioPlayerGUI.__init__(item=%r, menuw=%r)', item, menu) PlayerGUI.__init__(self, item, menuw) self.start_time = time.time() self.item = item self.image = skin.get_icon('misc/radio') #self.item.image = imlib2.open(self.image) self.item.image = self.image
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)
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()
def play(self, arg=None, menuw=None): print self.station + " " + str(self.station_index) + " " + self.name # self.parent.current_item = self 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 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 __init__(self, item, menuw=None): PlayerGUI.__init__(self, item, menuw) self.visible = menuw and True or False self.menuw = menuw self.item = item self.player = None self.running = False self.item.title = None self.item.artist = None self.box = None self.downl_time = 30 if not os.path.exists(self.item.filename): background = BGDownload(self.item.url, self.item.filename) background.start() popup = PopupBox(text=_("Buffering podcast...")) popup.show() time.sleep(10) # 10s. buffering time popup.destroy()
def __init__(self, item, menuw=None): PlayerGUI.__init__(self, item, menuw) self.visible = menuw and True or False self.menuw = menuw self.item = item self.player = None self.running = False self.item.title = None self.item.artist = None self.box = None self.downl_time = 30 if not os.path.exists(self.item.filename): background = BGDownload(self.item.url, self.item.filename) background.start() popup = PopupBox(text=_('Buffering podcast...')) popup.show() time.sleep(10) # 10s. buffering time popup.destroy()
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)