work on json playlist format
This commit is contained in:
parent
0c73b6b4b7
commit
f3e5024f8a
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,4 @@
|
||||
.ropeproject
|
||||
server.py
|
||||
**wip
|
||||
**temp
|
||||
**playlists
|
||||
*.log*
|
||||
|
34
wip/2019-03-05.json
Normal file
34
wip/2019-03-05.json
Normal 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
18
wip/json-reader.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user