Commit b61b3779 authored by Maxime Bombar's avatar Maxime Bombar

Update re2o-printer service

parent aaf077e1
......@@ -4,14 +4,15 @@
from configparser import ConfigParser
import socket
import sys
from re2oapi import Re2oAPIClient
import subprocess
DEBUG = True
LOCATION = '/re2o/media/printings'
KEYWORD = 'printings'
LOCATION = '/re2o/media/'
config = ConfigParser()
config.read('config.ini')
......@@ -28,7 +29,7 @@ client_hostname = socket.gethostname().split('.', 1)[0]
def get_path(filefield):
"""
"""
return(LOCATION + filefield.split(KEYWORD)[-1])
return(LOCATION + filefield)
def HP_name(name):
"""
......@@ -131,7 +132,12 @@ def extract(job):
return(filepath, filename, number, options)
for job in api_client.list("printer/jobs"):
filepath, filename, number, options = extract(job)
send(filepath, filename, number, options)
api_client.patch(job['api_url'], data={'status': 'Running'})
if '--history' in sys.argv:
for job in api_client.list("printer/history-jobs"):
filepath, filename, number, options = extract(job)
send(filepath, filename, number, options)
else:
for job in api_client.list("printer/printable-jobs"):
filepath, filename, number, options = extract(job)
send(filepath, filename, number, options)
api_client.patch(job['api_url'], data={'status': 'Running'})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment