feat: the proof card, machine pull and print file corrections (Dropstar, 05/11)
The proof card owns its final PNG, keeps its parent locked until the seller answers, enters the queue first, and shares one machine with the parent. The board no longer assigns a machine at payment; the puller records it. A stalled print file times out with a card warning and a retry, finished orders sort by completion, and finals are stored as PNG. The original download carries the order number (items 0.1, 0.4 to 0.7 and 0.9).
This commit is contained in:
@@ -7,12 +7,25 @@ import hashlib
|
||||
import http.cookiejar
|
||||
import json
|
||||
import os
|
||||
import struct
|
||||
import zlib
|
||||
from pathlib import Path
|
||||
import time
|
||||
from urllib.error import HTTPError
|
||||
from urllib.request import build_opener, HTTPCookieProcessor, Request, urlopen
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
def final_png_bytes(label='final'):
|
||||
"""A tiny real RGBA PNG tagged 300 DPI for operator final-file tests."""
|
||||
def chunk(kind, body):
|
||||
return struct.pack('>I', len(body)) + kind + body + struct.pack('>I', zlib.crc32(kind + body) & 0xffffffff)
|
||||
red = hashlib.sha256(label.encode()).digest()[0]
|
||||
row = b'\x00' + bytes((red, 30, 60, 255, 0, 0, 0, 0))
|
||||
return (b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', struct.pack('>IIBBBBB', 2, 1, 8, 6, 0, 0, 0)) +
|
||||
chunk(b'pHYs', struct.pack('>IIB', 11811, 11811, 1)) +
|
||||
chunk(b'IDAT', zlib.compress(row)) + chunk(b'IEND', b''))
|
||||
|
||||
if Path('.env').exists():
|
||||
for line in Path('.env').read_text().splitlines():
|
||||
if line.strip() and not line.startswith('#') and '=' in line:
|
||||
@@ -269,7 +282,7 @@ def run():
|
||||
if state=='tra':
|
||||
# The queue takes approved final files only.
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'tra','version':version},operator=True,expected=409)
|
||||
files=[{'item_index':i,'upload_id':upload_bytes(client,b'LOCAL FINAL FIXTURE '+str(i).encode(),order_id=oid)} for i in range(4)]
|
||||
files=[{'item_index':i,'upload_id':upload_bytes(client,final_png_bytes(str(i)),name=f'LOCAL-FINAL-{i}.png',order_id=oid)} for i in range(4)]
|
||||
result=client.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':files,'note':'Local test manual final-file approval'},operator=True)
|
||||
version=result['version']
|
||||
if state=='imp':
|
||||
|
||||
Reference in New Issue
Block a user