From 8e87c75c3aef1b59e2c2f08a11852abf2a87cd0c Mon Sep 17 00:00:00 2001 From: trav Date: Wed, 17 Aug 2022 01:45:37 -0400 Subject: [PATCH] backup before travel --- README.md | 18 +++++++++++++++++- addtoDB.py | 6 +++--- carousel.py | 55 ++++++++++++++++++++++++++--------------------------- 3 files changed, 47 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index ddde0da..eb11c08 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,13 @@ pip3 install spidev tinydb pillow pyqrcode qrcode --no-cache-dir probably also need to install _some_ of the libraries at https://github.com/adafruit/Python-Thermal-Printer but not all `sudo apt-get install git cups build-essential libcups2-dev libcupsimage2-dev python3-serial python3-pil python-unidecode` maybe don't need alllll of it +Do need to do this to install the printer: +```sudo lpadmin -p ZJ-58 -E -v serial:/dev/usb/lp0?baud=19200 -m zjiang/ZJ-58.ppd +sudo lpoptions -d ZJ-58``` + +certainly CUPS will cause you issues and you will need to reference https://www.cups.org/doc/man-cupsd.conf.html + + Now need to install an ARMv6 compatible NPM. This should work: ``` curl -o node.tar.gz https://unofficial-builds.nodejs.org/download/release/v13.8.0/node-v13.8.0-linux-armv6l.tar.gz @@ -81,6 +88,10 @@ sudo cp -r node-v13.8.0-linux-armv6l/* /usr/local If that doesn't work you can [read more about installing node on arm v6 architecture](https://www.thepolyglotdeveloper.com/2018/03/install-nodejs-raspberry-pi-zero-w-nodesource/). Also [the builds are here](https://unofficial-builds.nodejs.org/). + +might need to run `curl https://get.pimoroni.com/buttonshim | bash` to get the buttons to work + +
#### clone the repo ideally right in your home directory. @@ -88,7 +99,12 @@ ideally right in your home directory. `git clone https://git.laboratoryb.org/trav/ebb.git` #### setup SSB -I can't remember how I got ssb-server to work, `sudo npm install -g ssb-server` throws `illegal instruction`. Something to do with a woknky version of Node. So my **extremely** hacky workaround is to unzip `ssb-server.zip` from the install directory into `/usr/local/lib/node_modules/`. This is v bad and needs to be fixed asap. [SSB-server](https://github.com/ssbc/ssb-server) is made available via the MIT licese. +I can't remember how I got ssb-server to work, `sudo npm install -g ssb-server` throws `illegal instruction`. Something to do with a woknky version of Node. + +##### My **extremely** hacky workaround: +1. `sudo npm install -g ssb-server` to add all the npm-side ssb stuff +2. unzip `ssb-server.zip` from the install directory into `/usr/local/lib/node_modules/` to actually have a working SSB server. +This is v bad and needs to be fixed asap. [SSB-server](https://github.com/ssbc/ssb-server) is made available via the MIT licese. As long as the EBB repo is at `/home/pi/ebb` the following service files should be configured fine. Otherwise you gotta edit ssb.service and ebb-carousel.service and update the `WorkingDirectory` field. diff --git a/addtoDB.py b/addtoDB.py index 529c777..4c6cee4 100644 --- a/addtoDB.py +++ b/addtoDB.py @@ -48,12 +48,12 @@ def addFile(pathToImage, pathToDB, SSBidentify, composite): # get the ssb json from the bash command we just ran - newssb=result.stdout.read() + newssb=result.stdout.read() # iterate through new ssb posts - for decoded in iterparse.parsy(newssb): + for decoded in iterparse.parsy(newssb): # get the key for the post we just made - key = decoded['key'] + key = decoded['key'] return key diff --git a/carousel.py b/carousel.py index 87b24f0..e970c78 100755 --- a/carousel.py +++ b/carousel.py @@ -239,9 +239,9 @@ while True: half3 = half1.resize(newsize) half1 = half1.convert("1") half1.save(bmpath1) - half2 = im2.convert("1") + half2 = half2.convert("1") half2.save(bmpath2) - half3 = im3.convert("1") + half3 = half3.convert("1") half3.save(bmpath3) @@ -301,22 +301,23 @@ while True: # if we're printing, generate image to print if button_flag == "button_1" or button_flag == "button_2" or button_flag == "button_3": #generate unique file_name - unique = uuid.uuid4() - unique = str(unique) - composite = imagesPath + unique + '.jpg' + unique = uuid.uuid4() + unique = str(unique) + composite = imagesPath + unique + '.jpg' # concatenate images and save concatenated image at composite (is filepath) - header = Image.open(composite) - im1 = Image.open(jpgpath1) - im2 = Image.open(jpgpath2) - im3 = Image.open(jpgpath3) + headerIsAt = imagesPath + 'header.jpg' + header = Image.open(headerIsAt) + im1 = Image.open(jpgpath1) + im2 = Image.open(jpgpath2) + im3 = Image.open(jpgpath3) - get_concat_v(header, im1).save(composite) - concaz = Image.open(conposite) - get_concat_v(concaz, im2).save(composite) - concaz = Image.open(conposite) - get_concat_v(concaz, im3).save(composite) - concaz = Image.open(conposite) + get_concat_v(header, im1).save(composite) + concaz = Image.open(composite) + get_concat_v(concaz, im2).save(composite) + concaz = Image.open(composite) + get_concat_v(concaz, im3).save(composite) + concaz = Image.open(composite) #post to ssb and print @@ -355,15 +356,18 @@ while True: #generate unique file_name - unique = uuid.uuid4() - unique = str(unique) - FULLcomposite = imagesPath + unique + '.jpg' - - get_concat_v(concaz, (get_concat_h(qrInstruct, img))).save(FULLcomposite) - - # bash lp of Fullcomposite + unique = uuid.uuid4() + unique = str(unique) + FULLcomposite = imagesPath + unique + '.jpg' + get_concat_v(concaz, (get_concat_h(qrInstruct, img))).save(FULLcomposite) + # print Fullcomposite + try: + result = subprocess.call('lp' + Fullcomposite, shell=True) + except: + print('traceback.format_exc():\n%s' % traceback.format_exc()) + exit() @@ -411,12 +415,7 @@ while True: if button_flag == "button_3": button_flag == "null" #nothin! loop around... exitPhotoMode still false - - try: - result = subprocess.call(['raspistill', '-rot', '180', '-o', jpgpath3, '-vf', '-hf', '-w', '600', '-h', '800', '-t', '1000']) - except: - print('traceback.format_exc():\n%s' % traceback.format_exc()) - exit() + #reshoot