Compare commits
3 Commits
1dd8ac7c16
...
8033e98f20
Author | SHA1 | Date | |
---|---|---|---|
8033e98f20 | |||
5ddc19a267 | |||
68ed99df23 |
45
make_logsheet.py
Normal file
45
make_logsheet.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def format_duration(seconds):
|
||||||
|
seconds = float(seconds)
|
||||||
|
d = int(seconds / 86400)
|
||||||
|
h = int(seconds % 86400 / 3600)
|
||||||
|
m = int(seconds % 3600 / 60)
|
||||||
|
s = float(seconds % 60)
|
||||||
|
|
||||||
|
durations = []
|
||||||
|
if h:
|
||||||
|
durations.append('%sh' % h)
|
||||||
|
if m:
|
||||||
|
durations.append('%sm' % m)
|
||||||
|
if s:
|
||||||
|
durations.append('%ss' % int(s))
|
||||||
|
r = ' '.join(durations)
|
||||||
|
return r + ((10-len(r)) * ' ')
|
||||||
|
|
||||||
|
|
||||||
|
presets = json.load(open(sys.argv[1]))
|
||||||
|
sequence = json.load(open(sys.argv[2]))
|
||||||
|
|
||||||
|
|
||||||
|
padding = max([len(p['name']) for p in presets]) + 5
|
||||||
|
|
||||||
|
position = 0
|
||||||
|
for i, clip in enumerate(sequence):
|
||||||
|
preset = [p for p in presets if p['id'] == clip['preset']][0]
|
||||||
|
|
||||||
|
if clip.get('duration'):
|
||||||
|
position += clip.get('duration', 0)
|
||||||
|
d = format_duration(clip['duration'])
|
||||||
|
else:
|
||||||
|
d = '... '
|
||||||
|
|
||||||
|
print('\t'.join([
|
||||||
|
'%02d' % preset['id'] + ': ' + preset['name'] + ((padding-len(preset['name'])) * ' '),
|
||||||
|
format_duration(position),
|
||||||
|
'Speed: ' + str(clip.get('speed', 0)),
|
||||||
|
'Sleep: ' + str(clip.get('sleep', 0)),
|
||||||
|
d,
|
||||||
|
]))
|
|
@ -96,7 +96,7 @@
|
||||||
<h2>Edit:</h2>
|
<h2>Edit:</h2>
|
||||||
<li><button class="delete">delete row</button></li>
|
<li><button class="delete">delete row</button></li>
|
||||||
<li><button class="insert">insert row</button></li>
|
<li><button class="insert">insert row</button></li>
|
||||||
<li><button class="all_presets">load all presets</button></li>
|
<li><button class="all_presets">add unused presets</button></li>
|
||||||
<li>Global Speed: <input type="text" style="width:30px" value="20" class="default_speed"><button class="set_speed">set</button></li>
|
<li>Global Speed: <input type="text" style="width:30px" value="20" class="default_speed"><button class="set_speed">set</button></li>
|
||||||
<h2>Export:</h2>
|
<h2>Export:</h2>
|
||||||
<li><a><button class="export_sequence">export sequence</button></a></li>
|
<li><a><button class="export_sequence">export sequence</button></a></li>
|
||||||
|
|
|
@ -481,12 +481,21 @@ $('button.export_presets').on({click: function() {
|
||||||
});
|
});
|
||||||
}})
|
}})
|
||||||
$('button.all_presets').on({click: function() {
|
$('button.all_presets').on({click: function() {
|
||||||
loadData(presets.map(function(preset) {
|
api('getPresets', {}, function(response) {
|
||||||
return {
|
presets = response.result.presets
|
||||||
preset: preset.id,
|
var seq = [].concat(data, presets.filter(function(preset) {
|
||||||
speed: parseInt($('input.default_speed').val(), 10)
|
return data.filter(function(row) {
|
||||||
}
|
return row.preset == preset.id
|
||||||
}))
|
}).length == 0
|
||||||
|
}).map(function(preset) {
|
||||||
|
return {
|
||||||
|
preset: preset.id,
|
||||||
|
speed: parseInt($('input.default_speed').val(), 10)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
loadData(seq)
|
||||||
|
})
|
||||||
}})
|
}})
|
||||||
|
|
||||||
$('input.import_sequence').on({change: function() {
|
$('input.import_sequence').on({change: function() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user