|
@ -707,7 +707,7 @@ def rar_extract_core(rarfile_path, numrars, one_folder, nzo, setname, extraction |
|
|
elif line.startswith('Cannot find volume') and not inrecovery: |
|
|
elif line.startswith('Cannot find volume') and not inrecovery: |
|
|
filename = os.path.basename(TRANS(line[19:])) |
|
|
filename = os.path.basename(TRANS(line[19:])) |
|
|
nzo.fail_msg = T('Unpacking failed, unable to find %s') % unicoder(filename) |
|
|
nzo.fail_msg = T('Unpacking failed, unable to find %s') % unicoder(filename) |
|
|
msg = (u'[%s] ' + T('Unpacking failed, unable to find %s')) % (setname, filename) |
|
|
msg = ('[%s] ' + T('Unpacking failed, unable to find %s')) % (setname, filename) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
logging.warning(T('ERROR: unable to find "%s"'), filename) |
|
|
logging.warning(T('ERROR: unable to find "%s"'), filename) |
|
|
fail = 1 |
|
|
fail = 1 |
|
@ -715,14 +715,14 @@ def rar_extract_core(rarfile_path, numrars, one_folder, nzo, setname, extraction |
|
|
elif line.endswith('- CRC failed'): |
|
|
elif line.endswith('- CRC failed'): |
|
|
filename = TRANS(line[:-12].strip()) |
|
|
filename = TRANS(line[:-12].strip()) |
|
|
nzo.fail_msg = T('Unpacking failed, CRC error') |
|
|
nzo.fail_msg = T('Unpacking failed, CRC error') |
|
|
msg = (u'[%s] ' + T('ERROR: CRC failed in "%s"')) % (setname, filename) |
|
|
msg = ('[%s] ' + T('ERROR: CRC failed in "%s"')) % (setname, filename) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
logging.warning(T('ERROR: CRC failed in "%s"'), setname) |
|
|
logging.warning(T('ERROR: CRC failed in "%s"'), setname) |
|
|
fail = 2 # Older unrar versions report a wrong password as a CRC error |
|
|
fail = 2 # Older unrar versions report a wrong password as a CRC error |
|
|
|
|
|
|
|
|
elif line.startswith('File too large'): |
|
|
elif line.startswith('File too large'): |
|
|
nzo.fail_msg = T('Unpacking failed, file too large for filesystem (FAT?)') |
|
|
nzo.fail_msg = T('Unpacking failed, file too large for filesystem (FAT?)') |
|
|
msg = (u'[%s] ' + T('Unpacking failed, file too large for filesystem (FAT?)')) % setname |
|
|
msg = ('[%s] ' + T('Unpacking failed, file too large for filesystem (FAT?)')) % setname |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
# ERROR: File too large for file system (bigfile-5000MB) |
|
|
# ERROR: File too large for file system (bigfile-5000MB) |
|
|
logging.error(T('ERROR: File too large for filesystem (%s)'), setname) |
|
|
logging.error(T('ERROR: File too large for filesystem (%s)'), setname) |
|
@ -730,7 +730,7 @@ def rar_extract_core(rarfile_path, numrars, one_folder, nzo, setname, extraction |
|
|
|
|
|
|
|
|
elif line.startswith('Write error'): |
|
|
elif line.startswith('Write error'): |
|
|
nzo.fail_msg = T('Unpacking failed, write error or disk is full?') |
|
|
nzo.fail_msg = T('Unpacking failed, write error or disk is full?') |
|
|
msg = (u'[%s] ' + T('Unpacking failed, write error or disk is full?')) % setname |
|
|
msg = ('[%s] ' + T('Unpacking failed, write error or disk is full?')) % setname |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
logging.error(T('ERROR: write error (%s)'), line[11:]) |
|
|
logging.error(T('ERROR: write error (%s)'), line[11:]) |
|
|
fail = 1 |
|
|
fail = 1 |
|
@ -739,11 +739,11 @@ def rar_extract_core(rarfile_path, numrars, one_folder, nzo, setname, extraction |
|
|
line2 = proc.readline() |
|
|
line2 = proc.readline() |
|
|
if 'must not exceed 260' in line2: |
|
|
if 'must not exceed 260' in line2: |
|
|
nzo.fail_msg = T('Unpacking failed, path is too long') |
|
|
nzo.fail_msg = T('Unpacking failed, path is too long') |
|
|
msg = u'[%s] %s: %s' % (T('Unpacking failed, path is too long'), setname, unicoder(line[13:])) |
|
|
msg = '[%s] %s: %s' % (T('Unpacking failed, path is too long'), setname, unicoder(line[13:])) |
|
|
logging.error(T('ERROR: path too long (%s)'), unicoder(line[13:])) |
|
|
logging.error(T('ERROR: path too long (%s)'), unicoder(line[13:])) |
|
|
else: |
|
|
else: |
|
|
nzo.fail_msg = T('Unpacking failed, write error or disk is full?') |
|
|
nzo.fail_msg = T('Unpacking failed, write error or disk is full?') |
|
|
msg = u'[%s] %s: %s' % (T('Unpacking failed, write error or disk is full?'), setname, unicoder(line[13:])) |
|
|
msg = '[%s] %s: %s' % (T('Unpacking failed, write error or disk is full?'), setname, unicoder(line[13:])) |
|
|
logging.error(T('ERROR: write error (%s)'), unicoder(line[13:])) |
|
|
logging.error(T('ERROR: write error (%s)'), unicoder(line[13:])) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
fail = 1 |
|
|
fail = 1 |
|
@ -753,7 +753,7 @@ def rar_extract_core(rarfile_path, numrars, one_folder, nzo, setname, extraction |
|
|
elif line.startswith('ERROR: '): |
|
|
elif line.startswith('ERROR: '): |
|
|
nzo.fail_msg = T('Unpacking failed, see log') |
|
|
nzo.fail_msg = T('Unpacking failed, see log') |
|
|
logging.warning(T('ERROR: %s'), (unicoder(line[7:]))) |
|
|
logging.warning(T('ERROR: %s'), (unicoder(line[7:]))) |
|
|
msg = (u'[%s] ' + T('ERROR: %s')) % (setname, line[7:]) |
|
|
msg = ('[%s] ' + T('ERROR: %s')) % (setname, line[7:]) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
fail = 1 |
|
|
fail = 1 |
|
|
|
|
|
|
|
@ -772,7 +772,7 @@ def rar_extract_core(rarfile_path, numrars, one_folder, nzo, setname, extraction |
|
|
else: |
|
|
else: |
|
|
filename = os.path.split(rarfile_path)[1] |
|
|
filename = os.path.split(rarfile_path)[1] |
|
|
nzo.fail_msg = T('Unpacking failed, archive requires a password') |
|
|
nzo.fail_msg = T('Unpacking failed, archive requires a password') |
|
|
msg = (u'[%s][%s] ' + T('Unpacking failed, archive requires a password')) % (setname, filename) |
|
|
msg = ('[%s][%s] ' + T('Unpacking failed, archive requires a password')) % (setname, filename) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
nzo.set_unpack_info('Unpack', unicoder(msg)) |
|
|
fail = 2 |
|
|
fail = 2 |
|
|
|
|
|
|
|
@ -1329,7 +1329,7 @@ def PAR_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False): |
|
|
else: |
|
|
else: |
|
|
msg = T('Invalid par2 files or invalid PAR2 parameters, cannot verify or repair') |
|
|
msg = T('Invalid par2 files or invalid PAR2 parameters, cannot verify or repair') |
|
|
nzo.fail_msg = msg |
|
|
nzo.fail_msg = msg |
|
|
msg = u'[%s] %s' % (unicoder(setname), msg) |
|
|
msg = '[%s] %s' % (unicoder(setname), msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.status = Status.FAILED |
|
|
nzo.status = Status.FAILED |
|
|
|
|
|
|
|
@ -1348,7 +1348,7 @@ def PAR_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False): |
|
|
# Failed |
|
|
# Failed |
|
|
msg = T('Repair failed, not enough repair blocks (%s short)') % str(needed_blocks) |
|
|
msg = T('Repair failed, not enough repair blocks (%s short)') % str(needed_blocks) |
|
|
nzo.fail_msg = msg |
|
|
nzo.fail_msg = msg |
|
|
msg = u'[%s] %s' % (unicoder(setname), msg) |
|
|
msg = '[%s] %s' % (unicoder(setname), msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.status = Status.FAILED |
|
|
nzo.status = Status.FAILED |
|
|
|
|
|
|
|
@ -1414,7 +1414,7 @@ def PAR_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False): |
|
|
elif ' cannot be renamed to ' in line: |
|
|
elif ' cannot be renamed to ' in line: |
|
|
msg = unicoder(line.strip()) |
|
|
msg = unicoder(line.strip()) |
|
|
nzo.fail_msg = msg |
|
|
nzo.fail_msg = msg |
|
|
msg = u'[%s] %s' % (unicoder(setname), msg) |
|
|
msg = '[%s] %s' % (unicoder(setname), msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.status = Status.FAILED |
|
|
nzo.status = Status.FAILED |
|
|
|
|
|
|
|
@ -1422,7 +1422,7 @@ def PAR_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False): |
|
|
# Oops, disk is full! |
|
|
# Oops, disk is full! |
|
|
msg = T('Repairing failed, %s') % T('Disk full') |
|
|
msg = T('Repairing failed, %s') % T('Disk full') |
|
|
nzo.fail_msg = msg |
|
|
nzo.fail_msg = msg |
|
|
msg = u'[%s] %s' % (unicoder(setname), msg) |
|
|
msg = '[%s] %s' % (unicoder(setname), msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.status = Status.FAILED |
|
|
nzo.status = Status.FAILED |
|
|
|
|
|
|
|
@ -1447,7 +1447,7 @@ def PAR_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False): |
|
|
elif 'No details available for recoverable file' in line: |
|
|
elif 'No details available for recoverable file' in line: |
|
|
msg = unicoder(line.strip()) |
|
|
msg = unicoder(line.strip()) |
|
|
nzo.fail_msg = msg |
|
|
nzo.fail_msg = msg |
|
|
msg = u'[%s] %s' % (unicoder(setname), msg) |
|
|
msg = '[%s] %s' % (unicoder(setname), msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.status = Status.FAILED |
|
|
nzo.status = Status.FAILED |
|
|
|
|
|
|
|
@ -1482,7 +1482,7 @@ def PAR_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False): |
|
|
verifytotal = int(m.group(1)) |
|
|
verifytotal = int(m.group(1)) |
|
|
|
|
|
|
|
|
p.wait() |
|
|
p.wait() |
|
|
except WindowsError, err: |
|
|
except WindowsError as err: |
|
|
raise WindowsError(err) |
|
|
raise WindowsError(err) |
|
|
|
|
|
|
|
|
logging.debug('PAR2 output was\n%s', '\n'.join(lines)) |
|
|
logging.debug('PAR2 output was\n%s', '\n'.join(lines)) |
|
@ -1626,14 +1626,14 @@ def MultiPar_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False) |
|
|
else: |
|
|
else: |
|
|
msg = T('Invalid par2 files or invalid PAR2 parameters, cannot verify or repair') |
|
|
msg = T('Invalid par2 files or invalid PAR2 parameters, cannot verify or repair') |
|
|
nzo.fail_msg = msg |
|
|
nzo.fail_msg = msg |
|
|
msg = u'[%s] %s' % (unicoder(setname), msg) |
|
|
msg = '[%s] %s' % (unicoder(setname), msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.status = Status.FAILED |
|
|
nzo.status = Status.FAILED |
|
|
|
|
|
|
|
|
elif line.startswith('There is not enough space on the disk'): |
|
|
elif line.startswith('There is not enough space on the disk'): |
|
|
msg = T('Repairing failed, %s') % T('Disk full') |
|
|
msg = T('Repairing failed, %s') % T('Disk full') |
|
|
nzo.fail_msg = msg |
|
|
nzo.fail_msg = msg |
|
|
msg = u'[%s] %s' % (unicoder(setname), msg) |
|
|
msg = '[%s] %s' % (unicoder(setname), msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.status = Status.FAILED |
|
|
nzo.status = Status.FAILED |
|
|
|
|
|
|
|
@ -1774,7 +1774,7 @@ def MultiPar_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False) |
|
|
# Failed |
|
|
# Failed |
|
|
msg = T('Repair failed, not enough repair blocks (%s short)') % str(needed_blocks) |
|
|
msg = T('Repair failed, not enough repair blocks (%s short)') % str(needed_blocks) |
|
|
nzo.fail_msg = msg |
|
|
nzo.fail_msg = msg |
|
|
msg = u'[%s] %s' % (unicoder(setname), msg) |
|
|
msg = '[%s] %s' % (unicoder(setname), msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.set_unpack_info('Repair', msg) |
|
|
nzo.status = Status.FAILED |
|
|
nzo.status = Status.FAILED |
|
|
|
|
|
|
|
@ -1849,7 +1849,7 @@ def MultiPar_Verify(parfile, parfile_nzf, nzo, setname, joinables, single=False) |
|
|
if renames: |
|
|
if renames: |
|
|
# If succes, we also remove the possibly previously renamed ones |
|
|
# If succes, we also remove the possibly previously renamed ones |
|
|
if finished: |
|
|
if finished: |
|
|
reconstructed.extend(renames.values()) |
|
|
reconstructed.extend(list(renames.values())) |
|
|
|
|
|
|
|
|
# Adding to the collection |
|
|
# Adding to the collection |
|
|
nzo.renamed_file(renames) |
|
|
nzo.renamed_file(renames) |
|
@ -2309,6 +2309,17 @@ def list2cmdline(lst): |
|
|
return ' '.join(nlst) |
|
|
return ' '.join(nlst) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_from_url(url): |
|
|
|
|
|
""" Retrieve URL and return content |
|
|
|
|
|
`timeout` sets non-standard timeout |
|
|
|
|
|
""" |
|
|
|
|
|
import urllib.request, urllib.error, urllib.parse |
|
|
|
|
|
try: |
|
|
|
|
|
return urllib.request.urlopen(url).read() |
|
|
|
|
|
except: |
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def is_sevenfile(path): |
|
|
def is_sevenfile(path): |
|
|
""" Return True if path has proper extension and 7Zip is installed """ |
|
|
""" Return True if path has proper extension and 7Zip is installed """ |
|
|
return SEVEN_COMMAND and os.path.splitext(path)[1].lower() == '.7z' |
|
|
return SEVEN_COMMAND and os.path.splitext(path)[1].lower() == '.7z' |
|
|