enable m2ts file extension
[enigma2.git] / lib / python / Screens / ChannelSelection.py
index 9ced584026ebe602d9d8a078ef7bc739f910fad3..34316f01b0b085dc5379b14c44a09b51771c19f2 100644 (file)
@@ -20,7 +20,6 @@ from Components.Sources.ServiceEvent import ServiceEvent
 profile("ChannelSelection.py 2.3")
 from Components.Input import Input
 profile("ChannelSelection.py 3")
 profile("ChannelSelection.py 2.3")
 from Components.Input import Input
 profile("ChannelSelection.py 3")
-from Components.ParentalControl import parentalControl
 from Components.ChoiceList import ChoiceList, ChoiceEntryComponent
 from Components.SystemInfo import SystemInfo
 from Screens.InputBox import InputBox, PinInput
 from Components.ChoiceList import ChoiceList, ChoiceEntryComponent
 from Components.SystemInfo import SystemInfo
 from Screens.InputBox import InputBox, PinInput
@@ -77,6 +76,7 @@ def append_when_current_valid(current, menu, args, level = 0, key = ""):
 
 class ChannelContextMenu(Screen):
        def __init__(self, session, csel):
 
 class ChannelContextMenu(Screen):
        def __init__(self, session, csel):
+
                Screen.__init__(self, session)
                #raise Exception("we need a better summary screen here")
                self.csel = csel
                Screen.__init__(self, session)
                #raise Exception("we need a better summary screen here")
                self.csel = csel
@@ -106,14 +106,22 @@ class ChannelContextMenu(Screen):
                                isPlayable = not (current_sel_flags & (eServiceReference.isMarker|eServiceReference.isDirectory))
                                if isPlayable:
                                        if config.ParentalControl.configured.value:
                                isPlayable = not (current_sel_flags & (eServiceReference.isMarker|eServiceReference.isDirectory))
                                if isPlayable:
                                        if config.ParentalControl.configured.value:
+                                               from Components.ParentalControl import parentalControl
                                                if parentalControl.getProtectionLevel(csel.getCurrentSelection().toCompareString()) == -1:
                                                        append_when_current_valid(current, menu, (_("add to parental protection"), boundFunction(self.addParentalProtection, csel.getCurrentSelection())), level = 0)
                                                else:
                                                        append_when_current_valid(current, menu, (_("remove from parental protection"), boundFunction(self.removeParentalProtection, csel.getCurrentSelection())), level = 0)
                                        if haveBouquets:
                                                if parentalControl.getProtectionLevel(csel.getCurrentSelection().toCompareString()) == -1:
                                                        append_when_current_valid(current, menu, (_("add to parental protection"), boundFunction(self.addParentalProtection, csel.getCurrentSelection())), level = 0)
                                                else:
                                                        append_when_current_valid(current, menu, (_("remove from parental protection"), boundFunction(self.removeParentalProtection, csel.getCurrentSelection())), level = 0)
                                        if haveBouquets:
-                                               append_when_current_valid(current, menu, (_("add service to bouquet"), self.addServiceToBouquetSelected), level = 0)
+                                               bouquets = self.csel.getBouquetList()
+                                               if bouquets is None:
+                                                       bouquetCnt = 0
+                                               else:
+                                                       bouquetCnt = len(bouquets)
+                                               if not inBouquet or bouquetCnt > 1:
+                                                       append_when_current_valid(current, menu, (_("add service to bouquet"), self.addServiceToBouquetSelected), level = 0)
                                        else:
                                        else:
-                                               append_when_current_valid(current, menu, (_("add service to favourites"), self.addServiceToBouquetSelected), level = 0)
+                                               if not inBouquet:
+                                                       append_when_current_valid(current, menu, (_("add service to favourites"), self.addServiceToBouquetSelected), level = 0)
                                else:
                                        if current_root.getPath().find('FROM SATELLITES') != -1:
                                                append_when_current_valid(current, menu, (_("remove selected satellite"), self.removeSatelliteServices), level = 0)
                                else:
                                        if current_root.getPath().find('FROM SATELLITES') != -1:
                                                append_when_current_valid(current, menu, (_("remove selected satellite"), self.removeSatelliteServices), level = 0)
@@ -184,6 +192,7 @@ class ChannelContextMenu(Screen):
                self.close()
 
        def addParentalProtection(self, service):
                self.close()
 
        def addParentalProtection(self, service):
+               from Components.ParentalControl import parentalControl
                parentalControl.protectService(service.toCompareString())
                self.close()
 
                parentalControl.protectService(service.toCompareString())
                self.close()
 
@@ -192,6 +201,7 @@ class ChannelContextMenu(Screen):
 
        def pinEntered(self, service, result):
                if result:
 
        def pinEntered(self, service, result):
                if result:
+                       from Components.ParentalControl import parentalControl
                        parentalControl.unProtectService(service)
                        self.close()
                else:
                        parentalControl.unProtectService(service)
                        self.close()
                else: