Only extract comic if it isn't already extracted (muuuuch faster for large comics)
This commit is contained in:
parent
ee02a15182
commit
6460cfca37
|
|
@ -47,12 +47,22 @@ if ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
|
|||
}
|
||||
$data["startindex"] = $currentpage;
|
||||
|
||||
$extracted = false;
|
||||
if ( !is_dir($comicoutputfull) ) {
|
||||
mkdir($comicoutputfull, 0755, true);
|
||||
} else {
|
||||
touch($comicoutputfull);
|
||||
$extracted = true;
|
||||
}
|
||||
|
||||
$files = array();
|
||||
if ( $ext == "cbz" ) {
|
||||
if ( $extracted ) {
|
||||
$contents = glob($comicoutputfull . "*");
|
||||
foreach ( $contents as $i ) {
|
||||
$files[] = basename($i);
|
||||
}
|
||||
} else {
|
||||
if ( $ext == "cbz" ) {
|
||||
$zip = new ZipArchive();
|
||||
$opened = $zip->open($comicfull);
|
||||
for ( $i=0; $i<$zip->numFiles; $i++ ) {
|
||||
|
|
@ -67,7 +77,7 @@ if ( $ext == "cbz" ) {
|
|||
if ( $written ) $files[] = $imgname;
|
||||
}
|
||||
}
|
||||
} elseif ( $ext == "cbr" ) {
|
||||
} elseif ( $ext == "cbr" ) {
|
||||
$rar = RarArchive::open($comicfull);
|
||||
$entries = $rar->getEntries();
|
||||
foreach ( $entries as $entry ) {
|
||||
|
|
@ -80,8 +90,9 @@ if ( $ext == "cbz" ) {
|
|||
}
|
||||
}
|
||||
unset($entry);
|
||||
} else {
|
||||
} else {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
natsort($files);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user