Skip to content

Commit

Permalink
--source before --mode
Browse files Browse the repository at this point in the history
See #573
  • Loading branch information
sbs20 committed Mar 6, 2023
1 parent 6d216f6 commit 899ef49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions packages/server/src/classes/scanimage-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,16 @@ module.exports = class ScanimageCommand {
const cmdBuilder = new CommandBuilder(this.config.scanimage);
cmdBuilder.arg('-d', params.deviceId);

if ('mode' in params) {
cmdBuilder.arg('--mode', params.mode);
}

// Source needs to go before resolution
if ('source' in params) {
cmdBuilder.arg('--source', params.source);
}

if ('mode' in params) {
cmdBuilder.arg('--mode', params.mode);
}
if ('adfMode' in params) {
cmdBuilder.arg('--adf-mode', params.adfMode);
}

cmdBuilder.arg('--resolution', params.resolution);

if ('pageWidth' in params) {
Expand Down
4 changes: 2 additions & 2 deletions packages/server/test/scanimage-command.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('ScanimageCommand', () => {
const command = commandFor('1.0.31', request);

// eslint-disable-next-line quotes
assert.strictEqual(command, `/usr/bin/scanimage -d epjitsu:libusb:001:003 --mode Color --source 'ADF Front' --resolution 300 --page-width 215.8 --page-height 292 -t 0 --format tiff --brightness 0 --contrast 0 -o data/temp/~tmp-scan-0-0001.tif`);
assert.strictEqual(command, `/usr/bin/scanimage -d epjitsu:libusb:001:003 --source 'ADF Front' --mode Color --resolution 300 --page-width 215.8 --page-height 292 -t 0 --format tiff --brightness 0 --contrast 0 -o data/temp/~tmp-scan-0-0001.tif`);
});

it('scanimage-a14.txt', () => {
Expand All @@ -92,7 +92,7 @@ describe('ScanimageCommand', () => {
});
const command = commandFor('1.1.1', request);
// eslint-disable-next-line quotes
assert.strictEqual(command, `/usr/bin/scanimage -d 'fujitsu:ScanSnap S1500:8176' --mode Lineart --source 'ADF Front' --resolution 600 --page-width 215.8 --page-height 279.3 -l 0 -t 0 -x 215.8 -y 279.3 --format tiff --ald=yes --brightness 0 -o data/temp/~tmp-scan-0-0001.tif`);
assert.strictEqual(command, `/usr/bin/scanimage -d 'fujitsu:ScanSnap S1500:8176' --source 'ADF Front' --mode Lineart --resolution 600 --page-width 215.8 --page-height 279.3 -l 0 -t 0 -x 215.8 -y 279.3 --format tiff --ald=yes --brightness 0 -o data/temp/~tmp-scan-0-0001.tif`);
});

});

0 comments on commit 899ef49

Please sign in to comment.