def browse(self, preview=False): # Return nothing if preview is True if preview: return [] # Preview is False, this mean the item is entred # Check network connection try: from wynetwork import wynetwork as wn gateway = wn.NetDevices().getDeviceInfos( wn.NetConfigurations().getActiveConfigurationInfos() ['interface'])['gateway'] except: gateway = '0.0.0.0' if gateway == '0.0.0.0': MessageWindow(text=_('Please configure connection'), title=_('Not connected'), button=False).show(timeout=5) return None # Network is connected, we can start playing with Youtube win = LoadingWindow() win.show() if self._items is None or LiveStreaming_Data.catalog.is_old(): self._items = [] try: self._items = [ LiveStreamingChannelContainer(chan['title'], chan['position'], parent=self, menu=self.menu, **chan) for chan in LiveStreaming_Data.get_channels() ] except Exception, e: PRINT_EXCEPTION(e)
def browse(self, preview=False): # Only return content if preview is True if preview: return [ PicasaPrivateAreaContainer(_('Private Area'), menu=self.menu, parent=self), PicasaPublicAreaContainer(_('Public Area'), menu=self.menu, parent=self) ] # Preview is False, this mean the item is entred win = LoadingWindow() win.show() # Check network connection try: from wynetwork import wynetwork as wn gateway = wn.NetDevices().getDeviceInfos( wn.NetConfigurations().getActiveConfigurationInfos() ['interface'])['gateway'] except: gateway = '0.0.0.0' if gateway == '0.0.0.0': MessageWindow(text=_('Please configure connection'), title=_('Not connected'), button=False).show(timeout=5) win.hide() return None # Network is connected, we can start playing # We need to be logged to access public albums # So ask the user to define a valid user in private area if not already done if PicasaGData.email is None or PicasaGData.password is None: # Try to log with private users for username in PicasaConfig().GetPrivateUsers(): try: PicasaGData.ClientLogin( username, PicasaConfig().GetPrivatePassword(username)) break except: pass else: MessageWindow(text=_( 'Please define a valid user in private area\nThis is needed in order to access all features of PicasaWeb' ), title=_('No private user defined'), button=False).show(timeout=10) self._items = [ PicasaPrivateAreaContainer(_('Private Area'), menu=self.menu, parent=self), PicasaPublicAreaContainer(_('Public Area'), menu=self.menu, parent=self) ] win.hide() return self._items
def browse(self, preview=False): win = LoadingWindow() win.show() if not self._items: def _validate_password(kb): self.password = kb._text kb.hide() try: PicasaGData.ClientLogin(self.email, self.password) except: MessageWindow(text=_('Invalid email or password'), title=_('Picasa Error'), button=False).show(timeout=5) kb.hide() return None PicasaConfig().AddPrivateUser(self.email, self.password) userfeed = PicasaGData.GetUserFeed(user='******') new_user = PicasaPrivateUserContainer( name=userfeed.nickname.text, username=self.email, menu=self.menu, parent=self, thumbnail=userfeed.thumbnail.text) self._items.append(new_user) self.menu.get_item_list('main_list').append(new_user) return None def _validate_email(kb): self.email = kb._text kb.hide() kb = KeyboardWindow(_('Enter password'), text=self.password, confirm_action=_validate_password) kb.show() return None def _add_user(): kb = KeyboardWindow(_('Enter email'), text=self.email, confirm_action=_validate_email) kb.show() return None self._items = [ ActionItem(_('Add Users') + '...', type_='exe', action=_add_user) ] for username in PicasaConfig().GetPrivateUsers(): userfeed = PicasaGData.GetUserFeed(user=username) self._items.append( PicasaPrivateUserContainer( name=userfeed.nickname.text, username=username, menu=self.menu, parent=self, thumbnail=userfeed.thumbnail.text)) win.hide() return self._items
def _confirm(self): if not self._validate(): return None loader = LoadingWindow() loader.show() name_pattern = _('%(date)s %(channel)s %(start_time)s - %(end_time)s') if self._record_to_remove: old_rec = self._record_to_remove.record old_values = { 'channel': old_rec.service_name, 'date': strftime('%Y/%m/%d', localtime(old_rec.start_time)), 'start_time': seconds_to_hhmm(old_rec.start_time), 'end_time': seconds_to_hhmm(old_rec.stop_time) } computed_old_name = name_pattern % old_values if self._record_to_remove and computed_old_name != self._record_to_remove.name: scheduled_name = self._record_to_remove.name else: values = { 'channel': self.channel_list.selected.name, 'date': strftime('%Y/%m/%d', localtime(self.start_time)), 'start_time': seconds_to_hhmm(self.start_time), 'end_time': seconds_to_hhmm(self.end_time) } scheduled_name = name_pattern % values self._schedule_record(scheduled_name) loader.hide() return None
def browse(self, preview=False): win = LoadingWindow() win.show() if self._content is None or LiveStreaming_Data.catalog.is_old(): self._content = [] try: for channel_item in LiveStreaming_Data.get_channel_items( self.channel): self._content.append( LiveStreamingItem(channel_item['title'], parent=self, menu=self.menu, **channel_item)) except: pass try: for subchannel in LiveStreaming_Data.get_subchannels( self.channel): self._content.append( LiveStreamingSubChannelContainer( subchannel['title'], [self.channel, subchannel['position']], parent=self, menu=self.menu, **subchannel)) except: pass win.hide() return self._content
def browse(self, preview=False): if self._content is None or TF1Replay_Data.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: next_page, subcategories = TF1Replay_Data.get_subcategories( self.web_path) if next_page is not None: self._content.append( TF1ReplayCategory(_('Next page'), next_page, parent=self, menu=self.menu)) for sub_cat in subcategories: self._content.append( TF1ReplaySubCategory(sub_cat['title'], sub_cat['url_path'], parent=self, menu=self.menu, **sub_cat)) except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): if self._content is None or RTVEReplay_Data.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: # Execute item action itemlist = self.action() for item in itemlist: if item['type'] is 'video': self._content.append( RTVEReplayItem(item['title'], parent=self, menu=self.menu, **item)) else: self._content.append( RTVEReplaySubContainer(item['title'], parent=self, menu=self.menu, **item)) except: PRINT_EXCEPTION() win.hide() return self._content
def modify_scheduled_record(self): loader = LoadingWindow() loader.show() from pygui.menu.menu.tv.scheduled_record import ScheduledRecordMenu menu = ScheduledRecordMenu() menu._set_record(self.selected) menu.show() loader.hide() return None
def browse(self, preview=False): win = LoadingWindow() win.show() if not self._content: self._content = [] for station in self.search(): self._content.append(ShoutCastRadio(name=station['name'], station=station, parent=self, menu=self.menu)) win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() if not self._items: def _validate(kb): self.pattern = kb._text try: userfeed = PicasaGData.GetUserFeed(user=self.pattern) except GooglePhotosException: MessageWindow( text=_('User does not exist in Picasa database'), title=_('Picasa Error'), button=False).show(timeout=5) kb.hide() return None PicasaConfig().AddPublicUser(self.pattern) new_user = PicasaPublicUserContainer( name=userfeed.nickname.text, username=self.pattern, menu=self.menu, parent=self, thumbnail=userfeed.thumbnail.text) self._items.append(new_user) kb.hide() self.menu.get_item_list('main_list').append(new_user) return None def _search(): kb = KeyboardWindow(_('User name'), text=self.pattern, confirm_action=_validate) kb.show() return None self._items = [ ActionItem(_('Search Users') + '...', type_='exe', action=_search) ] for username in PicasaConfig().GetPublicUsers(): userfeed = PicasaGData.GetUserFeed(user=username) self._items.append( PicasaPublicUserContainer( name=userfeed.nickname.text, username=username, menu=self.menu, parent=self, thumbnail=userfeed.thumbnail.text)) win.hide() return self._items
def browse(self, preview=False): win = LoadingWindow() win.show() if not self._content: self._content = [] data = urllib.urlopen('http://api.shoutcast.com/legacy/Top500?k=%s&mt=audio/mpeg' % (dev_id)) try: shoutcast = ET.fromstring(data.read()) for station in shoutcast.findall('station'): self._content.append(ShoutCastRadio(name=station.attrib['name'], station=station.attrib, parent=self, menu=self.menu)) finally: data.close() win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() if not self._content: self._content = [] data = urllib.urlopen('http://api.shoutcast.com/legacy/genrelist?k=%s' % dev_id) try: tree = ET.fromstring(data.read()) for genre in tree.findall('genre'): self._content.append(ShoutCastSubGenreFolder(genre.attrib.pop('name'), menu=self.menu, parent=self)) finally: data.close() win.hide() return self._content
def push_thumbnail_menu(context, stack): loader = LoadingWindow() loader.show() from pygui.menu.menu import ThumbnailNavigator from copy import copy thumbnail_menu = ThumbnailNavigator('thumbnail_menu', folder=copy(context['parent']), universe=context['menu'].universe, type='%s_thumbnail' % context['menu'].type) try: thumbnail_menu.select(context['selected']) except ValueError: thumbnail_menu.select(thumbnail_menu.choices[0]) stack.back_to_menu(context['menu']) context['menu'].stop() stack.push_menu(thumbnail_menu) loader.hide()
def browse(self, preview=False): if self._content is None or Youtube_GData.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: self._content = [ YouTubeItem(infos['title'], parent=self, menu=self.menu, **infos) for infos in self.list_fn() ] except: PRINT_EXCEPTION() win.hide() return self._content
def event_action_menu(self, event): w = LoadingWindow() w.show() from pygui.menu.menu import ActionMenu sel = self.player.selected parent = None if sel is None and self.player._history: parent = self.player._history[-1]['selected'] else: parent = sel.parent context = dict(menu=self.player, selected=sel, parent=parent) s = ActionMenu(context, type_='playeraction', category='player', universe=self.player.universe) if s.get_item_list('main_list'): s.show() if not s.get_item_list('options_list'): louie_send('empty_options', sender=s) else: louie_send('not_empty_options', sender=s) w.hide() else: w.hide() self.player._error_spawner() return True
def browse(self, preview=False): win = LoadingWindow() win.show() if W9Replay_Data.catalog.is_old() or self._content is None: self._content = [] try: self._content = [ W9ReplayItem(prod['title'], parent=self, menu=self.menu, **prod) for prod in W9Replay_Data.get_product(self.category) ] except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): if self._content is None or RTVEReplay_Data.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: self._content = [ RTVEReplaySubContainer(item['title'], parent=self, menu=self.menu, **item) for item in RTVEReplay_Data.get_categories() ] except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() if self._content is None or LiveStreaming_Data.catalog.is_old(): self._content = [] try: self._content = [ LiveStreamingItem(subchannel_item['title'], parent=self, menu=self.menu, **subchannel_item) for subchannel_item in LiveStreaming_Data.get_subchannel_items(self.channel) ] except: pass win.hide() return self._content
def browse(self, preview=False): if self._content is None or TF1Replay_Data.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: self._content = [ TF1ReplayCategory(cat['title'], cat['url_path'], parent=self, menu=self.menu, **cat) for cat in TF1Replay_Data.get_categories() ] except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): if self._content is None or TF1Replay_Data.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: chapters = TF1Replay_Data.get_chapters(self.web_path) if chapters is not None: self._content = [ TF1ReplayItem(chapter['title'], parent=self, menu=self.menu, **chapter) for chapter in chapters ] except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() if M6Replay_Data.catalog.is_old() or self._content is None: self._content = [] try: self._content = [ M6ReplaySubCategory(sub_cat['title'], [self.category, sub_cat['position']], parent=self, menu=self.menu, **sub_cat) for sub_cat in M6Replay_Data.get_subcategories(self.category) ] except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() if W9Replay_Data.catalog.is_old() or self._content is None: self._content = [] try: self._content = [ W9ReplayCategory(cat['title'], cat['position'], parent=self, menu=self.menu, **cat) for cat in W9Replay_Data.get_categories() ] except: PRINT_EXCEPTION() win.hide() return self._content
def rate(self, age): self._update_checked(age) self.name = self.actions_dict[age]['caption'] self.menu._set_options_list(keep_selection=True) try: if isinstance(self.item, DirItem): w = LoadingWindow() w.show() ml = Markerlist(self.item.universe, 'rate') ml.add_item(self.item) ml['maturity_rating'] = age w.hide() ml.clear() else: if self.item['refid']: self.item.vfs_set_metas(_unref_link=True, maturity_rating=age) else: self.item['maturity_rating'] = age
def browse(self, preview=False): if self._content is None or TF1Replay_Data.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: product = TF1Replay_Data.get_products(self.web_path) if product is not None: self._content = [ TF1ReplayProduct(product['title'], product['url_path'], parent=self, menu=self.menu, **product) ] except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() try: self._content = [] PicasaGData.ClientLogin(self.email, self.password) for album in PicasaGData.GetUserFeed(user='******').entry: self._content.append( PicasaAlbumContainer( name=album.title.text, username='******', gphoto_id=album.gphoto_id.text, parent=self, menu=self.menu, thumbnail=album.media.thumbnail[0].url)) except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() try: self._content = [] for photo in PicasaGData.GetFeed( '/data/feed/api/user/%s/albumid/%s?kind=photo' % (self.username, self.gphoto_id)).entry: self._content.append( ImageItem(photo.title.text, thumbnail=photo.media.thumbnail[0].url, uri=photo.content.src, backend='dummy', parent=self, menu=self.menu)) except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() try: self._content = [] userfeed = PicasaGData.GetUserFeed(user=self.username) for album in userfeed.entry: self._content.append( PicasaAlbumContainer( name=album.title.text, username=self.username, gphoto_id=album.gphoto_id.text, parent=self, menu=self.menu, thumbnail=album.media.thumbnail[0].url)) except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): if self._content is None or Youtube_GData.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: self._content = [ YouTubeSubContainer( playlist['title'], (lambda playlist_id=playlist['id']: Youtube_GData. parse_playlist(id=playlist_id)), parent=self, menu=self.menu, thumbnail=playlist['thumbnail']) for playlist in self.list_fn() ] except: PRINT_EXCEPTION() win.hide() return self._content
def event_marker(self, event): play = self.player.navigator sel = play.selected if sel is None: log.warning('Nothing to put in markerlist') return True if not isinstance(sel, Markerlist): marker = markerlists()[self.player.universe] if sel.is_marked(): marker.del_item(sel) else: w = None if isinstance(sel, DirItem): w = LoadingWindow('') w.show() marker.add_item(sel) if w: w.hide() play._update_marker() return True
def browse(self, preview=False): win = LoadingWindow() win.show() self._content = [] for elt in self.list_fn(): try: v_uri = elt._video_uri if v_uri: infos = dict(id=v_uri, player_url=v_uri, thumbnail=elt._thumbnail_uri) self._content.append( DailyMotionItem(elt.title, parent=self, menu=self.menu, **infos)) except: MessageWindow(text=_( 'Enable to access RSS informations.\nTry again in few minutes.' ), title=_('RSS Error'), button=False).show(timeout=5) win.hide() return self._content
def execute_show_marker(context, marker): context['parent'].show_menu() loader = LoadingWindow() loader.show() marker.menu = context['menu'] from pygui.menu import menu
sel = play.selected ]: i: o: 33(t), 54(f) nname: 206 n 206(None)[play._update_marker() return True ]: i: 102(JA), 119(JA), 0(t) o: nname: 119 n 119(None)[w = None if isinstance(sel, DirItem): w = LoadingWindow('') w.show() marker.add_item(sel) if w: w.hide() ]: i: 70(f) o: 206(JA) nname: 102 n 102(None)[marker.del_item(sel) ]: i: 70(t) o: 206(JA) nname: 70
o: 94(t), 101(f) nname: 68 n 68(None)[item_list = marker.browse() ]: i: 65(try) o: 103() nname: 65 n 65(None)[]: i: 0(ASF) o: 68(try), 84(except) nname: 0 n 0(None)[context['parent'].show_menu() loader = LoadingWindow() loader.show() marker.menu = context['menu'] from pygui.menu import menu ]: i: o: 65(ASF2), 184(finally) nname: 195 n 195(None)[]: i: 184(AE) o: nname: 184 n 184(None)[loader.hide() ]: