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): 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 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 _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 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): # 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 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._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 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): 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 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): 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 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 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): 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): 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 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 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): 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 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 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): 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_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() 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 play(self, item, show_loading=False, offset=0, default_audio=None, default_video=None, default_sub=None): if show_loading: win = LoadingWindow() win.show() self.wpl.watch_property('status', self.status_change_callback) self.wpl.watch_property('speed', self.speed_change_callback) try: item.media_update() except AttributeError: log.warning('item %s is not updatable', item) options = dict() uri_options = dict() for k, v in item.wpl_options.iteritems(): if k in ('data', 'osd', 'outwin', 'adrv', 'vdrv'): options[k] = v else: uri_options[k] = v self.old_status, self.status = self.wpl.status, self.wpl.status log.info('STATUS: %s', self.status) if self.status == 'closed': log.debug('STATUS IS CLOSED, opening...') options['audio'] = self._audio_stream options['video'] = self._video_stream self.wpl.open(**options) self.aspect_ratio = player_aspect_ratio_dict[ config.user_config['video']['aspect_ratio']] self.display_format = config.user_config['video']['display_format'] elif self.status != 'idle': log.debug('STATUS IS NOT IDLE , stopping...') self._signals['playing'].clear() self.wpl.stop() if self._sub_stream: subs = item['subtitles'] if subs: sub_path = subs[0]['uri'].split('//', 1)[1] uri_options['subfile'] = sub_path uri_options['sublang'] = (default_sub if default_sub else 'eng') dlna = item['dlnaProfile'] if dlna: uri_options['dlna_profile'] = dlna uri_options['mime_type'] = item['mimeType'] self.wpl.spdif_surround = config.user_config['connections'][ 'spdif_surround'] log.debug('LOAD URI: %s (%s)', item['uri'], uri_options) self.wpl.load_uri(item['uri'], uri_options) self._wait_for_status('loading', timeout=3) self._wait_for_status('idle', timeout=60) preferred_language = config.user_config['video']['language'] preferred_len = len(preferred_language) log.info('preferred: %s', preferred_language) for a_track in self.wpl.alist(): if a_track['lang'][:preferred_len].lower() == preferred_language: self.wpl.aid = a_track['id'] log.info('audio: %s', a_track) break if item.wymedia_resource: use_bytes = item['class'].endswith('tvRecord') else: use_bytes = False if self._video_stream: self._set_framerate() log.debug('PLAY LOADED!') self.wpl.play_loaded(start_pos=offset, bytes=use_bytes) error = False for n in xrange(100): log.warning("It's the player countdown ! %d...", n) try: self._wait_for_status('playing', timeout=1) except OverflowError: if self._check_exception(): error = True break else: break if show_loading: win.hide() if error or self._check_exception(): self._play_next() return None
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 n 70(sel.is_marked())[marker = markerlists()[self.player.universe] ]: i: 0(f) o: 102(t), 119(f)
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() ]: i: 0(finally), 103(), 84(f), 84(t) o: 195(AE) nname: 84 n 84(<dummy_ex3> EXC_MATCH BrowseError)[]: i: 65(except) o: 184(f) nname: 103 n 103(None)[item_menu = menu.MarkerNavigator(_('Marker list'), context['menu'].universe, item_list, context['parent'], marker, type='marker' + marker.menu.type) pygui_globs['menustack'].push_menu(item_menu) ]: i: 68(), 101(AE) o: 184()