-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathtimestamps
More file actions
30 lines (25 loc) · 785 Bytes
/
timestamps
File metadata and controls
30 lines (25 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
import xml.etree.ElementTree as ET
import json
import time
import sys
guides = "kdenlive:docproperties.guides"
framerate = 30
def find_mainbin(root):
for child in root:
if "id" in child.attrib and child.attrib["id"] == "main_bin":
return child
def find_guides(root):
for child in root:
if "name" in child.attrib and child.attrib["name"] == guides:
return child.text
def parse_guides(guides):
for guide in guides:
print(time.strftime('%-M:%S', time.gmtime(guide["pos"]/framerate)), guide["comment"])
if len(sys.argv) == 2:
tree = ET.parse(sys.argv[1])
main_bin = find_mainbin(tree.getroot())
guides = json.loads(find_guides(main_bin))
parse_guides(guides)
else:
print("No File")