+ def addAlternativeServices(self):
+ cur_service = ServiceReference(self.getCurrentSelection())
+ root = self.getRoot()
+ cur_root = root and ServiceReference(root)
+ mutableBouquet = cur_root.list().startEdit()
+ if mutableBouquet:
+ name = cur_service.getServiceName()
+ print "NAME", name
+ if self.mode == MODE_TV:
+ str = '1:134:1:0:0:0:0:0:0:0:FROM BOUQUET \"alternatives.%s.tv\" ORDER BY bouquet'%(self.buildBouquetID(name))
+ else:
+ str = '1:134:2:0:0:0:0:0:0:0:FROM BOUQUET \"alternatives.%s.radio\" ORDER BY bouquet'%(self.buildBouquetID(name))
+ new_ref = ServiceReference(str)
+ if not mutableBouquet.addService(new_ref.ref, cur_service.ref):
+ mutableBouquet.removeService(cur_service.ref)
+ mutableBouquet.flushChanges()
+ eDVBDB.getInstance().reloadBouquets()
+ mutableAlternatives = new_ref.list().startEdit()
+ if mutableAlternatives:
+ mutableAlternatives.setListName(name)
+ if mutableAlternatives.addService(cur_service.ref):
+ print "add", cur_service.ref.toString(), "to new alternatives failed"
+ mutableAlternatives.flushChanges()
+ self.servicelist.addService(new_ref.ref, True)
+ self.servicelist.removeCurrent()
+ self.servicelist.moveUp()
+ else:
+ print "get mutable list for new created alternatives failed"
+ else:
+ print "add", str, "to", cur_root.getServiceName(), "failed"
+ else:
+ print "bouquetlist is not editable"
+