This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
generated from KOLANICH/python_project_boilerplate.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc3_m3u.py
executable file
·68 lines (56 loc) · 1.65 KB
/
rc3_m3u.py
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
#!/usr/bin/env python3
import sys
from datetime import datetime, timedelta
from pathlib import Path
from warnings import warn
warn("We have moved from M$ GitHub to https://codeberg.org/KOLANICH-tools/rc3_ical_fahrplan.py , read why on https://codeberg.org/KOLANICH/Fuck-GuanTEEnomo .")
try:
import ujson as json
except ImportError:
import json
rooms = {
"cbase": "c-base",
"cwtv": "Chaos-West TV",
"r3s": "Remote Rhein Ruhr Stage",
"csh": "ChaosStudio Hamburg",
"chaoszone": "ChaosZone TV",
"fem": "FeM",
"franconiannet": "franconian.net",
"aboutfuture": "about:future",
"sendezentrum": "Sendezentrum",
"haecksen": "Haecksen",
"gehacktes": "Gehacktes from Hell / Bierscheune",
"xhain": "xHain Lichtung",
"infobeamer": "Infobeamer"
}
BASE = "https://live.dus.c3voc.de/"
resolutions = {
"hd": "hd",
"sd": "sd",
"audio": "segment"
}
formats = {
"HLS": ("hls", "m3u8"),
"WebM": ("webm", "webm")
}
translations = {
"native": "Native",
"translated": "Translated",
"translated-2": "Translated 2"
}
def main() -> None:
curDir = Path(".").absolute()
for formatName, formatDescriptor in formats.items():
formatDir, ext = formatDescriptor
for resolution in resolutions:
formatResFile = curDir / ("rc3_" + formatDir + "_" + resolution + ".m3u")
with formatResFile.open("wt") as f:
for roomSlug, roomName in rooms.items():
prefix = BASE + formatDir + "/" + roomSlug + "/"
for translSlug, translName in translations.items():
resUri = prefix + translSlug + "_" + resolution + "." + ext
print(file=f)
print("#EXTINF:-1, " + roomName + " " + translName, file=f)
print(resUri, file=f)
if __name__ == "__main__":
main()