aboutsummaryrefslogtreecommitdiffstats
path: root/Soundboard.py
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2026-07-24 18:00:52 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2026-07-24 18:00:52 +0530
commitbc7d62ca9a406bc30419e985016c7f4f56e54e76 (patch)
treeb4f1091e7f008df31d20039f0fa4c683d05785e5 /Soundboard.py
first commit
Diffstat (limited to 'Soundboard.py')
-rw-r--r--Soundboard.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/Soundboard.py b/Soundboard.py
new file mode 100644
index 0000000..32ddfa6
--- /dev/null
+++ b/Soundboard.py
@@ -0,0 +1,52 @@
+# Soundboard Engine - customizable soundboard
+# Copyright (C) 2026 Vidhu Kant Sharma <vidhukant@vidhukant.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+import json
+
+
+class Soundboard:
+ def __init__(self, soundboard_path):
+ self.soundboard_path = soundboard_path
+ self.categories = []
+
+ def build(self):
+ data = json.load(open(self.soundboard_path))
+ for _c in data["categories"]:
+ c = SoundboardCategory(_c["name"], _c["image_path"])
+
+ for _s in _c["sounds"]:
+ s = SoundboardSound(_s["title"], _s["path"])
+ c.sounds.append(s)
+
+ self.categories.append(c)
+
+ self.soundboard_name = data["soundboard_name"]
+ self.soundboard_id = data["soundboard_id"]
+ self.soundboard_author = data["soundboard_author"]
+ self.soundboard_version = data["soundboard_version"]
+
+
+class SoundboardCategory:
+ def __init__(self, name, image_path):
+ self.name = name
+ self.image_path = image_path
+ self.sounds = []
+
+
+class SoundboardSound:
+ def __init__(self, title, path):
+ self.title = title
+ self.path = path