예제 #1
0
    def __init__(self, updateFun=None, downloadNew=True):
        printDBG("IconMenager.__init__")
        self.DOWNLOADED_IMAGE_PATH_BASE = config.plugins.iptvplayer.SciezkaCache.value
        self.cm = common()

        # download queue
        self.queueDQ = []
        self.lockDQ = threading.Lock()
        self.workThread = None

        # already available
        self.queueAA = {}
        self.lockAA = threading.Lock()

        #this function will be called after a new icon will be available
        self.updateFun = None

        #new icons dir for each run
        self.currDownloadDir = self.DOWNLOADED_IMAGE_PATH_BASE + '/' + GetNewIconsDirName(
        )
        if not os_path.exists(self.currDownloadDir):
            mkdirs(self.currDownloadDir)

        #load available icon from disk
        #will be runned in separeted thread to speed UP start plugin
        AsyncMethod(self.loadHistoryFromDisk)(self.currDownloadDir)

        # this is called to remove icons which are stored in old version
        AsyncMethod(RemoveAllFilesIconsFromPath)(
            self.DOWNLOADED_IMAGE_PATH_BASE)

        self.stopThread = False

        self.checkSpace = 0  # if 0 the left space on disk will be checked
        self.downloadNew = downloadNew
예제 #2
0
 def __del__(self):
     printDBG( "IconMenager.__del__ -------------------------------")
     self.clearDQueue()
     self.clearAAueue()
     
     if config.plugins.iptvplayer.SciezkaCache.value == self.DOWNLOADED_IMAGE_PATH_BASE and config.plugins.iptvplayer.showcover.value:
         AsyncMethod(RemoveOldDirsIcons)(self.DOWNLOADED_IMAGE_PATH_BASE, config.plugins.iptvplayer.deleteIcons.value)
     else:
         # remove all icons as they are not more needed due to config changes
         AsyncMethod(RemoveAllDirsIconsFromPath)(self.DOWNLOADED_IMAGE_PATH_BASE)
     printDBG( "IconMenager.__del__ end" )
예제 #3
0
 def decodeCover(self, filename, callBackFun, ident):
     
     #checki if decoding is needed
     if filename != self.currIconPath and filename != self.waitIconPath:
         self.waitIconPath = filename
         #run new thread
         AsyncMethod(self.decode, self.decodeCallBack)(filename, callBackFun, ident, self.instance.size().width(), self.instance.size().height())
     else:
         print "Cover: Not Neeed 1"
         callBackFun(  {"Changed": False, "FileName": filename, "Ident": ident}  )
     return
예제 #4
0
 def runWorkThread(self):
     if self.workThread == None or not self.workThread.Thread.isAlive():
         self.workThread = AsyncMethod(self.processDQ)()