Add random channel features. - 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 6a7c95a533be669f153f8a5d4fedf8f0b83fff43
(DIR) parent 03b889751ac37cff00a5d57b55a540215ec1dcd7
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Fri, 26 Dec 2025 18:42:42 +0100
Add random channel features.
Diffstat:
M gen-static-tv-lawn.py | 11 ++++++++++-
M index.gph | 1 +
2 files changed, 11 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/gen-static-tv-lawn.py b/gen-static-tv-lawn.py
@@ -10,6 +10,7 @@ import os
import sys
import getopt
import json
+import random
def usage(app):
app = os.path.basename(app)
@@ -81,6 +82,12 @@ def main(args):
channel["category"].append(category)
if "nanoid" in channel:
allchannels[channel["nanoid"]] = channel
+ # Set the random directory entries.
+ randomchannels = random.choices(list(allchannels.keys()), k=12)
+ i = 0
+ for channel in randomchannels:
+ allchannels[channel]["random"] = "%d" % (i)
+ i += 1
def write_channel_info(filename, channel):
if os.path.exists(filename):
@@ -121,7 +128,7 @@ def main(args):
# Symlink dirs.
linkto = "nanoid"
- for direntry in ["language", "country", "name", "category"]:
+ for direntry in ["language", "country", "name", "category", "random"]:
if not os.path.exists(direntry):
os.mkdir(direntry)
# Cleanup all directories.
@@ -144,6 +151,8 @@ def main(args):
fd.write("[1|%s|../nanoid/%s.gph|server|port]\n" \
% (clean_gphentry(c["name"]), c["nanoid"]))
+
+
return 0
if __name__ == "__main__":
(DIR) diff --git a/index.gph b/index.gph
@@ -5,5 +5,6 @@ You can find various channels from around the world
[1|by name|name|server|port]
[1|by category|category|server|port]
[1|by nanoid|nanoid|server|port]
+[1|by random|random|server|port]
[1|<< back|..|server|port]
[h|raw data|URL:https://github.com/TVGarden/tv-garden-channel-list|server|port]