2013-12-03 21:07:17 +01:00
|
|
|
import os
|
2014-03-07 14:47:09 +01:00
|
|
|
import sys
|
2013-11-29 23:55:19 +01:00
|
|
|
from datetime import datetime
|
2013-11-26 12:04:43 +01:00
|
|
|
import logging
|
2013-11-29 23:55:19 +01:00
|
|
|
from functools import partial
|
2019-11-15 19:47:09 +01:00
|
|
|
import unicodedata
|
2013-09-15 16:14:27 +02:00
|
|
|
|
2013-12-03 02:46:00 +01:00
|
|
|
from bottle import Bottle, request, static_file, redirect, abort, response
|
2014-04-22 16:32:55 +02:00
|
|
|
import bottle
|
2014-03-27 13:26:54 +01:00
|
|
|
|
2019-11-15 19:47:09 +01:00
|
|
|
logger = logging.getLogger('server')
|
2014-03-07 14:47:09 +01:00
|
|
|
botlog = logging.getLogger('bottle')
|
|
|
|
botlog.setLevel(logging.INFO)
|
|
|
|
botlog.addHandler(logging.StreamHandler(sys.stdout))
|
|
|
|
bottle._stderr = lambda x: botlog.info(x.strip())
|
2013-11-26 12:04:43 +01:00
|
|
|
|
|
|
|
from techrec import Rec, RecDB
|
2013-12-03 02:24:08 +01:00
|
|
|
from processqueue import get_process_queue
|
|
|
|
from forge import create_mp3
|
2013-12-02 20:58:43 +01:00
|
|
|
from config_manager import get_config
|
|
|
|
|
2013-09-15 16:14:27 +02:00
|
|
|
|
2013-12-03 21:07:17 +01:00
|
|
|
def date_read(s):
|
|
|
|
return datetime.fromtimestamp(int(s))
|
|
|
|
|
|
|
|
|
|
|
|
def date_write(dt):
|
|
|
|
return dt.strftime('%s')
|
|
|
|
|
|
|
|
|
|
|
|
def rec_sanitize(rec):
|
|
|
|
d = rec.serialize()
|
|
|
|
d['starttime'] = date_write(d['starttime'])
|
|
|
|
d['endtime'] = date_write(d['endtime'])
|
|
|
|
return d
|
|
|
|
|
|
|
|
|
2013-12-03 02:46:00 +01:00
|
|
|
class DateApp(Bottle):
|
|
|
|
'''
|
|
|
|
This application will expose some date-related functions; it is intended to
|
|
|
|
be used when you need to know the server's time on the browser
|
|
|
|
'''
|
|
|
|
def __init__(self):
|
|
|
|
Bottle.__init__(self)
|
|
|
|
self.route('/help', callback=self.help)
|
|
|
|
self.route('/date', callback=self.date)
|
|
|
|
self.route('/custom', callback=self.custom)
|
|
|
|
|
|
|
|
def date(self):
|
|
|
|
n = datetime.now()
|
|
|
|
return {
|
|
|
|
'unix': n.strftime('%s'),
|
|
|
|
'isoformat': n.isoformat(),
|
|
|
|
'ctime': n.ctime()
|
|
|
|
}
|
|
|
|
|
|
|
|
def custom(self):
|
|
|
|
n = datetime.now()
|
|
|
|
if 'strftime' not in request.query:
|
|
|
|
abort(400, 'Need argument "strftime"')
|
|
|
|
response.content_type = 'text/plain'
|
|
|
|
return n.strftime(request.query['strftime'])
|
|
|
|
|
|
|
|
def help(self):
|
|
|
|
response.content_type = 'text/plain'
|
|
|
|
return \
|
|
|
|
'/date : get JSON dict containing multiple formats of now()\n' + \
|
|
|
|
'/custom?strftime=FORMAT : get now().strftime(FORMAT)'
|
|
|
|
|
|
|
|
|
2013-12-10 03:04:52 +01:00
|
|
|
class RecAPI(Bottle):
|
2014-03-27 16:31:22 +01:00
|
|
|
def __init__(self, app):
|
2013-12-10 03:04:52 +01:00
|
|
|
Bottle.__init__(self)
|
2013-09-15 16:14:27 +02:00
|
|
|
self._route()
|
2014-03-27 16:31:22 +01:00
|
|
|
self._app = app
|
2013-12-04 16:26:08 +01:00
|
|
|
self.db = RecDB(get_config()['DB_URI'])
|
2013-09-15 16:14:27 +02:00
|
|
|
|
|
|
|
def _route(self):
|
2013-12-10 03:04:52 +01:00
|
|
|
self.post('/create', callback=self.create)
|
|
|
|
self.post('/delete', callback=self.delete)
|
|
|
|
self.post('/update/<recid:int>', callback=self.update)
|
|
|
|
self.post('/generate', callback=self.generate)
|
|
|
|
self.get('/help', callback=self.help)
|
|
|
|
self.get('/', callback=self.help)
|
|
|
|
self.get('/get/search', callback=self.search)
|
|
|
|
self.get('/get/ongoing', callback=self.get_ongoing)
|
2014-04-15 01:35:14 +02:00
|
|
|
self.get('/get/archive', callback=self.get_archive)
|
2013-12-10 03:04:52 +01:00
|
|
|
self.get('/jobs', callback=self.running_jobs)
|
|
|
|
self.get('/jobs/<job_id:int>', callback=self.check_job)
|
2013-11-29 23:55:19 +01:00
|
|
|
|
2013-09-15 16:14:27 +02:00
|
|
|
def create(self):
|
2013-11-29 23:55:19 +01:00
|
|
|
req = dict(request.POST.allitems())
|
2013-09-15 16:14:27 +02:00
|
|
|
ret = {}
|
2014-03-01 20:43:45 +01:00
|
|
|
logger.debug("Create request %s " % req)
|
2013-11-24 23:43:56 +01:00
|
|
|
|
2014-03-01 20:43:45 +01:00
|
|
|
now = datetime.now()
|
|
|
|
start = date_read(req['starttime']) if 'starttime' in req else now
|
2019-11-15 19:48:39 +01:00
|
|
|
name = req['name'].decode('utf8') if 'name' in req else u""
|
2014-03-01 20:43:45 +01:00
|
|
|
end = date_read(req['endtime']) if 'endtime' in req else now
|
2013-11-24 23:43:56 +01:00
|
|
|
|
2013-12-02 20:58:43 +01:00
|
|
|
rec = Rec(name=name,
|
2014-03-01 20:43:45 +01:00
|
|
|
starttime=start,
|
|
|
|
endtime=end)
|
2013-12-02 20:58:43 +01:00
|
|
|
ret = self.db.add(rec)
|
2013-11-19 23:16:03 +01:00
|
|
|
|
2013-12-02 20:58:43 +01:00
|
|
|
return self.rec_msg("Nuova registrazione creata! (id:%d)" % ret.id,
|
2013-12-03 21:07:17 +01:00
|
|
|
rec=rec_sanitize(rec))
|
2013-11-26 12:04:43 +01:00
|
|
|
|
2013-12-10 01:52:21 +01:00
|
|
|
def delete(self):
|
2013-11-29 23:55:19 +01:00
|
|
|
req = dict(request.POST.allitems())
|
|
|
|
logging.info("Server: request delete %s " % (req))
|
2013-12-10 01:52:21 +01:00
|
|
|
if 'id' not in req:
|
2013-11-24 23:43:56 +01:00
|
|
|
return self.rec_err("No valid ID")
|
2013-11-26 12:04:43 +01:00
|
|
|
|
2013-12-10 01:52:21 +01:00
|
|
|
if self.db.delete(req["id"]):
|
2013-11-24 23:43:56 +01:00
|
|
|
return self.rec_msg("DELETE OK")
|
|
|
|
else:
|
|
|
|
return self.rec_err("DELETE error: %s" % (self.db.get_err()))
|
|
|
|
|
2013-12-10 01:52:21 +01:00
|
|
|
def update(self, recid):
|
2013-11-29 23:55:19 +01:00
|
|
|
req = dict(request.POST.allitems())
|
2013-11-26 12:04:43 +01:00
|
|
|
|
2013-12-02 20:58:43 +01:00
|
|
|
newrec = {}
|
2013-12-03 21:07:17 +01:00
|
|
|
now = datetime.now()
|
2013-12-02 20:58:43 +01:00
|
|
|
if 'starttime' not in req:
|
2013-12-03 21:07:17 +01:00
|
|
|
newrec['starttime'] = now
|
2013-12-02 20:58:43 +01:00
|
|
|
else:
|
2013-12-03 21:07:17 +01:00
|
|
|
newrec['starttime'] = date_read(req['starttime'])
|
2013-12-02 20:58:43 +01:00
|
|
|
if "endtime" not in req:
|
2013-12-03 21:07:17 +01:00
|
|
|
newrec['endtime'] = now
|
2013-12-02 20:58:43 +01:00
|
|
|
else:
|
2013-12-03 21:07:17 +01:00
|
|
|
newrec['endtime'] = date_read(req['endtime'])
|
2013-12-05 01:06:44 +01:00
|
|
|
if 'name' in req:
|
2019-11-15 19:47:09 +01:00
|
|
|
newrec["name"] = req['name'].decode('utf8')
|
2013-11-29 23:55:19 +01:00
|
|
|
|
2013-12-03 21:07:17 +01:00
|
|
|
try:
|
|
|
|
logger.info("prima di update")
|
2013-12-10 01:52:21 +01:00
|
|
|
result_rec = self.db.update(recid, newrec)
|
2013-12-03 21:07:17 +01:00
|
|
|
logger.info("dopo update")
|
|
|
|
except Exception as exc:
|
|
|
|
return self.rec_err("Errore Aggiornamento", exception=exc)
|
|
|
|
return self.rec_msg("Aggiornamento completato!",
|
|
|
|
rec=rec_sanitize(result_rec))
|
|
|
|
|
|
|
|
def generate(self):
|
|
|
|
# prendiamo la rec in causa
|
2013-12-10 01:52:21 +01:00
|
|
|
recid = dict(request.POST.allitems())['id']
|
|
|
|
rec = self.db._search(_id=recid)[0]
|
2013-12-27 02:17:12 +01:00
|
|
|
if rec.filename is not None and os.path.exists(rec.filename):
|
2013-12-03 21:07:17 +01:00
|
|
|
return {'status': 'ready',
|
|
|
|
'message': 'The file has already been generated at %s' %
|
|
|
|
rec.filename,
|
|
|
|
'rec': rec
|
|
|
|
}
|
2013-12-23 22:34:24 +01:00
|
|
|
if get_config()['FORGE_MAX_DURATION'] > 0 and \
|
|
|
|
(rec.endtime - rec.starttime).total_seconds() > \
|
|
|
|
get_config()['FORGE_MAX_DURATION']:
|
2013-12-27 02:17:12 +01:00
|
|
|
response.status = 400
|
2013-12-23 22:34:24 +01:00
|
|
|
return {'status': 'error',
|
2014-02-18 19:09:10 +01:00
|
|
|
'message': 'The requested recording is too long' +
|
|
|
|
' (%d seconds)' %
|
|
|
|
(rec.endtime - rec.starttime).total_seconds()
|
2013-12-23 22:34:24 +01:00
|
|
|
}
|
2014-02-21 18:42:25 +01:00
|
|
|
rec.filename = get_config()['AUDIO_OUTPUT_FORMAT'] % {
|
2014-03-01 20:43:45 +01:00
|
|
|
'time': rec.starttime.strftime('%y%m%d_%H%M'),
|
2019-11-15 19:47:09 +01:00
|
|
|
'name': filter(lambda c: c.isalpha(),
|
|
|
|
unicodedata.normalize('NFKD', rec.name).encode('ascii', 'ignore'))
|
2014-03-01 20:43:45 +01:00
|
|
|
}
|
2014-04-14 22:37:47 +02:00
|
|
|
self.db.get_session(rec).commit()
|
2014-03-27 16:31:22 +01:00
|
|
|
job_id = self._app.pq.submit(
|
2013-12-03 02:24:08 +01:00
|
|
|
create_mp3,
|
2013-12-03 21:07:17 +01:00
|
|
|
start=rec.starttime,
|
|
|
|
end=rec.endtime,
|
2014-05-03 03:27:06 +02:00
|
|
|
outfile=os.path.join(get_config()['AUDIO_OUTPUT'], rec.filename),
|
|
|
|
options={
|
|
|
|
'title': rec.name,
|
|
|
|
'license_uri': get_config()['TAG_LICENSE_URI'],
|
|
|
|
'extra_tags': get_config()['TAG_EXTRA']
|
|
|
|
}
|
|
|
|
)
|
2014-02-27 17:04:12 +01:00
|
|
|
logger.debug("SUBMITTED: %d" % job_id)
|
2013-12-03 21:07:17 +01:00
|
|
|
return self.rec_msg("Aggiornamento completato!",
|
|
|
|
job_id=job_id,
|
|
|
|
result='/output/' + rec.filename,
|
|
|
|
rec=rec_sanitize(rec))
|
2013-11-29 23:55:19 +01:00
|
|
|
|
|
|
|
def check_job(self, job_id):
|
|
|
|
try:
|
2014-03-27 16:31:22 +01:00
|
|
|
job = self._app.pq.check_job(job_id)
|
2013-11-29 23:55:19 +01:00
|
|
|
except ValueError:
|
|
|
|
abort(400, 'job_id not valid')
|
|
|
|
|
|
|
|
def ret(status):
|
|
|
|
return {'job_status': status, 'job_id': job_id}
|
|
|
|
if job is True:
|
|
|
|
return ret('DONE')
|
|
|
|
if job is False:
|
|
|
|
abort(404, 'No such job has ever been spawned')
|
2013-11-24 23:43:56 +01:00
|
|
|
else:
|
2013-11-29 23:55:19 +01:00
|
|
|
if job.ready():
|
|
|
|
try:
|
|
|
|
res = job.get()
|
|
|
|
return res
|
|
|
|
except Exception as exc:
|
2013-12-03 02:24:08 +01:00
|
|
|
r = ret('FAILED')
|
|
|
|
r['exception'] = str(exc)
|
2014-04-08 18:06:58 +02:00
|
|
|
import traceback
|
|
|
|
tb = traceback.format_exc()
|
|
|
|
logger.warning(tb)
|
|
|
|
if get_config()['DEBUG']:
|
|
|
|
r['exception'] = "%s: %s" % (str(exc), tb)
|
|
|
|
r['traceback'] = tb
|
|
|
|
|
2013-12-03 02:24:08 +01:00
|
|
|
return r
|
2013-11-29 23:55:19 +01:00
|
|
|
return ret('WIP')
|
|
|
|
|
|
|
|
def running_jobs(self):
|
|
|
|
res = {}
|
2014-03-27 16:31:22 +01:00
|
|
|
res['last_job_id'] = self._app.pq.last_job_id
|
|
|
|
res['running'] = self._app.pq.jobs.keys()
|
2013-11-29 23:55:19 +01:00
|
|
|
return res
|
|
|
|
|
|
|
|
def search(self, args=None):
|
2013-12-02 20:58:43 +01:00
|
|
|
req = dict()
|
|
|
|
req.update(request.GET.allitems())
|
2014-02-27 17:04:12 +01:00
|
|
|
logger.debug("Search request: %s" % (req))
|
2013-11-26 12:04:43 +01:00
|
|
|
|
2013-12-02 20:58:43 +01:00
|
|
|
values = self.db._search(**req)
|
|
|
|
from pprint import pprint
|
2013-12-03 21:07:17 +01:00
|
|
|
logger.debug("Returned Values %s" %
|
|
|
|
pprint([r.serialize() for r in values]))
|
2013-11-26 12:04:43 +01:00
|
|
|
|
2013-11-19 23:16:03 +01:00
|
|
|
ret = {}
|
|
|
|
for rec in values:
|
2013-12-10 01:52:21 +01:00
|
|
|
ret[rec.id] = rec_sanitize(rec)
|
2013-11-24 23:43:56 +01:00
|
|
|
|
2013-12-02 20:58:43 +01:00
|
|
|
logging.info("Return: %s" % ret)
|
2013-11-19 23:16:03 +01:00
|
|
|
return ret
|
2013-11-26 12:04:43 +01:00
|
|
|
|
2013-12-09 17:46:01 +01:00
|
|
|
def get_ongoing(self):
|
2013-12-10 02:35:53 +01:00
|
|
|
return {rec.id: rec_sanitize(rec)
|
|
|
|
for rec in self.db.get_ongoing()}
|
2013-12-09 17:46:01 +01:00
|
|
|
|
2014-04-15 01:35:14 +02:00
|
|
|
def get_archive(self):
|
|
|
|
return {rec.id: rec_sanitize(rec)
|
|
|
|
for rec in self.db.get_archive_recent()}
|
|
|
|
|
2013-09-15 16:14:27 +02:00
|
|
|
# @route('/help')
|
|
|
|
def help(self):
|
2013-11-26 15:50:59 +01:00
|
|
|
return "<h1>help</h1><hr/>\
|
2013-12-10 01:52:21 +01:00
|
|
|
<h2>/get, /get/, /get/<id> </h2>\
|
|
|
|
<h3>Get Info about rec identified by ID </h3>\
|
2013-09-15 16:14:27 +02:00
|
|
|
\
|
|
|
|
<h2>/search, /search/, /search/<key>/<value></h2>\
|
|
|
|
<h3>Search rec that match key/value (or get all)</h3>\
|
|
|
|
\
|
2013-12-10 01:52:21 +01:00
|
|
|
<h2>/delete/<id> </h2>\
|
|
|
|
<h3>Delete rec identified by ID </h3>\
|
2013-09-15 16:14:27 +02:00
|
|
|
<h2>/update </h2>\
|
|
|
|
<h3>Not implemented.</h3>"
|
|
|
|
|
2013-11-29 23:55:19 +01:00
|
|
|
# JSON UTILS
|
2013-12-10 03:04:52 +01:00
|
|
|
|
2013-12-03 21:07:17 +01:00
|
|
|
def rec_msg(self, msg, status=True, **kwargs):
|
|
|
|
d = {"message": msg, "status": status}
|
2013-11-29 23:55:19 +01:00
|
|
|
d.update(kwargs)
|
|
|
|
return d
|
|
|
|
|
2013-12-03 21:07:17 +01:00
|
|
|
def rec_err(self, msg, **kwargs):
|
|
|
|
return self.rec_msg(msg, status=False, **kwargs)
|
2013-11-29 23:55:19 +01:00
|
|
|
|
|
|
|
|
2013-12-10 03:04:52 +01:00
|
|
|
class RecServer:
|
|
|
|
def __init__(self):
|
|
|
|
self._app = Bottle()
|
2014-03-27 16:31:22 +01:00
|
|
|
self._app.pq = get_process_queue()
|
2013-12-10 03:04:52 +01:00
|
|
|
self._route()
|
|
|
|
|
|
|
|
self.db = RecDB(get_config()['DB_URI'])
|
|
|
|
|
|
|
|
def _route(self):
|
2014-05-03 03:27:06 +02:00
|
|
|
# Static part of the site
|
2013-12-10 03:04:52 +01:00
|
|
|
self._app.route('/output/<filepath:path>',
|
|
|
|
callback=lambda filepath:
|
|
|
|
static_file(filepath,
|
2014-02-24 15:20:45 +01:00
|
|
|
root=get_config()['AUDIO_OUTPUT'],
|
|
|
|
download=True))
|
2019-11-15 19:20:56 +01:00
|
|
|
|
2013-12-10 03:04:52 +01:00
|
|
|
self._app.route('/static/<filepath:path>',
|
|
|
|
callback=lambda filepath: static_file(filepath,
|
2019-11-15 19:20:56 +01:00
|
|
|
root=get_config()['STATIC_FILES']))
|
2013-12-10 03:04:52 +01:00
|
|
|
self._app.route('/', callback=lambda: redirect('/new.html'))
|
|
|
|
self._app.route('/new.html',
|
|
|
|
callback=partial(static_file, 'new.html',
|
2019-11-15 19:20:56 +01:00
|
|
|
root=get_config()['STATIC_PAGES']))
|
2014-03-01 20:43:45 +01:00
|
|
|
self._app.route('/old.html',
|
|
|
|
callback=partial(static_file, 'old.html',
|
2019-11-15 19:20:56 +01:00
|
|
|
root=get_config()['STATIC_PAGES']))
|
2014-04-15 01:35:14 +02:00
|
|
|
self._app.route('/archive.html',
|
|
|
|
callback=partial(static_file, 'archive.html',
|
2019-11-15 19:20:56 +01:00
|
|
|
root=get_config()['STATIC_PAGES']))
|
2013-12-10 03:04:52 +01:00
|
|
|
|
2013-12-23 19:58:44 +01:00
|
|
|
|
2014-03-26 13:31:57 +01:00
|
|
|
class DebugAPI(Bottle):
|
|
|
|
'''
|
|
|
|
This application is useful for testing the webserver itself
|
|
|
|
'''
|
|
|
|
def __init__(self):
|
|
|
|
Bottle.__init__(self)
|
|
|
|
self.route('/sleep/:milliseconds', callback=self.sleep)
|
|
|
|
self.route('/cpusleep/:howmuch', callback=self.cpusleep)
|
|
|
|
self.route('/big/:exponent', callback=self.big)
|
|
|
|
|
|
|
|
def sleep(self, milliseconds):
|
|
|
|
import time
|
|
|
|
time.sleep(int(milliseconds)/1000.0)
|
|
|
|
return 'ok'
|
|
|
|
|
|
|
|
def cpusleep(self, howmuch):
|
|
|
|
out = ''
|
|
|
|
for i in xrange(int(howmuch) * (10**3)):
|
|
|
|
if i % 11234 == 0:
|
|
|
|
out += 'a'
|
|
|
|
return out
|
|
|
|
|
|
|
|
def big(self, exponent):
|
|
|
|
'''
|
|
|
|
returns a 2**n -1 string
|
|
|
|
'''
|
|
|
|
for i in xrange(int(exponent)):
|
|
|
|
yield str(i) * (2 ** i)
|
|
|
|
|
|
|
|
def help(self):
|
|
|
|
response.content_type = 'text/plain'
|
|
|
|
return '''
|
|
|
|
/sleep/<int:milliseconds> : sleep, than say "ok"
|
|
|
|
/cpusleep/<int:howmuch> : busysleep, than say "ok"
|
|
|
|
/big/<int:exponent> : returns a 2**n -1 byte content
|
|
|
|
'''
|
|
|
|
|
2014-05-03 03:27:06 +02:00
|
|
|
|
2014-04-22 16:32:55 +02:00
|
|
|
class PasteLoggingServer(bottle.PasteServer):
|
2014-05-03 03:27:06 +02:00
|
|
|
def run(self, handler): # pragma: no cover
|
2014-04-22 16:32:55 +02:00
|
|
|
from paste import httpserver
|
|
|
|
from paste.translogger import TransLogger
|
|
|
|
handler = TransLogger(handler, **self.options['translogger_opts'])
|
|
|
|
del self.options['translogger_opts']
|
|
|
|
httpserver.serve(handler, host=self.host, port=str(self.port),
|
|
|
|
**self.options)
|
|
|
|
bottle.server_names['pastelog'] = PasteLoggingServer
|
|
|
|
|
2014-03-26 13:31:57 +01:00
|
|
|
|
2013-12-23 19:58:44 +01:00
|
|
|
def main_cmd(*args):
|
2013-12-23 20:08:15 +01:00
|
|
|
"""meant to be called from argparse"""
|
2013-11-26 15:50:59 +01:00
|
|
|
c = RecServer()
|
2013-12-03 02:46:00 +01:00
|
|
|
c._app.mount('/date', DateApp())
|
2014-03-27 16:31:22 +01:00
|
|
|
c._app.mount('/api', RecAPI(c._app))
|
2014-03-26 13:31:57 +01:00
|
|
|
if get_config()['DEBUG']:
|
|
|
|
c._app.mount('/debug', DebugAPI())
|
|
|
|
|
2014-04-22 16:32:55 +02:00
|
|
|
server = get_config()['WSGI_SERVER']
|
|
|
|
if server == 'pastelog':
|
|
|
|
from paste.translogger import TransLogger
|
|
|
|
get_config()['WSGI_SERVER_OPTIONS']['translogger_opts'] = \
|
2014-05-03 03:27:06 +02:00
|
|
|
get_config()['TRANSLOGGER_OPTS']
|
2014-04-22 16:32:55 +02:00
|
|
|
|
|
|
|
c._app.run(server=server,
|
2014-03-26 13:31:57 +01:00
|
|
|
host=get_config()['HOST'],
|
|
|
|
port=get_config()['PORT'],
|
|
|
|
debug=get_config()['DEBUG'],
|
2014-04-22 16:32:55 +02:00
|
|
|
quiet=True, # this is to hide access.log style messages
|
2014-03-26 13:31:57 +01:00
|
|
|
**get_config()['WSGI_SERVER_OPTIONS']
|
|
|
|
)
|
2013-12-23 20:08:15 +01:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from cli import common_pre
|
|
|
|
common_pre()
|
|
|
|
logger.warn("Usage of server.py is deprecated; use cli.py")
|
|
|
|
main_cmd()
|
2014-04-08 18:06:58 +02:00
|
|
|
|
|
|
|
# vim: set ts=4 sw=4 et ai ft=python:
|