From 8aadbdd998e7e0923652785d20838305b7ed5c0c Mon Sep 17 00:00:00 2001 From: Jonathan Wyss Date: Fri, 5 Dec 2025 14:00:28 +0100 Subject: [PATCH] asdf --- mail/.offlineimaprc | 3 +-- scan | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/mail/.offlineimaprc b/mail/.offlineimaprc index 4bdb9ff..2064a77 100644 --- a/mail/.offlineimaprc +++ b/mail/.offlineimaprc @@ -138,8 +138,7 @@ accounts = [ACCOUNTNAME] # # Tilde and environment variable expansions will be performed. # -#pythonfile = ~/.offlineimap.py - +pythonfile = $XDG_CONFIG_HOME/msmtp/pass_wrapper.py # This option is in the [general] section. # diff --git a/scan b/scan index 48af022..fde9ad5 100755 --- a/scan +++ b/scan @@ -1,4 +1,4 @@ - +#!/bin/bash TEMPDIR=/tmp/scanner/ @@ -6,6 +6,17 @@ RET_SCAN=0 RET_MAGICK=-1 FILENAME="UNDEFINED" +#DEVICE=utsushi:esci:usb:0x04B8:0x110B +DEVICE="utsushi:esci:usb:/sys/devices/pci0000:00/0000:00:08.3/0000:13:00.0/usb7/7-1/7-1.2/7-1.2:1.0" +function sendPaperless() { + TOKEN=$(pass show paperless/api-token 2>/dev/null) + curl -X POST \ + --url https://5ccppi.org:8080/api/documents/post_document/ \ + --header "Authorization: token $TOKEN" \ + -F "document=@$1" + echo "curl: " $? + } + if [ ! -d "$TEMPDIR" ]; then echo "create tempdir as it does not exist" mkdir $TEMPDIR @@ -13,7 +24,7 @@ if [ ! -d "$TEMPDIR" ]; then fi if [ -d "$TEMPDIR" ]; then - scanimage --tl-x 7 -d utsushi:esci:usb:0x04B8:0x110B --batch="$TEMPDIR/out%d.pnm" \ + scanimage --tl-x 7 -d $DEVICE --batch="$TEMPDIR/out%d.pnm" \ --source=ADF \ --resolution=200 RET_SCAN=$? @@ -38,7 +49,10 @@ if [ $RET_SCAN == 2 ]; then fi if [ $RET_MAGICK == 0 ]; then echo "magick sucessful converted $FILENAME" + sendPaperless $FILENAME xdg-open $FILENAME else echo -e "ERROR: magick returned: " $RET_MAGICK " there sems to be nothing to do\n is the paper inserted?" fi + +