mirror of
https://github.com/fastogt/fastocloud_admin.git
synced 2025-03-09 23:38:52 +00:00
Script for parsing output
This commit is contained in:
parent
d57f1fbf2d
commit
8834e927eb
1 changed files with 25 additions and 0 deletions
25
scripts/parse_json_out.py
Normal file
25
scripts/parse_json_out.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import json
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
f = open("out.m3u", "w")
|
||||||
|
f.write('#EXTM3U\n')
|
||||||
|
with open('test.json') as json_file:
|
||||||
|
data = json.load(json_file)
|
||||||
|
idx = 0
|
||||||
|
for p in data:
|
||||||
|
name = p['name']
|
||||||
|
icon = p['icon']
|
||||||
|
group = p['group']
|
||||||
|
sid = p['input']['urls'][0]['id']
|
||||||
|
input = p['input']['urls'][0]['uri']
|
||||||
|
f.write('#EXTINF:{0} tvg-id="{1}" tvg-name="" tvg-logo="{3}" group-title="{4}",{2}\n{5}\n'.format(
|
||||||
|
idx,
|
||||||
|
sid,
|
||||||
|
name,
|
||||||
|
icon,
|
||||||
|
group,
|
||||||
|
input))
|
||||||
|
idx += 1
|
||||||
|
|
||||||
|
f.close()
|
Loading…
Add table
Add a link
Reference in a new issue