e13b4afa60
Each component has its own text file. I merge everything together with simple dependency resolution so I can figure out implementation order easier. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
128 lines
3.3 KiB
Plaintext
128 lines
3.3 KiB
Plaintext
== Files ==
|
|
ocarina/include/
|
|
library.h
|
|
ocarina/lib/
|
|
library.cpp
|
|
$HOME/.ocarina{-debug}/
|
|
album.db
|
|
artist.db
|
|
genre.db
|
|
library.db
|
|
track.db
|
|
|
|
== Depends ==
|
|
idle database groups filter
|
|
|
|
Library: (lib/library.cpp)
|
|
The library manages databases containing track information added by the
|
|
user. Ocarina 6 splits the library into multiple database tables for
|
|
storing content. The library will exist in a library namespace to
|
|
to make functions and classes more unique.
|
|
|
|
When a library : Track is created, it should be added to the "Library"
|
|
group if it is NOT a member of the banned songs group.
|
|
|
|
- Album:
|
|
class library :: Album : public DatabaseEntry {
|
|
string name;
|
|
short year;
|
|
};
|
|
|
|
File << year << name
|
|
|
|
- Artist:
|
|
class library :: Artist : public DatabaseEntry {
|
|
string name;
|
|
};
|
|
|
|
File << name
|
|
|
|
- Genre:
|
|
class library :: Genre : public DatabaseEntry {
|
|
string name;
|
|
};
|
|
|
|
File << name
|
|
|
|
- Path:
|
|
class library :: Path : public DatabaseEntry {
|
|
string root_path;
|
|
bool enabled;
|
|
};
|
|
|
|
File << enabled << root_path
|
|
|
|
- Track:
|
|
class library :: Track : public DatabaseEntry {
|
|
unsigned int artist_id;
|
|
unsigned int album_id;
|
|
unsigned int genre_id;
|
|
unsigned int library_id;
|
|
|
|
short track;
|
|
short last_year;
|
|
short last_month;
|
|
short last_day;
|
|
unsigned int play_count;
|
|
unsigned int length;
|
|
string title;
|
|
string length_str;
|
|
string filepath;
|
|
};
|
|
|
|
File << artist_id << album_id << genre_id << library_id << track << last_year
|
|
File << last_year << last_month << last_day << play_count << length << endl
|
|
File << title << endl;
|
|
File << filepath << endl;
|
|
|
|
- Track: /* This struct lies outside the library namespace */
|
|
struct Track {
|
|
library :: Album *album;
|
|
library :: Artist *artist;
|
|
library :: Genre *genre;
|
|
library :: Library *library;
|
|
library :: Track *track;
|
|
};
|
|
|
|
- Databases:
|
|
Database<library :: Album> album_db(album.db);
|
|
Database<library :: Artist> artist_db(artist.db);
|
|
Database<library :: Album> genre_db(genre.db);
|
|
Database<library :: Library> library_db(library.db);
|
|
Database<library :: Track> track_db(track.db);
|
|
|
|
- Updating algorithm:
|
|
set<pair<lib_id, track_path>> known_tracks;
|
|
|
|
1) For each track currently in the library, check if the track exists
|
|
in the filesystem.
|
|
1a) If the track does exist, add to the known_tracks map.
|
|
1b) Else, mark track invalid.
|
|
2) For each file in the scan directory, check if (lib_id, track_path)
|
|
exists in the known_tracks map.
|
|
2a) If the file is in the map, do nothing.
|
|
2b) Else, add track to the library, to the groups "All Music" and
|
|
"Library", and then to the filter index.
|
|
3) Save all databases
|
|
|
|
The taglib library should be used for finding artist, album, etc. tags
|
|
for each track.
|
|
|
|
Use idle tasks for step 2 to break up tagging new files into chunks.
|
|
This way the user will still be able to use Ocarina and scanning can
|
|
happen while idle.
|
|
|
|
- API
|
|
library :: init();
|
|
Initialize all databases
|
|
library :: add_path(string dir);
|
|
Add new row to paths table, update
|
|
library :: del_path(unsigned int lib_id);
|
|
Invalidate a path row
|
|
library :: update_path(lib_id);
|
|
Update the given library path, if valid.
|
|
const Database<LibraryEntry> &library :: get_db();
|
|
Returns the database containing library information.
|
|
struct Track library :: resolve(track_id)
|
|
Fill out a Track structure for the provided track_id
|