Start a design document for Ocarina 6

Up until now I've just been coding whatever I feel like without thinking
about it too much.  This time I'm actually going to come up with an
ocarina design and then implement it according to the document.  The doc
can then act as a reference for how and why things are done for future
work.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2013-05-13 23:13:54 -04:00 committed by Anna Schumaker
parent 7dc88a1e46
commit e4fa2155b9
1 changed files with 88 additions and 0 deletions

88
design.txt Normal file
View File

@ -0,0 +1,88 @@
===============================================================================
= =
= Ocarina 6.0 =
= =
===============================================================================
My main goal for Ocarina 6.x is to stop writing my own solutions to problems
that have already been solved. For example, this means using SQL to store
a library rather than developing my own file format. This should help with
future maintenance because I'll have less code to navigate.
SQLite:
I plan on using SQLite for data storage as much as possible. I had
been using my own custom file formats for storing preferences or
libraries, but this is turning into a hassle as I have more code that
needs to be maintained. Try to use an SQLite prepared statement
whenever possible.
#include <sqlite3.h>
$ pkg-config --cflags --libs sqlite3
Files:
$HOME/.ocarina{-debug}/ocarina.db
Database: (ocarina.db)
Paths -
create table if not exists paths(
id INTEGER PRIMARY KEY AUTOINCREMENT,
filepath TEXT UNIQUE, /* root path of library */
enabled INTEGER, /* 0 = false, 1 = true */
);
Artist -
create table if not exists artists(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE
);
Album -
create table if not exists albums(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE,
year SHORT INTEGER,
);
Tracks -
create table if not exists tracks(
id INTEGER PRIMARY KEY AUTOINCREMENT,
FOREIGN KEY(path_id) REFERENCES paths(id),
FOREIGN KEY(artist_id) REFERENCES artists(id),
FOREIGN KEY(album_id) REFERENCES albums(id),
filepath TEXT UNIQUE, /* full path - libary root */
title TEXT,
comment TEXT,
genre TEXT,
lenstr TEXT,
track UNSIGNED INT,
count UNSIGNED INT DEFAULT 0,
last_day UNSIGNED INT DEFAULT 0,
last_month UNSIGNED INT DEFAULT 0,
last_year UNSIGNED INT DEFAULT 0,
length INT,
bitrate INT,
sample INT,
channels INT,
banned INT, /* 0 = false, 1 = true */
);
Playlist -
create table if not exists playlists(
id INTEGER PRIMARY KEY AUTOINCREMENT,
flags UNSIGNED INTEGER
)
Playlist #N -
create table if not exists playlist{0-9}(
FOREIGN KEY(track) REFERENCES tracks(id),
);
User settings -
create table if not exists config(
name PRIMARY KEY,
value INT,
);
Archlinux packages:
extra/sqlite