2013-05-13 23:13:54 -04:00
|
|
|
===============================================================================
|
|
|
|
= =
|
|
|
|
= Ocarina 6.0 =
|
|
|
|
= =
|
|
|
|
===============================================================================
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
Ocarina 6.0 is the 6th (re)writing of the Ocarina music player - a lightweight,
|
|
|
|
GTK+ based music player. Improvements over the 5.x series will include the
|
|
|
|
existence of both a design document and unit tests, two items that will help
|
|
|
|
the main developer stay focused and make maintenance easier.
|
2013-05-13 23:13:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
Ocarina 6.0 will use Gstreamer 1.0 for audio playback and GTK-MM 3 for user
|
|
|
|
interface development.
|
2013-05-26 11:08:41 -04:00
|
|
|
|
|
|
|
|
2013-07-04 18:03:15 -04:00
|
|
|
|
2013-05-13 23:13:54 -04:00
|
|
|
Files:
|
2013-07-06 11:42:13 -04:00
|
|
|
$HOME/.ocarina{-debug}/
|
|
|
|
album.db
|
|
|
|
artist.db
|
|
|
|
genre.db
|
|
|
|
library.db
|
2013-12-28 14:01:38 -05:00
|
|
|
playlist.db
|
2014-01-04 11:21:05 -05:00
|
|
|
playqueue.lst
|
2013-07-06 11:42:13 -04:00
|
|
|
track.db
|
|
|
|
/usr/bin/
|
|
|
|
ocarina
|
|
|
|
/usr/lib/ocarina/
|
2013-05-26 11:08:41 -04:00
|
|
|
ocarina/
|
|
|
|
design.txt
|
2013-08-25 10:56:59 -04:00
|
|
|
ocarina/gui/
|
|
|
|
*
|
2013-12-28 14:01:38 -05:00
|
|
|
ocarina6.glade
|
2013-05-26 11:08:41 -04:00
|
|
|
ocarina/include/
|
2013-06-30 23:15:13 -04:00
|
|
|
audio.h
|
2014-01-15 20:40:24 -05:00
|
|
|
callback.h
|
2013-06-27 16:20:38 -04:00
|
|
|
database.h
|
|
|
|
database.hpp
|
2013-12-22 17:22:40 -05:00
|
|
|
deck.h
|
2013-12-28 14:01:38 -05:00
|
|
|
error.h
|
2013-06-27 23:48:09 -04:00
|
|
|
file.h
|
2013-07-04 17:44:40 -04:00
|
|
|
filter.h
|
2013-07-05 10:39:55 -04:00
|
|
|
idle.h
|
2013-08-07 21:21:13 -04:00
|
|
|
idle.hpp
|
2013-05-26 11:08:41 -04:00
|
|
|
library.h
|
|
|
|
playlist.h
|
2013-12-28 14:01:38 -05:00
|
|
|
playqueue.h
|
2013-07-04 18:03:15 -04:00
|
|
|
print.h
|
|
|
|
version.h
|
2013-05-26 11:08:41 -04:00
|
|
|
ocarina/lib/
|
2013-06-30 23:15:13 -04:00
|
|
|
audio.cpp
|
2014-01-15 20:40:24 -05:00
|
|
|
callback.cpp
|
2013-06-27 16:20:38 -04:00
|
|
|
database.cpp
|
2013-12-22 17:22:40 -05:00
|
|
|
deck.cpp
|
2013-06-27 23:48:09 -04:00
|
|
|
file.cpp
|
2013-07-06 11:42:13 -04:00
|
|
|
filter.cpp
|
2013-07-05 10:39:55 -04:00
|
|
|
idle.cpp
|
2013-05-26 11:08:41 -04:00
|
|
|
library.cpp
|
|
|
|
playlist.cpp
|
2013-12-28 14:01:38 -05:00
|
|
|
playqueue.cpp
|
2013-06-27 16:20:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-04 18:03:15 -04:00
|
|
|
Install:
|
|
|
|
Ocarina will be compiled into a single executable placed under
|
|
|
|
/usr/bin/. Any extra files needed to run will be placed under
|
|
|
|
/usr/lib/ocarina/.
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
Errors: (include/error.h
|
|
|
|
This file contains an enum defining error codes used throughout the
|
|
|
|
codebase.
|
|
|
|
|
|
|
|
Error Codes:
|
|
|
|
enum error_t {
|
2013-12-29 21:12:32 -05:00
|
|
|
EAUDIO = 1, /* Audio error */
|
|
|
|
EEXIST, /* Requested object does not exist */
|
|
|
|
EINVAL, /* Invalid operation requested */
|
|
|
|
EIO, /* I/O error */
|
|
|
|
ENOTRACK,
|
2013-12-28 14:01:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-05 12:14:51 -04:00
|
|
|
Printing: (include/print.h>
|
2013-07-04 18:03:15 -04:00
|
|
|
Sometimes text needs to be printed to the screen so users (or debuggers)
|
2013-12-28 14:01:38 -05:00
|
|
|
can trace what is going on.
|
2013-07-04 18:03:15 -04:00
|
|
|
|
|
|
|
API:
|
2013-12-28 14:01:38 -05:00
|
|
|
void print(string fmt, ...);
|
|
|
|
void dprint(string fmt, ...);
|
|
|
|
Print text to the screen. The dprint() option will only only
|
|
|
|
be implemented when when CONFIG_DEBUG or CONFIG_TEST is enabled,
|
|
|
|
and will be an empty function otherwise.
|
2013-07-04 18:03:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-27 10:25:15 -04:00
|
|
|
Versioning: (include/version.h)
|
|
|
|
This file contains a simple function for returning a string stating
|
|
|
|
the current version.
|
2013-07-05 10:39:55 -04:00
|
|
|
|
2013-07-27 10:25:15 -04:00
|
|
|
API:
|
|
|
|
const char *get_version();
|
|
|
|
Returns a string describing the current version.
|
2013-07-05 10:39:55 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-15 20:40:24 -05:00
|
|
|
Callbacks: (lib/callback.cpp)
|
|
|
|
Callbacks are used to notify a unit test or the gui that something in
|
|
|
|
the backend has changed. The callbacks structure should be initialized
|
|
|
|
with no-op default values and filled in by the user through the
|
|
|
|
get_callbacks() function.
|
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
|
2014-01-15 20:40:24 -05:00
|
|
|
- Callback functions:
|
|
|
|
struct Callbacks {
|
|
|
|
void (*on_library_add)(unsigned int, library :: Library *);
|
|
|
|
void (*on_library_update)(unsigned int, library :: Library *);
|
2014-01-18 11:00:08 -05:00
|
|
|
void (*on_library_track_add)();
|
2014-01-15 20:40:24 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct Callbacks callbacks;
|
|
|
|
|
|
|
|
- API:
|
|
|
|
struct Callbacks *get_callbacks();
|
|
|
|
Return the Callbacks structure;
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-27 23:48:09 -04:00
|
|
|
On-disk files: (lib/file.cpp)
|
2013-07-27 11:39:05 -04:00
|
|
|
Data will be stored in the user's home directory according to the
|
|
|
|
XDG / freedesktop.org specification. This means storing data in
|
|
|
|
$XDG_DATA_HOME/ocarina{-debug|-test}/ and storing configuration in
|
|
|
|
$XDG_CONFIG_HOME/ocarina{-debug|-test}/. In addition, I will support
|
|
|
|
importing data from Ocarina 5.10 for conversion to the new format.
|
|
|
|
|
|
|
|
In theory my file format will not change often, so it should be
|
|
|
|
possible to use multiple Ocarina versions with the same data. However,
|
|
|
|
should the format need to change I will only support forward
|
|
|
|
compatibility. This means that downgrades will not be possible after
|
|
|
|
a file format change. To keep the code even cleaner, I will only
|
|
|
|
support updating from the previous file format version. This means
|
|
|
|
that legacy support will be removed after the first file format change.
|
2013-06-27 16:20:38 -04:00
|
|
|
|
2013-06-27 22:41:03 -04:00
|
|
|
Items should be written to a file with either a space or new line
|
|
|
|
separating multiple values.
|
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- Notation:
|
2013-12-28 14:01:38 -05:00
|
|
|
"File << aaaaa << bbbbb << endl" is translated into "aaaaa bbbbb\n"
|
2013-06-27 22:41:03 -04:00
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- File version:
|
2013-07-27 11:39:05 -04:00
|
|
|
#define FILE_VERSION 0
|
|
|
|
|
|
|
|
- Hint where the file is located:
|
|
|
|
enum FileLocHint {
|
|
|
|
FILE_TYPE_CONFIG,
|
|
|
|
FILE_TYPE_DATA,
|
|
|
|
FILE_TYPE_LEGACY,
|
2013-08-10 23:52:52 -04:00
|
|
|
FILE_TYPE_INVALID,
|
2013-07-27 11:39:05 -04:00
|
|
|
}
|
2013-06-27 23:48:09 -04:00
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- Open mode:
|
2013-06-27 23:48:09 -04:00
|
|
|
enum OpenMode {
|
|
|
|
OPEN_READ,
|
|
|
|
OPEN_WRITE,
|
2013-07-28 19:57:07 -04:00
|
|
|
NOT_OPEN,
|
2013-06-27 23:48:09 -04:00
|
|
|
}
|
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- File:
|
2013-07-28 22:33:40 -04:00
|
|
|
class File : std::fstream {
|
2013-06-27 23:48:09 -04:00
|
|
|
private:
|
|
|
|
unsigned int version;
|
|
|
|
OpenMode mode;
|
2013-07-27 11:39:05 -04:00
|
|
|
FileLocHint hint;
|
2013-06-27 23:48:09 -04:00
|
|
|
string filepath;
|
2013-07-28 19:57:07 -04:00
|
|
|
|
2013-06-27 23:48:09 -04:00
|
|
|
public:
|
2013-07-27 11:39:05 -04:00
|
|
|
File(string, FileLocHint);
|
2013-07-28 19:57:07 -04:00
|
|
|
~File();
|
2013-07-27 11:39:05 -04:00
|
|
|
const char *get_filepath();
|
2013-07-28 22:33:40 -04:00
|
|
|
const unsigned int get_version();
|
2013-07-27 11:39:05 -04:00
|
|
|
bool exists();
|
2013-12-28 14:01:38 -05:00
|
|
|
void open(OpenMode);
|
|
|
|
void close();
|
2013-07-28 22:33:40 -04:00
|
|
|
string getline();
|
2013-06-27 23:48:09 -04:00
|
|
|
}
|
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- File format:
|
2013-07-27 11:39:05 -04:00
|
|
|
File << FILE_VERSION << endl;
|
2013-07-28 22:33:40 -04:00
|
|
|
File << <OTHER_DATA>;
|
2013-06-27 23:48:09 -04:00
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- API:
|
2013-12-28 14:01:38 -05:00
|
|
|
File :: File(string filepath, FileLocHint hint);
|
2013-07-27 11:39:05 -04:00
|
|
|
Resolve filepath to one of:
|
|
|
|
XDG_{CONFIG|DATA}_HOME/ocarina/filepath
|
|
|
|
XDG_{CONFIG|DATA}_HOME/ocarina-debug/filepath
|
|
|
|
XDG_{CONFIG|DATA}_HOME/ocarina-test/filepath
|
|
|
|
$HOME/.ocarina/
|
|
|
|
$HOME/.ocarina-debug/
|
2013-12-29 11:45:43 -05:00
|
|
|
$HOME/.ocarina-test/
|
2013-07-27 11:39:05 -04:00
|
|
|
|
2013-08-10 23:52:52 -04:00
|
|
|
If filepath is an empty string, set the file hint to
|
|
|
|
FILE_TYPE_INVALID and do not set the filepath field.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
File :: ~File();
|
2013-07-28 19:57:07 -04:00
|
|
|
Close the file stream if it is open.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
const char *File :: get_filepath();
|
2013-07-27 11:39:05 -04:00
|
|
|
Return the full filepath to the file.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
const unsigned int File :: get_version();
|
2013-07-28 22:33:40 -04:00
|
|
|
Return the file version number.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
bool File :: exists();
|
2013-07-27 11:39:05 -04:00
|
|
|
Return true if the file exists in the filesystem.
|
|
|
|
Return false otherwise.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void File :: open(OpenMode mode);
|
2013-07-27 11:39:05 -04:00
|
|
|
When opening a file for reading (mode == OPEN_READ),
|
2013-12-28 14:01:38 -05:00
|
|
|
- Throw -EEXIST if the file does not exist
|
2013-07-27 11:39:05 -04:00
|
|
|
- Open the file
|
|
|
|
- Read in version from the start of the file
|
|
|
|
|
|
|
|
When opening a file for writing (mode == OPEN_WRITE),
|
2013-12-28 14:01:38 -05:00
|
|
|
- Throw -ELEGACY if the file has FILE_TYPE_LEGACY set
|
2013-07-27 11:39:05 -04:00
|
|
|
- Create missing directories as needed
|
|
|
|
- Write version information to the start of the file
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
Throw -EINVAL if hint == FILE_TYPE_INVALID.
|
|
|
|
Throw -EOPEN if the file is already open.
|
2013-07-28 19:57:07 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void File :: close();
|
2013-07-28 19:57:07 -04:00
|
|
|
Close a file after IO.
|
2013-07-27 11:39:05 -04:00
|
|
|
|
2013-10-06 22:16:54 -04:00
|
|
|
string File :: getline();
|
2013-07-28 22:33:40 -04:00
|
|
|
Read an entire line from the file and return it to the caller.
|
|
|
|
In theory a return value optimization will occur so returning
|
|
|
|
a string by value won't be a problem.
|
2013-06-27 23:48:09 -04:00
|
|
|
|
2013-06-27 16:20:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
Database: (lib/database.cpp)
|
|
|
|
Ocarina 5.x created a different save file format for each type of
|
|
|
|
data that needed to be stored (preferences, library paths, playlists).
|
|
|
|
I intend to unify everything into a generic file format that can be
|
|
|
|
accessed through a generic database interface. The database code will
|
|
|
|
be in charge of printing the "valid" bit for each DatabaseEntry so that
|
|
|
|
child classes do not need to call into the parent class. If valid ==
|
|
|
|
true, the DatabaseEntry will be streamed out followed by a newline. If
|
|
|
|
valid == false the database will print the next entry in the vector.
|
|
|
|
|
|
|
|
Modules should inherit from the DatabasEntry class and implement their
|
|
|
|
own read() and write() functions. The "valid" field will be stored
|
|
|
|
before these functions are called, and the entry will be skipped if
|
|
|
|
valid is set to false.
|
|
|
|
|
|
|
|
The Database class is a templated class, so code could potentially
|
|
|
|
get messy. Normal class declarations can still exist in the file
|
|
|
|
include/database.h and member functions can be written in the file
|
|
|
|
include/database.hpp, which will be included by database.h. Any
|
|
|
|
function not relying on a template can be written in lib/database.cpp.
|
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- DatabaseEntry:
|
2013-06-27 16:20:38 -04:00
|
|
|
class DatabaseEntry { /* let database modify valid flag */
|
|
|
|
public:
|
2013-12-30 18:18:23 -05:00
|
|
|
const std::string primary_key;
|
2013-09-29 22:32:08 -04:00
|
|
|
bool valid;
|
|
|
|
|
2013-12-30 18:18:23 -05:00
|
|
|
DatabaseEntry(const std::string &);
|
2013-08-14 21:13:32 -04:00
|
|
|
virtual void write(File &) = 0;
|
|
|
|
virtual void read(File &) = 0;
|
2013-09-29 22:32:08 -04:00
|
|
|
virtual void print() = 0;
|
2013-06-27 16:20:38 -04:00
|
|
|
};
|
2013-05-26 11:08:41 -04:00
|
|
|
|
2013-06-27 22:41:03 -04:00
|
|
|
File << <CHILD_CLASS_DATA>
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
- IndexEntry:
|
|
|
|
class IndexEntry : public DatabaseEntry {
|
|
|
|
public:
|
2013-12-22 17:22:40 -05:00
|
|
|
set<unsigned int> values;
|
2013-11-23 13:21:17 -05:00
|
|
|
|
|
|
|
void write(File &);
|
|
|
|
void read(File &);
|
|
|
|
void print();
|
2013-12-30 18:18:23 -05:00
|
|
|
void insert(unsigned int);
|
|
|
|
void remove(unsigned int);
|
2013-11-23 13:21:17 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
File << key << endl;
|
|
|
|
File << values.size() << values[0] << .. << values[N] << endl;
|
2013-09-29 20:58:34 -04:00
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- Database:
|
2013-06-27 16:20:38 -04:00
|
|
|
template <class T>
|
|
|
|
class Database {
|
|
|
|
private:
|
2013-09-29 22:32:08 -04:00
|
|
|
vector<T> db;
|
2013-11-23 13:21:17 -05:00
|
|
|
map<std::string, unsigned int> keys;
|
2013-06-27 16:20:38 -04:00
|
|
|
unsigned int _size; /* Number of valid rows */
|
2013-09-29 22:32:08 -04:00
|
|
|
File file;
|
2013-12-28 14:01:38 -05:00
|
|
|
|
2013-06-27 16:20:38 -04:00
|
|
|
public:
|
2013-09-29 20:58:34 -04:00
|
|
|
Database::Database(filename, flags);
|
2013-06-27 16:20:38 -04:00
|
|
|
void load();
|
|
|
|
void save();
|
2013-11-23 13:21:17 -05:00
|
|
|
void clear();
|
2013-09-29 22:32:08 -04:00
|
|
|
void print();
|
2013-12-22 17:22:40 -05:00
|
|
|
void print_keys();
|
2013-08-14 21:13:32 -04:00
|
|
|
|
2013-06-27 23:16:21 -04:00
|
|
|
unsigned int insert(T);
|
2013-12-30 18:18:23 -05:00
|
|
|
void remove(unsigned int);
|
2013-08-14 21:13:32 -04:00
|
|
|
unsigned int size();
|
|
|
|
unsigned int num_rows();
|
|
|
|
|
|
|
|
unsigned int first();
|
|
|
|
unsigned int last();
|
2013-11-23 13:21:17 -05:00
|
|
|
unsigned int next(unsigned int &);
|
2013-12-28 14:01:38 -05:00
|
|
|
bool has_key(const std :: string &);
|
2013-12-22 17:22:40 -05:00
|
|
|
unsigned int find_index(const std::string &);
|
|
|
|
T &find(const std::string &);
|
2013-08-07 22:00:14 -04:00
|
|
|
T &operator[](unsigned int);
|
2013-06-27 16:20:38 -04:00
|
|
|
};
|
2013-05-26 11:08:41 -04:00
|
|
|
|
2013-06-27 23:48:09 -04:00
|
|
|
File << db.size() << endl
|
2013-06-27 22:41:03 -04:00
|
|
|
File << INDEX_0 << db[INDEX_0].valid << db[INDEX_0] << endl;
|
2013-09-29 22:32:08 -04:00
|
|
|
File << INDEX_1 << db[INDEX_1].valid << db[INDEX_1] << endl;
|
2013-06-27 22:41:03 -04:00
|
|
|
...
|
2013-06-27 16:20:38 -04:00
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- API:
|
2013-09-29 22:32:08 -04:00
|
|
|
Database :: Database(filename, flags);
|
2013-08-10 23:38:57 -04:00
|
|
|
Initializes database to use ~/.ocarina{-debug}/filename.
|
2013-09-29 20:58:34 -04:00
|
|
|
Set up flags.
|
2013-08-07 22:00:14 -04:00
|
|
|
|
2013-09-29 22:32:08 -04:00
|
|
|
void Database :: load();
|
|
|
|
Reads a saved database from disk.
|
|
|
|
|
|
|
|
void Database :: save();
|
|
|
|
Saves the database to disk.
|
2013-08-07 22:00:14 -04:00
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
void Database :: clear();
|
2013-12-28 14:01:38 -05:00
|
|
|
This function exists only if CONFIG_TEST is enabled.
|
2013-11-23 13:21:17 -05:00
|
|
|
Clear the database contents in-memory, but do NOT write
|
|
|
|
to disk.
|
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
void Database :: print();
|
2013-12-28 14:01:38 -05:00
|
|
|
This function exists only If CONFIG_TEST is enabled.
|
2013-09-29 22:32:08 -04:00
|
|
|
Following a similar format for writing to disk, print the
|
|
|
|
database to the console in a human-readable format.
|
2013-08-07 22:00:14 -04:00
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
void Database :: print_keys();
|
2013-12-28 14:01:38 -05:00
|
|
|
This function exists only if CONFIG_TEST is enabled.
|
2013-12-22 17:22:40 -05:00
|
|
|
Print out the collected primary keys in the database.
|
|
|
|
|
2013-08-07 22:00:14 -04:00
|
|
|
template <class T>
|
2013-09-29 22:32:08 -04:00
|
|
|
unsigned int Database :: insert(T &);
|
2013-11-23 13:21:17 -05:00
|
|
|
Adds a new item to the db and marks it as valid. A reverse
|
|
|
|
mapping is also created into the keys map to map the primary
|
|
|
|
key back to the id of the newly added item.
|
2013-08-14 21:13:32 -04:00
|
|
|
|
2013-12-30 18:18:23 -05:00
|
|
|
void Database :: remove(unsigned int index);
|
2013-08-14 21:13:32 -04:00
|
|
|
Mark db[index] as invalid (quick deletion).
|
|
|
|
|
2013-09-29 22:32:08 -04:00
|
|
|
unsigned int Database :: size();
|
2013-08-14 21:13:32 -04:00
|
|
|
Returns number of valid rows in the database.
|
2013-08-07 22:00:14 -04:00
|
|
|
|
2013-09-29 22:32:08 -04:00
|
|
|
unsigned int Database :: num_rows();
|
2013-08-14 21:13:32 -04:00
|
|
|
Return db.size().
|
2013-08-07 22:00:14 -04:00
|
|
|
|
2013-09-29 22:32:08 -04:00
|
|
|
unsigned int Database :: first();
|
2013-12-30 18:18:23 -05:00
|
|
|
Return the id to the first valid row. Return db.size() if
|
|
|
|
there are no valid rows.
|
2013-08-14 21:13:32 -04:00
|
|
|
|
2013-09-29 22:32:08 -04:00
|
|
|
unsigned int Database :: last();
|
2013-12-30 18:18:23 -05:00
|
|
|
Return the id of the last valid row. Return db.size() if
|
|
|
|
there are no valid rows.
|
2013-08-14 21:13:32 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
unsigned int Database :: next(unsigned int &id);
|
2013-12-30 18:18:23 -05:00
|
|
|
Return the id of the next valid row or return db.size() if
|
|
|
|
there are no valid rows.
|
2013-12-28 14:01:38 -05:00
|
|
|
|
|
|
|
bool Database :: has_key(const std::string &key);
|
|
|
|
Return true if an item with primary key "key" exists in the
|
|
|
|
database, and false otherwise.
|
|
|
|
|
|
|
|
unsigned int Database :: find_index(const std::string key);
|
|
|
|
If the key exists in the database, return the index of the
|
|
|
|
database item with that key. Throw -EEXIST if the key is not
|
|
|
|
in the database.
|
2013-08-07 22:00:14 -04:00
|
|
|
|
|
|
|
template <class T>
|
2013-11-23 13:21:17 -05:00
|
|
|
T &Database :: find(const std::string &key);
|
|
|
|
Search for primary key "key" in the database. The reverse
|
2013-12-30 18:18:23 -05:00
|
|
|
mapping should be used to make this operation faster.
|
|
|
|
Throw -EEXIST if the key is not found in the mapping.
|
|
|
|
Throw -EINVAL if the key points to an invalid entry.
|
2013-09-01 11:20:47 -04:00
|
|
|
|
2013-08-14 21:13:32 -04:00
|
|
|
template <class T>
|
2013-12-28 14:01:38 -05:00
|
|
|
T &Database :: operator[](unsigned int index);
|
2013-12-30 18:18:23 -05:00
|
|
|
Return a reference to db[index].
|
|
|
|
Throw -EEXIST if index is out of range.
|
|
|
|
Throw -EINVAL if index is invalid.
|
2013-06-27 23:03:14 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-06 11:42:13 -04:00
|
|
|
Filter: (lib/filter.cpp)
|
2013-08-25 10:36:15 -04:00
|
|
|
Filtering is used to generate a subset of songs displayed by the UI to
|
|
|
|
that users can choose from. The inverted index is generated at startup
|
|
|
|
so there is no need for a remove() function, since it will be wiped
|
|
|
|
the next time the application starts.
|
2013-07-06 11:42:13 -04:00
|
|
|
|
|
|
|
- Index:
|
2013-11-23 13:21:17 -05:00
|
|
|
Database<database :: IndexEntry> filter_index;
|
2013-08-25 10:36:15 -04:00
|
|
|
map<string, string> lowercase_cache;
|
|
|
|
unsigned int lowercase_cache_hits;
|
2013-07-06 11:42:13 -04:00
|
|
|
|
|
|
|
- Parsing:
|
|
|
|
1) Convert the provided string into a list of words, using whitespace
|
2013-08-25 10:36:15 -04:00
|
|
|
and the following characters as delimiters: \/,;()_-~+"
|
2013-07-06 11:42:13 -04:00
|
|
|
|
|
|
|
For each word:
|
|
|
|
2) Check the lowercase_cache to see if we have seen the word before,
|
|
|
|
a) If we have, return the stored string
|
|
|
|
b) Convert the string to lowercase and strip out remaining
|
|
|
|
special characters. Add the result to the lowercase_cache;
|
|
|
|
|
|
|
|
- API:
|
2013-08-25 10:36:15 -04:00
|
|
|
void filter :: add(string, track_id);
|
|
|
|
Parse the string into substrings following the "Parsing"
|
|
|
|
section (above). Add each (substring, track_id) pair to the
|
|
|
|
filter_index.
|
|
|
|
|
|
|
|
To generate substrings, iterate over the word starting from
|
2013-12-28 14:01:38 -05:00
|
|
|
the front. For example: "goron" would contain the substrings
|
|
|
|
{g, go, gor, goro, goron}.
|
2013-08-25 10:36:15 -04:00
|
|
|
|
2013-07-06 11:42:13 -04:00
|
|
|
void filter :: search(string, set<track_id> &);
|
2013-08-25 10:36:15 -04:00
|
|
|
Parse the string into substrings following the "Parsing"
|
|
|
|
section (above). We want to find track_ids that match ALL
|
|
|
|
substrings, so take the intersection of all sets returned by
|
|
|
|
the filter_index for a given substring.
|
|
|
|
|
2013-12-30 20:54:19 -05:00
|
|
|
std::string filter :: to_lowercase(const std::string &string);
|
2013-12-28 14:01:38 -05:00
|
|
|
Split the string into words following step 1 of "Parsing"
|
|
|
|
(above). Assemble and return a result string using the lower
|
|
|
|
case cache to convert each term to lowercase.
|
|
|
|
|
2013-08-25 10:36:15 -04:00
|
|
|
void filter :: print_cache_stats();
|
|
|
|
Print cache hit and size information.
|
|
|
|
|
|
|
|
void filter :: get_index();
|
2013-12-29 11:45:43 -05:00
|
|
|
This function only exists if CONFIG_TEST is enabled.
|
2013-08-25 10:36:15 -04:00
|
|
|
Return the index storing all the filter data.
|
2013-07-06 11:42:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
Idle queue: (lib/idle.cpp)
|
|
|
|
The idle queue is used to schedule tasks to run at a later time. Idle
|
|
|
|
tasks must inherit from the IdleBase class so that multiple templated
|
|
|
|
IdleTask pointers can be placed on the same idle queue.
|
|
|
|
|
|
|
|
Creating an idle queue in idle.hpp will create a new queue for every
|
|
|
|
file that idle.h is included in. I want to have a single, shared
|
|
|
|
idle queue used by the entire application so to get around this the
|
|
|
|
IdleBase class is used and implemented in lib/idle.cpp.
|
|
|
|
|
|
|
|
- IdleBase:
|
|
|
|
class IdleBase {
|
|
|
|
private:
|
|
|
|
schedule();
|
|
|
|
|
|
|
|
public:
|
|
|
|
IdleBase();
|
|
|
|
~IdleBase();
|
|
|
|
virtual void run() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
- IdleTask:
|
|
|
|
template <class T>
|
|
|
|
class IdleTask : IdleBase {
|
|
|
|
private:
|
|
|
|
void (*func)(T &);
|
|
|
|
T &data;
|
|
|
|
|
|
|
|
public:
|
|
|
|
IdleTask(void (*)(T &), T);
|
|
|
|
void run();
|
|
|
|
};
|
|
|
|
|
|
|
|
- Queue:
|
|
|
|
queue<IdleBase *> idle_queue;
|
|
|
|
float queued = 0.0
|
|
|
|
float serviced = 0.0
|
|
|
|
|
|
|
|
- API:
|
|
|
|
void IdleBase :: schedule();
|
|
|
|
Add the idle task to the idle queue. This should be called
|
|
|
|
by the IdleTask constructor.
|
|
|
|
queued++;
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
static inline void idle :: schedule(void (*)(T &), T);
|
|
|
|
Create a new IdleTask to run the function later.
|
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
bool idle :: run_task();
|
2013-11-23 13:21:17 -05:00
|
|
|
If there are tasks on the queue:
|
|
|
|
run the next task
|
|
|
|
scheduled++
|
|
|
|
If there are still tasks on the queue:
|
|
|
|
return true
|
|
|
|
else:
|
|
|
|
queued = 0
|
|
|
|
scheduled = 0
|
|
|
|
return false
|
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
float idle :: get_progress();
|
2013-11-23 13:21:17 -05:00
|
|
|
Return (serviced / queued) to the caller. If there are no
|
|
|
|
tasks, return 1.0 to indicate that the queue is finished (and
|
|
|
|
to avoid a divide-by-zero error).
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
Playlists: (lib/playlist.cpp)
|
2013-12-31 16:58:40 -05:00
|
|
|
Playlists are a new feature in Ocarina 6 and are modeled after Gmail
|
|
|
|
labels. Ocarina 6.0 will support two different playlists that the
|
|
|
|
user can add tracks to: banned and favorites.
|
2013-12-29 11:45:43 -05:00
|
|
|
|
|
|
|
Future releases will add support for more playlists.
|
|
|
|
|
|
|
|
- Database:
|
|
|
|
Database<database :: IndexEntry> playlist_db
|
|
|
|
|
|
|
|
- Default playlists:
|
|
|
|
Favorites:
|
|
|
|
The user will add music they really like to this playlist.
|
2013-12-31 16:58:40 -05:00
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
Banned:
|
|
|
|
The user should add music they do not like to this playlist.
|
2013-12-31 16:58:40 -05:00
|
|
|
Tracks should be removed from the Library playqueue when they
|
|
|
|
are banned and added back to the playqueue when they are
|
2013-12-29 11:45:43 -05:00
|
|
|
un-banned.
|
|
|
|
|
|
|
|
- API
|
2013-12-31 16:58:40 -05:00
|
|
|
void playlist :: init():
|
|
|
|
Load the playlist database.
|
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
void playlist :: add(name, track_id);
|
2013-12-31 16:58:40 -05:00
|
|
|
Add the track_id to the playlist named "name". Save the
|
|
|
|
database to disk.
|
|
|
|
Throw -EEXIST if "name" does not exist.
|
2013-12-29 11:45:43 -05:00
|
|
|
|
|
|
|
void playlist :: del(name, track_id);
|
2013-12-31 16:58:40 -05:00
|
|
|
Remove the track_id from the playlist named "name". Save the
|
|
|
|
database to disk. Attempting to remove a track_id that does
|
|
|
|
not exist is not an error.
|
|
|
|
Throw -EEXIST if "name" does not exist.
|
|
|
|
|
|
|
|
const std::set<unsigned int> &playlist :: get_tracks(name);
|
|
|
|
Return the set of tracks representing the requested group.
|
|
|
|
Throw -EEXIST if "name" does not exist.
|
|
|
|
|
|
|
|
void playlist :: clear();
|
|
|
|
This function only exists if CONFIG_TEST is enabled. Clear
|
|
|
|
(reset) the playlist database.
|
2013-12-29 11:45:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-19 14:07:36 -04:00
|
|
|
Library: (lib/library.cpp)
|
2013-06-27 22:21:07 -04:00
|
|
|
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.
|
2013-05-26 11:08:41 -04:00
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
- Databases:
|
|
|
|
enum DB_Type {
|
|
|
|
DB_ALBUM,
|
|
|
|
DB_ARTIST,
|
|
|
|
DB_GENRE,
|
|
|
|
DB_LIBRARY,
|
|
|
|
DB_TRACK,
|
|
|
|
};
|
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- Album:
|
2013-06-27 22:21:07 -04:00
|
|
|
class library :: Album : public DatabaseEntry {
|
2013-09-01 11:20:47 -04:00
|
|
|
public:
|
2014-01-01 13:34:25 -05:00
|
|
|
/* primary_key = "$name.$year.$artist_id" */
|
2013-06-19 14:07:36 -04:00
|
|
|
string name;
|
2013-12-31 19:57:28 -05:00
|
|
|
string name_lower;
|
2013-11-23 13:21:17 -05:00
|
|
|
unsigned int year;
|
|
|
|
unsigned int artist_id;
|
2013-06-19 14:07:36 -04:00
|
|
|
};
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
File << artist_id << year << name
|
2013-06-27 22:41:03 -04:00
|
|
|
|
2013-12-31 19:57:28 -05:00
|
|
|
- Artist and Genre:
|
|
|
|
class library :: AGInfo : public DatabaseEntry {
|
2013-09-01 11:20:47 -04:00
|
|
|
public:
|
2013-12-31 19:57:28 -05:00
|
|
|
string name; /* primary key */
|
|
|
|
string name_lower;
|
2013-06-21 18:18:53 -04:00
|
|
|
};
|
2013-05-26 11:08:41 -04:00
|
|
|
|
2013-06-27 22:41:03 -04:00
|
|
|
File << name
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
- Library:
|
|
|
|
class library :: Library : public DatabaseEntry {
|
2013-09-01 11:20:47 -04:00
|
|
|
public:
|
2013-12-31 19:57:28 -05:00
|
|
|
string root_path; /* primary_key */
|
2013-12-28 14:01:38 -05:00
|
|
|
unsigned int count;
|
2013-06-27 16:20:38 -04:00
|
|
|
bool enabled;
|
|
|
|
};
|
|
|
|
|
2013-06-27 22:41:03 -04:00
|
|
|
File << enabled << root_path
|
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- Track:
|
2013-12-28 14:01:38 -05:00
|
|
|
The primary key for a track is the full filepath (library.root_path +
|
|
|
|
track.filepath)
|
|
|
|
|
2013-06-27 22:21:07 -04:00
|
|
|
class library :: Track : public DatabaseEntry {
|
2013-09-01 11:20:47 -04:00
|
|
|
public:
|
2013-12-31 19:57:28 -05:00
|
|
|
/* primary_key = library.root_path + "/" + filepath */
|
2013-11-23 13:21:17 -05:00
|
|
|
unsigned int library_id;
|
2013-06-27 16:20:38 -04:00
|
|
|
unsigned int artist_id;
|
|
|
|
unsigned int album_id;
|
|
|
|
unsigned int genre_id;
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
unsigned int track;
|
|
|
|
unsigned int last_year;
|
|
|
|
unsigned int last_month;
|
|
|
|
unsigned int last_day;
|
2013-06-27 16:20:38 -04:00
|
|
|
unsigned int play_count;
|
|
|
|
unsigned int length;
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-06-27 16:20:38 -04:00
|
|
|
string length_str;
|
2013-12-31 19:57:28 -05:00
|
|
|
string title;
|
|
|
|
string title_lower;
|
2013-06-27 16:20:38 -04:00
|
|
|
string filepath;
|
|
|
|
};
|
|
|
|
|
2013-12-31 19:57:28 -05:00
|
|
|
File << library_id << artist_id << album_id << genre_id;
|
|
|
|
File << track << last_year << last_month << last_day << play_count;
|
|
|
|
File << length << length_str << endl
|
2013-06-27 22:41:03 -04:00
|
|
|
File << title << endl;
|
|
|
|
File << filepath << endl;
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
- Song:
|
|
|
|
struct Song {
|
2013-06-27 22:21:07 -04:00
|
|
|
library :: Album *album;
|
2013-12-31 19:57:28 -05:00
|
|
|
library :: AGInfo *artist;
|
|
|
|
library :: AGInfo *genre;
|
2013-06-27 22:21:07 -04:00
|
|
|
library :: Library *library;
|
|
|
|
library :: Track *track;
|
|
|
|
};
|
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- Databases:
|
2013-06-27 23:16:21 -04:00
|
|
|
Database<library :: Album> album_db(album.db);
|
2013-12-31 19:57:28 -05:00
|
|
|
Database<library :: AGInfo> artist_db(artist.db);
|
|
|
|
Database<library :: AGInfo> genre_db(genre.db);
|
2013-06-27 23:16:21 -04:00
|
|
|
Database<library :: Library> library_db(library.db);
|
|
|
|
Database<library :: Track> track_db(track.db);
|
2013-06-27 16:20:38 -04:00
|
|
|
|
2013-06-28 00:12:56 -04:00
|
|
|
- Updating algorithm:
|
2013-12-31 19:57:28 -05:00
|
|
|
1) Use a single IdleTask to loop over each track in the library, check
|
|
|
|
if the track still exists in the filesystem and remove it from
|
|
|
|
library_db if not.
|
|
|
|
2) For each directory in the scan directory, create an IdleTask to
|
|
|
|
scan the next level of directories.
|
|
|
|
3) For each file in the scan directory, check if the file already
|
|
|
|
exists in the track_db and add it to the database if not. Save
|
|
|
|
each database after adding files.
|
2013-06-27 22:21:07 -04:00
|
|
|
|
|
|
|
The taglib library should be used for finding artist, album, etc. tags
|
|
|
|
for each track.
|
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
- Importing
|
|
|
|
Ocarina 5.11 stores library files in ~/.ocarina/library/. Importing
|
|
|
|
involves reading each file and adding them to the database. If the file
|
|
|
|
describes a path already in the database then DO NOT overwrite the
|
|
|
|
current path and instead move on to the next file. If version != 2 then
|
|
|
|
move on to the next file.
|
|
|
|
|
|
|
|
File format:
|
|
|
|
File << version << endl; /* version == 2 */
|
|
|
|
File << path << endl;
|
|
|
|
File << id << enabled << next_track_id << size << endl;
|
|
|
|
File << <track list>
|
|
|
|
|
|
|
|
Track format:
|
|
|
|
File << filepath << endl;
|
|
|
|
File << title << endl;
|
|
|
|
File << artist << endl;
|
|
|
|
File << album << endl;
|
|
|
|
File << comment << endl;
|
|
|
|
File << genre << endl;
|
|
|
|
File << lenstr << endl;
|
|
|
|
File << id << year << track << count;
|
|
|
|
File << last_day << last_month << last_year;
|
|
|
|
File << length << bitrate << sample << channels << banned << endl;
|
|
|
|
|
2013-08-28 20:59:57 -04:00
|
|
|
- Testing:
|
2013-11-23 13:21:17 -05:00
|
|
|
The script tests/library/gen_library.sh will create a sample library
|
|
|
|
in the /tmp/ directory for testing purposes. All the track files are
|
|
|
|
complete silence, but the script will fake up tags for each file.
|
2013-08-28 20:59:57 -04:00
|
|
|
|
2013-12-29 11:52:05 -05:00
|
|
|
To test importing, create several mock library files and copy them to
|
|
|
|
~/.ocarina-test/library/ and attempt to read them in.
|
|
|
|
|
2013-05-26 11:08:41 -04:00
|
|
|
- API
|
2013-11-23 13:21:17 -05:00
|
|
|
void library :: init();
|
2013-12-28 14:01:38 -05:00
|
|
|
Initialize databases and read files from disk. While reading
|
|
|
|
the library:
|
2013-12-31 19:57:28 -05:00
|
|
|
- Update the count of tracks in each library path
|
2013-12-28 14:01:38 -05:00
|
|
|
- Find the lowercase text of artist, album, genre, track
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void library :: add_path(string dir);
|
2013-11-23 13:21:17 -05:00
|
|
|
If dir is not a directory:
|
2013-12-28 14:01:38 -05:00
|
|
|
throw -EINVAL
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2014-01-15 20:40:24 -05:00
|
|
|
Trigger the on_library_add() callback on success.
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
void library :: del_path(unsigned int lib_id);
|
|
|
|
Invalidate a library_db row and all tracks owned by that path
|
2013-12-31 19:57:28 -05:00
|
|
|
if lib_id is not valid, throw -EEXIST.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
void library :: update_path(lib_id);
|
2013-12-31 19:57:28 -05:00
|
|
|
Update the given library_db row.
|
|
|
|
If lib_id is not valid, throw -EEXIST.
|
|
|
|
|
2014-01-15 20:40:24 -05:00
|
|
|
Trigger the on_library_update() callback.
|
|
|
|
|
2013-12-31 19:57:28 -05:00
|
|
|
void library :: update_all();
|
|
|
|
Update all library paths.
|
2014-01-15 20:40:24 -05:00
|
|
|
Trigger the on_library_update() callback for each path.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
struct Song library :: lookup(track_id);
|
2013-12-31 19:57:28 -05:00
|
|
|
Fill out a Song structure for the provided track_id.
|
|
|
|
Throw -EEXIST if there is no track mapping to track_id.
|
2013-12-28 14:01:38 -05:00
|
|
|
|
2014-01-01 20:55:07 -05:00
|
|
|
struct library :: Library *library :: lookup_path(unsigned int id);
|
2013-12-31 19:57:28 -05:00
|
|
|
Return the library path with index id.
|
|
|
|
Throw -EEXIST if there is no such path.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
void library :: import();
|
|
|
|
Call this function to import an Ocarina 5.11 style library,
|
|
|
|
following the "Importing" section above.
|
|
|
|
|
2013-12-31 19:57:28 -05:00
|
|
|
#ifdef CONFIG_TEST
|
2013-11-23 13:21:17 -05:00
|
|
|
void library :: print_db(DB_Type);
|
|
|
|
Print the database corresponding to DB_Type
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
void library :: reset();
|
|
|
|
Clear all databases, returning the library to an empty state.
|
2013-12-31 19:57:28 -05:00
|
|
|
endif /* CONFIG_TEST */
|
|
|
|
|
2013-05-26 11:08:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
Playqueue: (lib/playqueue.cpp)
|
|
|
|
Playqueues are a list of songs that the user has requested to play.
|
2013-07-27 10:25:15 -04:00
|
|
|
|
|
|
|
- Flags:
|
2013-12-28 14:01:38 -05:00
|
|
|
enum playqueue_flags {
|
|
|
|
PQ_ENABLED (1 << 0),
|
|
|
|
PQ_RANDOM (1 << 1),
|
|
|
|
PQ_REPEAT (1 << 2),
|
|
|
|
};
|
|
|
|
|
|
|
|
- Sort order:
|
|
|
|
enum sort_t {
|
2014-01-02 21:58:18 -05:00
|
|
|
SORT_ARTIST_ASC = 1,
|
|
|
|
SORT_ARTIST_DESC = 2,
|
|
|
|
SORT_ALBUM_ASC = 3,
|
|
|
|
SORT_ALBUM_DESC = 4,
|
|
|
|
SORT_COUNT_ASC = 5,
|
|
|
|
SORT_COUNT_DESC = 6,
|
|
|
|
SORT_GENRE_ASC = 7,
|
|
|
|
SORT_GENRE_DESC = 8,
|
|
|
|
SORT_LENGTH_ASC = 9,
|
|
|
|
SORT_LENGTH_DESC = 10,
|
|
|
|
SORT_PLAYED_ASC = 11,
|
|
|
|
SORT_PLAYED_DESC = 12,
|
|
|
|
SORT_TITLE_ASC = 13,
|
|
|
|
SORT_TITLE_DESC = 14,
|
|
|
|
SORT_TRACK_ASC = 15,
|
|
|
|
SORT_TRACK_DESC = 16,
|
|
|
|
SORT_YEAR_ASC = 17,
|
|
|
|
SORT_YEAR_DESC = 18,
|
2013-07-27 10:25:15 -04:00
|
|
|
};
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
- Playqueue:
|
|
|
|
class Playqueue {
|
2013-07-27 10:25:15 -04:00
|
|
|
private:
|
2013-12-22 17:22:40 -05:00
|
|
|
vector<track_id> tracks;
|
2014-01-02 21:58:18 -05:00
|
|
|
list<sort_t> sort_order; /* default = { SORT_ARTIST_ASC,
|
|
|
|
SORT_YEAR_ASC,
|
|
|
|
SORT_TRACK_ASC };
|
2013-07-27 10:25:15 -04:00
|
|
|
unsigned int cur;
|
|
|
|
unsigned int flags;
|
2013-12-29 11:45:43 -05:00
|
|
|
unsigned int length;
|
2013-07-27 10:25:15 -04:00
|
|
|
public:
|
2013-12-28 14:01:38 -05:00
|
|
|
Playqueue(flags);
|
2013-12-27 17:25:45 -05:00
|
|
|
void write(File &);
|
|
|
|
void read(File &);
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void set_flag(playqueue_flags);
|
|
|
|
void unset_flag(playqueue_flags);
|
2013-07-27 10:25:15 -04:00
|
|
|
const unsigned int get_flags();
|
2013-12-29 11:45:43 -05:00
|
|
|
string get_length();
|
2013-07-27 10:25:15 -04:00
|
|
|
|
2013-12-27 17:25:45 -05:00
|
|
|
unsigned int add(track_id);
|
2013-12-28 14:01:38 -05:00
|
|
|
unsigned int add_front(track_id);
|
|
|
|
void del(playqueue_id);
|
2013-12-27 17:25:45 -05:00
|
|
|
unsigned int size();
|
2013-07-27 10:25:15 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void reset_sort();
|
|
|
|
void add_sort(sort_t, bool);
|
2013-07-27 10:25:15 -04:00
|
|
|
void sort();
|
2013-12-28 14:01:38 -05:00
|
|
|
|
2013-12-22 17:22:40 -05:00
|
|
|
unsigned int next();
|
2013-12-28 14:01:38 -05:00
|
|
|
void reset_cur();
|
2013-07-27 10:25:15 -04:00
|
|
|
}
|
|
|
|
|
2013-09-01 11:20:47 -04:00
|
|
|
File << flags << tracks.size() << tracks[0] << tracks[1] << ... << tracks[N];
|
|
|
|
|
2013-07-27 10:25:15 -04:00
|
|
|
- API
|
2013-12-28 14:01:38 -05:00
|
|
|
Playqueue :: Playlist(unsigned int flags);
|
|
|
|
Create a new playqueue with the appropriate flags set.
|
|
|
|
sort_order = { (SORT_ARTIST, true), (SORT_YEAR, true),
|
|
|
|
(SORT_TRACK, true) };
|
|
|
|
|
|
|
|
unsigned int Playqueue :: add(unsigned int track_id);
|
|
|
|
unsigned int Playqueue :: add_front(unsigned int track_id);
|
|
|
|
Add a new track to the tracks vector and return the index. If
|
|
|
|
add_front is called, the track will be added to the front of
|
2013-12-29 11:45:43 -05:00
|
|
|
the playqueue (index = 0).
|
|
|
|
length += track.length.
|
2013-12-28 14:01:38 -05:00
|
|
|
|
|
|
|
void Playqueue :: del(unsigned int playqueue_id);
|
|
|
|
Erase tracks[playqueue_id] from the tracks vector.
|
2013-12-29 11:45:43 -05:00
|
|
|
length -= track.length.
|
2013-12-28 14:01:38 -05:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
void Playqueue :: del_track(unsigned int track_id);
|
|
|
|
Erase all tracks with track id track_id.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void Playqueue :: set_flag(playqueue_flags flag);
|
|
|
|
void Playqueue :: unset_flag(playqueue_flags flag);
|
2013-12-22 17:22:40 -05:00
|
|
|
Set or unset the given flag.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
const unsigned int Playqueue :: get_flags();
|
2013-12-22 17:22:40 -05:00
|
|
|
Return the currently enabled flags.
|
2013-07-27 10:25:15 -04:00
|
|
|
|
2013-12-29 11:45:43 -05:00
|
|
|
song Playqueue :: get_length();
|
|
|
|
Convert the length variable into a string and return the result
|
|
|
|
to the caller.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
unsigned int Playqueue :: size();
|
2013-12-22 17:22:40 -05:00
|
|
|
Return tracks.size();
|
2013-07-27 10:25:15 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void Playqueue :: write(File &);
|
|
|
|
void Playqueue :: read(File &);
|
|
|
|
Read or write the playqueue to the file.
|
|
|
|
|
|
|
|
void Playqueue :: reset_sort();
|
|
|
|
Reset the sort_order list to empty.
|
2013-07-27 10:25:15 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void Playqueue :: add_sort(sort_t type, bool ascending);
|
|
|
|
Add a new term to the sort order.
|
2013-07-27 10:25:15 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void Playqueue :: sort();
|
|
|
|
Perform a stable sort on the entire playqueue. Compare tracks
|
|
|
|
based on the sort_order list.
|
|
|
|
|
|
|
|
unsigned int Playqueue :: next();
|
2013-12-27 17:25:45 -05:00
|
|
|
Return the next track_id to play.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
if (tracks.size() == 0)
|
|
|
|
throw -EEXIST;
|
|
|
|
|
2013-12-22 17:22:40 -05:00
|
|
|
if (flags & PL_RANDOM):
|
|
|
|
cur += rand() % tracks.size();
|
|
|
|
else:
|
|
|
|
cur += 1;
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-22 17:22:40 -05:00
|
|
|
if (cur > = tracks.size())
|
|
|
|
cur -= tracks.size();
|
|
|
|
track = tracks[cur];
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
if (!(flags & PL_REPEAT)):
|
2013-12-29 11:45:43 -05:00
|
|
|
length -= track.length;
|
2013-12-22 17:22:40 -05:00
|
|
|
tracks.erase(cur);
|
|
|
|
return track;
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void Playqueue :: reset_cur();
|
|
|
|
This function is intended to be used by the audio layer when
|
|
|
|
managing the recently played playqueue.
|
|
|
|
|
|
|
|
cur = 0;
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
|
|
|
|
|
2013-12-22 17:22:40 -05:00
|
|
|
Deck: (lib/deck.cpp)
|
2013-12-28 14:01:38 -05:00
|
|
|
The playqueue deck is used to hold the temporary playqueues created by
|
2013-12-22 17:22:40 -05:00
|
|
|
the user.
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
This module also controls the library playqueue, which should be updated
|
|
|
|
using the on_library_track_add() and on_library_track_del() callback
|
|
|
|
functions. The library playqueue will always have PQ_ENABLED and
|
|
|
|
PQ_REPEAT set. This playlist will default to PQ_RANDOM unset.
|
|
|
|
|
2013-12-22 17:22:40 -05:00
|
|
|
- Deck:
|
2013-12-28 14:01:38 -05:00
|
|
|
list<Playqueue> deck;
|
2014-01-18 11:00:08 -05:00
|
|
|
Playqueue library_pq;
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
File << library_pq.random << deck.size() << endl;
|
2013-12-22 17:22:40 -05:00
|
|
|
File << deck[0] << endl;
|
|
|
|
File << deck[N] << endl;
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-22 17:22:40 -05:00
|
|
|
- API
|
2014-01-18 11:00:08 -05:00
|
|
|
void deck :: init();
|
|
|
|
Set up callbacks used by the library.
|
|
|
|
|
2013-12-27 17:25:45 -05:00
|
|
|
void deck :: read(File &);
|
|
|
|
void deck :: write(File &);
|
2013-12-28 14:01:38 -05:00
|
|
|
Read or write the playqueue file. This will be called
|
2013-12-27 17:25:45 -05:00
|
|
|
from the audio layer to store state.
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
Playqueue *deck :: create();
|
|
|
|
Adds a new playqueue to the end of the deck and returns a
|
2013-12-27 17:25:45 -05:00
|
|
|
pointer to it.
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-27 17:25:45 -05:00
|
|
|
void deck :: remove(N);
|
2013-12-28 14:01:38 -05:00
|
|
|
Remove playqueue N from the deck.
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
Playqueue *deck :: get(N);
|
|
|
|
Return playqueue N from the deck.
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-27 17:25:45 -05:00
|
|
|
void deck :: move(M, N);
|
2013-12-28 14:01:38 -05:00
|
|
|
Move playqueue at index M to index N.
|
2013-12-27 17:25:45 -05:00
|
|
|
|
2013-12-22 17:22:40 -05:00
|
|
|
unsigned int deck :: next();
|
2013-12-28 14:01:38 -05:00
|
|
|
Iterate through the deck until you find a playqueue with the
|
2014-01-04 11:21:05 -05:00
|
|
|
flag PQ_ENABLED set. Call next() on this playqueue and return
|
2013-12-22 17:22:40 -05:00
|
|
|
the result.
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
If the playqueue is empty after calling next(), remove it from
|
2013-12-22 17:22:40 -05:00
|
|
|
the deck.
|
2013-11-23 13:21:17 -05:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
If there are no playqueues on the deck, play a song from the
|
|
|
|
library playqueue.
|
|
|
|
|
2014-01-04 13:09:44 -05:00
|
|
|
If there are no playable IDs, throw -EEXIST.
|
2013-12-27 17:25:45 -05:00
|
|
|
|
|
|
|
void deck :: reset();
|
2013-12-29 11:45:43 -05:00
|
|
|
This function only exists if CONFIG_TEST is enabled. Erase
|
2013-12-28 14:01:38 -05:00
|
|
|
all the playqueue information and reset the deck list.
|
2013-12-27 17:25:45 -05:00
|
|
|
|
|
|
|
void deck :: print_info();
|
2013-12-29 11:45:43 -05:00
|
|
|
This function only exists if CONFIG_TEST is enabled. Print
|
2013-12-28 14:01:38 -05:00
|
|
|
out helpful stats about the current state of the playqueue deck.
|
2013-12-27 17:25:45 -05:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
Playqueue *deck :: get_library_pq();
|
|
|
|
Return the library playqueue.
|
|
|
|
|
2013-11-23 13:21:17 -05:00
|
|
|
|
|
|
|
|
2013-08-07 21:07:07 -04:00
|
|
|
Audio: (lib/audio.cpp)
|
|
|
|
This file will introduce an "audio" namespace containing all of the
|
|
|
|
functions interacting with gstreamer. This will create a wrapper
|
|
|
|
namespace that will be easier to work with than using raw gstreamer
|
|
|
|
functions.
|
|
|
|
|
2013-12-27 17:25:45 -05:00
|
|
|
The audio layer is meant to be an interface used by the front end to
|
|
|
|
control most features of the backend library. This means implementing
|
|
|
|
next track, previous track, and so on here.
|
|
|
|
|
|
|
|
Gstreamer options passed to audio :: init() can be found by running
|
|
|
|
`gst-inspect-1.0 --help-gst` on the command line.
|
2013-08-07 21:07:07 -04:00
|
|
|
|
|
|
|
- Internal:
|
|
|
|
Set up a message bus to look for end-of-stream and error messages so
|
|
|
|
the next song can be played. This function should call the play
|
|
|
|
function after loading a track and after checking the "pause after N"
|
|
|
|
count.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
The audio layer will also create an internal playqueue for tracking
|
|
|
|
recently played songs.
|
|
|
|
|
|
|
|
- State:
|
|
|
|
The audio layer will store the current trackid to disk, and then save
|
|
|
|
the playqueue deck.
|
|
|
|
|
|
|
|
File << current_track << endl
|
|
|
|
deck.write(File);
|
|
|
|
|
2013-08-07 21:07:07 -04:00
|
|
|
- API:
|
2013-12-28 14:01:38 -05:00
|
|
|
void audio :: init(argc, argv);
|
2013-08-07 21:07:07 -04:00
|
|
|
Initialize the gstreamer layer and reload the track that was
|
2013-12-27 17:25:45 -05:00
|
|
|
last loaded before shutdown. Gstreamer is supposed to remove
|
|
|
|
options from the argv array as they are processed, so pass
|
|
|
|
pointers to argc and argv to this function.
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
Read in the state file.
|
|
|
|
|
|
|
|
void audio :: quit();
|
2013-12-27 17:25:45 -05:00
|
|
|
Clean up memory allocated by gstreamer.
|
2013-12-28 14:01:38 -05:00
|
|
|
Write out the state file.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void audio :: play();
|
|
|
|
void audio :: pause();
|
2013-12-27 17:25:45 -05:00
|
|
|
Change the gstreamer state to either GST_STATE_PLAYING or
|
2014-01-04 13:09:44 -05:00
|
|
|
GST_STATE_PAUSED. Do nothing if there is not a track loaded
|
|
|
|
in the pipeline. Throw -EAUDIO if there is an error changing
|
2013-12-28 14:01:38 -05:00
|
|
|
state.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void audio :: seek_to(long);
|
|
|
|
Seek to a position X nanoseconds into the track. Throw -EAUDIO
|
2014-01-04 13:09:44 -05:00
|
|
|
if there is an error seeking to the requested position. Do
|
|
|
|
nothing if there is not a track loaded in the pipeline.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-27 17:25:45 -05:00
|
|
|
Seconds can be converted to nanoseconds by multiplying with
|
|
|
|
GST_SECOND.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void audio :: stop();
|
2013-08-07 21:07:07 -04:00
|
|
|
pause()
|
|
|
|
seek_to(0)
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void audio :: next();
|
2013-12-27 17:25:45 -05:00
|
|
|
Call the deck :: next() function to get the next trackid,
|
2013-11-23 13:21:17 -05:00
|
|
|
and load that file into the gstreamer pipeline. Do not change
|
|
|
|
the state of the pipeline (if nothing is playing yet, don't
|
2014-01-04 13:09:44 -05:00
|
|
|
call play()). Throw -EEXIST if there is no track to load
|
2013-12-28 14:01:38 -05:00
|
|
|
into the pipeline.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
When a track is loaded:
|
|
|
|
Is it already in the recently played playqueue?
|
|
|
|
If yes, remove it from the playqueue.
|
|
|
|
Add to the front of the recently played playqueue.
|
|
|
|
Reset the current pointer in the playqueue to 0.
|
|
|
|
|
|
|
|
Write out the state file.
|
|
|
|
|
|
|
|
void audio :: previous();
|
2013-11-23 13:21:17 -05:00
|
|
|
Call the playlist :: previous() function to iterate backwards
|
2013-12-28 14:01:38 -05:00
|
|
|
through the recently played playqueue. Load the returned trackid
|
2013-11-23 13:21:17 -05:00
|
|
|
without changing the pipeline state.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
trackid audio :: current_trackid();
|
2014-01-04 13:09:44 -05:00
|
|
|
Return the trackid of the currently playing song. If no track
|
|
|
|
is loaded throw -EEXIST;
|
2013-08-07 21:07:07 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
unsigned int audio :: position();
|
2013-11-23 13:21:17 -05:00
|
|
|
Return the number of seconds that the song has played.
|
2013-08-07 21:07:07 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
unsigned int audio :: duration();
|
2013-11-23 13:21:17 -05:00
|
|
|
Return the duration of the current song in seconds.
|
2013-08-07 21:07:07 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
void audio :: pause_after(bool enabled, unsigned int N);
|
2013-12-27 17:25:45 -05:00
|
|
|
Pause after N tracks. The first parameter is a bool
|
|
|
|
representing if this feature is enabled or not (true == enabled,
|
|
|
|
false == disabled).
|
|
|
|
|
|
|
|
The count will only be decremented when an end-of-stream message
|
|
|
|
is received by the gstreamer pipeline, and not when calling
|
|
|
|
next().
|
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
bool audio :: pause_enabled();
|
2013-12-27 17:25:45 -05:00
|
|
|
Return true if pausing is enabled, and false if pausing is
|
|
|
|
disabled.
|
2013-10-06 22:16:54 -04:00
|
|
|
|
2013-12-28 14:01:38 -05:00
|
|
|
unsigned int audio :: pause_count();
|
2013-11-23 13:21:17 -05:00
|
|
|
Return the number of tracks that will be played before
|
|
|
|
playback pauses.
|
2013-07-27 10:25:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-25 10:56:59 -04:00
|
|
|
Gui: (ocarina/*)
|
|
|
|
The GUI will be written in C++ using gtkmm3 for (hopefully) cleaner code.
|
|
|
|
|
|
|
|
- Design requirements:
|
|
|
|
- gtkmm3
|
|
|
|
- Front-end for the library to add, remove and modify paths
|
|
|
|
- This can be hidden since it's not a common task
|
|
|
|
- Double-click to play songs
|
|
|
|
- Front-end for groups to add and remove tracks
|
|
|
|
- This is a common task and should not be hidden
|
|
|
|
- Don't save / restore window size
|
|
|
|
- Some window managers already do this automatically
|
|
|
|
- Set reasonable defaults
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 18:18:53 -04:00
|
|
|
Future work:
|
|
|
|
I want to set reasonable expectations for Ocarina 6 so that I don't
|
|
|
|
have to spend a large amount of time coding before releasing something
|
|
|
|
to the wild. This section will be a list of features that I want, but
|
|
|
|
should be deferred to a future release so basic support can be coded.
|
|
|
|
|
|
|
|
Hint: If feature B depends on A, implement A in 6.x and B in 6.x+1
|
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- New default groups:
|
2013-07-04 17:44:40 -04:00
|
|
|
Unplayed tracks
|
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Categories:
|
2013-06-21 18:18:53 -04:00
|
|
|
Use these to make "groups of groups" for better organization.
|
|
|
|
Different categories can include Album, Artist and Genere
|
|
|
|
dynamic groups in addition to user created groups (see below)
|
|
|
|
|
|
|
|
The Artist, Album and Genre "tables" can be used to populate
|
|
|
|
these categories.
|
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- User created song groups:
|
2013-06-21 18:18:53 -04:00
|
|
|
Basic add and remove features can be implemented using the
|
|
|
|
Library and Banned Songs groups. This will give me a chance
|
|
|
|
to test saving groups on a small scale before letting users
|
|
|
|
create anything they want.
|
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Save a user's playlist as a group:
|
2013-06-21 18:18:53 -04:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Library defragment:
|
2013-06-21 18:18:53 -04:00
|
|
|
Ocarina 6.0 will leave holes in the library when tracks are
|
|
|
|
deleted, potentially leading to fragmentation and larger-than-
|
|
|
|
needed file sizes. A "defragment" utility can be created to
|
|
|
|
clean up unused slots.
|
|
|
|
|
|
|
|
To help with fixing groups, a mapping of (old values) ->
|
|
|
|
(new values) should be kept.
|
2013-06-30 23:15:13 -04:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Fix track durations:
|
2013-06-30 23:15:13 -04:00
|
|
|
Some tracks in my library are tagged with the wrong duration,
|
|
|
|
so fix them as they are played.
|
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Track tag editor:
|
2013-06-30 23:15:13 -04:00
|
|
|
Make a pop-up window for editing the tags of a track. Be sure
|
|
|
|
to update the library information and the on-disk file.
|
2013-07-04 17:44:40 -04:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Album art:
|
2014-01-15 20:40:24 -05:00
|
|
|
(easy) Start with album art fetching script
|
|
|
|
(hard) Build in to Ocarina
|
2013-07-04 17:44:40 -04:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Playlist custom sorting:
|
2013-07-04 17:44:40 -04:00
|
|
|
Click column headers to choos sort order
|
|
|
|
Keep a list of fields that the user has selected and place new
|
|
|
|
fields in the front of this list. Use a recursive stable sort
|
|
|
|
to do the sorting.
|
2013-08-14 21:13:32 -04:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Better design file format:
|
2013-08-25 10:36:15 -04:00
|
|
|
Todo list in each document instead of all at once in the footer.
|
|
|
|
Leave the Todo list out of the official "design document" and
|
|
|
|
keep it in each individual section instead.
|
2013-08-14 21:13:32 -04:00
|
|
|
XML?
|
|
|
|
Code formatting?
|
2014-01-15 20:40:24 -05:00
|
|
|
Checkbox for when features are done? (reference commit)
|
2013-08-25 10:36:15 -04:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Copy a song group to a different directory:
|
2013-08-25 10:36:15 -04:00
|
|
|
This can be useful for keeping an external device (like an
|
|
|
|
Android phone) updated with the music you want to listen to.
|
|
|
|
Complications: I have an mp3 mirror of all my music, and I
|
|
|
|
want the mp3s to be synced. Perhaps track mirrors in Ocarina?
|
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Mirror directory:
|
2013-08-25 10:36:15 -04:00
|
|
|
I rip music to .flac, but keep an mp3 mirror directory to sync
|
|
|
|
to other computers and phones. An Ocarina tool to manage a
|
|
|
|
COMPLETE library mirror might be a good idea so I no longer
|
|
|
|
need to manage it externally. This can still be done with a
|
|
|
|
script, a cron job, and maybe a "mirror this track" option in
|
|
|
|
the library? Perhaps create a mirror group?
|
2013-09-29 20:58:34 -04:00
|
|
|
|
2014-01-18 11:00:08 -05:00
|
|
|
- Extra testing ideas:
|
2013-09-29 20:58:34 -04:00
|
|
|
- Run tests through valgrind to help find memory leaks
|
2013-12-27 17:25:45 -05:00
|
|
|
- Some way to enable / disable tests during development
|
|
|
|
- Run tests based on dependencies
|
|
|
|
- Fix tests that will only work on my computer
|
2014-01-15 20:40:24 -05:00
|
|
|
- Double check that all inputs and outputs are tested
|
|
|
|
- Simple testing library?
|
2014-01-18 11:00:08 -05:00
|
|
|
- Stop tests on failure
|
|
|
|
- Test callbacks
|
2014-01-15 20:40:24 -05:00
|
|
|
|
|
|
|
- Preferences:
|
|
|
|
- Set default sort
|
|
|
|
- Save window size
|
|
|
|
- Set album art size
|
|
|
|
|
|
|
|
- Rip out Ocarina 5.x importing and legacy file support
|
|
|
|
|
|
|
|
- AirPlay / remote audio support
|
|
|
|
|
|
|
|
- Media keys
|
|
|
|
|
|
|
|
- Replaygain support
|
|
|
|
External script to calculate values?
|
|
|
|
Calculate value after first playback?
|
|
|
|
Store in library :: Track structure
|
2014-01-18 11:00:08 -05:00
|
|
|
|
|
|
|
- Autosave databases
|
|
|
|
Artist, album, genere and library path don't change often so
|
|
|
|
saving on every add / remove won't be a huge performance hit
|
|
|
|
and may actually be more efficient in the long run.
|
|
|
|
|
|
|
|
- Scons improvements:
|
|
|
|
Why does everything compile with the same CONFIG_* parameters?
|
|
|
|
Cleanups to tests/Sconscript
|
|
|
|
Global dependency resolution (rather than having multiple ways
|
|
|
|
in lib/ design/ and tests/)
|
|
|
|
|
|
|
|
- Playqueue and database inherit from common class
|
|
|
|
- "About" dialog
|