show real satellite name in satellite list
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 19 Dec 2005 14:35:19 +0000 (14:35 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 19 Dec 2005 14:35:19 +0000 (14:35 +0000)
lib/dvb/db.cpp
lib/python/Components/ServiceList.py
lib/python/Screens/ChannelSelection.py
lib/service/iservice.h
lib/service/listboxservice.cpp
lib/service/listboxservice.h

index a3a98c0..33a422f 100644 (file)
@@ -854,19 +854,12 @@ eDVBDBSatellitesQuery::eDVBDBSatellitesQuery(eDVBDB *db, const eServiceReference
                        {
                                eServiceReferenceDVB ref;
                                ref.setDVBNamespace(dvbnamespace);
+                               ref.flags=eServiceReference::flagDirectory;
                                char buf[64];
-// TODO get real satellite name..
-// but i dont like to parse the satellites.xml here.. and in the python part
-                               int tpos = dvbnamespace>>16;
-                               if (tpos > 1800) // west
-                                       snprintf(buf, 64, "Services (%3.1fW)", (0 - (tpos - 3600)) / 10.0);
-                               else
-                                       snprintf(buf, 64, "Services (%3.1fE)", tpos / 10.0);
-                               ref.name=buf;
                                snprintf(buf, 64, "(satellitePosition == %d) && ", dvbnamespace>>16);
+
                                ref.path=buf+source.path;
                                unsigned int pos=ref.path.find("FROM");
-                               ref.flags=eServiceReference::flagDirectory;
                                ref.path.erase(pos);
                                ref.path+="ORDER BY name";
 //                             eDebug("ref.path now %s", ref.path.c_str());
@@ -877,11 +870,6 @@ eDVBDBSatellitesQuery::eDVBDBSatellitesQuery(eDVBDB *db, const eServiceReference
                                ref.path.erase(pos+5);
                                ref.path+="PROVIDERS ORDER BY name";
 //                             eDebug("ref.path now %s", ref.path.c_str());
-                               if (tpos > 1800) // west
-                                       snprintf(buf, 64, "Providers (%3.1fW)", (0 - (tpos - 3600)) / 10.0);
-                               else
-                                       snprintf(buf, 64, "Providers (%3.1fE)", tpos / 10.0);
-                               ref.name=buf;
                                m_list.push_back(ref);
                        }
                }
index d24f956..4c10c66 100644 (file)
@@ -79,9 +79,17 @@ class ServiceList(HTMLComponent, GUIComponent):
        def setPlayableIgnoreService(self, ref):
                self.l.setIgnoreService(ref)
 
-       def setRoot(self, root):
+       def setRoot(self, root, justSet=False):
                self.root = root
-               self.l.setRoot(root)
+               self.l.setRoot(root, justSet)
+               if not justSet:
+                       self.l.sort()
+
+       def addService(self, service):
+               self.l.addService(service)
+
+       def finishFill(self):
+               self.l.FillFinished()
                self.l.sort()
 
 # stuff for multiple marks (edit mode / later multiepg)
index c7d8d16..a775227 100644 (file)
@@ -7,6 +7,7 @@ from enigma import eServiceReference, eEPGCache, eEPGCachePtr, eServiceCenter, e
 from Components.config import config, configElement, ConfigSubsection, configText
 from Screens.FixedMenu import FixedMenu
 from Tools.NumericalTextInput import NumericalTextInput
+from Components.NimManager import nimmanager
 
 import xml.dom.minidom
 
@@ -34,7 +35,7 @@ class ChannelContextMenu(FixedMenu):
                haveBouquets = csel.bouquet_root.getPath().find('FROM BOUQUET "bouquets.') != -1
 
                if not csel.bouquet_mark_edit and not csel.movemode and not inBouquetRootList:
-                       if (csel.getCurrentSelection().type & eServiceReference.flagDirectory) != eServiceReference.flagDirectory:
+                       if (csel.getCurrentSelection().flags & eServiceReference.flagDirectory) != eServiceReference.flagDirectory:
                                if haveBouquets:
                                        menu.append((_("add service to bouquet"), self.addServiceToBouquetSelected))
                                else:
@@ -251,8 +252,8 @@ class ChannelSelectionBase(Screen):
 
                self.service_types = self.service_types_tv
 
-               #self.bouquet_root = eServiceReference('1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "bouquets.tv" ORDER BY bouquet')
-               self.bouquet_root = eServiceReference('%s FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet'%(self.service_types))
+               self.bouquet_root = eServiceReference('1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "bouquets.tv" ORDER BY bouquet')
+               #self.bouquet_root = eServiceReference('%s FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet'%(self.service_types))
 
                self["key_red"] = Button(_("All"))
                self["key_green"] = Button(_("Satellites"))
@@ -290,14 +291,14 @@ class ChannelSelectionBase(Screen):
                                                offsetCount += 1
                return offsetCount
 
-       def setRootBase(self, root):
+       def setRootBase(self, root, justSet=False):
                inBouquetRootList = root.getPath().find('FROM BOUQUET "bouquets.') != -1 #FIXME HACK
                if not inBouquetRootList and (root.getPath().find('FROM BOUQUET') != -1):
                        self.servicelist.setMode(ServiceList.MODE_FAVOURITES)
                        self.servicelist.setNumberOffset(self.getBouquetNumOffset(root))
                else:
                        self.servicelist.setMode(ServiceList.MODE_NORMAL)
-               self.servicelist.setRoot(root)
+               self.servicelist.setRoot(root, justSet)
 
        def moveUp(self):
                self.servicelist.moveUp()
@@ -311,7 +312,29 @@ class ChannelSelectionBase(Screen):
 
        def showSatellites(self):
                ref = eServiceReference('%s FROM SATELLITES ORDER BY satellitePosition'%(self.service_types))
-               self.setRoot(ref)
+               self.setRoot(ref, True)
+               serviceHandler = eServiceCenter.getInstance()
+               servicelist = serviceHandler.list(ref)
+               if not servicelist is None:
+                       while True:
+                               service = servicelist.getNext()
+                               if not service.valid(): #check if end of list
+                                       break
+                               orbpos = service.getData(4) >> 16
+                               if service.getPath().find("FROM PROVIDER") != -1:
+                                       service_name = _("Providers")
+                               else:
+                                       service_name = _("Services")
+                               try:
+                                       service_name += ' - %s'%(nimmanager.getSatDescription(orbpos))
+                                       service.setName(str(service_name)) # why we need this cast?
+                               except:
+                                       if orbpos > 1800: # west
+                                               service.setName("%s (%3.1fW)"%(str, (0 - (orbpos - 3600)) / 10.0))
+                                       else:
+                                               service.setName("%s (%3.1fE)"%(str, orbpos / 10.0))
+                               self.servicelist.addService(service)
+               self.servicelist.finishFill()
 
        def showProviders(self):
                ref = eServiceReference('%s FROM PROVIDERS ORDER BY name'%(self.service_types))
@@ -432,9 +455,9 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit):
                        self.zap()
                        self.close(ref)
 
-       def setRoot(self, root):
+       def setRoot(self, root, justSet=False):
                if not self.movemode:
-                       self.setRootBase(root)
+                       self.setRootBase(root, justSet)
 
        #called from infoBar and channelSelected
        def zap(self):
index 285063e..f84b961 100644 (file)
@@ -47,6 +47,19 @@ public:
        std::string path;
        std::string getPath() { return path; }
 
+       int getData(int num) const
+       {
+               if ( num < sizeof(data)/sizeof(int) )
+                       return data[num];
+               return 0;
+       }
+
+       void setData(int num, int val)
+       {
+               if ( num < sizeof(data)/sizeof(int) )
+                       data[num] = val;
+       }
+
 // only for override service names in bouquets or to give servicerefs a name which not have a
 // real existing service ( for dvb eServiceDVB )
        std::string name;
index 035658e..cd48c62 100644 (file)
@@ -3,12 +3,29 @@
 #include <lib/gdi/font.h>
 #include <lib/dvb/epgcache.h>
 #include <lib/dvb/pmt.h>
+#include <lib/python/connections.h>
 
-void eListboxServiceContent::setRoot(const eServiceReference &root)
+void eListboxServiceContent::addService(const eServiceReference &service)
+{
+       m_list.push_back(service);
+}
+
+void eListboxServiceContent::FillFinished()
+{
+       m_size = m_list.size();
+       cursorHome();
+
+       if (m_listbox)
+               m_listbox->entryReset();
+}
+
+void eListboxServiceContent::setRoot(const eServiceReference &root, bool justSet)
 {
        m_list.clear();
        m_root = root;
-       
+
+       if (justSet)
+               return;
        assert(m_service_center);
        
        ePtr<iListableService> lst;
@@ -18,11 +35,7 @@ void eListboxServiceContent::setRoot(const eServiceReference &root)
                if (lst->getContent(m_list))
                        eDebug("getContent failed");
 
-       m_size = m_list.size();
-       cursorHome();
-       
-       if (m_listbox)
-               m_listbox->entryReset();
+       FillFinished();
 }
 
 void eListboxServiceContent::setCurrent(const eServiceReference &ref)
index a742b06..234cd39 100644 (file)
@@ -11,8 +11,11 @@ class eListboxServiceContent: public virtual iListboxContent
 public:
        eListboxServiceContent();
 
+       void addService(const eServiceReference &ref);
+       void FillFinished();
+
        void setIgnoreService( const eServiceReference &service );
-       void setRoot(const eServiceReference &ref);
+       void setRoot(const eServiceReference &ref, bool justSet=false);
        void getCurrent(eServiceReference &ref);
        
        int getNextBeginningWithChar(char c);