def unpackArchive(self, tmpFile, tmpDIR):
     printDBG(
         'CBaseSubProviderClass.unpackArchive tmpFile[%s], tmpDIR[%s]' %
         (tmpFile, tmpDIR))
     rmtree(tmpDIR, ignore_errors=True)
     if not mkdirs(tmpDIR):
         SetIPTVPlayerLastHostError(
             _('Failed to create directory "%s".') % tmpDIR)
         return False
     if tmpFile.endswith('.zip'):
         return self.unpackZipArchive(tmpFile, tmpDIR)
     elif tmpFile.endswith('.rar'):
         cmd = "unrar e -o+ -y '{0}' '{1}' 2>/dev/null".format(
             tmpFile, tmpDIR)
         printDBG("cmd[%s]" % cmd)
         ret = self.iptv_execute(cmd)
         if not ret['sts'] or 0 != ret['code']:
             message = _('Unrar error code[%s].') % ret['code']
             if str(ret['code']) == str(127):
                 message += '\n' + _(
                     'It seems that unrar utility is not installed.')
             elif str(ret['code']) == str(9):
                 message += '\n' + _('Wrong format of rar archive.')
             SetIPTVPlayerLastHostError(message)
             return False
         return True
     return False
Exemplo n.º 2
0
 def clearTmpData(self):
     try:
         rmtree(self.tmpDir)
     except:
         printExc()
 def clearTmpData(self):
     try:
         rmtree(self.tmpDir)
     except:
         printExc()