add cursed remote print functionality
This commit is contained in:
parent
fd42fed19d
commit
4bfa581e9f
5 changed files with 53 additions and 0 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "fetcher"]
|
||||||
|
path = fetcher
|
||||||
|
url = https://git.glyphs.tech/sigil-03/nomadnet-file-fetcher.git
|
||||||
1
fetcher
Submodule
1
fetcher
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 742a4a70047e748a25bd5407ad14ae85d9603079
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
git submodule update --init --recursive
|
||||||
mkdir -p ${HOME}/.nomadnetwork/storage/plugins/print3d/files/
|
mkdir -p ${HOME}/.nomadnetwork/storage/plugins/print3d/files/
|
||||||
mkdir -p ${HOME}/.nomadnetwork/storage/plugins/print3d/printers/
|
mkdir -p ${HOME}/.nomadnetwork/storage/plugins/print3d/printers/
|
||||||
|
mkdir -p ${HOME}/.nomadnetwork/storage/plugins/print3d/cache/
|
||||||
mkdir -p ${HOME}/.nomadnetwork/storage/pages/print3d/
|
mkdir -p ${HOME}/.nomadnetwork/storage/pages/print3d/
|
||||||
yes | cp -rf ./pages/* ${HOME}/.nomadnetwork/storage/pages/print3d
|
yes | cp -rf ./pages/* ${HOME}/.nomadnetwork/storage/pages/print3d
|
||||||
|
|
||||||
|
python3 -m venv venv && source venv/bin/activate && pip install -r fetcher/requirements.txt
|
||||||
|
|
||||||
echo "print3d installed, make sure to make pages/print3d/index.mu accessible!"
|
echo "print3d installed, make sure to make pages/print3d/index.mu accessible!"
|
||||||
|
echo "remote print3d installed, make sure to make pages/print3d/remote_print.mu accessible!"
|
||||||
|
|
|
||||||
27
pages/remote_print.mu
Executable file
27
pages/remote_print.mu
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
import os
|
||||||
|
from os import listdir
|
||||||
|
from os.path import isfile, join
|
||||||
|
|
||||||
|
userdir = os.path.expanduser("~")
|
||||||
|
nomaddir = userdir+"/.nomadnetwork"
|
||||||
|
|
||||||
|
|
||||||
|
print("> PRINTERS")
|
||||||
|
printers = [f for f in listdir(nomaddir+'/storage/plugins/print3d/printers')]
|
||||||
|
if len(printers) == 0:
|
||||||
|
print("no printer config files available :(")
|
||||||
|
print("add printer config files to: ~/.nomadnetwork/storage/plugins/print3d/printers/")
|
||||||
|
|
||||||
|
else:
|
||||||
|
for p in printers:
|
||||||
|
print("""`<^|printer|{p}`>`b {p}""".format(p=p))
|
||||||
|
|
||||||
|
print("\n")
|
||||||
|
print("> FILE")
|
||||||
|
print("print file URL: `B444`<url`>`b")
|
||||||
|
print("\n")
|
||||||
|
print("> SUBMIT")
|
||||||
|
print("""`!`[>SUBMIT<`:/page/print3d/submit_remote.mu`printer|url|nomad_dir={ndir}]`!""".format(ndir=nomaddir))
|
||||||
|
|
||||||
16
pages/submit_remote.mu
Executable file
16
pages/submit_remote.mu
Executable file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
STORAGEDIR=${var_nomad_dir}/storage/plugins/print3d
|
||||||
|
CACHEDIR=${STORAGEDIR}/cache
|
||||||
|
PCONFIG=${STORAGEDIR}/printers/${field_printer}
|
||||||
|
# FILE=${STORAGEDIR}/files/${field_file}
|
||||||
|
FILE="${field_url##*/}"
|
||||||
|
echo ${FILE}
|
||||||
|
|
||||||
|
echo "submitting job..."
|
||||||
|
|
||||||
|
source ${var_nomad_dir}/plugins/print3d/venv/bin/activate && python3 ${var_nomad_dir}/plugins/print3d/fetcher/fetcher.py ${field_url} ${STORAGEDIR}/cache >/dev/null 2>&1
|
||||||
|
|
||||||
|
${var_nomad_dir}/plugins/print3d/prusatool --printer-config ${PCONFIG} load ${STORAGEDIR}/cache/${FILE} --print-immediately
|
||||||
|
|
||||||
|
echo "...job submitted successfully"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue