Esempio n. 1
0
 def control_changed(self, mode, rcu, standby):
     from peewee.notifier import events_drop
     from pygui.facilities.power import PowerManager
     from pygui.menu.menu.bsod import BSoDMenu
     log.debug('Control changed: mode=%s rcu=%s standby=%s', mode, rcu,
               standby)
     msg = control_mode_popup_dict[mode]
     if rcu:
         if self._controlmode_popup:
             self._controlmode_popup.hide()
             self._controlmode_popup = None
         events_drop(False)
         plugins.discard('popup_blocker')
         if standby == False:
             stack = pygui_globs['menustack']
             if not stack.is_on_firstboot():
                 stack.back_to_home()
             MessageWindow(msg, button=None).show(timeout=3)
     else:
         events_drop(True)
         plugins.add('popup_blocker')
         stack = pygui_globs['menustack']
         if not stack.is_on_firstboot():
             stack.back_to_home()
             BSoDMenu().show()
         self._controlmode_popup = MessageWindow(msg, button=None)
         self._controlmode_popup.show()
     return None
Esempio n. 2
0
 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
Esempio n. 3
0
 def _schedule_record(self, rec_name):
     _wyrecord = WyRecord()
     start_time, stop_time = self.start_time, self.end_time
     if self._record_to_remove:
         log.info('Deleting scheduled recording [%s] for replacement',
                  self._record_to_remove)
         try:
             rule_id = self._record_to_remove.periodic_rule.id
             _wyrecord.scheduler.RemovePeriodicRecording(
                 rule_id, delete_records=False)
         except AttributeError:
             try:
                 _wyrecord.scheduler.DeleteRecording(
                     self._record_to_remove.record.id)
             except SchedulerRecordingRunningError:
                 error_title = _('Impossible to cancel recording')
                 message = _('This recording has already started.')
                 MessageWindow(message, error_title,
                               button=None).show(timeout=5)
         self._record_to_remove = None
     try:
         self.scheduled_record = _wyrecord.scheduler.ScheduleRecording(
             int(self.channel_list.selected['serviceId']),
             int(start_time),
             int(stop_time),
             rec_name,
             favorite=self['favorite_name'])
         periodicity_type = self.repetition_type_list.selected
         periodicity_number = self.repetition_number_list.selected.val
         rule_id = None
         if periodicity_type.key != 'none' and periodicity_number > 1:
             rule_id = _wyrecord.scheduler.createPeriodicityRule(
                 periodicity_type.key)
             end_date = datetime.fromtimestamp(start_time) + timedelta(
                 days=periodicity_type.val[1] * periodicity_number - 1)
             res = _wyrecord.scheduler.GeneratePeriodicRecording(
                 self.scheduled_record.id, rule_id, end_date)
     except SchedulerConflictWithInstantRecordError, e:
         conflicting_rec = e.conflict.getAllRecInConflict()[0]
         message_pattern = _(
             'An instant recording on %(channel)s will be stopped when this recording starts.'
         )
         message = message_pattern % {
             'name': conflicting_rec.name,
             'start_time': seconds_to_hhmm(conflicting_rec.start_time),
             'channel': conflicting_rec.service_name
         }
         title = _('Conflict with an instant recording')
         MessageWindow(message, title, button=None).show(timeout=5)
         self.scheduled_record = e.conflict.rec
Esempio n. 4
0
 def record_selected(self):
     program = self.selected
     now = int(time())
     if program.end_time > now:
         start_time = max(now, program.start_time)
         end_time = min(program.end_time, start_time + 21600)
         channel = program.parent
         chan_id = int(channel['serviceId'])
         favorite_name = channel.parent.name
         values = {
             'channel': channel.name,
             'title': program.name,
             'date': strftime('%Y/%m/%d', localtime(start_time)),
             'start_time': seconds_to_hhmm(start_time),
             'end_time': seconds_to_hhmm(end_time)
         }
         record_name = EPG_RECORDING_NAME_PATTERN % values
         try:
             WyRecord().scheduler.ScheduleRecording(chan_id,
                                                    start_time,
                                                    end_time,
                                                    record_name,
                                                    program_id=program.id,
                                                    favorite=favorite_name)
             louie_send('update_record')
         except SchedulerConflictWithInstantRecordError, e:
             louie_send('update_record', sender=None)
             conflicting_rec = e.conflict.getAllRecInConflict()[0]
             message_pattern = _(
                 'An instant recording on %(channel)s will be stopped when this recording starts.'
             )
             message = message_pattern % {
                 'name': ellipsize(conflicting_rec.name, 40),
                 'start_time': seconds_to_hhmm(conflicting_rec.start_time),
                 'channel': conflicting_rec.service_name
             }
             title = _('Conflict with an instant recording')
             MessageWindow(message, title, button=None).show(timeout=5)
         except SchedulerConflictError, e:
             conflicting_rec = e.conflict.getAllRecInConflict()[0]
             message_pattern = _(
                 'The recording you are attempting to schedule conflicts with "%(name)s", starting at %(start_time)s on %(channel)s.'
             )
             message = message_pattern % {
                 'name': ellipsize(conflicting_rec.name, 40),
                 'start_time': seconds_to_hhmm(conflicting_rec.start_time),
                 'channel': conflicting_rec.service_name
             }
             title = _('Recording scheduler error')
             MessageWindow(message, title, button=None).show(timeout=5)
Esempio n. 5
0
	def __do_delete():
		fl = markerlists().get(context['menu'].universe)
		try:
			fl.vfs_delete()
		except RemoveError:
			PRINT_EXCEPTION()
			MessageWindow(text=_('Error removing %s') % 'markerlist', title=_('Error')).show(timeout=5)
		except:
			except NotPermittedError, e:
				PRINT_EXCEPTION()
				if e.message == 'NOT_SUPPORTED_BY_FS':
					BigMessageWindow(text=_('The way this disk was formatted does not allow this operation'), title=_('Error')).show(timeout=5)
				else:
					MessageWindow(text=_('Operation not permitted'), title=_('Error')).show(timeout=5)
Esempio n. 6
0
def handle_demo(obj):
	def do_nothing(*args):
		pass

	update_manager = UpdateManager()
	if update_manager.check_window is not None:
		update_manager.check_window.hide()
	else:
		update_manager._update_check_start.im_func.func_code = do_nothing.func_code
	update_manager._update_check_failed.im_func.func_code = do_nothing.func_code
	MessageWindow('Installing demo mode...\nWill auto-reboot.', button=None).show()
	import os
	prefix = os.path.join(obj['path'], 'demo_mode_pack')
	medias_archive = os.path.join(prefix, 'media.tar')
	if os.path.isfile(medias_archive):
		import tarfile
		tarfile.TarFile(medias_archive).extractall('/wymedia')
	scenario = os.path.join(prefix, 'scenario')
	if os.path.isfile(scenario):
		os.system("cp -f '%s' /etc/params/demo.replay" % scenario)
	from pygui import config
	config.user_config['advanced']['demo_mode'] = True
	config.user_config.save()
	os.system('sleep 1; reboot;')
	return None
Esempio n. 7
0
 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)
Esempio n. 8
0
 def launch_net_services(self, name):
     from peewee.networkmanager import NetworkManager
     NM = NetworkManager()
     if NM.get_state() == 'disconnected':
         stack.back_to_home()
         MessageWindow(text='Please configure connection',
                       title='Not connected',
                       button=False).show(timeout=5)
     else:
         if name == 'net_services':
             from wymedia.wmplus import set_param
             login, password = user_config['net']['login'], user_config[
                 'net']['password']
             if login is not None:
                 log.info("'user' param set for net services'")
                 set_param('user', login)
             if password is not None:
                 log.info("'pass' param set for net services'")
                 set_param('pass', password)
             lang = user_config['base']['language']
             log.info("'lang' param set for net services'")
             set_param('lang', lang)
         if self._navigator is None:
             from pygui.menu.menu import Navigator
             self._navigator = Navigator(name, name, [], type=name)
         else:
             self._navigator.reset(name, type=name, universe=name)
         self._navigator.show()
         user_config['advanced']['last_universe'] = name
         user_config.save()
     return None
Esempio n. 9
0
	def event_select(self, event):
		sel = self.player['main_list'].selected
		if isinstance(sel, DirItem) and not isinstance(sel, Playlist):
			text = _('To enter this folder, please go back to list mode.')
			MessageWindow(text).show(timeout=5)
		else:
			GridNavigatorEventHandler.event_select(self, event)
		return True
Esempio n. 10
0
 def _display_picture(self):
     try:
         louie_send('picture_%d' % pos[0],
                    sender=self,
                    value=self.selected['uri'],
                    callback=self.tasks['transition'].start)
     except IOError, e:
         from pygui.window import MessageWindow
         MessageWindow(_('Invalid picture'), button=None).show(timeout=5)
Esempio n. 11
0
 def zap_to_selected(self):
     if self.player.can_zap():
         channel = self.get_item_list('main_list').selected
         self.hide()
         channel.execute()
         return True
     else:
         title = _("Can't change channels")
         message = _('A recording is in progress. Stop it before zapping.')
         MessageWindow(message, title, button=None).show(timeout=5)
     return None
Esempio n. 12
0
 def execute(self, delay=0):
     if self['backend'] != 'upnp':
         try:
             if os.path.exists('/dev/sr0'):
                 self.player.play(self, playlist=None, delay=delay)
             else:
                 MessageWindow(text=_('No external USB DVD reader found'),
                               title=_('DVD Error'),
                               button=False).show(timeout=5)
         except Exception, e:
             PRINT_EXCEPTION(e)
Esempio n. 13
0
 def live_catalog(self):
     if os.path.isfile(CACHE_FILE):
         f = open(CACHE_FILE, 'r')
         try:
             self.catalog = pickle.load(f)
         except:
             self.catalog = None
         f.close()
     else:
         self.catalog = None
     if self.catalog is None or self.catalog.is_old():
         url = urllib.urlopen(LIVE_XML_CATALOG)
         catalog_xml = url.read()
         url.close()
         try:
             channels = etree.XML(catalog_xml)
         except etree.XMLSyntaxError:
             msg_win = MessageWindow(text=_(
                 'XML file is malformed !!!\nPlease wait while BeautifulSoup fix it'
             ),
                                     title=_('XML Error'),
                                     button=False)
             msg_win.show()
             catalog_xml = str(BeautifulStoneSoup(catalog_xml))
             try:
                 msg_win.hide()
             except:
                 pass
         self.catalog = Catalog(catalog_xml)
         if not os.path.exists(CACHE_DIR):
             os.mkdir(CACHE_DIR)
         f = open(CACHE_FILE, 'w')
         pickle.dump(self.catalog, f)
         f.close()
     return self.catalog.catalog
Esempio n. 14
0
    def _get_flv_uri(self, player_url, choosen_format):
        video_dict = dict()
        available_formats = []

        # Open player url
        request = urllib2.Request(player_url)
        request.add_header('Cookie', 'family_filter=off')
        try:
            webpage = urllib2.urlopen(request).read()
        except (urllib2.URLError, httplib.HTTPException, socket.error), err:
            MessageWindow('ERROR: unable retrieve video webpage: %s' %
                          str(err)).show()
            return '', '', ''
Esempio n. 15
0
 def event_marker(self, event):
     try:
         if self.player.time_elapsed > self.player.last_mark_time:
             byte_position = (self.player.wpl.byte_pos['data'] /
                              self.player.wpl.rel_pos['data']
                              ) * self.player.wpl.rel_pos['video']
             if 'start' in self.player.current_mark:
                 if self.player.time_elapsed > self.player.total_time - 2.0:
                     end_time = self.player.total_time
                     end_byte = -1.0
                 else:
                     end_time = self.player.time_elapsed
                     end_byte = byte_position
                 self.player.current_mark.setdefault(
                     'end', dict(byte=end_byte, time=end_time))
                 tmp_mark = copy_obj(self.player.current_mark)
                 self.player.current_mark.clear()
                 self.player.mark_list.append(tmp_mark)
                 self.player.last_mark_time = self.player.time_elapsed
                 new_bar = Image(repository=config.themes_dir +
                                 '/wybox/images/players/progressbar/',
                                 image_or_file='rec-progress.png')
                 new_bar.set_keep_real_size(False)
                 player_obj = pygui_globs['display'].get_obj_by_name(
                     'recedit_player')
                 mark_list_obj = player_obj.get_obj_by_name('mark_list')
                 mark_list_obj.add_child(new_bar,
                                         name='mark_bar',
                                         top='0%',
                                         left='100%',
                                         height='100%',
                                         width='0%',
                                         aspect=False)
             else:
                 if self.player.time_elapsed > 2.0:
                     start_time = self.player.time_elapsed
                     start_byte = byte_position
                 else:
                     start_time = 0.0
                     start_byte = 0.0
                 self.player.current_mark.setdefault(
                     'start', dict(byte=start_byte, time=start_time))
                 self.player.last_mark_time = self.player.time_elapsed
             sleep(1)
         else:
             MessageWindow(
                 title=_('Error'),
                 text=_('Enable to add mark before other')).show(timeout=3)
     except:
         print 'Enable to add mark'
     return True
Esempio n. 16
0
 def cancel_record_selected(self):
     program = self.selected
     rec_id = program.recording_id
     if rec_id:
         log.info('Canceling recording for %s', program)
         try:
             WyRecord().scheduler.DeleteRecording(rec_id)
         except SchedulerRecordingRunningError:
             error_title = _('Impossible to cancel recording')
             message = _(
                 'This recording has already started. To stop it, close the EPG grid and press Stop.'
             )
             MessageWindow(message, error_title,
                           button=None).show(timeout=5)
     return None
Esempio n. 17
0
    def launch_tv(self):
        def _fullscan():
            from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
            item = TNTAutomaticScanItem(parent=None,
                                        name=_('Automatic scan'),
                                        type_='setupitem')
            item.menu = self
            item.execute()
            return None

        # Prompt the user to launch a TV scan. If the user answers yes,
        # the TV player is launched after the scan's completion.
        #
        # If play_on_no equals True, attempt to launch the TV player
        # regardless of the user's answer (e.g. if the only channel
        # is the analog capture and the user doesn't want to scan).
        def prompt_tv_scan(play_on_no=False):
            buttons = [Button(_('Yes'), True), Button(_('No'), False)]
            buttons[0].connect(_fullscan)
            if play_on_no:
                buttons[1].connect(ChannelItem.player.play)
            messbox = ConfirmWindow(
                text=_('Do you want to launch a scan now?'), buttons=buttons)
            messbox.show()
            return None

        try:
            acl = TVRootItem().get_acl(menu=self)
            channels = acl.browse()
            num_channels = len(channels)
        except:
            w = MessageWindow(text=_(
                'Channels are unavailable. Please try again.\nIf the problem persists, launch a scan or reset to factory defaults.'
            ),
                              title=_('TV failure'))
            w.show(timeout=3)
            PRINT_EXCEPTION()
            return None
        user_config['advanced']['last_universe'] = 'tv'
        user_config.save()
        if num_channels == 0:
            _fullscan()
        elif num_channels == 1 and channels[0]['class'].endswith(
                'videoCapture'):
            prompt_tv_scan(play_on_no=True)
        else:
            ChannelItem.player.play()
        return None
Esempio n. 18
0
 def device_plugged(self, obj, plugged):
     if not obj.get('title'):
         name = _('Unknown device')
     else:
         name = obj.get('title')
     if plugged:
         msg_template = _('Device "%(name)s" plugged in.')
     else:
         msg_template = _('Device "%(name)s" removed.')
     msg = msg_template % {'name': name}
     log.debug('%s / %s', msg, name)
     stack = pygui_globs['menustack']
     #		if plugged:
     #			if 'WYDEMO' in obj['title'].upper():
     #				from pygui.facilities.demomode import handle_demo
     #				handle_demo(obj)
     if 'popup_blocker' in plugins:
         stack.get_player()
     else:
         MessageWindow(msg, button=None).show(timeout=3)
     if 'transcode' in plugins and name.startswith("PSP"):
         pygui_globs['psp_path'] = obj.get(uri)
     nav = self._navigator
     if nav is not None and nav in stack:
         if not plugged:
             concerned = False
             try:
                 for h in nav._history:
                     if h['selected'] and obj['id'] == h[
                             'selected'].wymedia_resource['id']:
                         concerned = True
             except:
                 pass
             if concerned:
                 stack.close_player()
                 stack.back_to_menu(nav)
                 nav.back_to_root()
             from pygui.markerlist import markerlists
             for mlist in markerlists():
                 mlist._refresh()
             nav._update_marker()
         if nav is stack.get_navigator():
             log.debug('calling _refresh_root()')
             nav._refresh_root()
             if nav._history:
                 log.debug('calling build_preview()')
                 nav.build_preview()
     return None
Esempio n. 19
0
	def __do_cancel(context):
		record = context['selected']
		scheduler = WyRecord().scheduler
		try:
			rule_id = record.periodic_rule.id
			scheduler.RemovePeriodicRecording(rule_id, 'delete_records', False)
		except AttributeError:
			try:
				scheduler.DeleteRecording(record, record.id)
			except SchedulerRecordingRunningError:
				error_title = _('Impossible to cancel recording')
				message = _('This recording has already started.')
				MessageWindow(message, error_title, button=None).show(timeout=5)
				return None
		context['selected'].show_menu()
		return None
Esempio n. 20
0
 def execute_selected(self):
     item = self.selected
     player = self._player
     if isinstance(item, Playlist):
         self.browse_selected()
         return None
     if item == player.selected or player.can_zap():
         if isinstance(item, DirItem):
             item.browse()[0].execute()
         else:
             Navigator.execute_selected(self)
     else:
         title = _("Can't change channels")
         message = _('A recording is in progress. Stop it before zapping.')
         MessageWindow(message, title, button=None).show(timeout=5)
     return None
Esempio n. 21
0
 def kbd_hide():
     kbd.hide()
     if rule_id:
         _wyrecord.scheduler.RemovePeriodicRecording(
             rule_id, delete_records=False)
     else:
         try:
             _wyrecord.scheduler.DeleteRecording(
                 self.scheduled_record.id)
         except SchedulerRecordingRunningError:
             error_title = _('Impossible to cancel recording')
             message = _('This recording has already started.')
             MessageWindow(message, error_title,
                           button=None).show(timeout=5)
             return None
     self.scheduled_record = None
     return None
Esempio n. 22
0
def _copy_ts(ts_file, psp_path):
	psp_mp4_file, psp_thm_file = _get_psp_filenames(psp_path)
	msg = MessageWindow(_('Copying to PSP (tm) please wait...'), button=None)
	msg.show()
	mp4_cmd = '/usr/bin/ts2psp "%s" "%s"' % (ts_file, psp_mp4_file)
	thm_cmd = 'cp "%s" "%s"' % (thm_src_file, psp_thm_file)
	log.debug(mp4_cmd)
	os.system(mp4_cmd)
	log.debug(thm_cmd)
	os.system(thm_cmd)
	os.system('sync')
	sleep(2)
	msg.hide()
	return None
Esempio n. 23
0
 def browse(self, preview=False):
     # Only return content if preview is True
     if preview:
         return [
             YoutubeUsersContainer(_('User Playlists'),
                                   menu=self.menu,
                                   parent=self),
             YoutubeStandardFeedContainer(_('Standard Feeds'),
                                          menu=self.menu,
                                          parent=self),
             YoutubeSearchContainer(_('Search Videos'),
                                    menu=self.menu,
                                    parent=self)
         ]
     # 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
     if not self._items:
         self._items = [
             YoutubeUsersContainer(_('User Playlists'),
                                   menu=self.menu,
                                   parent=self),
             YoutubeStandardFeedContainer(_('Standard Feeds'),
                                          menu=self.menu,
                                          parent=self),
             YoutubeSearchContainer(_('Search Videos'),
                                    menu=self.menu,
                                    parent=self)
         ]
     return self._items
Esempio n. 24
0
 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
Esempio n. 25
0
 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
Esempio n. 26
0
	def browse(self, preview=False):
		# Only return content if preview is True
		if preview:
			return [ShoutCastTop500Folder(_('Shoutcast Top 500'), menu=self.menu, parent=self),
							ShoutCastGenreFolder(_('Shoutcast by Genre'), menu=self.menu, parent=self),
							ShoutCastSearchFolder(_('Shoutcast Search'), menu=self.menu, parent=self)]
		# 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
		elif not self._items:
			self._items = [ShoutCastTop500Folder(_('Shoutcast Top 500'), menu=self.menu, parent=self),
										 ShoutCastGenreFolder(_('Shoutcast by Genre'), menu=self.menu, parent=self),
										 ShoutCastSearchFolder(_('Shoutcast Search'), menu=self.menu, parent=self)]
		return self._items
Esempio n. 27
0
 def _validate(self):
     all_fields = set(['date', 'start_time', 'end_date', 'end_time'])
     invalid_fields = set()
     error_message = None
     now = time()
     start_time, end_time = self.start_time, self.end_time
     if abs(end_time - start_time) > 21600:
         error_message = _('The recording cannot be longer than 6 hours.')
     if end_time < now:
         error_message = _(
             'You are trying to record a program already over.')
         invalid_fields.add('end_time')
         if now - end_time >= 86400:
             invalid_fields.add('date')
     for field in all_fields.difference(invalid_fields):
         louie_send('%s_valid' % field, sender=self)
     if error_message is not None:
         for field in invalid_fields:
             louie_send('%s_invalid' % field, sender=self)
         error_title = _('Invalid data')
         MessageWindow(error_message, error_title,
                       button=None).show(timeout=5)
         return False
     return True
Esempio n. 28
0
 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
Esempio n. 29
0
self.nodes: {0: <unpyclib.structure.node instance at 0xb776cfac>}
nname: 103
n 103(None)[return True
]:
	i: 48(), 86()
	o: 

nname: 86
n 86(None)[GridNavigatorEventHandler.event_select(self, event)
]:
	i: 0&31(f)
	o: 103()

nname: 48
n 48(None)[text = _('To enter this folder, please go back to list mode.')
MessageWindow(text).show(timeout=5)
]:
	i: 0&31(t)
	o: 103()

nname: 0&31
n 0&31(isinstance(sel, DirItem) and not isinstance(sel, Playlist))[sel = self.player['main_list'].selected
]:
	i: 
	o: 48(t), 86(f)

nname: 0&31
n 0&31(None)[sel = self.player['main_list'].selected
if isinstance(sel, DirItem) and not isinstance(sel, Playlist):
	text = _('To enter this folder, please go back to list mode.')
	MessageWindow(text).show(timeout=5)
Esempio n. 30
0
join = os.path.join
exists = os.path.exists
psp_prefix = os.path.join(psp_path, 'video', 'M4V')
while exists(psp_prefix + '%s.MP4' % index) or exists(psp_prefix + '%s.THM' % index):
	index -= 1
else:
	_POP_TOP pass
return (psp_prefix + '%s.MP4' % index, psp_prefix + '%s.THM' % index)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748e6c>}
nname: 0
n 0(None)[psp_mp4_file, psp_thm_file = _get_psp_filenames(psp_path)
msg = MessageWindow(_('Copying to PSP (tm) please wait...'), button=None)
msg.show()
mp4_cmd = '/usr/bin/ts2psp "%s" "%s"' % (ts_file, psp_mp4_file)
thm_cmd = 'cp "%s" "%s"' % (thm_src_file, psp_thm_file)
log.debug(mp4_cmd)
os.system(mp4_cmd)
log.debug(thm_cmd)
os.system(thm_cmd)
os.system('sync')
sleep(2)
msg.hide()
return None
]:
	i: 
	o: 
Esempio n. 31
0
                conflicting_rec = e.conflict.getAllRecInConflict()[0]
                message_pattern = _(
                    'The recording you are attempting to schedule conflicts with "%(name)s", starting at %(start_time)s on %(channel)s.'
                )
                message = message_pattern % {
                    'name': ellipsize(conflicting_rec.name, 40),
                    'start_time': seconds_to_hhmm(conflicting_rec.start_time),
                    'channel': conflicting_rec.service_name
                }
                title = _('Recording scheduler error')
                MessageWindow(message, title, button=None).show(timeout=5)
            except SchedulerError, e:
                log.error("Can't start recording due to %s", e)
                title = _('Recording scheduler error')
                message = 'Unable to schedule your recording. Sorry.'
                MessageWindow(message, title, button=None).show(timeout=5)
        else:
            message = _('The program is over. You cannot record it.')
            title = _('Program already over')
            win = MessageWindow(message, title, button=None)
            win.show(timeout=5)
        return None

    # Cancel the scheduled recording of the selected program.
    #
    # TODO Factor this out, it's cut&pasted from epg_grid.py.
    def cancel_record_selected(self):
        program = self.selected
        rec_id = program.recording_id
        if rec_id:
            log.info('Canceling recording for %s', program)