kodi-timekeeper/README.md

54 lines
2.9 KiB
Markdown
Raw Normal View History

2022-03-27 00:19:49 +00:00
# kodi-timekeeper
An approach to having kids use a Kodi media center instance: manage session use and keep track of time spent and available budget.
## Getting started
1. Set up a MySQL database by whatever means you prefer. This step is outside the scope of this *getting started* guide.
* In your MySQL daemon create one database and a user with all grants except for the `GRANT` grant on that database, here with account `kodi-timekeeper` as an example on a MySQL 5.7.22 daemon:
```
# Create account
CREATE USER 'kodi-timekeeper'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*hash' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
# Grants for kodi-timekeeper@localhost
GRANT USAGE ON *.* TO 'kodi-timekeeper'@'localhost';
GRANT ALL PRIVILEGES ON `kodi-timekeeper`.* TO 'kodi-timekeeper'@'localhost';
```
Here `hash` is the hashed account password. To compute it yourself head into your MySQL daemon and execute the query:
```
SELECT CONCAT('*', UPPER(SHA1(UNHEX(SHA1('topsecret')))));
```
The result of which will be something like:
```
*6C47D9CD3A183D230B04FE7F38D7D313E2B4B5AE
```
Which is the hash representation of password `topsecret`. This query-hash mechanism comes courtesy of René Cannaò formerly of Pythian Services Inc. in his 2011 [article "Hashing Algorithm in MySQL PASSWORD()" at blog.pythian.com](https://blog.pythian.com/hashing-algorithm-in-mysql-password-2/).
2. On your operating system make sure the `mysql_config` binary exists. On a Debian or a derivative distribution that typically involves `sudo apt-get install default-libmysqlclient-dev`.
3. `git clone` this repo
4. Install requirements via `pip install -r requirements.txt`
5. Export the following shell environment variables as needed. The next step will use these variables to connect to your database and create tables. Values below are defaults so if you want to stick to a default feel free to simply not export the variable.
```
export DB_DIALECTDRIVER='mysql'
export DB_USER='kodi-timekeeper'
export DB_PASSWORD='-kodi-timekeeper'
export DB_HOST='localhost'
export DB_NAME='kodi-timekeeper'
```
6. Navigate into the repository's `db` subdirectory
7. Initialize your database: `alembic upgrade head`
## Valid Conventional Commits scopes
* `meta`: Affects the Git project's structure such as for example a `pyproject.toml` change, adding a new directory or changing how a news fragment file is formatted
* Examples:
```
refactor(meta): Move pytest config into 'pyproject.toml'
```
```
build(meta): Set custom towncrier news topics
```
2022-05-04 00:56:23 +02:00
* `db`: Affects database connectivity features, for example being able to migrate database versions or installing an empty database
* Examples:
```
feat(db): Add requirements for database work
```