From bc7d62ca9a406bc30419e985016c7f4f56e54e76 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Fri, 24 Jul 2026 18:00:52 +0530 Subject: first commit --- Soundboard.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Soundboard.py (limited to 'Soundboard.py') 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 +# +# 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 . + +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 -- cgit v1.2.3