Initial Commit

This commit is contained in:
Bradley Bickford 2025-10-11 16:05:06 -04:00
commit 336e38dc08
7 changed files with 63 additions and 0 deletions

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# Sanctuary Commander
Sanctuary Commander will be the successor to Video Commander. With built in functionality for preparing dynamically submitted content, rather than working from a static configuration file.
The end goal is to have web based control of TV power, volume, input, and displayed content from a single location, while having the ability to pre-download Youtube video content, upload videos and pictures for display later, and keep the interface as simple as possible for the less technically adept.
Simple Goal List
- HomeAssistant Integration for TV Power, Volume, and Input Control
- FFPlay based playback of video and audio
- Ahead of time downloading of Youtube video content
- Ahead of time uploading of pictures and videos from external devices
- USB media awareness/playback

0
pages/home/__init__.py Normal file
View File

View File

0
sc_webserver.py Normal file
View File

View File

@ -0,0 +1,50 @@
class Database():
def __init__(self):
pass
def query(self, query: str, parameters: list=None) -> tuple[int, list[dict]]:
pass
def select(self, table: str, columns: list[str]=None, where: list[dict]=None) -> list[dict]:
query_string = "SELECT {columns} FROM {table}{where}".format(
columns = "*" if columns is None else ",".join(columns),
table = table,
where = self.__generate_basic_where_clause(where) if not where is None else ""
)
return self.query(query_string, [element["value"] for element in where] if not where is None else None)[1]
def insert(self, table: str, columns: list[str], values: list) -> int:
query_string = "INSERT INTO {table} ({columns}) VALUES ({values})".format(
table = table,
columns = ",".join(columns),
values = ("?," * len(values))[:-1]
)
return self.query(query_string, values)[0]
def update(self, table: str, columns: list[str], values: list, where: list[dict]=None) -> int:
query_string = "UPDATE {table} SET {set_rules}{where}".format(
table = table,
set_rules = ",".join([element + "=?" for element in columns]),
where = self.__generate_basic_where_clause(where) if not where is None else ""
)
return self.query(query_string, values)[0]
def delete(self, table: str, where: list[dict]=None) -> int:
query_string = "DELETE FROM {table}{where}".format(
table = table,
where = self.__generate_basic_where_clause(where) if not where is None else ""
)
return self.query(query_string)[0]
def __generate_basic_where_clause(self, where: list[dict]):
return " WHERE {clauses}".format(
clauses = "".join([
element["name"] + " " + element["compare"] + " ?" + (" " + element["boolean_op"] + " " if "boolean_op" in element else "")
for element in where
])
)

View File

View File