Skip to content

Commit

Permalink
Completely remove shell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pedropombeiro committed Oct 1, 2024
1 parent 5a69280 commit 52e868e
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 112 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ RUN apt-get -y install \
php-curl \
sudo \
iproute2 \
jq \
bc \
pdftk \
poppler-utils \
&& apt-get -y clean
Expand Down
8 changes: 4 additions & 4 deletions files/brscan-skey.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
password=
IMAGE="bash /opt/brother/scanner/brscan-skey/script/scantoimage.sh"
OCR="bash /opt/brother/scanner/brscan-skey/script/scantoocr.sh"
EMAIL="bash /opt/brother/scanner/brscan-skey/script/scantoemail.sh"
FILE="bash /opt/brother/scanner/brscan-skey/script/scantofile.sh"
IMAGE="python3 /opt/brother/scanner/brscan-skey/script/scantoimage.py"
OCR="python3 /opt/brother/scanner/brscan-skey/script/scantoocr.py"
EMAIL="python3 /opt/brother/scanner/brscan-skey/script/scantoemail.py"
FILE="python3 /opt/brother/scanner/brscan-skey/script/scantofile.py"
SEMID=b
eth=
ip_address=
6 changes: 3 additions & 3 deletions html/scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
if (in_array($target, array('file','email','image','ocr'))) {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
//return immediately
$handle = popen('sudo -b -u \#'.$UID.' /opt/brother/scanner/brscan-skey/script/scanto'.$target.'.sh', 'r');
$handle = popen('sudo -b -u \#'.$UID.' /opt/brother/scanner/brscan-skey/script/scanto'.$target.'.py', 'r');
} else if ($_SERVER['REQUEST_METHOD'] == 'GET') {
//wait for completion
$output=shell_exec('sudo -u \#'.$UID.' /opt/brother/scanner/brscan-skey/script/scanto'.$target.'.sh');
$output=shell_exec('sudo -u \#'.$UID.' /opt/brother/scanner/brscan-skey/script/scanto'.$target.'.py');
}
}
else
Expand All @@ -43,4 +43,4 @@
// die();
//}

?>
?>
18 changes: 0 additions & 18 deletions script/scantoemail-0.2.4-1.py

This file was deleted.

10 changes: 0 additions & 10 deletions script/scantoemail-0.2.4-1.sh

This file was deleted.

1 change: 0 additions & 1 deletion script/scantoemail.py

This file was deleted.

21 changes: 21 additions & 0 deletions script/scantoemail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/python3
# $1 = scanner device
# $2 = friendly name

import sys

from scanner import read_environment, scan_rear

if __name__ == "__main__":
# Open the log file in append mode
with open("/var/log/scanner.log", "a") as log:
# Redirect stdout to the log file
sys.stdout = log
sys.stderr = log

read_environment()

device = None
if len(sys.argv) > 1:
device = sys.argv[1]
scan_rear(log, device)
1 change: 0 additions & 1 deletion script/scantoemail.sh

This file was deleted.

18 changes: 0 additions & 18 deletions script/scantofile-0.2.4-1.py

This file was deleted.

10 changes: 0 additions & 10 deletions script/scantofile-0.2.4-1.sh

This file was deleted.

1 change: 0 additions & 1 deletion script/scantofile.py

This file was deleted.

21 changes: 21 additions & 0 deletions script/scantofile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/python3
# $1 = scanner device
# $2 = friendly name

import sys

from scanner import read_environment, scan_front

if __name__ == "__main__":
# Open the log file in append mode
with open("/var/log/scanner.log", "a") as log:
# Redirect stdout to the log file
sys.stdout = log
sys.stderr = log

read_environment()

device = None
if len(sys.argv) > 1:
device = sys.argv[1]
scan_front(log, device)
1 change: 0 additions & 1 deletion script/scantofile.sh

This file was deleted.

12 changes: 0 additions & 12 deletions script/scantoimage-0.2.4-1.sh

This file was deleted.

19 changes: 19 additions & 0 deletions script/scantoimage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/python3
# $1 = scanner device
# $2 = friendly name

import sys

if __name__ == "__main__":
# Open the log file in append mode
with open("/var/log/scanner.log", "a") as log:
# Redirect stdout to the log file
sys.stdout = log
sys.stderr = log

print("ERROR!")
print("This function is not implemented.")
print("You may implement your own script and mount under $0.")
print(
"Check out scripts in same folder or https://github.com/PhilippMundhenk/BrotherScannerDocker for examples."
)
1 change: 0 additions & 1 deletion script/scantoimage.sh

This file was deleted.

18 changes: 0 additions & 18 deletions script/scantoocr-0.2.4-1.py

This file was deleted.

10 changes: 0 additions & 10 deletions script/scantoocr-0.2.4-1.sh

This file was deleted.

1 change: 0 additions & 1 deletion script/scantoocr.py

This file was deleted.

21 changes: 21 additions & 0 deletions script/scantoocr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/python3
# $1 = scanner device
# $2 = friendly name

import sys

from scanner import read_environment, scan_front

if __name__ == "__main__":
# Open the log file in append mode
with open("/var/log/scanner.log", "a") as log:
# Redirect stdout to the log file
sys.stdout = log
sys.stderr = log

read_environment()

device = None
if len(sys.argv) > 1:
device = sys.argv[1]
scan_front(log, device, ["--mode=True Gray"])
1 change: 0 additions & 1 deletion script/scantoocr.sh

This file was deleted.

0 comments on commit 52e868e

Please sign in to comment.