21
Dockerfile
Normal file
21
Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM archlinux
|
||||
|
||||
|
||||
RUN pacman --noconfirm -Sy qrencode \
|
||||
zbar \
|
||||
imagemagick \
|
||||
git \
|
||||
ttf-roboto \
|
||||
fontconfig \
|
||||
diffutils
|
||||
|
||||
ENV FONT=Roboto-Regular \
|
||||
OUTPUT_DIR=/target/ \
|
||||
INPUT_DIR=/target/
|
||||
|
||||
RUN mkdir /paperify
|
||||
COPY . /paperify
|
||||
WORKDIR /paperify
|
||||
|
||||
ENTRYPOINT ["/paperify/paperify.sh"]
|
||||
|
18
README.md
18
README.md
@@ -38,6 +38,8 @@ wget https://github.com/alisinabh/paperify/archive/master.zip -O paperify.zip &&
|
||||
unzip paperify.zip && cd paperify-master
|
||||
```
|
||||
|
||||
Or you can use paperify's Docker image at alisinabh/paperify. More details below.
|
||||
|
||||
## Usage
|
||||
```
|
||||
# Creates FILE-qr directory with generated qr codes inside.
|
||||
@@ -50,6 +52,22 @@ wget https://github.com/alisinabh/paperify/archive/master.zip -O paperify.zip &&
|
||||
./digitalify.sh OUTPUT_FILE DIRECTORY
|
||||
```
|
||||
|
||||
### Use with Docker
|
||||
|
||||
You can mount your files at `/target` in paperify's docker container. Then run paperify.
|
||||
|
||||
For simplicity, You can just copy the bellow commands which will mount your current directory automatically.
|
||||
|
||||
```
|
||||
# To Paperify
|
||||
# FIRST: cd into the folder that your file is in
|
||||
docker run -v$(pwd):/target alisinabh/paperify FILE
|
||||
|
||||
# To Digitallify
|
||||
# First cd into the folder that your scanned images are in
|
||||
docker run -v$(pwd):/target --entrypoint=/paperify/digitallify.sh alisinabh/paperify OUTPUT_FILE .
|
||||
```
|
||||
|
||||
## Recommendations
|
||||
|
||||
### Multiple files
|
||||
|
@@ -1,7 +1,18 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
outputfile="$1"
|
||||
dir="$2"
|
||||
if [ "$1" = "-h" ]; then
|
||||
echo "usage: digitallify.sh <outputfile> <images_directory>"
|
||||
exit 0
|
||||
elif [ "$1" = "" ]; then
|
||||
echo "Please provide a filename as the first argument"
|
||||
exit 1
|
||||
elif [ "$2" = "" ]; then
|
||||
echo "Please provide the directory of the images as the second argument"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outputfile="$INPUT_DIR$1"
|
||||
dir="$OUTPUT_DIR$2"
|
||||
|
||||
files=$(ls $dir)
|
||||
|
||||
|
33
paperify.sh
33
paperify.sh
@@ -1,16 +1,35 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
while getopts "c:" opt; do
|
||||
case $opt in
|
||||
c) comment=$OPTARG ;; # Handle -c
|
||||
\?) echo "Use -c \"COMMENT\" to add comment to images."; exit ;; # Handle error: unknown option or missing required argument.
|
||||
esac
|
||||
for ((i=1;i<=$#;i++));
|
||||
do
|
||||
|
||||
if [ ${!i} = "-c" ]
|
||||
then ((i++))
|
||||
comment=${!i};
|
||||
elif [ ${!i} = "-h" ]
|
||||
then ((i++))
|
||||
echo "usage: paperify.sh [OPTIONS] <FILE>"
|
||||
echo ""
|
||||
echo "options:"
|
||||
echo -e " -h\t\tShow this help."
|
||||
echo -e " -c COMMENT\tAdd comment to the generated files."
|
||||
exit 0
|
||||
else
|
||||
file="$INPUT_DIR${!i}";
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
for file in $@; do :; done
|
||||
if test -f "$file"; then
|
||||
echo "Paperifying $file"
|
||||
else
|
||||
echo "File not found! $file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
filename=$(echo $file | rev | cut -f 1 -d '/' | rev)
|
||||
prefix="$filename-"
|
||||
dir="$filename-qr"
|
||||
dir="$OUTPUT_DIR$filename-qr"
|
||||
|
||||
mkdir -p $dir
|
||||
rm -f $dir/*
|
||||
|
Reference in New Issue
Block a user