work on json playlist format

This commit is contained in:
jb-alvarado 2019-03-05 16:28:06 +01:00
parent 0c73b6b4b7
commit f3e5024f8a
3 changed files with 52 additions and 2 deletions

2
.gitignore vendored
View File

@ -1,6 +1,4 @@
.ropeproject
server.py
**wip
**temp
**playlists
*.log*

34
wip/2019-03-05.json Normal file
View File

@ -0,0 +1,34 @@
{
"channel": "Test 1",
"date": "2019-03-05",
"begin": "06:00:00.000",
"length": "24:00:00.000",
"program": [{
"in": 0,
"out": 647.68,
"duration": 647.68,
"source": "/Media/clip1.mp4"
},
{
"in": 0,
"out": 149,
"duration": 149,
"source": "/Media/clip2.mp4"
},
{
"in": 0,
"out": 114.72,
"duration": 114.72,
"source": "/Media/clip3.mp4"
},
{
"in": 0,
"out": 2531.36,
"duration": 2531.36,
"source": "/Media/clip4.mp4"
}
]
}

18
wip/json-reader.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
with open('2019-03-05.json') as f:
data = json.load(f)
h, m, s = data["begin"].split(':')
begin = float(h) * 3600 + float(m) * 60 + float(s)
for item in data["program"]:
inp = item["in"]
out = item["out"]
duration = item["duration"]
print(begin)
begin += out - inp