diff --git a/README.rst b/README.rst index 5c29af8..b796829 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ Google's linux connector, it does not require chrome to be installed on the serv Requires --------------------------------------------------- - python 2.6 or 2.7 -- pycups (can be tricky on OS X) wich depends on libcups2-dev +- pycups (can be tricky on OS X) which depends on libcups2-dev Usage --------------------------------------------------- diff --git a/cloudprint.service b/cloudprint.service new file mode 100644 index 0000000..0b5d03c --- /dev/null +++ b/cloudprint.service @@ -0,0 +1,17 @@ +[Unit] +Description=Google Cloud Print Daemon +Requires=cups.service +After=cups.service +Documentation=https://github.com/4gra/cloudprint + +[Service] +User=printer +ExecStart=/usr/local/bin/cloudprint +Restart=always +RestartSec=300 +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=cloudprint + +[Install] +WantedBy=multi-user.target diff --git a/cloudprint/cloudprint.py b/cloudprint/cloudprint.py index dc454e2..751fc87 100755 --- a/cloudprint/cloudprint.py +++ b/cloudprint/cloudprint.py @@ -408,8 +408,12 @@ def process_job(cups_connection, cpp, printer, job): if 'request' in options: del options['request'] - options = dict((str(k), str(v)) for k, v in list(options.items())) - options['job-originating-user-name'] = job['ownerId'] + options = dict( + (str(k), str(v)) for k, v in list(options.items()) if v != 'None' + ) + options['job-originating-user-name'] = job['ownerId'].encode( + 'unicode_escape' + ) # Cap the title length to 255, or cups will complain about invalid # job-name @@ -425,7 +429,8 @@ def process_job(cups_connection, cpp, printer, job): cpp.finish_job(job['id']) num_retries = 0 - except Exception: + except Exception, e: + LOGGER.debug(unicode_escape('ERROR detail: %s' % e)) if num_retries >= RETRIES: num_retries = 0 cpp.fail_job(job['id'])