Better category handling. - tv-lawn - Bitreich TV Lawn
(HTM) git clone git://bitreich.org/tv-lawn git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tv-lawn
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit db3ba66dce0ffcc6055fb93e0f680832e4650eb4
(DIR) parent 7ae91a1a31b57fa3a42b32b3d5cf666ce8ee4d46
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Fri, 26 Dec 2025 18:05:36 +0100
Better category handling.
Diffstat:
M gen-static-tv-lawn.py | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
---
(DIR) diff --git a/gen-static-tv-lawn.py b/gen-static-tv-lawn.py
@@ -76,7 +76,9 @@ def main(args):
for category in categories.keys():
channels = categories[category]["channels"]
for channel in channels:
- channel["category"] = category
+ if not "category" in channel:
+ channel["category"] = []
+ channel["category"].append(category)
if "nanoid" in channel:
allchannels[channel["nanoid"]] = channel
@@ -84,8 +86,12 @@ def main(args):
if os.path.exists(filename):
os.remove(filename)
with open(filename, "w") as fd:
- for direntry in ["name", "language", "country", "isGeoBlocked", "nanoid"]:
+ for direntry in ["name", "language", "isGeoBlocked", "nanoid", "category"]:
fd.write("%s: %s\n" % (direntry, channel[direntry]))
+ if "country" in channel:
+ country = countries[channel["country"]]
+ for e in ["country", "timeZone"]:
+ fd.write("%s: %s\n" % (e, country[e]))
for iptvurl in channel["iptv_urls"]:
fd.write("[h|%s|URL:%s|server|port]\n" % (iptvurl, iptvurl))
for yturl in channel["youtube_urls"]:
@@ -125,13 +131,14 @@ def main(args):
for channel in allchannels.keys():
c = allchannels[channel]
if direntry in c:
- filename = "%s/%s.gph" % (direntry, clean_filename(c[direntry]))
- if not os.path.exists(filename):
- with open(filename, "w") as fd:
- fd.write("== %s/%s ==\n" % (direntry, c[direntry]))
- with open(filename, "a") as fd:
- fd.write("[1|%s|../nanoid/%s.gph|server|port]\n" \
- % (clean_gphentry(c["name"]), c["nanoid"]))
+ for d in c[direntry]:
+ filename = "%s/%s.gph" % (direntry, clean_filename(d))
+ if not os.path.exists(filename):
+ with open(filename, "w") as fd:
+ fd.write("== %s/%s ==\n" % (direntry, d))
+ with open(filename, "a") as fd:
+ fd.write("[1|%s|../nanoid/%s.gph|server|port]\n" \
+ % (clean_gphentry(c["name"]), c["nanoid"]))
return 0