File scan improvements

* Support more versions of RAR signatures & file listings
* Better FILE_ID.DIZ, NFO, etc. extraction
This commit is contained in:
Bryan Ashby 2019-02-02 19:04:36 -07:00
parent 8ba80426e3
commit 50c1a60838
2 changed files with 17 additions and 6 deletions

View File

@ -553,7 +553,7 @@ function getDefaultConfig() {
}, },
'application/x-rar-compressed' : { 'application/x-rar-compressed' : {
desc : 'RAR Archive', desc : 'RAR Archive',
sig : '526172211a0700', sig : '526172211a07',
offset : 0, offset : 0,
archiveHandler : 'Rar', archiveHandler : 'Rar',
}, },
@ -704,7 +704,7 @@ function getDefaultConfig() {
list : { list : {
cmd : 'unrar', cmd : 'unrar',
args : [ 'l', '{archivePath}' ], 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]+)$', entryMatch : '^\\s+[\\.A-Z]+\\s+([\\d]+)\\s{2}[0-9]{2,4}\\-[0-9]{2}\\-[0-9]{2}\\s[0-9]{2}\\:[0-9]{2}\\s{2}([^\\r\\n]+)$',
}, },
extract : { extract : {
cmd : 'unrar', cmd : 'unrar',
@ -880,12 +880,23 @@ function getDefaultConfig() {
// FILE_ID.DIZ - https://en.wikipedia.org/wiki/FILE_ID.DIZ // FILE_ID.DIZ - https://en.wikipedia.org/wiki/FILE_ID.DIZ
// Some groups include a FILE_ID.ANS. We try to use that over FILE_ID.DIZ if available. // Some groups include a FILE_ID.ANS. We try to use that over FILE_ID.DIZ if available.
desc : [ desc : [
'^[^/\]*FILE_ID\.ANS$', '^[^/\]*FILE_ID\.DIZ$', '^[^/\]*DESC\.SDI$', '^[^/\]*DESCRIPT\.ION$', '^[^/\]*FILE\.DES$', '^[^/\]*FILE\.SDI$', '^[^/\]*DISK\.ID$' // eslint-disable-line no-useless-escape '^.*FILE_ID\.ANS$', '^.*FILE_ID\.DIZ$', // eslint-disable-line no-useless-escape
'^.*DESC\.SDI$', // eslint-disable-line no-useless-escape
'^.*DESCRIPT\.ION$', // eslint-disable-line no-useless-escape
'^.*FILE\.DES$', // eslint-disable-line no-useless-escape
'^.*FILE\.SDI$', // eslint-disable-line no-useless-escape
'^.*DISK\.ID$' // eslint-disable-line no-useless-escape
], ],
// common README filename - https://en.wikipedia.org/wiki/README // common README filename - https://en.wikipedia.org/wiki/README
descLong : [ descLong : [
'^[^/\]*\.NFO$', '^[^/\]*README\.1ST$', '^[^/\]*README\.NOW$', '^[^/\]*README\.TXT$', '^[^/\]*READ\.ME$', '^[^/\]*README$', '^[^/\]*README\.md$',// eslint-disable-line no-useless-escape '^[^/\]*\.NFO$', // eslint-disable-line no-useless-escape
'^.*README\.1ST$', // eslint-disable-line no-useless-escape
'^.*README\.NOW$', // eslint-disable-line no-useless-escape
'^.*README\.TXT$', // eslint-disable-line no-useless-escape
'^.*READ\.ME$', // eslint-disable-line no-useless-escape
'^.*README$', // eslint-disable-line no-useless-escape
'^.*README\.md$', // eslint-disable-line no-useless-escape
'^RELEASE-INFO.ASC$' // eslint-disable-line no-useless-escape '^RELEASE-INFO.ASC$' // eslint-disable-line no-useless-escape
], ],
}, },

View File

@ -354,8 +354,8 @@ function extractAndProcessDescFiles(fileEntry, filePath, archiveEntries, cb) {
} }
const descFiles = { const descFiles = {
desc : shortDescFile ? paths.join(tempDir, shortDescFile.fileName) : null, desc : shortDescFile ? paths.join(tempDir, paths.basename(shortDescFile.fileName)) : null,
descLong : longDescFile ? paths.join(tempDir, longDescFile.fileName) : null, descLong : longDescFile ? paths.join(tempDir, paths.basename(longDescFile.fileName)) : null,
}; };
return callback(null, descFiles); return callback(null, descFiles);