add subservice selection to timer (when linkage services are avail for the selected...
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sun, 8 Jan 2006 14:55:16 +0000 (14:55 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sun, 8 Jan 2006 14:55:16 +0000 (14:55 +0000)
better layout in timerlist (more space for service name and event description)

RecordTimer.py
data/skin.xml
lib/python/Components/TimerList.py
lib/python/Screens/SubserviceSelection.py
lib/python/Screens/TimerEntry.py
lib/service/event.cpp
lib/service/event.h
lib/service/service.cpp
lib/service/servicedvb.cpp

index 37aecdbdb574401abde0a65d36b431e14c12152c..2234bfc3f19f9975d141251c87c19138fbd80fd3 100644 (file)
@@ -8,6 +8,7 @@ import timer
 import xml.dom.minidom
 
 from Screens.MessageBox import MessageBox
+from Screens.SubserviceSelection import SubserviceSelection
 import NavigationInstance
 
 from Tools.XMLTools import elementsWithTag
@@ -26,7 +27,7 @@ def parseEvent(ev):
        description = ev.getShortDescription()
        begin = ev.getBeginTime()
        end = begin + ev.getDuration()
-       eit = None
+       eit = ev.getEventId()
        return (begin, end, name, description, eit)
 
 class RecordTimerEntry(timer.TimerEntry):
index 9a4eaa134bafe743d21cf09db8533d8156a51c7b..5c4482b55ed6845b2f7cfe265515c2e6ce4155d6 100644 (file)
                        <widget name="config" position="10,30" size="420,220" />
                </screen>
                <screen name="TimerEditList" position="70,100" size="560,400" title="Timer Editor">
-                       <widget name="timerlist" position="0,50" size="560,300" scrollbarMode="showOnDemand" />
+                       <widget name="timerlist" position="0,45" size="560,350" scrollbarMode="showOnDemand" />
                        <widget name="key_red" position="0,0" size="140,40" backgroundColor="red" font="Regular;21" />
                        <widget name="key_green" position="140,0" size="140,40" backgroundColor="green" font="Regular;21" />
                        <widget name="key_yellow" position="280,0" size="140,40" backgroundColor="yellow" font="Regular;21" />
index e48b7a0dd304a9fc43898d643c9e7a801a4d19af..47c49d3f410f3faa6cda7e19ceb7bc4ba8716773 100644 (file)
@@ -26,7 +26,9 @@ RT_WRAP = 32
 def TimerEntryComponent(timer, processed):
        res = [ timer ]
        
-       res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 220, 30, 0, RT_HALIGN_LEFT, timer.service_ref.getServiceName()))
+       res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 560, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, timer.service_ref.getServiceName()))
+       res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, 560, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, timer.name))
+       
        repeatedtext = ""
        days = [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" ]
        if (timer.repeated != 0):
@@ -39,12 +41,10 @@ def TimerEntryComponent(timer, processed):
                                        repeatedtext += days[x]
                                        count += 1
                                flags = flags >> 1
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, 300, 20, 1, RT_HALIGN_LEFT, repeatedtext + (" %s ... %s" % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1]))))
+               res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 300, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (" %s ... %s" % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1]))))
        else:
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, 300, 20, 1, RT_HALIGN_LEFT, repeatedtext + ("%s, %s ... %s" % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:]))))
+               res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 300, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ("%s, %s ... %s" % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:]))))
 
-       res.append((eListboxPythonMultiContent.TYPE_TEXT, 240, 0, 320, 20, 1, RT_HALIGN_RIGHT, timer.name))
-       
        if not processed:
                if timer.state == TimerEntry.StateWait:
                        state = "waiting"
@@ -57,7 +57,7 @@ def TimerEntryComponent(timer, processed):
        else:
                state = "done!"
        
-       res.append((eListboxPythonMultiContent.TYPE_TEXT, 320, 30, 240, 20, 1, RT_HALIGN_RIGHT, state))
+       res.append((eListboxPythonMultiContent.TYPE_TEXT, 320, 50, 240, 20, 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, state))
        
        return res
 
@@ -75,7 +75,7 @@ class TimerList(HTMLComponent, GUIComponent):
        def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
-               self.instance.setItemHeight(50)
+               self.instance.setItemHeight(70)
        
        def GUIdelete(self):
                self.instance.setContent(None)
index a73cf0e4e08eb9137acf9eb1478c79c0213b976c..0aa34b61a378b4daec97d84b78208a2c2b5e7ae7 100644 (file)
@@ -2,7 +2,7 @@ from Screen import Screen
 from Components.ActionMap import ActionMap
 from Components.MenuList import MenuList
 from Components.Label import Label
-from enigma import eServiceReferencePtr, eServiceReference
+from enigma import eServiceReferencePtr, eServiceReference, iSubserviceListPtr, eServiceEventPtrPtr
 
 class SubserviceSelection(Screen):
        def KeyOk(self):
@@ -10,7 +10,7 @@ class SubserviceSelection(Screen):
                self.close(selection[1])
        def Cancel(self):
                self.close(None)
-       def __init__(self, session, subservices):
+       def __init__(self, session, subservices, parent=None):
                Screen.__init__(self, session)
 
                self["actions"] = ActionMap(["OkCancelActions"], 
@@ -21,10 +21,19 @@ class SubserviceSelection(Screen):
 
                self.subservices = subservices
 
+               print subservices
                tlist = []
-               n = subservices.getNumberOfSubservices()
-               for x in range(n):
-                       i = subservices.getSubservice(x)
-                       tlist.append((i.getName(), i))
+               if isinstance(subservices, iSubserviceListPtr):
+                       n = subservices.getNumberOfSubservices()
+                       for x in range(n):
+                               i = subservices.getSubservice(x)
+                               tlist.append((i.getName(), i))
+               elif isinstance(subservices, eServiceEventPtrPtr):
+                       n = subservices.getNumOfLinkageServices()
+                       for x in range(n):
+                               i = subservices.getLinkageService(parent, x)
+                               tlist.append((i.getName(), i))
+               else:
+                       print "unknown type of subservices"
 
                self["subservices"] = MenuList(tlist)
index ea18d892df4b4231d8cdc81f35bfcd731813e750..703e4aba884cafc04b998eb8fb6abae15c74080e 100644 (file)
@@ -7,6 +7,8 @@ from Components.ConfigList import ConfigList
 from Components.NimManager import nimmanager
 from Components.Label import Label
 from Components.Pixmap import Pixmap
+from Screens.SubserviceSelection import SubserviceSelection
+from enigma import eEPGCache
 import time
 import datetime
 
@@ -256,8 +258,19 @@ class TimerEntry(Screen):
                                        if (config.timerentry.day[x].value == 0): self.timer.setRepeated(x)
 
                        self.timer.begin = self.getTimestamp(time.time(), config.timerentry.starttime.value)
-                       self.timer.end = self.getTimestamp(time.time(), config.timerentry.endtime.value)                                
-
+                       self.timer.end = self.getTimestamp(time.time(), config.timerentry.endtime.value)
+
+               if self.timer.eit is not None:
+                       event = eEPGCache.getInstance().lookupEventId(self.timer.service_ref.ref, self.timer.eit)
+                       if event is not None:
+                               if event.getNumOfLinkageServices() > 0:
+                                       self.session.openWithCallback(self.subserviceSelected, SubserviceSelection, event, self.timer.service_ref.ref)
+                                       return
+                       self.close((True, self.timer))
+
+       def subserviceSelected(self, service):
+               if not service is None:
+                       self.timer.service_ref = ServiceReference(service)
                self.close((True, self.timer))
 
        def keyCancel(self):
index f84c38b7ed250580458cb65ecc75a975da8afb58..2d0f83a47833547a0cd74137fa6019181e637732 100644 (file)
@@ -204,7 +204,7 @@ RESULT eServiceEvent::getComponentData(ePtr<eComponentData> &dest, int tagnum) c
        return -1;
 }
 
-RESULT eServiceEvent::getLinkageService(eServiceReference &service, int num) const
+RESULT eServiceEvent::getLinkageService(eServiceReference &service, eServiceReference &parent, int num) const
 {
        std::list<eServiceReference>::const_iterator it =
                m_linkage_services.begin();
@@ -213,6 +213,25 @@ RESULT eServiceEvent::getLinkageService(eServiceReference &service, int num) con
        if ( it != m_linkage_services.end() )
        {
                service = *it;
+               eServiceReferenceDVB &subservice = (eServiceReferenceDVB&) service;
+               eServiceReferenceDVB &current = (eServiceReferenceDVB&) parent;
+               subservice.setDVBNamespace(current.getDVBNamespace());
+               if ( current.getParentTransportStreamID().get() )
+               {
+                       subservice.setParentTransportStreamID( current.getParentTransportStreamID() );
+                       subservice.setParentServiceID( current.getParentServiceID() );
+               }
+               else
+               {
+                       subservice.setParentTransportStreamID( current.getTransportStreamID() );
+                       subservice.setParentServiceID( current.getServiceID() );
+               }
+               if ( subservice.getParentTransportStreamID() == subservice.getTransportStreamID() &&
+                       subservice.getParentServiceID() == subservice.getServiceID() )
+               {
+                       subservice.setParentTransportStreamID( eTransportStreamID(0) );
+                       subservice.setParentServiceID( eServiceID(0) );
+               }
                return 0;
        }
        service.type = eServiceReference::idInvalid;
index 0a6891aac4c738fcc53fc7125747fe3070387e72..9ee6538bd08d4c2462a55765c37d2f60e9983c51 100644 (file)
@@ -53,7 +53,7 @@ public:
        std::string getBeginTimeString() const;
        SWIG_VOID(RESULT) getComponentData(ePtr<eComponentData> &SWIG_OUTPUT, int tagnum) const;
        int getNumOfLinkageServices() const { return m_linkage_services.size(); }
-       SWIG_VOID(RESULT) getLinkageService(eServiceReference &SWIG_OUTPUT, int num) const;
+       SWIG_VOID(RESULT) getLinkageService(eServiceReference &SWIG_OUTPUT, eServiceReference &parent, int num) const;
 };
 
 TEMPLATE_TYPEDEF(ePtr<eServiceEvent>, eServiceEventPtr);
index 150a0cd3298ca47c18500a9d77b084aa7cea973c..a490c3d7ba099d7177328435532d240c5d0ca81f 100644 (file)
@@ -7,8 +7,8 @@
 eServiceReference::eServiceReference(const std::string &string)
 {
        const char *c=string.c_str();
-       int pathl=-1;
-       
+       int pathl=0;
+
        if ( sscanf(c, "%d:%d:%x:%x:%x:%x:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7], &pathl) < 8 )
        {
                memset( data, 0, sizeof(data) );
@@ -17,7 +17,19 @@ eServiceReference::eServiceReference(const std::string &string)
        }
 
        if (pathl)
-               path=c+pathl;
+       {
+               const char *pathstr = c+pathl;
+               const char *namestr = strchr(pathstr, ':');
+               if (namestr)
+               {
+                       if (pathstr != namestr)
+                               path.assign(pathstr, namestr-pathstr);
+                       if (*(namestr+1))
+                               name=namestr+1;
+               }
+               else
+                       path=pathstr;
+       }
 }
 
 std::string eServiceReference::toString() const
@@ -27,10 +39,10 @@ std::string eServiceReference::toString() const
        ret += ":";
        ret += getNum(flags);
        for (unsigned int i=0; i<sizeof(data)/sizeof(*data); ++i)
-       {
                ret+=":"+ getNum(data[i], 0x10);
-       }
        ret+=":"+path;
+       if (name.length())
+               ret+=":"+name;
        return ret;
 }
 
index 9cba0aafecab682a33317404ce7140695155eaec..15deff62901599a5e54ab6dae751480e570346a9 100644 (file)
@@ -1037,29 +1037,8 @@ RESULT eDVBServicePlay::getSubservice(eServiceReference &sub, unsigned int n)
        ePtr<eServiceEvent> evt;
        if (!m_event_handler.getEvent(evt, 0))
        {
-               if (!evt->getLinkageService(sub, n))
-               {
-                       eServiceReferenceDVB &subservice = (eServiceReferenceDVB&) sub;
-                       eServiceReferenceDVB &current = (eServiceReferenceDVB&) m_reference;
-                       subservice.setDVBNamespace(current.getDVBNamespace());
-                       if ( current.getParentTransportStreamID().get() )
-                       {
-                               subservice.setParentTransportStreamID( current.getParentTransportStreamID() );
-                               subservice.setParentServiceID( current.getParentServiceID() );
-                       }
-                       else
-                       {
-                               subservice.setParentTransportStreamID( current.getTransportStreamID() );
-                               subservice.setParentServiceID( current.getServiceID() );
-                       }
-                       if ( subservice.getParentTransportStreamID() == subservice.getTransportStreamID() &&
-                               subservice.getParentServiceID() == subservice.getServiceID() )
-                       {
-                               subservice.setParentTransportStreamID( eTransportStreamID(0) );
-                               subservice.setParentServiceID( eServiceID(0) );
-                       }
+               if (!evt->getLinkageService(sub, m_reference, n))
                        return 0;
-               }
        }
        sub.type=eServiceReference::idInvalid;
        return -1;