def download_img(self, img_url, filename): # if at start there was NOT enough space on disk # new icon will not be downloaded if False == self.downloadNew: return False if len(self.DOWNLOADED_IMAGE_PATH) < 4: print('download_img: wrong path for IPTVCache') return False path = self.DOWNLOADED_IMAGE_PATH + '/' # if at start there was enough space on disk # we will check if we still have free space if 0 >= self.checkSpace: print('download_img: checking space on device') if not iptvtools_FreeSpace(path, 10): print( 'download_img: not enough space for new icons, new icons will not be downloaded any more' ) self.downloadNew = False return False else: # for another 50 check again self.checkSpace = 50 else: self.checkSpace -= 1 try: image_on_web = urllib2.urlopen(img_url) if image_on_web.headers.maintype == 'image': buf = image_on_web.read() file_path = "%s%s" % (path, filename) print file_path downloaded_image = file(file_path, "wb") downloaded_image.write(buf) downloaded_image.close() image_on_web.close() else: print("download_img not image") return False except: print("download_img exception") return False return True
def download_img(self, img_url, filename): # if at start there was NOT enough space on disk # new icon will not be downloaded if False == self.downloadNew: return False if len(self.DOWNLOADED_IMAGE_PATH) < 4: print('download_img: wrong path for IPTVCache') return False path = self.DOWNLOADED_IMAGE_PATH + '/' # if at start there was enough space on disk # we will check if we still have free space if 0 >= self.checkSpace: print('download_img: checking space on device') if not iptvtools_FreeSpace(path, 10): print('download_img: not enough space for new icons, new icons will not be downloaded any more') self.downloadNew = False return False else: # for another 50 check again self.checkSpace = 50 else: self.checkSpace -= 1 try: image_on_web = urllib2.urlopen(img_url) if image_on_web.headers.maintype == 'image': buf = image_on_web.read() file_path = "%s%s" % (path, filename) print file_path downloaded_image = file(file_path, "wb") downloaded_image.write(buf) downloaded_image.close() image_on_web.close() else: print("download_img not image") return False except: print("download_img exception") return False return True
def keyUpdate(self): self.save() #aktualizacja from libs.tools import UpdateIPTV_from_GIT as iptvtools_UpdateIPTV_from_GIT, FreeSpace as iptvtools_FreeSpace WersjaGIT=self.iptvtools_GetGITversion msgtxt = "Autors don't take any responsibility for issues with tunners when using this plugin and using it to illegal download of the files" if iptvtools_FreeSpace(config.plugins.BoardReader.NaszaTMP.value,2): StatusUpdate = iptvtools_UpdateIPTV_from_GIT(config.plugins.BoardReader.NaszaTMP.value) if StatusUpdate == "OK": self.session.open(MessageBox, "Restart oPLI po aktualizacji wtyczki do wersji %s...\n Czytałeś już licencję?\nJeśli tak, to wiesz, że\n\n" % WersjaGIT + msgtxt, type = MessageBox.TYPE_INFO, timeout = 5 ) from enigma import quitMainloop quitMainloop(3) else: self.session.open(MessageBox, "Błąd aktualizacji wtyczki, spróbuj ponownie za jakiś czas.\n Status: %s \n\n Dla przypomnienia -\n\n" % StatusUpdate + msgtxt, type = MessageBox.TYPE_INFO, timeout = 10 ) return else: self.session.open(MessageBox, "Brak wolnego miejsca w katalogu %s" % (config.plugins.BoardReader.NaszaTMP.value), type = MessageBox.TYPE_INFO, timeout = 10 ) return
def __init__(self, session): self.session = session Screen.__init__(self, session) self.BRConsole = Console() #j00zek self.nagrywanie=False #j00zek self.CurrentService = self.session.nav.getCurrentlyPlayingServiceReference() #self.session.nav.stopService() self.session.nav.event.append(self.__event) self["key_red"] = StaticText("Exit") #self["key_green"] = StaticText("Config") #self["key_yellow"] = StaticText("Show pictures") #self["key_blue"] = StaticText("Info") self["list"] = MyListComponent() self["list"].connectSelChanged(self.onSelectionChanged) self["statustext"] = Label("Pobieranie listy...") self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions"], { "ok": self.ok_pressed, "back": self.back_pressed, "red": self.red_pressed, #"green": self.green_pressed, #"yellow": self.yellow_pressed, #"blue": self.blue_pressed, }, -1) self["titel"] = Label() self["station"] = Label() self["headertext"] = Label() self["console"] = Label() self["cover"] = Cover() self["cover"].hide() self["playerlogo"] = Cover() self.showMessageNoFreeSpaceForIcon = False self.iconManager = None if config.plugins.BoardReader.showcover.value: if not os_path.exists(config.plugins.BoardReader.SciezkaCache.value): iptvtools_mkdirs(config.plugins.BoardReader.SciezkaCache.value) if iptvtools_FreeSpace(config.plugins.BoardReader.SciezkaCache.value,10): self.iconManager = IconManager(self.checkIconCallBack, True) else: self.showMessageNoFreeSpaceForIcon = True self.iconManager = IconManager(self.checkIconCallBack, False) self.onClose.append(self.__onClose) #self.onLayoutFinish.append(self.selectHost) self.onShow.append(self.onStart) #Defs self.searchPattern = '' self.searchType = None self.changeIcon = True self.started = 0 self.workThread = None self.host = None self.hostName = '' self.nextSelIndex = 0 self.currSelIndex = 0 self.prevSelList = [] self.categoryList = [] self.currList = [] self.currSelectedItemName = "" self.visible = True ################################################################# # Inits for Proxy Queue ################################################################# # register function in main Queue global gMainFunctionsQueue gMainFunctionsQueue = CFunctionProxyQueue() gMainFunctionsQueue.unregisterAllFunctions() gMainFunctionsQueue.clearQueue() gMainFunctionsQueue.registerFunction(self.reloadList) gMainFunctionsQueue.registerFunction(self.checkIconCallBack) gMainFunctionsQueue.registerFunction(self.updateCover) gMainFunctionsQueue.registerFunction(self.displayIcon) #main Queue self.mainTimer = eTimer() self.mainTimer.timeout.get().append(self.processProxyQueue) # every 100ms Proxy Queue will be checked self.mainTimer.start(100)
def __init__(self, session): self.session = session Screen.__init__(self, session) self.session.nav.event.append(self.__event) self["key_red"] = StaticText(_("Exit")) self["list"] = MyListComponent() self["list"].connectSelChanged(self.onSelectionChanged) self["statustext"] = Label(_("Downloading list...")) self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions"], { "ok": self.ok_pressed, "back": self.back_pressed, "red": self.red_pressed, }, -1) self["headertext"] = Label() self["console"] = Label() self["cover"] = Cover() self["cover"].hide() self["playerlogo"] = Cover() self.showMessageNoFreeSpaceForIcon = False self.iconManager = None if not os_path.exists("/tmp/BoardsReaderCache/"): iptvtools_mkdirs("/tmp/BoardsReaderCache/") if iptvtools_FreeSpace("/tmp/BoardsReaderCache/",10): self.iconManager = IconManager(self.checkIconCallBack, True) else: self.showMessageNoFreeSpaceForIcon = True self.iconManager = IconManager(self.checkIconCallBack, False) self.onClose.append(self.__onClose) #self.onLayoutFinish.append(self.selectHost) self.onShow.append(self.onStart) #Defs self.searchPattern = '' self.searchType = None self.changeIcon = True self.started = 0 self.workThread = None self.host = None self.hostName = '' self.nextSelIndex = 0 self.currSelIndex = 0 self.prevSelList = [] self.categoryList = [] self.currList = [] self.currSelectedItemName = "" self.visible = True ################################################################# # Inits for Proxy Queue ################################################################# # register function in main Queue global gMainFunctionsQueue gMainFunctionsQueue = CFunctionProxyQueue() gMainFunctionsQueue.unregisterAllFunctions() gMainFunctionsQueue.clearQueue() gMainFunctionsQueue.registerFunction(self.reloadList) gMainFunctionsQueue.registerFunction(self.checkIconCallBack) gMainFunctionsQueue.registerFunction(self.updateCover) gMainFunctionsQueue.registerFunction(self.displayIcon) #main Queue self.mainTimer = eTimer() self.mainTimer.timeout.get().append(self.processProxyQueue) # every 100ms Proxy Queue will be checked self.mainTimer.start(100)
def __init__(self, session): self.session = session Screen.__init__(self, session) self.session.nav.event.append(self.__event) self["key_red"] = StaticText(_("Exit")) self["list"] = MyListComponent() self["list"].connectSelChanged(self.onSelectionChanged) self["statustext"] = Label(_("Downloading list...")) self["actions"] = ActionMap( ["WizardActions", "DirectionActions", "ColorActions"], { "ok": self.ok_pressed, "back": self.back_pressed, "red": self.red_pressed, }, -1) self["headertext"] = Label() self["console"] = Label() self["cover"] = Cover() self["cover"].hide() self["playerlogo"] = Cover() self.showMessageNoFreeSpaceForIcon = False self.iconManager = None if not os_path.exists("/tmp/BoardsReaderCache/"): iptvtools_mkdirs("/tmp/BoardsReaderCache/") if iptvtools_FreeSpace("/tmp/BoardsReaderCache/", 10): self.iconManager = IconManager(self.checkIconCallBack, True) else: self.showMessageNoFreeSpaceForIcon = True self.iconManager = IconManager(self.checkIconCallBack, False) self.onClose.append(self.__onClose) #self.onLayoutFinish.append(self.selectHost) self.onShow.append(self.onStart) #Defs self.searchPattern = '' self.searchType = None self.changeIcon = True self.started = 0 self.workThread = None self.host = None self.hostName = '' self.nextSelIndex = 0 self.currSelIndex = 0 self.prevSelList = [] self.categoryList = [] self.currList = [] self.currSelectedItemName = "" self.visible = True ################################################################# # Inits for Proxy Queue ################################################################# # register function in main Queue global gMainFunctionsQueue gMainFunctionsQueue = CFunctionProxyQueue() gMainFunctionsQueue.unregisterAllFunctions() gMainFunctionsQueue.clearQueue() gMainFunctionsQueue.registerFunction(self.reloadList) gMainFunctionsQueue.registerFunction(self.checkIconCallBack) gMainFunctionsQueue.registerFunction(self.updateCover) gMainFunctionsQueue.registerFunction(self.displayIcon) #main Queue self.mainTimer = eTimer() self.mainTimer.timeout.get().append(self.processProxyQueue) # every 100ms Proxy Queue will be checked self.mainTimer.start(100)