installable on py3
This commit is contained in:
parent
ed79fd62b0
commit
d5726fbc32
10 changed files with 36 additions and 36 deletions
|
@ -1,2 +1,2 @@
|
|||
import server
|
||||
import cli
|
||||
from . import server
|
||||
from . import cli
|
||||
|
|
|
@ -9,10 +9,10 @@ logger = logging.getLogger('cli')
|
|||
|
||||
CWD = os.getcwd()
|
||||
|
||||
import forge
|
||||
import maint
|
||||
from config_manager import get_config
|
||||
import server
|
||||
from techrec import forge
|
||||
from techrec import maint
|
||||
from .config_manager import get_config
|
||||
from techrec import server
|
||||
|
||||
|
||||
def pre_check_permissions():
|
||||
|
@ -84,6 +84,7 @@ def common_pre():
|
|||
def main():
|
||||
parser = ArgumentParser(description='creates mp3 from live recordings')
|
||||
parser.add_argument('--verbose', '-v', action='count',
|
||||
default=0,
|
||||
help='Increase verbosity; can be used multiple times')
|
||||
parser.add_argument('--pretend', '-p', action='store_true', default=False,
|
||||
help='Only pretend; no real action will be done')
|
||||
|
|
|
@ -33,7 +33,5 @@ try:
|
|||
if resource_isdir('techrec', 'pages'):
|
||||
STATIC_PAGES = resource_filename('techrec', 'pages')
|
||||
STATIC_FILES = resource_filename('techrec', 'static')
|
||||
else:
|
||||
print "invece dice", resource_filename('techrec', 'static')
|
||||
except ImportError:
|
||||
logging.exception("Error loading resources from installed part")
|
||||
|
|
|
@ -4,7 +4,7 @@ import os
|
|||
from subprocess import Popen
|
||||
import logging
|
||||
|
||||
from config_manager import get_config
|
||||
from .config_manager import get_config
|
||||
|
||||
|
||||
def get_timefile_exact(time):
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from __future__ import print_function
|
||||
import sys
|
||||
import logging
|
||||
|
||||
from sqlalchemy import inspect
|
||||
|
||||
from config_manager import get_config
|
||||
from techrec import RecDB
|
||||
from .config_manager import get_config
|
||||
from .techrec import RecDB
|
||||
|
||||
def cleanold_cmd(options):
|
||||
log = logging.getLogger('cleanold')
|
||||
|
@ -14,7 +15,7 @@ def cleanold_cmd(options):
|
|||
count = len(res)
|
||||
if options.pretend:
|
||||
for rec in res:
|
||||
print rec
|
||||
print(rec)
|
||||
else:
|
||||
for rec in res:
|
||||
logging.info("Deleting " + str(rec))
|
||||
|
|
|
@ -40,11 +40,11 @@ class JobQueue(object):
|
|||
|
||||
def simulate_long_job(recid=None, starttime=None, endtime=None, name='', filename=None):
|
||||
from time import sleep
|
||||
print "evviva " + name
|
||||
print("evviva " + name)
|
||||
sleep(2)
|
||||
print "lavoro su " + name
|
||||
print("lavoro su " + name)
|
||||
sleep(2)
|
||||
print "done su " + name
|
||||
print("done su " + name)
|
||||
_queue = None
|
||||
|
||||
|
||||
|
@ -60,15 +60,15 @@ if __name__ == '__main__':
|
|||
|
||||
def sleep(n):
|
||||
import time
|
||||
print "Inizio %d" % n
|
||||
print("Inizio %d" % n)
|
||||
time.sleep(n)
|
||||
print "Finisco %d" % n
|
||||
print("Finisco %d" % n)
|
||||
return n
|
||||
|
||||
get_process_queue().submit(sleep, 3)
|
||||
get_process_queue().submit(sleep, 3)
|
||||
get_process_queue().join()
|
||||
print get_process_queue().jobs
|
||||
print(get_process_queue().jobs)
|
||||
delta = (datetime.now() - n).total_seconds()
|
||||
print delta
|
||||
print(delta)
|
||||
assert 5 < delta < 7
|
||||
|
|
|
@ -14,10 +14,10 @@ botlog.setLevel(logging.INFO)
|
|||
botlog.addHandler(logging.StreamHandler(sys.stdout))
|
||||
bottle._stderr = lambda x: botlog.info(x.strip())
|
||||
|
||||
from techrec import Rec, RecDB
|
||||
from processqueue import get_process_queue
|
||||
from forge import create_mp3
|
||||
from config_manager import get_config
|
||||
from .techrec import Rec, RecDB
|
||||
from .processqueue import get_process_queue
|
||||
from .forge import create_mp3
|
||||
from .config_manager import get_config
|
||||
|
||||
|
||||
def date_read(s):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'''
|
||||
This module contains DB logic
|
||||
'''
|
||||
from __future__ import print_function
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
@ -11,7 +12,7 @@ from sqlalchemy import create_engine, Column, Integer, String, DateTime, inspect
|
|||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from config_manager import get_config
|
||||
from .config_manager import get_config
|
||||
|
||||
PAGESIZE = 10
|
||||
|
||||
|
@ -218,7 +219,7 @@ class RecDB:
|
|||
return ret
|
||||
|
||||
def get_err(self):
|
||||
print "DB error: %s" % (self.err)
|
||||
print("DB error: %s" % (self.err))
|
||||
t = self.err
|
||||
self.err = ""
|
||||
return t
|
||||
|
@ -227,25 +228,25 @@ class RecDB:
|
|||
if __name__ == "__main__":
|
||||
def printall(queryres):
|
||||
for record in queryres:
|
||||
print "Record: %s" % record
|
||||
print("Record: %s" % record)
|
||||
|
||||
db = RecDB()
|
||||
_mytime = datetime(2014, 05, 23, 15, 12, 17)
|
||||
_endtime = datetime(2014, 05, 24, 17, 45, 17)
|
||||
_mytime = datetime(2014, 5, 23, 15, 12, 17)
|
||||
_endtime = datetime(2014, 5, 24, 17, 45, 17)
|
||||
|
||||
a = Rec(name="Mimmo1", starttime=_mytime, endtime=_endtime)
|
||||
printall(db._search())
|
||||
sys.exit("End test job")
|
||||
|
||||
# a = Rec(name="Mimmo1", starttime=_mytime, endtime=None)
|
||||
print "Aggiunto", db.add(a)
|
||||
print("Aggiunto", db.add(a))
|
||||
printall(db.get_all(page_size=5, page=0))
|
||||
|
||||
print "Mimmo "
|
||||
print("Mimmo ")
|
||||
printall(db._search(name="Mimmo1"))
|
||||
print "Search"
|
||||
print("Search")
|
||||
printall(db._search(name="Mimmo1",
|
||||
starttime=datetime(2014, 05, 24, 15, 16, 1) ))
|
||||
starttime=datetime(2014, 5, 24, 15, 16, 1) ))
|
||||
a = db.get_by_id(5)
|
||||
a.start()
|
||||
db.delete(1)
|
||||
|
|
|
@ -4,7 +4,7 @@ from nose.tools import raises, eq_
|
|||
|
||||
from forge import get_files_and_intervals, get_timefile_exact, round_timefile,\
|
||||
get_timefile, mp3_join
|
||||
from config_manager import get_config
|
||||
from .config_manager import get_config
|
||||
|
||||
eight = datetime(2014, 5, 30, 20)
|
||||
nine = datetime(2014, 5, 30, 21)
|
||||
|
|
5
setup.py
5
setup.py
|
@ -14,10 +14,9 @@ setup(
|
|||
packages=["techrec"],
|
||||
package_dir={"techrec": "server"},
|
||||
install_requires=[
|
||||
"Paste==1.7.5.1",
|
||||
"Paste~=3.2",
|
||||
"SQLAlchemy==0.8.3",
|
||||
"bottle==0.11.6",
|
||||
"wsgiref==0.1.2",
|
||||
"bottle~=0.12",
|
||||
],
|
||||
classifiers=["Programming Language :: Python :: 2.7"],
|
||||
entry_points={"console_scripts": ["techrec = techrec.cli:main"]},
|
||||
|
|
Loading…
Reference in a new issue