Closed burnbabyburn closed 1 year ago
It might be that a simple change could fix it:
if attrs['color-supported']:
-> if 'color-supported' in attrs:
Let me know if that helps @burnbabyburn , then I can update the code quickly.
@DrPsychick
Thx for the fix. Worked for me, but the Color is always true now!
I added some missing stuff from the specification and an else clause for the color. Maybe another possability is to use
if attrs.get('color-supported', True):
Someone needs to check the python code though
copies = Element('txt-record')
if 'copies' in attrs.get('job-creation-attributes-supported'):
copies.text = 'Copies=T'
else:
copies.text = 'Copies=F'
service.append(copies)
tbcp = Element('txt-record')
if 'tbcp' in attrs.get('port-monitor-supported'):
tbcp.text = 'TBCP=T'
else:
tbcp.text = 'TBCP=F'
service.append(tbcp)
staple = Element('txt-record')
if '4' in attrs.get('finishings-supported'):
staple.text = 'Staple=T'
else:
staple.text = 'Staple=F'
service.append(staple)
##THE OR PART IS BROKEN
punch = Element('txt-record')
punch.text = 'Punch=U'
if '3' in attrs.get('finishings-supported'):
punch.text = 'Punch=0'
if '70' or '71' or '72' or '73' in attrs.get('finishings-supported'):
punch.text = 'Punch=1'
if '74' or '75' or '76' or '77' in attrs.get('finishings-supported'):
punch.text = 'Punch=2'
if '78' or '79' or '80' or '81' in attrs.get('finishings-supported'):
punch.text = 'Punch=3'
if '82' or '83' or '84' or '85' in attrs.get('finishings-supported'):
punch.text = 'Punch=4'
service.append(punch)
##
bind = Element('txt-record')
if '7' in attrs.get('finishings-supported'):
bind.text = 'Bind=T'
else:
bind.text = 'Bind=F'
service.append(bind)
collate = Element('txt-record')
if 'separate-documents-collated-copies' in attrs.get('multiple-document-handling-supported'):
collate.text = 'Collate=T'
else:
collate.text = 'Collate=F'
service.append(collate)
duplex = Element('txt-record')
if 'sides' in attrs.get('job-creation-attributes-supported'):
duplex.text = 'Duplex=T'
else:
duplex.text = 'Duplex=F'
service.append(duplex)
color = Element('txt-record')
if attrs['color-supported']:
color.text = 'Color=T'
else:
color.text = 'Color=F'
service.append(color)
sorry the late response. I have moved to a printer that supports air print natively so haven't been using this container much recently.
should be fine now, thanks for the extremely fast feedback @burnbabyburn !
@vajonam
Hi, i am coming from this commit In the past i had removed the gpc stuff on a local checkout myself. And your very nice container worked fine for months ATM i am migrating my docker host and tried to go with upstream again But it seems pull #45 killed it for me
output:
printer creation:
the attrs array parsed in python script (this is from manual adding via cups interface and trying hplip address for more information so ignore device uri) arry parsed in pythonscript.txt
Adding the
color-supported
toCUPS_LPADMIN_PRINTER1
was not sufficient(Only) after removing the
color-supported
option fromairprint-generate.py
creating an avahi service was successful Commenting out wasn't ideal, so i did some research. Seems to me like the value checked for color isn't ideal and/or needs a fallback:Sadly my python skills s**** and my printer is not supporting that much, so i leave the additional information here and maybe get back to it
the quick fix for me is to just comment out the commit mentioned above
Greetings