From e70f28fffedb5145b1e08b1b772b0bed4b842cd4 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Fri, 17 Feb 2017 21:56:28 -0700 Subject: [PATCH] * Use proper unrar for .rar riles (7za has issues) * Fix short/long desc issues when filenames have paths --- core/archive_util.js | 2 +- core/config.js | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/core/archive_util.js b/core/archive_util.js index f1bf70df..02a2e283 100644 --- a/core/archive_util.js +++ b/core/archive_util.js @@ -265,7 +265,7 @@ module.exports = class ArchiveUtil { while((m = entryMatchRe.exec(output))) { entries.push({ byteSize : parseInt(m[entryGroupOrder.byteSize]), - fileName : m[entryGroupOrder.fileName], + fileName : m[entryGroupOrder.fileName].trim(), }); } diff --git a/core/config.js b/core/config.js index 755cc56c..adf82630 100644 --- a/core/config.js +++ b/core/config.js @@ -305,6 +305,22 @@ function getDefaultConfig() { cmd : 'arj', args : [ 'e', '{archivePath}', '{extractPath}', '{fileList}' ], } + }, + + Rar : { + decompress : { + cmd : 'unrar', + args : [ 'x', '{archivePath}', '{extractPath}' ], + }, + list : { + cmd : 'unrar', + args : [ 'l', '{archivePath}' ], + entryMatch : '^\\s+[\\.A-Z]+\\s+([\\d]+)\\s{2}[0-9]{2}\\-[0-9]{2}\\-[0-9]{2}\\s[0-9]{2}\\:[0-9]{2}\\s{2}([^\\r\\n]+)$', + }, + extract : { + cmd : 'unrar', + args : [ 'e', '{archivePath}', '{extractPath}', '{fileList}' ], + } } }, @@ -338,7 +354,7 @@ function getDefaultConfig() { sig : '526172211a0700', offset : 0, exts : [ 'rar' ], - handler : '7Zip', + handler : 'Rar', desc : 'RAR Archive', }, gzip : { @@ -483,12 +499,12 @@ function getDefaultConfig() { // These are NOT case sensitive // FILE_ID.DIZ - https://en.wikipedia.org/wiki/FILE_ID.DIZ desc : [ - '^FILE_ID\.DIZ$', '^DESC\.SDI$', '^DESCRIPT\.ION$', '^FILE\.DES$', '$FILE\.SDI$', '^DISK\.ID$' + '^[^/\]*FILE_ID\.DIZ$', '^[^/\]*DESC\.SDI$', '^[^/\]*DESCRIPT\.ION$', '^[^/\]*FILE\.DES$', '^[^/\]*FILE\.SDI$', '^[^/\]*DISK\.ID$' ], // common README filename - https://en.wikipedia.org/wiki/README descLong : [ - '^.*\.NFO$', '^README\.1ST$', '^README\.NOW$', '^README\.TXT$', '^READ\.ME$', '^README$', '^README\.md$' + '^[^/\]*\.NFO$', '^[^/\]*README\.1ST$', '^[^/\]*README\.NOW$', '^[^/\]*README\.TXT$', '^[^/\]*READ\.ME$', '^[^/\]*README$', '^[^/\]*README\.md$' ], },