fix in fedora: 7z doesn't support rar archives, use unrar (#370)
see https://github.com/ttys3/fedora-rpm-p7zip https://sourceforge.net/p/sevenzip/discussion/45798/thread/dc2d0438/#8f9f
This commit is contained in:
1 parent
c979486e28
commit
4fa72780a1
1 file changed
+11
@@ -39,6 +39,13 @@ class ComicArchive:
|
|||||||
break
|
break
|
||||||
process.communicate()
|
process.communicate()
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
|
process = Popen('unrar l -y -p1 "' + self.filepath + '"', stderr=STDOUT, stdout=PIPE, stdin=PIPE, shell=True)
|
||||||
|
for line in process.stdout:
|
||||||
|
if b'Details: ' in line:
|
||||||
|
self.type = line.rstrip().decode().split(' ')[1].upper()
|
||||||
|
print(self.type)
|
||||||
|
break
|
||||||
|
if(self.type != 'RAR'):
|
||||||
raise OSError('Archive is corrupted or encrypted.')
|
raise OSError('Archive is corrupted or encrypted.')
|
||||||
elif self.type not in ['7Z', 'RAR', 'RAR5', 'ZIP']:
|
elif self.type not in ['7Z', 'RAR', 'RAR5', 'ZIP']:
|
||||||
raise OSError('Unsupported archive format.')
|
raise OSError('Unsupported archive format.')
|
||||||
@@ -49,6 +56,10 @@ class ComicArchive:
|
|||||||
process = Popen('7z x -y -xr!__MACOSX -xr!.DS_Store -xr!thumbs.db -xr!Thumbs.db -o"' + targetdir + '" "' +
|
process = Popen('7z x -y -xr!__MACOSX -xr!.DS_Store -xr!thumbs.db -xr!Thumbs.db -o"' + targetdir + '" "' +
|
||||||
self.filepath + '"', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
self.filepath + '"', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||||
process.communicate()
|
process.communicate()
|
||||||
|
if process.returncode != 0:
|
||||||
|
process = Popen('unrar x -y -x__MACOSX -x.DS_Store -xthumbs.db -xThumbs.db "' + self.filepath + '" "' +
|
||||||
|
targetdir + '"', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||||
|
process.communicate()
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
raise OSError('Failed to extract archive.')
|
raise OSError('Failed to extract archive.')
|
||||||
tdir = os.listdir(targetdir)
|
tdir = os.listdir(targetdir)
|
||||||
|
|||||||
Reference in new issue
Block a user