1 from ChannelSelection import ChannelSelection, BouquetSelector
3 from Components.ActionMap import ActionMap, HelpableActionMap
4 from Components.ActionMap import NumberActionMap
5 from Components.Harddisk import harddiskmanager
6 from Components.Input import Input
7 from Components.Label import Label
8 from Components.PluginComponent import plugins
9 from Components.ServiceEventTracker import ServiceEventTracker
10 from Components.Sources.Boolean import Boolean
11 from Components.config import config, ConfigBoolean, ConfigClock
12 from Components.SystemInfo import SystemInfo
13 from Components.UsageConfig import preferredInstantRecordPath, defaultMoviePath
14 from EpgSelection import EPGSelection
15 from Plugins.Plugin import PluginDescriptor
17 from Screen import Screen
18 from Screens.ChoiceBox import ChoiceBox
19 from Screens.Dish import Dish
20 from Screens.EventView import EventViewEPGSelect, EventViewSimple
21 from Screens.InputBox import InputBox
22 from Screens.MessageBox import MessageBox
23 from Screens.MinuteInput import MinuteInput
24 from Screens.TimerSelection import TimerSelection
25 from Screens.PictureInPicture import PictureInPicture
26 from Screens.SubtitleDisplay import SubtitleDisplay
27 from Screens.RdsDisplay import RdsInfoDisplay, RassInteractive
28 from Screens.TimeDateInput import TimeDateInput
29 from ServiceReference import ServiceReference
31 from Tools import Notifications
32 from Tools.Directories import fileExists
34 from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \
35 iPlayableService, eServiceReference, eEPGCache
37 from time import time, localtime, strftime
38 from os import stat as os_stat
39 from bisect import insort
41 from RecordTimer import RecordTimerEntry, RecordTimer
44 from Menu import MainMenu, mdom
48 self.dishDialog = self.session.instantiateDialog(Dish)
50 class InfoBarShowHide:
51 """ InfoBar show/hide control, accepts toggleShow and hide actions, might start
59 self["ShowHideActions"] = ActionMap( ["InfobarShowHideActions"] ,
61 "toggleShow": self.toggleShow,
63 }, 1) # lower prio to make it possible to override ok and cancel..
65 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
67 iPlayableService.evStart: self.serviceStarted,
70 self.__state = self.STATE_SHOWN
73 self.hideTimer = eTimer()
74 self.hideTimer.callback.append(self.doTimerHide)
75 self.hideTimer.start(5000, True)
77 self.onShow.append(self.__onShow)
78 self.onHide.append(self.__onHide)
80 def serviceStarted(self):
82 if config.usage.show_infobar_on_zap.value:
86 self.__state = self.STATE_SHOWN
89 def startHideTimer(self):
90 if self.__state == self.STATE_SHOWN and not self.__locked:
91 idx = config.usage.infobar_timeout.index
93 self.hideTimer.start(idx*1000, True)
96 self.__state = self.STATE_HIDDEN
100 self.startHideTimer()
102 def doTimerHide(self):
103 self.hideTimer.stop()
104 if self.__state == self.STATE_SHOWN:
107 def toggleShow(self):
108 if self.__state == self.STATE_SHOWN:
110 self.hideTimer.stop()
111 elif self.__state == self.STATE_HIDDEN:
115 self.__locked = self.__locked + 1
118 self.hideTimer.stop()
120 def unlockShow(self):
121 self.__locked = self.__locked - 1
123 self.startHideTimer()
125 # def startShow(self):
126 # self.instance.m_animation.startMoveAnimation(ePoint(0, 600), ePoint(0, 380), 100)
127 # self.__state = self.STATE_SHOWN
129 # def startHide(self):
130 # self.instance.m_animation.startMoveAnimation(ePoint(0, 380), ePoint(0, 600), 100)
131 # self.__state = self.STATE_HIDDEN
133 class NumberZap(Screen):
140 self.close(int(self["number"].getText()))
142 def keyNumberGlobal(self, number):
143 self.Timer.start(3000, True) #reset timer
144 self.field = self.field + str(number)
145 self["number"].setText(self.field)
146 if len(self.field) >= 4:
149 def __init__(self, session, number):
150 Screen.__init__(self, session)
151 self.field = str(number)
153 self["channel"] = Label(_("Channel:"))
155 self["number"] = Label(self.field)
157 self["actions"] = NumberActionMap( [ "SetupActions" ],
161 "1": self.keyNumberGlobal,
162 "2": self.keyNumberGlobal,
163 "3": self.keyNumberGlobal,
164 "4": self.keyNumberGlobal,
165 "5": self.keyNumberGlobal,
166 "6": self.keyNumberGlobal,
167 "7": self.keyNumberGlobal,
168 "8": self.keyNumberGlobal,
169 "9": self.keyNumberGlobal,
170 "0": self.keyNumberGlobal
173 self.Timer = eTimer()
174 self.Timer.callback.append(self.keyOK)
175 self.Timer.start(3000, True)
177 class InfoBarNumberZap:
178 """ Handles an initial number for NumberZapping """
180 self["NumberActions"] = NumberActionMap( [ "NumberActions"],
182 "1": self.keyNumberGlobal,
183 "2": self.keyNumberGlobal,
184 "3": self.keyNumberGlobal,
185 "4": self.keyNumberGlobal,
186 "5": self.keyNumberGlobal,
187 "6": self.keyNumberGlobal,
188 "7": self.keyNumberGlobal,
189 "8": self.keyNumberGlobal,
190 "9": self.keyNumberGlobal,
191 "0": self.keyNumberGlobal,
194 def keyNumberGlobal(self, number):
195 # print "You pressed number " + str(number)
197 if isinstance(self, InfoBarPiP) and self.pipHandles0Action():
198 self.pipDoHandle0Action()
200 self.servicelist.recallPrevService()
202 if self.has_key("TimeshiftActions") and not self.timeshift_enabled:
203 self.session.openWithCallback(self.numberEntered, NumberZap, number)
205 def numberEntered(self, retval):
206 # print self.servicelist
208 self.zapToNumber(retval)
210 def searchNumberHelper(self, serviceHandler, num, bouquet):
211 servicelist = serviceHandler.list(bouquet)
212 if not servicelist is None:
214 serviceIterator = servicelist.getNext()
215 if not serviceIterator.valid(): #check end of list
217 playable = not (serviceIterator.flags & (eServiceReference.isMarker|eServiceReference.isDirectory))
220 if not num: #found service with searched number ?
221 return serviceIterator, 0
224 def zapToNumber(self, number):
225 bouquet = self.servicelist.bouquet_root
227 serviceHandler = eServiceCenter.getInstance()
228 if not config.usage.multibouquet.value:
229 service, number = self.searchNumberHelper(serviceHandler, number, bouquet)
231 bouquetlist = serviceHandler.list(bouquet)
232 if not bouquetlist is None:
234 bouquet = bouquetlist.getNext()
235 if not bouquet.valid(): #check end of list
237 if bouquet.flags & eServiceReference.isDirectory:
238 service, number = self.searchNumberHelper(serviceHandler, number, bouquet)
239 if not service is None:
240 if self.servicelist.getRoot() != bouquet: #already in correct bouquet?
241 self.servicelist.clearPath()
242 if self.servicelist.bouquet_root != bouquet:
243 self.servicelist.enterPath(self.servicelist.bouquet_root)
244 self.servicelist.enterPath(bouquet)
245 self.servicelist.setCurrentSelection(service) #select the service in servicelist
246 self.servicelist.zap()
248 config.misc.initialchannelselection = ConfigBoolean(default = True)
250 class InfoBarChannelSelection:
251 """ ChannelSelection - handles the channelSelection dialog and the initial
252 channelChange actions which open the channelSelection dialog """
255 self.servicelist = self.session.instantiateDialog(ChannelSelection)
257 if config.misc.initialchannelselection.value:
258 self.onShown.append(self.firstRun)
260 self["ChannelSelectActions"] = HelpableActionMap(self, "InfobarChannelSelection",
262 "switchChannelUp": (self.switchChannelUp, _("open servicelist(up)")),
263 "switchChannelDown": (self.switchChannelDown, _("open servicelist(down)")),
264 "zapUp": (self.zapUp, _("previous channel")),
265 "zapDown": (self.zapDown, _("next channel")),
266 "historyBack": (self.historyBack, _("previous channel in history")),
267 "historyNext": (self.historyNext, _("next channel in history")),
268 "openServiceList": (self.openServiceList, _("open servicelist")),
271 def showTvChannelList(self, zap=False):
272 self.servicelist.setModeTv()
274 self.servicelist.zap()
275 self.session.execDialog(self.servicelist)
277 def showRadioChannelList(self, zap=False):
278 self.servicelist.setModeRadio()
280 self.servicelist.zap()
281 self.session.execDialog(self.servicelist)
284 self.onShown.remove(self.firstRun)
285 config.misc.initialchannelselection.value = False
286 config.misc.initialchannelselection.save()
287 self.switchChannelDown()
289 def historyBack(self):
290 self.servicelist.historyBack()
292 def historyNext(self):
293 self.servicelist.historyNext()
295 def switchChannelUp(self):
296 self.servicelist.moveUp()
297 self.session.execDialog(self.servicelist)
299 def switchChannelDown(self):
300 self.servicelist.moveDown()
301 self.session.execDialog(self.servicelist)
303 def openServiceList(self):
304 self.session.execDialog(self.servicelist)
307 if self.servicelist.inBouquet():
308 prev = self.servicelist.getCurrentSelection()
310 prev = prev.toString()
312 if config.usage.quickzap_bouquet_change.value:
313 if self.servicelist.atBegin():
314 self.servicelist.prevBouquet()
315 self.servicelist.moveUp()
316 cur = self.servicelist.getCurrentSelection()
317 if not cur or (not (cur.flags & 64)) or cur.toString() == prev:
320 self.servicelist.moveUp()
321 self.servicelist.zap()
324 if self.servicelist.inBouquet():
325 prev = self.servicelist.getCurrentSelection()
327 prev = prev.toString()
329 if config.usage.quickzap_bouquet_change.value and self.servicelist.atEnd():
330 self.servicelist.nextBouquet()
332 self.servicelist.moveDown()
333 cur = self.servicelist.getCurrentSelection()
334 if not cur or (not (cur.flags & 64)) or cur.toString() == prev:
337 self.servicelist.moveDown()
338 self.servicelist.zap()
341 """ Handles a menu action, to open the (main) menu """
343 self["MenuActions"] = HelpableActionMap(self, "InfobarMenuActions",
345 "mainMenu": (self.mainMenu, _("Enter main menu...")),
347 self.session.infobar = None
350 print "loading mainmenu XML..."
351 menu = mdom.getroot()
352 assert menu.tag == "menu", "root element in menu must be 'menu'!"
354 self.session.infobar = self
355 # so we can access the currently active infobar from screens opened from within the mainmenu
356 # at the moment used from the SubserviceSelection
358 self.session.openWithCallback(self.mainMenuClosed, MainMenu, menu)
360 def mainMenuClosed(self, *val):
361 self.session.infobar = None
363 class InfoBarSimpleEventView:
364 """ Opens the Eventview for now/next """
366 self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",
368 "showEventInfo": (self.openEventView, _("show event details")),
369 "showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible,
372 def showEventInfoWhenNotVisible(self):
379 def openEventView(self):
381 self.epglist = epglist
382 service = self.session.nav.getCurrentService()
383 ref = self.session.nav.getCurrentlyPlayingServiceReference()
384 info = service.info()
392 self.session.open(EventViewSimple, epglist[0], ServiceReference(ref), self.eventViewCallback)
394 def eventViewCallback(self, setEvent, setService, val): #used for now/next displaying
395 epglist = self.epglist
398 epglist[0] = epglist[1]
402 class SimpleServicelist:
403 def __init__(self, services):
404 self.services = services
405 self.length = len(services)
408 def selectService(self, service):
414 while self.services[self.current].ref != service:
416 if self.current >= self.length:
420 def nextService(self):
423 if self.current+1 < self.length:
428 def prevService(self):
431 if self.current-1 > -1:
434 self.current = self.length - 1
436 def currentService(self):
437 if not self.length or self.current >= self.length:
439 return self.services[self.current]
442 """ EPG - Opens an EPG list when the showEPGList action fires """
444 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
446 iPlayableService.evUpdatedEventInfo: self.__evEventInfoChanged,
449 self.is_now_next = False
451 self.bouquetSel = None
452 self.eventView = None
453 self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",
455 "showEventInfo": (self.openEventView, _("show EPG...")),
456 "showEventInfoPlugin": (self.showEventInfoPlugins, _("show single service EPG...")),
457 "showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible,
460 def showEventInfoWhenNotVisible(self):
467 def zapToService(self, service):
468 if not service is None:
469 if self.servicelist.getRoot() != self.epg_bouquet: #already in correct bouquet?
470 self.servicelist.clearPath()
471 if self.servicelist.bouquet_root != self.epg_bouquet:
472 self.servicelist.enterPath(self.servicelist.bouquet_root)
473 self.servicelist.enterPath(self.epg_bouquet)
474 self.servicelist.setCurrentSelection(service) #select the service in servicelist
475 self.servicelist.zap()
477 def getBouquetServices(self, bouquet):
479 servicelist = eServiceCenter.getInstance().list(bouquet)
480 if not servicelist is None:
482 service = servicelist.getNext()
483 if not service.valid(): #check if end of list
485 if service.flags & (eServiceReference.isDirectory | eServiceReference.isMarker): #ignore non playable services
487 services.append(ServiceReference(service))
490 def openBouquetEPG(self, bouquet, withCallback=True):
491 services = self.getBouquetServices(bouquet)
493 self.epg_bouquet = bouquet
495 self.dlg_stack.append(self.session.openWithCallback(self.closed, EPGSelection, services, self.zapToService, None, self.changeBouquetCB))
497 self.session.open(EPGSelection, services, self.zapToService, None, self.changeBouquetCB)
499 def changeBouquetCB(self, direction, epg):
502 self.bouquetSel.down()
505 bouquet = self.bouquetSel.getCurrent()
506 services = self.getBouquetServices(bouquet)
508 self.epg_bouquet = bouquet
509 epg.setServices(services)
511 def closed(self, ret=False):
512 closedScreen = self.dlg_stack.pop()
513 if self.bouquetSel and closedScreen == self.bouquetSel:
514 self.bouquetSel = None
515 elif self.eventView and closedScreen == self.eventView:
516 self.eventView = None
518 dlgs=len(self.dlg_stack)
520 self.dlg_stack[dlgs-1].close(dlgs > 1)
522 def openMultiServiceEPG(self, withCallback=True):
523 bouquets = self.servicelist.getBouquetList()
528 if cnt > 1: # show bouquet list
530 self.bouquetSel = self.session.openWithCallback(self.closed, BouquetSelector, bouquets, self.openBouquetEPG, enableWrapAround=True)
531 self.dlg_stack.append(self.bouquetSel)
533 self.bouquetSel = self.session.open(BouquetSelector, bouquets, self.openBouquetEPG, enableWrapAround=True)
535 self.openBouquetEPG(bouquets[0][1], withCallback)
537 def changeServiceCB(self, direction, epg):
540 self.serviceSel.nextService()
542 self.serviceSel.prevService()
543 epg.setService(self.serviceSel.currentService())
545 def SingleServiceEPGClosed(self, ret=False):
546 self.serviceSel = None
548 def openSingleServiceEPG(self):
549 ref=self.session.nav.getCurrentlyPlayingServiceReference()
551 if self.servicelist.getMutableList() is not None: # bouquet in channellist
552 current_path = self.servicelist.getRoot()
553 services = self.getBouquetServices(current_path)
554 self.serviceSel = SimpleServicelist(services)
555 if self.serviceSel.selectService(ref):
556 self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref, serviceChangeCB = self.changeServiceCB)
558 self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref)
560 self.session.open(EPGSelection, ref)
562 def showEventInfoPlugins(self):
563 list = [(p.name, boundFunction(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO)]
566 list.append((_("show single service EPG..."), self.openSingleServiceEPG))
567 self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list, skin_name = "EPGExtensionsList")
569 self.openSingleServiceEPG()
571 def runPlugin(self, plugin):
572 plugin(session = self.session, servicelist = self.servicelist)
574 def EventInfoPluginChosen(self, answer):
575 if answer is not None:
578 def openSimilarList(self, eventid, refstr):
579 self.session.open(EPGSelection, refstr, None, eventid)
581 def getNowNext(self):
583 service = self.session.nav.getCurrentService()
584 info = service and service.info()
585 ptr = info and info.getEvent(0)
588 ptr = info and info.getEvent(1)
591 self.epglist = epglist
593 def __evEventInfoChanged(self):
594 if self.is_now_next and len(self.dlg_stack) == 1:
596 assert self.eventView
598 self.eventView.setEvent(self.epglist[0])
600 def openEventView(self):
601 ref = self.session.nav.getCurrentlyPlayingServiceReference()
603 epglist = self.epglist
605 self.is_now_next = False
606 epg = eEPGCache.getInstance()
607 ptr = ref and ref.valid() and epg.lookupEventTime(ref, -1)
610 ptr = epg.lookupEventTime(ref, ptr.getBeginTime(), +1)
614 self.is_now_next = True
616 self.eventView = self.session.openWithCallback(self.closed, EventViewEPGSelect, self.epglist[0], ServiceReference(ref), self.eventViewCallback, self.openSingleServiceEPG, self.openMultiServiceEPG, self.openSimilarList)
617 self.dlg_stack.append(self.eventView)
619 print "no epg for the service avail.. so we show multiepg instead of eventinfo"
620 self.openMultiServiceEPG(False)
622 def eventViewCallback(self, setEvent, setService, val): #used for now/next displaying
623 epglist = self.epglist
626 epglist[0]=epglist[1]
630 class InfoBarRdsDecoder:
631 """provides RDS and Rass support/display"""
633 self.rds_display = self.session.instantiateDialog(RdsInfoDisplay)
634 self.rass_interactive = None
636 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
638 iPlayableService.evEnd: self.__serviceStopped,
639 iPlayableService.evUpdatedRassSlidePic: self.RassSlidePicChanged
642 self["RdsActions"] = ActionMap(["InfobarRdsActions"],
644 "startRassInteractive": self.startRassInteractive
647 self["RdsActions"].setEnabled(False)
649 self.onLayoutFinish.append(self.rds_display.show)
650 self.rds_display.onRassInteractivePossibilityChanged.append(self.RassInteractivePossibilityChanged)
652 def RassInteractivePossibilityChanged(self, state):
653 self["RdsActions"].setEnabled(state)
655 def RassSlidePicChanged(self):
656 if not self.rass_interactive:
657 service = self.session.nav.getCurrentService()
658 decoder = service and service.rdsDecoder()
660 decoder.showRassSlidePicture()
662 def __serviceStopped(self):
663 if self.rass_interactive is not None:
664 rass_interactive = self.rass_interactive
665 self.rass_interactive = None
666 rass_interactive.close()
668 def startRassInteractive(self):
669 self.rds_display.hide()
670 self.rass_interactive = self.session.openWithCallback(self.RassInteractiveClosed, RassInteractive)
672 def RassInteractiveClosed(self, *val):
673 if self.rass_interactive is not None:
674 self.rass_interactive = None
675 self.RassSlidePicChanged()
676 self.rds_display.show()
679 """handles actions like seeking, pause"""
681 SEEK_STATE_PLAY = (0, 0, 0, ">")
682 SEEK_STATE_PAUSE = (1, 0, 0, "||")
683 SEEK_STATE_EOF = (1, 0, 0, "END")
685 def __init__(self, actionmap = "InfobarSeekActions", useSeekBackHack=True):
686 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
688 iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged,
689 iPlayableService.evStart: self.__serviceStarted,
691 iPlayableService.evEOF: self.__evEOF,
692 iPlayableService.evSOF: self.__evSOF,
695 self.minSpeedBackward = useSeekBackHack and 16 or 0
697 class InfoBarSeekActionMap(HelpableActionMap):
698 def __init__(self, screen, *args, **kwargs):
699 HelpableActionMap.__init__(self, screen, *args, **kwargs)
702 def action(self, contexts, action):
703 print "action:", action
704 if action[:5] == "seek:":
705 time = int(action[5:])
706 self.screen.doSeekRelative(time * 90000)
708 elif action[:8] == "seekdef:":
709 key = int(action[8:])
710 time = (-config.seek.selfdefined_13.value, False, config.seek.selfdefined_13.value,
711 -config.seek.selfdefined_46.value, False, config.seek.selfdefined_46.value,
712 -config.seek.selfdefined_79.value, False, config.seek.selfdefined_79.value)[key-1]
713 self.screen.doSeekRelative(time * 90000)
716 return HelpableActionMap.action(self, contexts, action)
718 self["SeekActions"] = InfoBarSeekActionMap(self, actionmap,
720 "playpauseService": self.playpauseService,
721 "pauseService": (self.pauseService, _("pause")),
722 "unPauseService": (self.unPauseService, _("continue")),
724 "seekFwd": (self.seekFwd, _("skip forward")),
725 "seekFwdManual": (self.seekFwdManual, _("skip forward (enter time)")),
726 "seekBack": (self.seekBack, _("skip backward")),
727 "seekBackManual": (self.seekBackManual, _("skip backward (enter time)"))
729 # give them a little more priority to win over color buttons
731 self["SeekActions"].setEnabled(False)
733 self.seekstate = self.SEEK_STATE_PLAY
734 self.lastseekstate = self.SEEK_STATE_PLAY
736 self.onPlayStateChanged = [ ]
738 self.lockedBecauseOfSkipping = False
740 self.__seekableStatusChanged()
742 def makeStateForward(self, n):
743 minspeed = config.seek.stepwise_minspeed.value
744 repeat = int(config.seek.stepwise_repeat.value)
745 if minspeed != "Never" and n >= int(minspeed) and repeat > 1:
746 return (0, n * repeat, repeat, ">> %dx" % n)
748 return (0, n, 0, ">> %dx" % n)
750 def makeStateBackward(self, n):
751 minspeed = config.seek.stepwise_minspeed.value
752 repeat = int(config.seek.stepwise_repeat.value)
753 if self.minSpeedBackward and n < self.minSpeedBackward:
754 r = (self.minSpeedBackward - 1)/ n + 1
755 if minspeed != "Never" and n >= int(minspeed) and repeat > 1:
757 return (0, -n * r, r, "<< %dx" % n)
758 elif minspeed != "Never" and n >= int(minspeed) and repeat > 1:
759 return (0, -n * repeat, repeat, "<< %dx" % n)
761 return (0, -n, 0, "<< %dx" % n)
763 def makeStateSlowMotion(self, n):
764 return (0, 0, n, "/%d" % n)
766 def isStateForward(self, state):
769 def isStateBackward(self, state):
772 def isStateSlowMotion(self, state):
773 return state[1] == 0 and state[2] > 1
775 def getHigher(self, n, lst):
781 def getLower(self, n, lst):
789 def showAfterSeek(self):
790 if isinstance(self, InfoBarShowHide):
800 service = self.session.nav.getCurrentService()
804 seek = service.seek()
806 if seek is None or not seek.isCurrentlySeekable():
811 def isSeekable(self):
812 if self.getSeek() is None:
816 def __seekableStatusChanged(self):
817 # print "seekable status changed!"
818 if not self.isSeekable():
819 self["SeekActions"].setEnabled(False)
820 # print "not seekable, return to play"
821 self.setSeekState(self.SEEK_STATE_PLAY)
823 self["SeekActions"].setEnabled(True)
826 def __serviceStarted(self):
827 self.seekstate = self.SEEK_STATE_PLAY
828 self.__seekableStatusChanged()
830 def setSeekState(self, state):
831 service = self.session.nav.getCurrentService()
836 if not self.isSeekable():
837 if state not in (self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE):
838 state = self.SEEK_STATE_PLAY
840 pauseable = service.pause()
842 if pauseable is None:
843 print "not pauseable."
844 state = self.SEEK_STATE_PLAY
846 self.seekstate = state
848 if pauseable is not None:
849 if self.seekstate[0]:
850 print "resolved to PAUSE"
852 elif self.seekstate[1]:
853 print "resolved to FAST FORWARD"
854 pauseable.setFastForward(self.seekstate[1])
855 elif self.seekstate[2]:
856 print "resolved to SLOW MOTION"
857 pauseable.setSlowMotion(self.seekstate[2])
859 print "resolved to PLAY"
862 for c in self.onPlayStateChanged:
865 self.checkSkipShowHideLock()
869 def playpauseService(self):
870 if self.seekstate != self.SEEK_STATE_PLAY:
871 self.unPauseService()
875 def pauseService(self):
876 if self.seekstate == self.SEEK_STATE_PAUSE:
877 if config.seek.on_pause.value == "play":
878 self.unPauseService()
879 elif config.seek.on_pause.value == "step":
880 self.doSeekRelative(0)
881 elif config.seek.on_pause.value == "last":
882 self.setSeekState(self.lastseekstate)
883 self.lastseekstate = self.SEEK_STATE_PLAY
885 if self.seekstate != self.SEEK_STATE_EOF:
886 self.lastseekstate = self.seekstate
887 self.setSeekState(self.SEEK_STATE_PAUSE);
889 def unPauseService(self):
891 if self.seekstate == self.SEEK_STATE_PLAY:
893 self.setSeekState(self.SEEK_STATE_PLAY)
895 def doSeek(self, pts):
896 seekable = self.getSeek()
901 def doSeekRelative(self, pts):
902 seekable = self.getSeek()
905 prevstate = self.seekstate
907 if self.seekstate == self.SEEK_STATE_EOF:
908 if prevstate == self.SEEK_STATE_PAUSE:
909 self.setSeekState(self.SEEK_STATE_PAUSE)
911 self.setSeekState(self.SEEK_STATE_PLAY)
912 seekable.seekRelative(pts<0 and -1 or 1, abs(pts))
913 if abs(pts) > 100 and config.usage.show_infobar_on_skip.value:
917 if self.seekstate == self.SEEK_STATE_PLAY:
918 self.setSeekState(self.makeStateForward(int(config.seek.enter_forward.value)))
919 elif self.seekstate == self.SEEK_STATE_PAUSE:
920 if len(config.seek.speeds_slowmotion.value):
921 self.setSeekState(self.makeStateSlowMotion(config.seek.speeds_slowmotion.value[-1]))
923 self.setSeekState(self.makeStateForward(int(config.seek.enter_forward.value)))
924 elif self.seekstate == self.SEEK_STATE_EOF:
926 elif self.isStateForward(self.seekstate):
927 speed = self.seekstate[1]
928 if self.seekstate[2]:
929 speed /= self.seekstate[2]
930 speed = self.getHigher(speed, config.seek.speeds_forward.value) or config.seek.speeds_forward.value[-1]
931 self.setSeekState(self.makeStateForward(speed))
932 elif self.isStateBackward(self.seekstate):
933 speed = -self.seekstate[1]
934 if self.seekstate[2]:
935 speed /= self.seekstate[2]
936 speed = self.getLower(speed, config.seek.speeds_backward.value)
938 self.setSeekState(self.makeStateBackward(speed))
940 self.setSeekState(self.SEEK_STATE_PLAY)
941 elif self.isStateSlowMotion(self.seekstate):
942 speed = self.getLower(self.seekstate[2], config.seek.speeds_slowmotion.value) or config.seek.speeds_slowmotion.value[0]
943 self.setSeekState(self.makeStateSlowMotion(speed))
946 seekstate = self.seekstate
947 if seekstate == self.SEEK_STATE_PLAY:
948 self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value)))
949 elif seekstate == self.SEEK_STATE_EOF:
950 self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value)))
951 self.doSeekRelative(-6)
952 elif seekstate == self.SEEK_STATE_PAUSE:
953 self.doSeekRelative(-3)
954 elif self.isStateForward(seekstate):
957 speed /= seekstate[2]
958 speed = self.getLower(speed, config.seek.speeds_forward.value)
960 self.setSeekState(self.makeStateForward(speed))
962 self.setSeekState(self.SEEK_STATE_PLAY)
963 elif self.isStateBackward(seekstate):
964 speed = -seekstate[1]
966 speed /= seekstate[2]
967 speed = self.getHigher(speed, config.seek.speeds_backward.value) or config.seek.speeds_backward.value[-1]
968 self.setSeekState(self.makeStateBackward(speed))
969 elif self.isStateSlowMotion(seekstate):
970 speed = self.getHigher(seekstate[2], config.seek.speeds_slowmotion.value)
972 self.setSeekState(self.makeStateSlowMotion(speed))
974 self.setSeekState(self.SEEK_STATE_PAUSE)
976 def seekFwdManual(self):
977 self.session.openWithCallback(self.fwdSeekTo, MinuteInput)
979 def fwdSeekTo(self, minutes):
980 print "Seek", minutes, "minutes forward"
981 self.doSeekRelative(minutes * 60 * 90000)
983 def seekBackManual(self):
984 self.session.openWithCallback(self.rwdSeekTo, MinuteInput)
986 def rwdSeekTo(self, minutes):
988 self.doSeekRelative(-minutes * 60 * 90000)
990 def checkSkipShowHideLock(self):
991 wantlock = self.seekstate != self.SEEK_STATE_PLAY
993 if config.usage.show_infobar_on_skip.value:
994 if self.lockedBecauseOfSkipping and not wantlock:
996 self.lockedBecauseOfSkipping = False
998 if wantlock and not self.lockedBecauseOfSkipping:
1000 self.lockedBecauseOfSkipping = True
1002 def calcRemainingTime(self):
1003 seekable = self.getSeek()
1004 if seekable is not None:
1005 len = seekable.getLength()
1007 tmp = self.cueGetEndCutPosition()
1012 pos = seekable.getPlayPosition()
1013 speednom = self.seekstate[1] or 1
1014 speedden = self.seekstate[2] or 1
1015 if not len[0] and not pos[0]:
1016 if len[1] <= pos[1]:
1018 time = (len[1] - pos[1])*speedden/(90*speednom)
1023 if self.seekstate == self.SEEK_STATE_EOF:
1026 # if we are seeking forward, we try to end up ~1s before the end, and pause there.
1027 seekstate = self.seekstate
1028 if self.seekstate != self.SEEK_STATE_PAUSE:
1029 self.setSeekState(self.SEEK_STATE_EOF)
1031 if seekstate not in (self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE): # if we are seeking
1032 seekable = self.getSeek()
1033 if seekable is not None:
1035 if seekstate == self.SEEK_STATE_PLAY: # regular EOF
1036 self.doEofInternal(True)
1038 self.doEofInternal(False)
1040 def doEofInternal(self, playing):
1041 pass # Defined in subclasses
1044 self.setSeekState(self.SEEK_STATE_PLAY)
1047 from Screens.PVRState import PVRState, TimeshiftState
1049 class InfoBarPVRState:
1050 def __init__(self, screen=PVRState, force_show = False):
1051 self.onPlayStateChanged.append(self.__playStateChanged)
1052 self.pvrStateDialog = self.session.instantiateDialog(screen)
1053 self.onShow.append(self._mayShow)
1054 self.onHide.append(self.pvrStateDialog.hide)
1055 self.force_show = force_show
1058 if self.execing and self.seekstate != self.SEEK_STATE_PLAY:
1059 self.pvrStateDialog.show()
1061 def __playStateChanged(self, state):
1062 playstateString = state[3]
1063 self.pvrStateDialog["state"].setText(playstateString)
1065 # if we return into "PLAY" state, ensure that the dialog gets hidden if there will be no infobar displayed
1066 if not config.usage.show_infobar_on_skip.value and self.seekstate == self.SEEK_STATE_PLAY and not self.force_show:
1067 self.pvrStateDialog.hide()
1072 class InfoBarTimeshiftState(InfoBarPVRState):
1074 InfoBarPVRState.__init__(self, screen=TimeshiftState, force_show = True)
1077 if self.execing and self.timeshift_enabled and self.seekstate != self.SEEK_STATE_PLAY:
1078 self.pvrStateDialog.show()
1080 class InfoBarShowMovies:
1082 # i don't really like this class.
1083 # it calls a not further specified "movie list" on up/down/movieList,
1084 # so this is not more than an action map
1086 self["MovieListActions"] = HelpableActionMap(self, "InfobarMovieListActions",
1088 "movieList": (self.showMovies, _("movie list")),
1089 "up": (self.showMovies, _("movie list")),
1090 "down": (self.showMovies, _("movie list"))
1093 # InfoBarTimeshift requires InfoBarSeek, instantiated BEFORE!
1097 # Timeshift works the following way:
1098 # demux0 demux1 "TimeshiftActions" "TimeshiftActivateActions" "SeekActions"
1099 # - normal playback TUNER unused PLAY enable disable disable
1100 # - user presses "yellow" button. FILE record PAUSE enable disable enable
1101 # - user presess pause again FILE record PLAY enable disable enable
1102 # - user fast forwards FILE record FF enable disable enable
1103 # - end of timeshift buffer reached TUNER record PLAY enable enable disable
1104 # - user backwards FILE record BACK # !! enable disable enable
1108 # - when a service is playing, pressing the "timeshiftStart" button ("yellow") enables recording ("enables timeshift"),
1109 # freezes the picture (to indicate timeshift), sets timeshiftMode ("activates timeshift")
1110 # now, the service becomes seekable, so "SeekActions" are enabled, "TimeshiftEnableActions" are disabled.
1111 # - the user can now PVR around
1112 # - if it hits the end, the service goes into live mode ("deactivates timeshift", it's of course still "enabled")
1113 # the service looses it's "seekable" state. It can still be paused, but just to activate timeshift right
1115 # the seek actions will be disabled, but the timeshiftActivateActions will be enabled
1116 # - if the user rewinds, or press pause, timeshift will be activated again
1118 # note that a timeshift can be enabled ("recording") and
1119 # activated (currently time-shifting).
1121 class InfoBarTimeshift:
1123 self["TimeshiftActions"] = HelpableActionMap(self, "InfobarTimeshiftActions",
1125 "timeshiftStart": (self.startTimeshift, _("start timeshift")), # the "yellow key"
1126 "timeshiftStop": (self.stopTimeshift, _("stop timeshift")) # currently undefined :), probably 'TV'
1128 self["TimeshiftActivateActions"] = ActionMap(["InfobarTimeshiftActivateActions"],
1130 "timeshiftActivateEnd": self.activateTimeshiftEnd, # something like "rewind key"
1131 "timeshiftActivateEndAndPause": self.activateTimeshiftEndAndPause # something like "pause key"
1132 }, prio=-1) # priority over record
1134 self.timeshift_enabled = 0
1135 self.timeshift_state = 0
1136 self.ts_rewind_timer = eTimer()
1137 self.ts_rewind_timer.callback.append(self.rewindService)
1139 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
1141 iPlayableService.evStart: self.__serviceStarted,
1142 iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged
1145 def getTimeshift(self):
1146 service = self.session.nav.getCurrentService()
1147 return service and service.timeshift()
1149 def startTimeshift(self):
1150 print "enable timeshift"
1151 ts = self.getTimeshift()
1153 self.session.open(MessageBox, _("Timeshift not possible!"), MessageBox.TYPE_ERROR)
1154 print "no ts interface"
1157 if self.timeshift_enabled:
1158 print "hu, timeshift already enabled?"
1160 if not ts.startTimeshift():
1161 self.timeshift_enabled = 1
1163 # we remove the "relative time" for now.
1164 #self.pvrStateDialog["timeshift"].setRelative(time.time())
1167 #self.setSeekState(self.SEEK_STATE_PAUSE)
1168 self.activateTimeshiftEnd(False)
1170 # enable the "TimeshiftEnableActions", which will override
1171 # the startTimeshift actions
1172 self.__seekableStatusChanged()
1174 print "timeshift failed"
1176 def stopTimeshift(self):
1177 if not self.timeshift_enabled:
1179 print "disable timeshift"
1180 ts = self.getTimeshift()
1183 self.session.openWithCallback(self.stopTimeshiftConfirmed, MessageBox, _("Stop Timeshift?"), MessageBox.TYPE_YESNO)
1185 def stopTimeshiftConfirmed(self, confirmed):
1189 ts = self.getTimeshift()
1194 self.timeshift_enabled = 0
1197 self.__seekableStatusChanged()
1199 # activates timeshift, and seeks to (almost) the end
1200 def activateTimeshiftEnd(self, back = True):
1201 ts = self.getTimeshift()
1202 print "activateTimeshiftEnd"
1207 if ts.isTimeshiftActive():
1208 print "!! activate timeshift called - but shouldn't this be a normal pause?"
1212 ts.activateTimeshift() # activate timeshift will automatically pause
1213 self.setSeekState(self.SEEK_STATE_PAUSE)
1216 self.doSeek(-5) # seek some gops before end
1217 self.ts_rewind_timer.start(200, 1)
1219 self.doSeek(-1) # seek 1 gop before end
1221 def rewindService(self):
1222 self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value)))
1224 # same as activateTimeshiftEnd, but pauses afterwards.
1225 def activateTimeshiftEndAndPause(self):
1226 print "activateTimeshiftEndAndPause"
1227 #state = self.seekstate
1228 self.activateTimeshiftEnd(False)
1230 def __seekableStatusChanged(self):
1233 # print "self.isSeekable", self.isSeekable()
1234 # print "self.timeshift_enabled", self.timeshift_enabled
1236 # when this service is not seekable, but timeshift
1237 # is enabled, this means we can activate
1239 if not self.isSeekable() and self.timeshift_enabled:
1242 # print "timeshift activate:", enabled
1243 self["TimeshiftActivateActions"].setEnabled(enabled)
1245 def __serviceStarted(self):
1246 self.timeshift_enabled = False
1247 self.__seekableStatusChanged()
1249 from Screens.PiPSetup import PiPSetup
1251 class InfoBarExtensions:
1252 EXTENSION_SINGLE = 0
1258 self["InstantExtensionsActions"] = HelpableActionMap(self, "InfobarExtensions",
1260 "extensions": (self.showExtensionSelection, _("view extensions...")),
1261 }, 1) # lower priority
1263 def addExtension(self, extension, key = None, type = EXTENSION_SINGLE):
1264 self.list.append((type, extension, key))
1266 def updateExtension(self, extension, key = None):
1267 self.extensionsList.append(extension)
1269 if self.extensionKeys.has_key(key):
1273 for x in self.availableKeys:
1274 if not self.extensionKeys.has_key(x):
1279 self.extensionKeys[key] = len(self.extensionsList) - 1
1281 def updateExtensions(self):
1282 self.extensionsList = []
1283 self.availableKeys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue" ]
1284 self.extensionKeys = {}
1286 if x[0] == self.EXTENSION_SINGLE:
1287 self.updateExtension(x[1], x[2])
1290 self.updateExtension(y[0], y[1])
1293 def showExtensionSelection(self):
1294 self.updateExtensions()
1295 extensionsList = self.extensionsList[:]
1298 for x in self.availableKeys:
1299 if self.extensionKeys.has_key(x):
1300 entry = self.extensionKeys[x]
1301 extension = self.extensionsList[entry]
1303 name = str(extension[0]())
1304 list.append((extension[0](), extension))
1306 extensionsList.remove(extension)
1308 extensionsList.remove(extension)
1309 list.extend([(x[0](), x) for x in extensionsList])
1311 keys += [""] * len(extensionsList)
1312 self.session.openWithCallback(self.extensionCallback, ChoiceBox, title=_("Please choose an extension..."), list = list, keys = keys, skin_name = "ExtensionsList")
1314 def extensionCallback(self, answer):
1315 if answer is not None:
1318 from Tools.BoundFunction import boundFunction
1320 # depends on InfoBarExtensions
1322 class InfoBarPlugins:
1324 self.addExtension(extension = self.getPluginList, type = InfoBarExtensions.EXTENSION_LIST)
1326 def getPluginName(self, name):
1329 def getPluginList(self):
1330 list = [((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None, p.name) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU)]
1331 list.sort(key = lambda e: e[2]) # sort by name
1334 def runPlugin(self, plugin):
1335 if isinstance(self, InfoBarChannelSelection):
1336 plugin(session = self.session, servicelist = self.servicelist)
1338 plugin(session = self.session)
1340 from Components.Task import job_manager
1341 class InfoBarJobman:
1343 self.addExtension(extension = self.getJobList, type = InfoBarExtensions.EXTENSION_LIST)
1345 def getJobList(self):
1346 return [((boundFunction(self.getJobName, job), boundFunction(self.showJobView, job), lambda: True), None) for job in job_manager.getPendingJobs()]
1348 def getJobName(self, job):
1349 return "%s: %s (%d%%)" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))
1351 def showJobView(self, job):
1352 from Screens.TaskView import JobView
1353 job_manager.in_background = False
1354 self.session.openWithCallback(self.JobViewCB, JobView, job)
1356 def JobViewCB(self, in_background):
1357 job_manager.in_background = in_background
1359 # depends on InfoBarExtensions
1363 self.session.pipshown
1365 self.session.pipshown = False
1366 if SystemInfo.get("NumVideoDecoders", 1) > 1:
1368 self.addExtension((self.getShowHideName, self.showPiP, lambda: True), "blue")
1369 self.addExtension((self.getMoveName, self.movePiP, self.pipShown), "green")
1370 self.addExtension((self.getSwapName, self.swapPiP, self.pipShown), "yellow")
1372 self.addExtension((self.getShowHideName, self.showPiP, self.pipShown), "blue")
1373 self.addExtension((self.getMoveName, self.movePiP, self.pipShown), "green")
1376 return self.session.pipshown
1378 def pipHandles0Action(self):
1379 return self.pipShown() and config.usage.pip_zero_button.value != "standard"
1381 def getShowHideName(self):
1382 if self.session.pipshown:
1383 return _("Disable Picture in Picture")
1385 return _("Activate Picture in Picture")
1387 def getSwapName(self):
1388 return _("Swap Services")
1390 def getMoveName(self):
1391 return _("Move Picture in Picture")
1394 if self.session.pipshown:
1395 del self.session.pip
1396 self.session.pipshown = False
1398 self.session.pip = self.session.instantiateDialog(PictureInPicture)
1399 self.session.pip.show()
1400 newservice = self.session.nav.getCurrentlyPlayingServiceReference()
1401 if self.session.pip.playService(newservice):
1402 self.session.pipshown = True
1403 self.session.pip.servicePath = self.servicelist.getCurrentServicePath()
1405 self.session.pipshown = False
1406 del self.session.pip
1407 self.session.nav.playService(newservice)
1410 swapservice = self.session.nav.getCurrentlyPlayingServiceReference()
1411 if self.session.pip.servicePath:
1412 servicepath = self.servicelist.getCurrentServicePath()
1413 ref=servicepath[len(servicepath)-1]
1414 pipref=self.session.pip.getCurrentService()
1415 self.session.pip.playService(swapservice)
1416 self.servicelist.setCurrentServicePath(self.session.pip.servicePath)
1417 if pipref.toString() != ref.toString(): # is a subservice ?
1418 self.session.nav.stopService() # stop portal
1419 self.session.nav.playService(pipref) # start subservice
1420 self.session.pip.servicePath=servicepath
1423 self.session.open(PiPSetup, pip = self.session.pip)
1425 def pipDoHandle0Action(self):
1426 use = config.usage.pip_zero_button.value
1429 elif "swapstop" == use:
1435 from RecordTimer import parseEvent, RecordTimerEntry
1437 class InfoBarInstantRecord:
1438 """Instant Record - handles the instantRecord action in order to
1439 start/stop instant records"""
1441 self["InstantRecordActions"] = HelpableActionMap(self, "InfobarInstantRecord",
1443 "instantRecord": (self.instantRecord, _("Instant Record...")),
1447 def stopCurrentRecording(self, entry = -1):
1448 if entry is not None and entry != -1:
1449 self.session.nav.RecordTimer.removeEntry(self.recording[entry])
1450 self.recording.remove(self.recording[entry])
1452 def startInstantRecording(self, limitEvent = False):
1453 serviceref = self.session.nav.getCurrentlyPlayingServiceReference()
1455 # try to get event info
1458 service = self.session.nav.getCurrentService()
1459 epg = eEPGCache.getInstance()
1460 event = epg.lookupEventTime(serviceref, -1, 0)
1462 info = service.info()
1463 ev = info.getEvent(0)
1469 end = begin + 3600 # dummy
1470 name = "instant record"
1474 if event is not None:
1475 curEvent = parseEvent(event)
1477 description = curEvent[3]
1478 eventid = curEvent[4]
1483 self.session.open(MessageBox, _("No event info found, recording indefinitely."), MessageBox.TYPE_INFO)
1485 if isinstance(serviceref, eServiceReference):
1486 serviceref = ServiceReference(serviceref)
1488 recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname = preferredInstantRecordPath())
1489 recording.dontSave = True
1491 if event is None or limitEvent == False:
1492 recording.autoincrease = True
1493 if recording.setAutoincreaseEnd():
1494 self.session.nav.RecordTimer.record(recording)
1495 self.recording.append(recording)
1497 simulTimerList = self.session.nav.RecordTimer.record(recording)
1498 if simulTimerList is not None: # conflict with other recording
1499 name = simulTimerList[1].name
1500 name_date = ' '.join((name, strftime('%c', localtime(simulTimerList[1].begin))))
1501 print "[TIMER] conflicts with", name_date
1502 recording.autoincrease = True # start with max available length, then increment
1503 if recording.setAutoincreaseEnd():
1504 self.session.nav.RecordTimer.record(recording)
1505 self.recording.append(recording)
1506 self.session.open(MessageBox, _("Record time limited due to conflicting timer %s") % name_date, MessageBox.TYPE_INFO)
1508 self.session.open(MessageBox, _("Couldn't record due to conflicting timer %s") % name, MessageBox.TYPE_INFO)
1509 recording.autoincrease = False
1511 self.recording.append(recording)
1513 def isInstantRecordRunning(self):
1514 print "self.recording:", self.recording
1516 for x in self.recording:
1521 def recordQuestionCallback(self, answer):
1522 print "pre:\n", self.recording
1524 if answer is None or answer[1] == "no":
1527 recording = self.recording[:]
1529 if not x in self.session.nav.RecordTimer.timer_list:
1530 self.recording.remove(x)
1531 elif x.dontSave and x.isRunning():
1532 list.append((x, False))
1534 if answer[1] == "changeduration":
1535 if len(self.recording) == 1:
1536 self.changeDuration(0)
1538 self.session.openWithCallback(self.changeDuration, TimerSelection, list)
1539 elif answer[1] == "changeendtime":
1540 if len(self.recording) == 1:
1543 self.session.openWithCallback(self.setEndtime, TimerSelection, list)
1544 elif answer[1] == "stop":
1545 if len(self.recording) == 1:
1546 self.stopCurrentRecording(0)
1548 self.session.openWithCallback(self.stopCurrentRecording, TimerSelection, list)
1549 elif answer[1] in ( "indefinitely" , "manualduration", "manualendtime", "event"):
1550 self.startInstantRecording(limitEvent = answer[1] in ("event", "manualendtime") or False)
1551 if answer[1] == "manualduration":
1552 self.changeDuration(len(self.recording)-1)
1553 elif answer[1] == "manualendtime":
1554 self.setEndtime(len(self.recording)-1)
1555 print "after:\n", self.recording
1557 def setEndtime(self, entry):
1558 if entry is not None and entry >= 0:
1559 self.selectedEntry = entry
1560 self.endtime=ConfigClock(default = self.recording[self.selectedEntry].end)
1561 dlg = self.session.openWithCallback(self.TimeDateInputClosed, TimeDateInput, self.endtime)
1562 dlg.setTitle(_("Please change recording endtime"))
1564 def TimeDateInputClosed(self, ret):
1567 localendtime = localtime(ret[1])
1568 print "stopping recording at", strftime("%c", localendtime)
1569 if self.recording[self.selectedEntry].end != ret[1]:
1570 self.recording[self.selectedEntry].autoincrease = False
1571 self.recording[self.selectedEntry].end = ret[1]
1572 self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry])
1574 def changeDuration(self, entry):
1575 if entry is not None and entry >= 0:
1576 self.selectedEntry = entry
1577 self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER)
1579 def inputCallback(self, value):
1580 if value is not None:
1581 print "stopping recording after", int(value), "minutes."
1582 entry = self.recording[self.selectedEntry]
1584 entry.autoincrease = False
1585 entry.end = int(time()) + 60 * int(value)
1586 self.session.nav.RecordTimer.timeChanged(entry)
1588 def instantRecord(self):
1589 dir = preferredInstantRecordPath()
1590 if not dir or not fileExists(dir, 'w'):
1591 dir = defaultMoviePath()
1595 # XXX: this message is a little odd as we might be recording to a remote device
1596 self.session.open(MessageBox, _("No HDD found or HDD not initialized!"), MessageBox.TYPE_ERROR)
1599 if self.isInstantRecordRunning():
1600 self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, \
1601 title=_("A recording is currently running.\nWhat do you want to do?"), \
1602 list=((_("stop recording"), "stop"), \
1603 (_("add recording (stop after current event)"), "event"), \
1604 (_("add recording (indefinitely)"), "indefinitely"), \
1605 (_("add recording (enter recording duration)"), "manualduration"), \
1606 (_("add recording (enter recording endtime)"), "manualendtime"), \
1607 (_("change recording (duration)"), "changeduration"), \
1608 (_("change recording (endtime)"), "changeendtime"), \
1609 (_("do nothing"), "no")))
1611 self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, \
1612 title=_("Start recording?"), \
1613 list=((_("add recording (stop after current event)"), "event"), \
1614 (_("add recording (indefinitely)"), "indefinitely"), \
1615 (_("add recording (enter recording duration)"), "manualduration"), \
1616 (_("add recording (enter recording endtime)"), "manualendtime"), \
1617 (_("don't record"), "no")))
1619 from Tools.ISO639 import LanguageCodes
1621 class InfoBarAudioSelection:
1623 self["AudioSelectionAction"] = HelpableActionMap(self, "InfobarAudioSelectionActions",
1625 "audioSelection": (self.audioSelection, _("Audio Options...")),
1628 def audioSelection(self):
1629 service = self.session.nav.getCurrentService()
1630 self.audioTracks = audio = service and service.audioTracks()
1631 n = audio and audio.getNumberOfTracks() or 0
1634 self.audioChannel = service.audioChannel()
1639 i = audio.getTrackInfo(idx)
1640 languages = i.getLanguage().split('/')
1641 description = i.getDescription()
1644 for lang in languages:
1647 if LanguageCodes.has_key(lang):
1648 language += LanguageCodes[lang][0]
1653 if len(description):
1654 description += " (" + language + ")"
1656 description = language
1658 tlist.append((description, idx))
1661 tlist.sort(key=lambda x: x[0])
1663 selectedAudio = self.audioTracks.getCurrentTrack()
1668 if x[1] != selectedAudio:
1673 if SystemInfo["CanDownmixAC3"]:
1674 tlist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix),
1675 ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"),
1677 keys = [ "red", "green", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n
1680 tlist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist
1681 keys = [ "red", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n
1683 self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection")
1685 del self.audioTracks
1687 def changeAC3Downmix(self, arg):
1688 choicelist = self.session.current_dialog["list"]
1689 list = choicelist.list
1691 list[0][1]=(t[0], t[1], t[2], t[3], t[4], t[5], t[6],
1692 _("AC3 downmix") + " - " + (_("On"), _("Off"))[config.av.downmix_ac3.value and 1 or 0])
1693 choicelist.setList(list)
1694 if config.av.downmix_ac3.value:
1695 config.av.downmix_ac3.value = False
1697 config.av.downmix_ac3.value = True
1698 config.av.downmix_ac3.save()
1700 def audioSelected(self, audio):
1701 if audio is not None:
1702 if isinstance(audio[1], str):
1703 if audio[1] == "mode":
1704 keys = ["red", "green", "yellow"]
1705 selection = self.audioChannel.getCurrentChannel()
1706 tlist = ((_("left"), 0), (_("stereo"), 1), (_("right"), 2))
1707 self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys, skin_name ="AudioModeSelection")
1709 del self.audioChannel
1710 if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > audio[1]:
1711 self.audioTracks.selectTrack(audio[1])
1713 del self.audioChannel
1714 del self.audioTracks
1716 def modeSelected(self, mode):
1717 if mode is not None:
1718 self.audioChannel.selectChannel(mode[1])
1719 del self.audioChannel
1721 class InfoBarSubserviceSelection:
1723 self["SubserviceSelectionAction"] = HelpableActionMap(self, "InfobarSubserviceSelectionActions",
1725 "subserviceSelection": (self.subserviceSelection, _("Subservice list...")),
1728 self["SubserviceQuickzapAction"] = HelpableActionMap(self, "InfobarSubserviceQuickzapActions",
1730 "nextSubservice": (self.nextSubservice, _("Switch to next subservice")),
1731 "prevSubservice": (self.prevSubservice, _("Switch to previous subservice"))
1733 self["SubserviceQuickzapAction"].setEnabled(False)
1735 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
1737 iPlayableService.evUpdatedEventInfo: self.checkSubservicesAvail
1742 def checkSubservicesAvail(self):
1743 service = self.session.nav.getCurrentService()
1744 subservices = service and service.subServices()
1745 if not subservices or subservices.getNumberOfSubservices() == 0:
1746 self["SubserviceQuickzapAction"].setEnabled(False)
1748 def nextSubservice(self):
1749 self.changeSubservice(+1)
1751 def prevSubservice(self):
1752 self.changeSubservice(-1)
1754 def changeSubservice(self, direction):
1755 service = self.session.nav.getCurrentService()
1756 subservices = service and service.subServices()
1757 n = subservices and subservices.getNumberOfSubservices()
1760 ref = self.session.nav.getCurrentlyPlayingServiceReference()
1763 if subservices.getSubservice(idx).toString() == ref.toString():
1768 selection += direction
1773 newservice = subservices.getSubservice(selection)
1774 if newservice.valid():
1777 self.session.nav.playService(newservice, False)
1779 def subserviceSelection(self):
1780 service = self.session.nav.getCurrentService()
1781 subservices = service and service.subServices()
1782 self.bouquets = self.servicelist.getBouquetList()
1783 n = subservices and subservices.getNumberOfSubservices()
1786 ref = self.session.nav.getCurrentlyPlayingServiceReference()
1790 i = subservices.getSubservice(idx)
1791 if i.toString() == ref.toString():
1793 tlist.append((i.getName(), i))
1796 if self.bouquets and len(self.bouquets):
1797 keys = ["red", "blue", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n
1798 if config.usage.multibouquet.value:
1799 tlist = [(_("Quickzap"), "quickzap", service.subServices()), (_("Add to bouquet"), "CALLFUNC", self.addSubserviceToBouquetCallback), ("--", "")] + tlist
1801 tlist = [(_("Quickzap"), "quickzap", service.subServices()), (_("Add to favourites"), "CALLFUNC", self.addSubserviceToBouquetCallback), ("--", "")] + tlist
1804 tlist = [(_("Quickzap"), "quickzap", service.subServices()), ("--", "")] + tlist
1805 keys = ["red", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n
1808 self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice..."), list = tlist, selection = selection, keys = keys, skin_name = "SubserviceSelection")
1810 def subserviceSelected(self, service):
1812 if not service is None:
1813 if isinstance(service[1], str):
1814 if service[1] == "quickzap":
1815 from Screens.SubservicesQuickzap import SubservicesQuickzap
1816 self.session.open(SubservicesQuickzap, service[2])
1818 self["SubserviceQuickzapAction"].setEnabled(True)
1819 self.session.nav.playService(service[1], False)
1821 def addSubserviceToBouquetCallback(self, service):
1822 if len(service) > 1 and isinstance(service[1], eServiceReference):
1823 self.selectedSubservice = service
1824 if self.bouquets is None:
1827 cnt = len(self.bouquets)
1828 if cnt > 1: # show bouquet list
1829 self.bsel = self.session.openWithCallback(self.bouquetSelClosed, BouquetSelector, self.bouquets, self.addSubserviceToBouquet)
1830 elif cnt == 1: # add to only one existing bouquet
1831 self.addSubserviceToBouquet(self.bouquets[0][1])
1832 self.session.open(MessageBox, _("Service has been added to the favourites."), MessageBox.TYPE_INFO)
1834 def bouquetSelClosed(self, confirmed):
1836 del self.selectedSubservice
1838 self.session.open(MessageBox, _("Service has been added to the selected bouquet."), MessageBox.TYPE_INFO)
1840 def addSubserviceToBouquet(self, dest):
1841 self.servicelist.addServiceToBouquet(dest, self.selectedSubservice[1])
1843 self.bsel.close(True)
1845 del self.selectedSubservice
1847 class InfoBarAdditionalInfo:
1850 self["RecordingPossible"] = Boolean(fixed=harddiskmanager.HDDCount() > 0 and config.misc.rcused.value == 1)
1851 self["TimeshiftPossible"] = self["RecordingPossible"]
1852 self["ShowTimeshiftOnYellow"] = Boolean(fixed=(not config.misc.rcused.value == 0))
1853 self["ShowAudioOnYellow"] = Boolean(fixed=config.misc.rcused.value == 0)
1854 self["ShowRecordOnRed"] = Boolean(fixed=config.misc.rcused.value == 1)
1855 self["ExtensionsAvailable"] = Boolean(fixed=1)
1857 class InfoBarNotifications:
1859 self.onExecBegin.append(self.checkNotifications)
1860 Notifications.notificationAdded.append(self.checkNotificationsIfExecing)
1861 self.onClose.append(self.__removeNotification)
1863 def __removeNotification(self):
1864 Notifications.notificationAdded.remove(self.checkNotificationsIfExecing)
1866 def checkNotificationsIfExecing(self):
1868 self.checkNotifications()
1870 def checkNotifications(self):
1871 notifications = Notifications.notifications
1873 n = notifications[0]
1875 del notifications[0]
1878 if n[3].has_key("onSessionOpenCallback"):
1879 n[3]["onSessionOpenCallback"]()
1880 del n[3]["onSessionOpenCallback"]
1883 dlg = self.session.openWithCallback(cb, n[1], *n[2], **n[3])
1885 dlg = self.session.open(n[1], *n[2], **n[3])
1887 # remember that this notification is currently active
1889 Notifications.current_notifications.append(d)
1890 dlg.onClose.append(boundFunction(self.__notificationClosed, d))
1892 def __notificationClosed(self, d):
1893 Notifications.current_notifications.remove(d)
1895 class InfoBarServiceNotifications:
1897 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
1899 iPlayableService.evEnd: self.serviceHasEnded
1902 def serviceHasEnded(self):
1903 print "service end!"
1906 self.setSeekState(self.SEEK_STATE_PLAY)
1910 class InfoBarCueSheetSupport:
1916 ENABLE_RESUME_SUPPORT = False
1918 def __init__(self, actionmap = "InfobarCueSheetActions"):
1919 self["CueSheetActions"] = HelpableActionMap(self, actionmap,
1921 "jumpPreviousMark": (self.jumpPreviousMark, _("jump to previous marked position")),
1922 "jumpNextMark": (self.jumpNextMark, _("jump to next marked position")),
1923 "toggleMark": (self.toggleMark, _("toggle a cut mark at the current position"))
1927 self.is_closing = False
1928 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
1930 iPlayableService.evStart: self.__serviceStarted,
1933 def __serviceStarted(self):
1936 print "new service started! trying to download cuts!"
1937 self.downloadCuesheet()
1939 if self.ENABLE_RESUME_SUPPORT:
1942 for (pts, what) in self.cut_list:
1943 if what == self.CUT_TYPE_LAST:
1946 if last is not None:
1947 self.resume_point = last
1948 if config.usage.on_movie_start.value == "ask":
1949 Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?"), timeout=10)
1950 elif config.usage.on_movie_start.value == "resume":
1951 # TRANSLATORS: The string "Resuming playback" flashes for a moment
1952 # TRANSLATORS: at the start of a movie, when the user has selected
1953 # TRANSLATORS: "Resume from last position" as start behavior.
1954 # TRANSLATORS: The purpose is to notify the user that the movie starts
1955 # TRANSLATORS: in the middle somewhere and not from the beginning.
1956 # TRANSLATORS: (Some translators seem to have interpreted it as a
1957 # TRANSLATORS: question or a choice, but it is a statement.)
1958 Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Resuming playback"), timeout=2, type=MessageBox.TYPE_INFO)
1960 def playLastCB(self, answer):
1962 self.doSeek(self.resume_point)
1963 self.hideAfterResume()
1965 def hideAfterResume(self):
1966 if isinstance(self, InfoBarShowHide):
1969 def __getSeekable(self):
1970 service = self.session.nav.getCurrentService()
1973 return service.seek()
1975 def cueGetCurrentPosition(self):
1976 seek = self.__getSeekable()
1979 r = seek.getPlayPosition()
1984 def cueGetEndCutPosition(self):
1987 for cp in self.cut_list:
1988 if cp[1] == self.CUT_TYPE_OUT:
1992 elif cp[1] == self.CUT_TYPE_IN:
1996 def jumpPreviousNextMark(self, cmp, start=False):
1997 current_pos = self.cueGetCurrentPosition()
1998 if current_pos is None:
2000 mark = self.getNearestCutPoint(current_pos, cmp=cmp, start=start)
2001 if mark is not None:
2009 def jumpPreviousMark(self):
2010 # we add 2 seconds, so if the play position is <2s after
2011 # the mark, the mark before will be used
2012 self.jumpPreviousNextMark(lambda x: -x-5*90000, start=True)
2014 def jumpNextMark(self):
2015 if not self.jumpPreviousNextMark(lambda x: x):
2018 def getNearestCutPoint(self, pts, cmp=abs, start=False):
2024 bestdiff = cmp(0 - pts)
2026 nearest = [0, False]
2027 for cp in self.cut_list:
2028 if beforecut and cp[1] in (self.CUT_TYPE_IN, self.CUT_TYPE_OUT):
2030 if cp[1] == self.CUT_TYPE_IN: # Start is here, disregard previous marks
2031 diff = cmp(cp[0] - pts)
2037 if cp[1] in (self.CUT_TYPE_MARK, self.CUT_TYPE_LAST):
2038 diff = cmp(cp[0] - pts)
2039 if diff >= 0 and (nearest is None or bestdiff > diff):
2044 def toggleMark(self, onlyremove=False, onlyadd=False, tolerance=5*90000, onlyreturn=False):
2045 current_pos = self.cueGetCurrentPosition()
2046 if current_pos is None:
2047 print "not seekable"
2050 nearest_cutpoint = self.getNearestCutPoint(current_pos)
2052 if nearest_cutpoint is not None and abs(nearest_cutpoint[0] - current_pos) < tolerance:
2054 return nearest_cutpoint
2056 self.removeMark(nearest_cutpoint)
2057 elif not onlyremove and not onlyreturn:
2058 self.addMark((current_pos, self.CUT_TYPE_MARK))
2063 def addMark(self, point):
2064 insort(self.cut_list, point)
2065 self.uploadCuesheet()
2066 self.showAfterCuesheetOperation()
2068 def removeMark(self, point):
2069 self.cut_list.remove(point)
2070 self.uploadCuesheet()
2071 self.showAfterCuesheetOperation()
2073 def showAfterCuesheetOperation(self):
2074 if isinstance(self, InfoBarShowHide):
2077 def __getCuesheet(self):
2078 service = self.session.nav.getCurrentService()
2081 return service.cueSheet()
2083 def uploadCuesheet(self):
2084 cue = self.__getCuesheet()
2087 print "upload failed, no cuesheet interface"
2089 cue.setCutList(self.cut_list)
2091 def downloadCuesheet(self):
2092 cue = self.__getCuesheet()
2095 print "download failed, no cuesheet interface"
2098 self.cut_list = cue.getCutList()
2100 class InfoBarSummary(Screen):
2102 <screen position="0,0" size="132,64">
2103 <widget source="global.CurrentTime" render="Label" position="62,46" size="82,18" font="Regular;16" >
2104 <convert type="ClockToText">WithSeconds</convert>
2106 <widget source="session.RecordState" render="FixedLabel" text=" " position="62,46" size="82,18" zPosition="1" >
2107 <convert type="ConfigEntryTest">config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean</convert>
2108 <convert type="ConditionalShowHide">Blink</convert>
2110 <widget source="session.CurrentService" render="Label" position="6,4" size="120,42" font="Regular;18" >
2111 <convert type="ServiceName">Name</convert>
2113 <widget source="session.Event_Now" render="Progress" position="6,46" size="46,18" borderWidth="1" >
2114 <convert type="EventTime">Progress</convert>
2118 # for picon: (path="piconlcd" will use LCD picons)
2119 # <widget source="session.CurrentService" render="Picon" position="6,0" size="120,64" path="piconlcd" >
2120 # <convert type="ServiceName">Reference</convert>
2123 class InfoBarSummarySupport:
2127 def createSummary(self):
2128 return InfoBarSummary
2130 class InfoBarMoviePlayerSummary(Screen):
2132 <screen position="0,0" size="132,64">
2133 <widget source="global.CurrentTime" render="Label" position="62,46" size="64,18" font="Regular;16" halign="right" >
2134 <convert type="ClockToText">WithSeconds</convert>
2136 <widget source="session.RecordState" render="FixedLabel" text=" " position="62,46" size="64,18" zPosition="1" >
2137 <convert type="ConfigEntryTest">config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean</convert>
2138 <convert type="ConditionalShowHide">Blink</convert>
2140 <widget source="session.CurrentService" render="Label" position="6,4" size="120,42" font="Regular;18" >
2141 <convert type="ServiceName">Name</convert>
2143 <widget source="session.CurrentService" render="Progress" position="6,46" size="56,18" borderWidth="1" >
2144 <convert type="ServicePosition">Position</convert>
2148 class InfoBarMoviePlayerSummarySupport:
2152 def createSummary(self):
2153 return InfoBarMoviePlayerSummary
2155 class InfoBarTeletextPlugin:
2157 self.teletext_plugin = None
2159 for p in plugins.getPlugins(PluginDescriptor.WHERE_TELETEXT):
2160 self.teletext_plugin = p
2162 if self.teletext_plugin is not None:
2163 self["TeletextActions"] = HelpableActionMap(self, "InfobarTeletextActions",
2165 "startTeletext": (self.startTeletext, _("View teletext..."))
2168 print "no teletext plugin found!"
2170 def startTeletext(self):
2171 self.teletext_plugin(session=self.session, service=self.session.nav.getCurrentService())
2173 class InfoBarSubtitleSupport(object):
2175 object.__init__(self)
2176 self.subtitle_window = self.session.instantiateDialog(SubtitleDisplay)
2177 self.__subtitles_enabled = False
2179 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
2181 iPlayableService.evEnd: self.__serviceStopped,
2182 iPlayableService.evUpdatedInfo: self.__updatedInfo
2184 self.cached_subtitle_checked = False
2185 self.__selected_subtitle = None
2187 def __serviceStopped(self):
2188 self.cached_subtitle_checked = False
2189 if self.__subtitles_enabled:
2190 self.subtitle_window.hide()
2191 self.__subtitles_enabled = False
2192 self.__selected_subtitle = None
2194 def __updatedInfo(self):
2195 if not self.cached_subtitle_checked:
2196 self.cached_subtitle_checked = True
2197 subtitle = self.getCurrentServiceSubtitle()
2198 self.setSelectedSubtitle(subtitle and subtitle.getCachedSubtitle())
2199 if self.__selected_subtitle:
2200 self.setSubtitlesEnable(True)
2202 def getCurrentServiceSubtitle(self):
2203 service = self.session.nav.getCurrentService()
2204 return service and service.subtitle()
2206 def setSubtitlesEnable(self, enable=True):
2207 subtitle = self.getCurrentServiceSubtitle()
2209 if self.__selected_subtitle:
2210 if subtitle and not self.__subtitles_enabled:
2211 subtitle.enableSubtitles(self.subtitle_window.instance, self.selected_subtitle)
2212 self.subtitle_window.show()
2213 self.__subtitles_enabled = True
2216 subtitle.disableSubtitles(self.subtitle_window.instance)
2217 self.__selected_subtitle = False
2218 self.__subtitles_enabled = False
2219 self.subtitle_window.hide()
2221 def setSelectedSubtitle(self, subtitle):
2222 self.__selected_subtitle = subtitle
2224 subtitles_enabled = property(lambda self: self.__subtitles_enabled, setSubtitlesEnable)
2225 selected_subtitle = property(lambda self: self.__selected_subtitle, setSelectedSubtitle)
2227 class InfoBarServiceErrorPopupSupport:
2229 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
2231 iPlayableService.evTuneFailed: self.__tuneFailed,
2232 iPlayableService.evStart: self.__serviceStarted
2234 self.__serviceStarted()
2236 def __serviceStarted(self):
2237 self.last_error = None
2238 Notifications.RemovePopup(id = "ZapError")
2240 def __tuneFailed(self):
2241 service = self.session.nav.getCurrentService()
2242 info = service and service.info()
2243 error = info and info.getInfo(iServiceInformation.sDVBState)
2245 if error == self.last_error:
2248 self.last_error = error
2251 eDVBServicePMTHandler.eventNoResources: _("No free tuner!"),
2252 eDVBServicePMTHandler.eventTuneFailed: _("Tune failed!"),
2253 eDVBServicePMTHandler.eventNoPAT: _("No data on transponder!\n(Timeout reading PAT)"),
2254 eDVBServicePMTHandler.eventNoPATEntry: _("Service not found!\n(SID not found in PAT)"),
2255 eDVBServicePMTHandler.eventNoPMT: _("Service invalid!\n(Timeout reading PMT)"),
2256 eDVBServicePMTHandler.eventNewProgramInfo: None,
2257 eDVBServicePMTHandler.eventTuned: None,
2258 eDVBServicePMTHandler.eventSOF: None,
2259 eDVBServicePMTHandler.eventEOF: None,
2260 eDVBServicePMTHandler.eventMisconfiguration: _("Service unavailable!\nCheck tuner configuration!"),
2261 }.get(error) #this returns None when the key not exist in the dict
2263 if error is not None:
2264 Notifications.AddPopup(text = error, type = MessageBox.TYPE_ERROR, timeout = 5, id = "ZapError")
2266 Notifications.RemovePopup(id = "ZapError")