From 5e1f11902c1560f08e37dff64bf79270e9663bd4 Mon Sep 17 00:00:00 2001
From: Sebastian Krzyszkowiak <dos@dosowisko.net>
Date: Sat, 14 Oct 2023 01:13:16 +0200
Subject: [PATCH] py,st3m: Add "Media" and "Games" as app categories

---
 python_payload/apps/audio_passthrough/flow3r.toml |  2 +-
 python_payload/apps/wurzelitzer/flow3r.toml       |  2 +-
 python_payload/st3m/application.py                | 12 +++++++-----
 python_payload/st3m/run.py                        |  2 ++
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/python_payload/apps/audio_passthrough/flow3r.toml b/python_payload/apps/audio_passthrough/flow3r.toml
index 9ec2f0a28b..2b57ba9171 100644
--- a/python_payload/apps/audio_passthrough/flow3r.toml
+++ b/python_payload/apps/audio_passthrough/flow3r.toml
@@ -1,6 +1,6 @@
 [app]
 name = "Audio Passthrough"
-menu = "Apps"
+menu = "Media"
 
 [entry]
 class = "AudioPassthrough"
diff --git a/python_payload/apps/wurzelitzer/flow3r.toml b/python_payload/apps/wurzelitzer/flow3r.toml
index 614fbbfae4..0751bd28c6 100644
--- a/python_payload/apps/wurzelitzer/flow3r.toml
+++ b/python_payload/apps/wurzelitzer/flow3r.toml
@@ -1,6 +1,6 @@
 [app]
 name = "Wurzelitzer"
-menu = "Music"
+menu = "Media"
 wifi_preference = true
 
 [metadata]
diff --git a/python_payload/st3m/application.py b/python_payload/st3m/application.py
index 9dfd13264f..2c9ce60ced 100644
--- a/python_payload/st3m/application.py
+++ b/python_payload/st3m/application.py
@@ -97,8 +97,8 @@ class BundleMetadata:
        [app]
        # Required, displayed in the menu.
        name = "Name of the application"
-       # One of "Apps", "Badge", "Music". Picks which menu the bundle's class
-       # will be loadable from.
+       # One of "Apps", "Badge", "Music", "Games", "Media". Picks which menu
+       # the bundle's class will be loadable from.
        menu = "Apps"
 
        [entry]
@@ -147,8 +147,10 @@ class BundleMetadata:
         if "menu" not in app or type(app["menu"]) != str:
             raise BundleMetadataBroken("missing app.menu key")
         self.menu = app["menu"]
-        if self.menu not in ["Apps", "Music", "Badge", "Hidden"]:
-            raise BundleMetadataBroken("app.menu must be either Apps, Music or Badge")
+        if self.menu not in ["Apps", "Music", "Badge", "Games", "Media", "Hidden"]:
+            raise BundleMetadataBroken(
+                "app.menu must be either Apps, Music, Badge, Games or Media"
+            )
 
         version = 0
         if t.get("metadata") is not None:
@@ -218,7 +220,7 @@ class BundleMetadata:
         """
         Returns MenuItemAppLauch entries for this bundle for a given menu kind.
 
-        Kind is one of 'Apps', 'Badge', 'Music'.
+        Kind is one of 'Apps', 'Badge', 'Music', 'Games', 'Media'.
         """
         if self.menu != kind:
             return []
diff --git a/python_payload/st3m/run.py b/python_payload/st3m/run.py
index 280168ad19..c1ecc6cdd2 100644
--- a/python_payload/st3m/run.py
+++ b/python_payload/st3m/run.py
@@ -247,6 +247,8 @@ def run_main() -> None:
         [
             MenuItemForeground("Badge", _make_bundle_menu(bundles, "Badge")),
             MenuItemForeground("Music", _make_bundle_menu(bundles, "Music")),
+            MenuItemForeground("Media", _make_bundle_menu(bundles, "Media")),
+            MenuItemForeground("Games", _make_bundle_menu(bundles, "Games")),
             MenuItemForeground("Apps", _make_bundle_menu(bundles, "Apps")),
             MenuItemForeground("System", menu_system),
         ],
-- 
GitLab