-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
236 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
# Pay 2 Print Extension - <small>[repository](https://github.com/lnbits/pay2print) extension</small> | ||
|
||
|
||
## share a printer via the network on cups | ||
https://www.cups.org/doc/sharing.html | ||
|
||
|
||
### 1. install cups and configure printer | ||
``` | ||
apt-get install cups | ||
systemctl start cups | ||
systemctl enable cups | ||
lpadmin -p MyPrinterName -o printer-is-shared=true | ||
# set default printer | ||
# lpoptions -d MyPrinterName | ||
cupsctl --share-printers | ||
``` | ||
|
||
### server where you access the sharedprinter via the network | ||
``` | ||
apt-get install cups-client | ||
# check if printer is shared | ||
lpstat -h 10.5.5.2 -a | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import asyncio | ||
|
||
from .crud import db, update_print | ||
from .helpers import check_printer, print_file | ||
from .models import Print, Printer, PrintStatus | ||
|
||
|
||
async def print_service(_print: Print, printer: Printer) -> None: | ||
check_printer(printer.host, printer.name) | ||
async with db.connect() as conn: | ||
_print.print_status = PrintStatus.PRINTING | ||
await update_print(_print, conn=conn) | ||
try: | ||
print_file(printer.host, printer.name, _print.file) | ||
await asyncio.sleep(5) # simulate printing time | ||
_print.print_status = PrintStatus.SUCCESS | ||
await update_print(_print, conn=conn) | ||
return | ||
except Exception as exc: | ||
_print.print_status = PrintStatus.FAILED | ||
await update_print(_print, conn=conn) | ||
raise exc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.