Private
Public Access
1
0

player improvements

This commit is contained in:
Sander Roosendaal
2019-12-07 13:06:35 +01:00
parent c47b0227b7
commit 99a1709a30
3 changed files with 71 additions and 13 deletions

View File

@@ -198,7 +198,12 @@ def get_video_data(w,groups=['basic'],mode='water'):
if dict(rowingmetrics)[c]['numtype'] == 'integer':
data[c] = df2[c].astype(int).tolist()
else:
data[c] = df2[c].values.tolist()
sigfigs = dict(rowingmetrics)[c]['sigfigs']
if (c != 'pace'):
da = ((10**sigfigs)*df2[c]).astype(int)/(10**sigfigs)
else:
da = df2[c]
data[c] = da.values.tolist()
metrics[c] = {
'name': dict(rowingmetrics)[c]['verbose_name'],
'metric': c,

View File

@@ -56,7 +56,8 @@ rowingmetrics = (
'ax_max': 1e5,
'mode':'both',
'type': 'basic',
'group':'basic'}),
'group':'basic',
'sigfigs': -1}),
('hr',{
'numtype':'integer',
@@ -66,7 +67,8 @@ rowingmetrics = (
'ax_max': 200,
'mode':'both',
'type': 'basic',
'group':'athlete'}),
'group':'athlete',
'sigfigs':0,}),
('pace',{
'numtype':'float',
@@ -76,6 +78,7 @@ rowingmetrics = (
'ax_max': 1.0e3*75,
'mode':'both',
'type': 'basic',
'sigfigs': 1,
'group': 'basic'}),
('velo',{
@@ -86,6 +89,7 @@ rowingmetrics = (
'ax_max': 8,
'default': 0,
'mode':'both',
'sigfigs': 1,
'type':'pro',
'group': 'basic'}),
@@ -106,6 +110,7 @@ rowingmetrics = (
'ax_min': 15,
'ax_max': 45,
'mode':'both',
'sigfigs': 1,
'type': 'basic',
'group':'basic'}),
@@ -116,6 +121,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 1000,
'mode':'both',
'sigfigs': 0,
'type': 'pro',
'group':'forcepower'}),
@@ -126,6 +132,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 600,
'mode':'both',
'sigfigs': 0,
'type': 'basic',
'group':'forcepower'}),
@@ -136,6 +143,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 1200,
'mode':'both',
'sigfigs': 0,
'type': 'pro',
'group':'forcepower'}),
@@ -145,6 +153,7 @@ rowingmetrics = (
'verbose_name': 'Peak Drive Force (N)',
'ax_min': 0,
'ax_max': 1500,
'sigfigs': 0,
'mode':'both',
'type': 'pro',
'group':'forcepower'}),
@@ -156,6 +165,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 2.5,
'mode':'rower',
'sigfigs': 2,
'type': 'pro',
'group':'stroke'}),
@@ -165,6 +175,7 @@ rowingmetrics = (
'verbose_name': 'Average/Peak Force Ratio',
'ax_min': 0,
'ax_max': 1,
'sigfigs': 2,
'mode':'both',
'type': 'pro',
'group': 'forcepower'}),
@@ -175,6 +186,7 @@ rowingmetrics = (
'verbose_name': 'Interval Distance (m)',
'ax_min': 0,
'ax_max': 1e5,
'sigfigs': 0,
'mode':'both',
'type': 'basic',
'group':'basic'}),
@@ -186,6 +198,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 1e5,
'mode':'both',
'sigfigs': 0,
'type': 'basic',
'group':'basic'}),
@@ -196,10 +209,12 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 4,
'default': 0,
'sigfigs': 2,
'mode':'both',
'type': 'pro',
'group': 'stroke'}),
('catch',{
'numtype':'float',
'null':True,
@@ -207,6 +222,7 @@ rowingmetrics = (
'ax_min': -40,
'ax_max': -75,
'default': 0,
'sigfigs': 0,
'mode':'water',
'type': 'pro',
'group': 'stroke'}),
@@ -218,6 +234,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 20,
'default': 0,
'sigfigs': 1,
'mode':'water',
'type': 'pro',
'group': 'stroke'}),
@@ -229,6 +246,7 @@ rowingmetrics = (
'ax_min': 20,
'ax_max': 55,
'default': 0,
'sigfigs': 0,
'mode':'water',
'type': 'pro',
'group': 'stroke'}),
@@ -240,6 +258,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 30,
'default': 0,
'sigfigs': 0,
'mode':'water',
'type': 'pro',
'group': 'stroke'}),
@@ -251,6 +270,7 @@ rowingmetrics = (
'ax_min': -50,
'ax_max': 50,
'default': 0,
'sigfigs': 0,
'mode':'water',
'type': 'pro',
'group':'stroke'}),
@@ -263,6 +283,7 @@ rowingmetrics = (
'ax_min': 40,
'ax_max': 140,
'default': 0,
'sigfigs': 0,
'mode':'water',
'type': 'pro',
'group':'stroke'}),
@@ -275,6 +296,7 @@ rowingmetrics = (
'ax_min': 40,
'ax_max': 140,
'default': 0,
'sigfigs': 0,
'mode':'water',
'type': 'pro',
'group':'stroke'}),
@@ -286,6 +308,7 @@ rowingmetrics = (
'ax_min': 20,
'ax_max': 55,
'default': 1.0,
'sigfigs': 0,
'mode':'erg',
'type': 'pro',
'group':'stroke'}),
@@ -297,6 +320,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 110,
'default': 0,
'sigfigs': 0,
'mode':'water',
'type': 'pro',
'group':'forcepower'}),
@@ -308,6 +332,7 @@ rowingmetrics = (
'ax_min': 0,
'ax_max': 15,
'default': 0,
'sigfigs': 1,
'mode':'both',
'type': 'basic',
'group':'basic'}),

View File

@@ -314,15 +314,43 @@
</form>
<script>
$(document).ready( function() {
// cookie reader
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
// lock
var lock = document.getElementById("lock");
// lock.onchange nog doen
var output = document.getElementById("id_delay");
var cookie = readCookie("lock");
var delay = output.value;
if (cookie=="true") {
lock.checked = true;
output.disabled = true;
}
// lock.onchange nog doen
{% if locked %}
lock.checked = true;
output.disabled = true;
{% endif %}
var delay = output.value;
// slider
var slider = document.getElementById("myRange");
@@ -407,20 +435,18 @@
slider.value = this.value+Math.round(player.getCurrentTime());
}
// lock delay form field if checkbox checked
lock.oninput = function() {
if (this.checked) {
output.disabled = true;
} else {
output.disabled = false;
}
}
// Update the current slider value (each time the slider is changed)
slider.onchange = function() {
clearInterval(timeupdater)
if (lock.checked) {
if (this.value-output.value > 0) {
player.seekTo(this.value-output.value);
if (playing) {
player.playVideo();
} else {
player.pauseVideo();
}
} else {
if (playing) {
player.seekTo(0);
@@ -482,8 +508,10 @@
lock.oninput = function() {
if (this.checked) {
output.disabled = true;
createCookie("lock","true",0);
} else {
output.disabled = false;
createCookie("lock","false",0);
}
}
// Slider start stop