-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse.py
More file actions
executable file
·135 lines (128 loc) · 7.6 KB
/
Copy pathparse.py
File metadata and controls
executable file
·135 lines (128 loc) · 7.6 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env python3
'''Parses resources to create review.'''
from json import load
from datetime import datetime
def overview(out, now, locally=False):
out.write('# Intergalactic FM streams for Kodi video plugin\n\n')
streams = load(open('../plugin.video.intergalacticfm/resources/streams.json'))
for key, values in streams.items():
filename = values['label'].lower().replace(' ', '_')
anchor = values['label'].lower().replace(' ', '-')
if values['label'].lower() == 'mule driver': # exception
filename = 'muledriver'
anchor = 'mule-driver'
elif values['label'].lower() == 'el camino': # exception
filename = 'elcamino'
anchor = 'el-camino'
elif values['label'].lower() == 'cobra fm': # exception
filename = 'cobrafm'
anchor = 'cobra-fm'
elif values['label'].lower() == 'murder capital tv': # exception
filename = 'intergalactic_tv'
anchor = 'intergalactic-tv'
out.write('[](#{})'.format(filename, anchor))
out.write('\n\n')
out.write('Below are the specific texts and images required by Kodi. '
'Please, try to meet the requirements as close as possible. '
'Kodi has many different views and we do not know which view '
'for navigating and playing streams is used by the user. '
'So using this format as described by Kodi itself gives the '
'best result for all. Let is know when something needs to be '
'changed. This overview has been automatically generated on '
'{}.\n\n'.format(now))
out.write('**Pleas note:** that the examples below with a **clearlogo** '
'are **only** shown in Kodi when you hit pause. The clearlogo is '
'not shown during normal playback. So a stream can still sport '
'its own logos whereever on the screen they want.\n\n')
for key, values in streams.items():
filename = values['label'].lower().replace(' ', '_')
if values['label'].lower() == 'mule driver': # exception
filename = 'muledriver'
elif values['label'].lower() == 'el camino': # exception
filename = 'elcamino'
elif values['label'].lower() == 'cobra fm': # exception
filename = 'cobrafm'
elif values['label'].lower() == 'murder capital tv': # exception
filename = 'intergalactic_tv'
out.write('## {}\n\n'.format(values['label']))
out.write('**Tagline** (two to five words): *{}*\n\n'.format(values['tagline']))
out.write('**Plot** (twenty to thirty words): *{}*\n\n'.format(values['plot']))
out.write('**Genre** (one to three genres): *{}*\n\n'.format(values['genre']))
out.write('**ID and basename**: `{}` and `{}`\n\n'.format(key, filename))
out.write('**Poster** (1000 x 1500 PNG, main logo in center):\n')
out.write('\n\n'.format(filename))
out.write('**Fanart** (1920 x 1080 JPG, only for background, max. quality 96, prefer 90):\n')
if locally:
if filename == 'intergalactic_tv':
out.write('\n\n')
else:
out.write('\n\n'.format(filename))
else:
if filename == 'intergalactic_tv':
out.write('\n\n')
else:
out.write('\n\n'.format(filename))
out.write('**Clear logo** (800 x 310 PNG with transparency):\n')
out.write('\n\n'.format(filename))
out.close()
def catalog(out, now, locally=False):
out.write('# Intergalactic FM streams for Kodi video plugin\n\n')
streams = load(open('../plugin.video.intergalacticfm/resources/streams.json'))
for key, values in streams.items():
filename = values['label'].lower().replace(' ', '_')
anchor = values['label'].lower().replace(' ', '-')
if values['label'].lower() == 'mule driver': # exception
filename = 'muledriver'
anchor = 'mule-driver'
elif values['label'].lower() == 'el camino': # exception
filename = 'elcamino'
anchor = 'el-camino'
elif values['label'].lower() == 'cobra fm': # exception
filename = 'cobrafm'
anchor = 'cobra-fm'
elif values['label'].lower() == 'murder capital tv': # exception
filename = 'intergalactic_tv'
anchor = 'intergalactic-tv'
out.write('[](#{})'.format(filename, anchor))
out.write('\n\n')
out.write('Streams are only available in Kodi if they are live. When they are not live, they are hidden.\n')
out.write('\n\n')
for key, values in streams.items():
filename = values['label'].lower().replace(' ', '_')
if values['label'].lower() == 'mule driver': # exception
filename = 'muledriver'
elif values['label'].lower() == 'el camino': # exception
filename = 'elcamino'
elif values['label'].lower() == 'cobra fm': # exception
filename = 'cobrafm'
elif values['label'].lower() == 'murder capital tv': # exception
filename = 'intergalactic_tv'
out.write('# {}\n\n'.format(values['label']))
out.write('\n\n'.format(filename))
out.write('**Tagline** *{}*\n\n'.format(values['tagline']))
out.write('**Plot** *{}*\n\n'.format(values['plot']))
out.write('**Genre** *{}*\n\n'.format(values['genre']))
out.write('**Background** (only shown behind menu)\n')
if locally:
if filename == 'intergalactic_tv':
out.write('\n\n')
else:
out.write('\n\n'.format(filename))
else:
if filename == 'intergalactic_tv':
out.write('\n\n')
else:
out.write('\n\n'.format(filename))
out.write('**Logo** (only shown when pauzing stream)\n')
out.write('\n\n'.format(filename))
out.write('# Colophon\n\n')
out.write('The video plugin can be installed directly from within Kodi. For more information, see https://kodi.tv/addon/plugins-video-add-ons/intergalactic-fm-tv')
out.write('\n\n')
out.write('This overview has been automatically generated on '
'{}.\n\n'.format(now))
out.close()
now = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
overview(open('admin-overview-online.md', 'w'), now)
overview(open('admin-overview-locally.md', 'w'), now, True)
catalog(open('public-catalog-online.md', 'w'), now)
catalog(open('public-catalog-locally.md', 'w'), now, True)