Merge remote-tracking branch 'origin/master'

leftovers of published stuff
This commit is contained in:
boyska 2019-11-15 19:55:58 +01:00
commit b0a4ebd8d2
5 changed files with 11 additions and 6 deletions

View file

@ -15,7 +15,7 @@ DB_URI = 'sqlite:///techrec.db'
AUDIO_OUTPUT = 'output/' AUDIO_OUTPUT = 'output/'
AUDIO_INPUT = 'rec/' AUDIO_INPUT = 'rec/'
AUDIO_INPUT_FORMAT = '%Y-%m/%d/rec-%Y-%m-%d-%H-%M-%S.mp3' AUDIO_INPUT_FORMAT = '%Y-%m/%d/rec-%Y-%m-%d-%H-%M-%S.mp3'
AUDIO_OUTPUT_FORMAT = 'techrec-%(time)s-%(name)s.mp3' AUDIO_OUTPUT_FORMAT = 'techrec-%(startdt)s-%(endtime)s-%(name)s.mp3'
FORGE_TIMEOUT = 20 FORGE_TIMEOUT = 20
FORGE_MAX_DURATION = 3600*5 FORGE_MAX_DURATION = 3600*5
FFMPEG_OUT_CODEC = ['-acodec', 'copy'] FFMPEG_OUT_CODEC = ['-acodec', 'copy']

View file

@ -53,10 +53,11 @@ $(function() {
parseInt(rec.starttime, 10)).toLocaleString() parseInt(rec.starttime, 10)).toLocaleString()
); );
var duration = $('<td/>').text(delta(rec.endtime, rec.starttime)); var duration = $('<td/>').text(delta(rec.endtime, rec.starttime));
var dl_text = $('<span/>').text(" Scarica").addClass('pure-hidden-phone');
var fn = $("<td/>").append($("<a/>").prop("href", "/output/" + var fn = $("<td/>").append($("<a/>").prop("href", "/output/" +
rec.filename).addClass("pure-button pure-button-small") rec.filename).addClass("pure-button pure-button-small")
.html( $("<i/>").addClass("fa fa-download").css("color", "green")) .html( $("<i/>").addClass("fa fa-download").css("color", "green"))
.append(" Scarica") ); .append(dl_text));
var row = $('<tr/>').append(name).append(start).append(duration).append(fn); var row = $('<tr/>').append(name).append(start).append(duration).append(fn);
$('#ongoing-recs-table tbody').append(row); $('#ongoing-recs-table tbody').append(row);
} }

View file

@ -37,7 +37,7 @@
<form id="form" class="pure-form"> <form id="form" class="pure-form">
<label for="name" required placeholder="Corrispondenza dalla Luna">Nome</label> <label for="name" required placeholder="Corrispondenza dalla Luna">Nome</label>
<input type="text" id="name" name="name" size="40" required placeholder="Corrispondenza dalla Luna"> <input type="text" id="name" name="name" size="40" autocomplete="off" required placeholder="Corrispondenza dalla Luna">
<fieldset> <fieldset>
<legend>Da</legend> <legend>Da</legend>
<div class="pure-u-1-3"> <div class="pure-u-1-3">

View file

@ -162,9 +162,12 @@ class RecAPI(Bottle):
(rec.endtime - rec.starttime).total_seconds() (rec.endtime - rec.starttime).total_seconds()
} }
rec.filename = get_config()['AUDIO_OUTPUT_FORMAT'] % { rec.filename = get_config()['AUDIO_OUTPUT_FORMAT'] % {
'time': rec.starttime.strftime('%y%m%d_%H%M'), 'time': rec.starttime.strftime('%y%m%d_%H%M'), # kept for retrocompatibility, should be dropped
'endtime': rec.endtime.strftime('%H%M'),
'startdt': rec.starttime.strftime('%y%m%d_%H%M'),
'enddt': rec.endtime.strftime('%y%m%d_%H%M'),
'name': filter(lambda c: c.isalpha(), 'name': filter(lambda c: c.isalpha(),
unicodedata.normalize('NFKD', rec.name).encode('ascii', 'ignore')) unicodedata.normalize('NFKD', rec.name).encode('ascii', 'ignore')),
} }
self.db.get_session(rec).commit() self.db.get_session(rec).commit()
job_id = self._app.pq.submit( job_id = self._app.pq.submit(

View file

@ -23,7 +23,7 @@ var form = {
errs.unshift({ msg: msg, el: element}); errs.unshift({ msg: msg, el: element});
} }
var v = form.get_values(); var v = form.get_values();
if(v.val === '') { if(v.name === '') {
err("Nome mancante", $('#name')); err("Nome mancante", $('#name'));
} }
if(v.start === null) { if(v.start === null) {
@ -106,6 +106,7 @@ $(function() {
var check = form.check(); var check = form.check();
if(check.length > 0) { if(check.length > 0) {
console.log("Errors in form", check); console.log("Errors in form", check);
error_dialog(check.map(function(err) { return err.msg; }).join('\n'));
return; return;
} }
click($('#download')); click($('#download'));