mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 04:19:59 +00:00
Revert unrar5 experiment
This commit is contained in:
parent
e269bab186
commit
682c3b834f
@ -411,19 +411,6 @@ bitjs.archive = bitjs.archive || {};
|
||||
return "unrar.js";
|
||||
};
|
||||
|
||||
/**
|
||||
* Unrarrer5
|
||||
* @extends {bitjs.archive.Unarchiver}
|
||||
* @constructor
|
||||
*/
|
||||
bitjs.archive.Unrarrer5 = function(arrayBuffer, optPathToBitJS) {
|
||||
bitjs.base(this, arrayBuffer, optPathToBitJS);
|
||||
};
|
||||
bitjs.inherits(bitjs.archive.Unrarrer5, bitjs.archive.Unarchiver);
|
||||
bitjs.archive.Unrarrer5.prototype.getScriptFileName = function() {
|
||||
return "unrar5.js";
|
||||
};
|
||||
|
||||
/**
|
||||
* Untarrer
|
||||
* @extends {bitjs.archive.Unarchiver}
|
||||
|
@ -14,10 +14,10 @@
|
||||
/* global VM_FIXEDGLOBALSIZE, VM_GLOBALMEMSIZE, MAXWINMASK, VM_GLOBALMEMADDR, MAXWINSIZE */
|
||||
|
||||
// This file expects to be invoked as a Worker (see onmessage below).
|
||||
/*importScripts("../io/bitstream.js");
|
||||
importScripts("../io/bitstream.js");
|
||||
importScripts("../io/bytebuffer.js");
|
||||
importScripts("archive.js");
|
||||
importScripts("rarvm.js");*/
|
||||
importScripts("rarvm.js");
|
||||
|
||||
// Progress variables.
|
||||
var currentFilename = "";
|
||||
@ -29,21 +29,19 @@ var totalFilesInArchive = 0;
|
||||
|
||||
// Helper functions.
|
||||
var info = function(str) {
|
||||
console.log(str);
|
||||
// postMessage(new bitjs.archive.UnarchiveInfoEvent(str));
|
||||
postMessage(new bitjs.archive.UnarchiveInfoEvent(str));
|
||||
};
|
||||
var err = function(str) {
|
||||
console.log(str);
|
||||
// postMessage(new bitjs.archive.UnarchiveErrorEvent(str));
|
||||
postMessage(new bitjs.archive.UnarchiveErrorEvent(str));
|
||||
};
|
||||
var postProgress = function() {
|
||||
/*postMessage(new bitjs.archive.UnarchiveProgressEvent(
|
||||
postMessage(new bitjs.archive.UnarchiveProgressEvent(
|
||||
currentFilename,
|
||||
currentFileNumber,
|
||||
currentBytesUnarchivedInFile,
|
||||
currentBytesUnarchived,
|
||||
totalUncompressedBytesInArchive,
|
||||
totalFilesInArchive));*/
|
||||
totalFilesInArchive));
|
||||
};
|
||||
|
||||
// shows a byte value as its hex representation
|
||||
@ -1300,7 +1298,7 @@ var unrar = function(arrayBuffer) {
|
||||
totalUncompressedBytesInArchive = 0;
|
||||
totalFilesInArchive = 0;
|
||||
|
||||
//postMessage(new bitjs.archive.UnarchiveStartEvent());
|
||||
postMessage(new bitjs.archive.UnarchiveStartEvent());
|
||||
var bstream = new bitjs.io.BitStream(arrayBuffer, false /* rtl */);
|
||||
|
||||
var header = new RarVolumeHeader(bstream);
|
||||
@ -1350,7 +1348,7 @@ var unrar = function(arrayBuffer) {
|
||||
localfile.unrar();
|
||||
|
||||
if (localfile.isValid) {
|
||||
// postMessage(new bitjs.archive.UnarchiveExtractEvent(localfile));
|
||||
postMessage(new bitjs.archive.UnarchiveExtractEvent(localfile));
|
||||
postProgress();
|
||||
}
|
||||
}
|
||||
@ -1360,7 +1358,7 @@ var unrar = function(arrayBuffer) {
|
||||
} else {
|
||||
err("Invalid RAR file");
|
||||
}
|
||||
// postMessage(new bitjs.archive.UnarchiveFinishEvent());
|
||||
postMessage(new bitjs.archive.UnarchiveFinishEvent());
|
||||
};
|
||||
|
||||
// event.data.file has the ArrayBuffer.
|
||||
|
@ -162,15 +162,10 @@ function initProgressClick() {
|
||||
function loadFromArrayBuffer(ab) {
|
||||
var start = (new Date).getTime();
|
||||
var h = new Uint8Array(ab, 0, 10);
|
||||
unrar5(ab);
|
||||
var pathToBitJS = "../../static/js/archive/";
|
||||
var lastCompletion = 0;
|
||||
/*if (h[0] === 0x52 && h[1] === 0x61 && h[2] === 0x72 && h[3] === 0x21) { //Rar!
|
||||
if (h[7] === 0x01) {
|
||||
unarchiver = new bitjs.archive.Unrarrer(ab, pathToBitJS);
|
||||
} else {
|
||||
unarchiver = new bitjs.archive.Unrarrer5(ab, pathToBitJS);
|
||||
}
|
||||
if (h[0] === 0x52 && h[1] === 0x61 && h[2] === 0x72 && h[3] === 0x21) { //Rar!
|
||||
unarchiver = new bitjs.archive.Unrarrer(ab, pathToBitJS);
|
||||
} else if (h[0] === 80 && h[1] === 75) { //PK (Zip)
|
||||
unarchiver = new bitjs.archive.Unzipper(ab, pathToBitJS);
|
||||
} else if (h[0] === 255 && h[1] === 216) { // JPEG
|
||||
@ -234,7 +229,7 @@ function loadFromArrayBuffer(ab) {
|
||||
unarchiver.start();
|
||||
} else {
|
||||
alert("Some error");
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
function scrollTocToActive() {
|
||||
|
Loading…
Reference in New Issue
Block a user