Skip to content

Database synchronization (3)

Knickedi edited this page Nov 29, 2011 · 17 revisions

Description

With this request you can perform local database synchronization. You can also request the database compression timestamp and request a forced re-compression of the database. Compression means that all data which is not needed is stripped from the database of the player. Because this action is quite expensive the banshee extension will perform it only once a day automatically on player startup. So it will report the same timestamp for a whole day.

The schema of the database is this one:

CREATE TABLE tracks (
    _id INTEGER PRIMARY KEY,
    artistId  INTEGER,            -- foreign key to artists._id
    albumId  INTEGER,             -- foreign key to albums._id
    title TEXT,                   -- track title            (optional)
    trackNumber INTEGER,          -- track number on album  (optional)
    duration INTEGER,             -- duration of track in milliseconds
    year INTEGER,                 -- year of track          (optional)
    genre TEXT                    -- genre of track         (optional)
    rating INTEGER                -- track rating 0 to 5    (optional)
);

CREATE TABLE artists (
    _id INTEGER PRIMARY KEY,
    name TEXT                     -- name of artist         (optional)
);

CREATE TABLE albums (
    _id  PRIMARY KEY,
    artistId INTEGER,             -- foreign key to artists._id
    title TEXT,                   -- title of album         (optional)
    artId TEXT                    -- cover ID               (optional)
);

The tracks._id is the same as returned by Player status.
The albums.artId is the same as returned by Track information and used in Cover.

Parameters

[0x01] - returns 4[database timestamp]
[0x02] - returns +[database bytes]
[0x03] - returns [0x01]

Response

  • [0x01] - last compression timestamp (Integer). 0 indicates that there no database available. If your local available database timestamp equals to the returned one then it's probably up to date and requesting the database file would return the same database anyway.
  • [0x02] - SQLite database file as byte array. A single byte with value 0 means that there's no database available.
  • [0x03] - Request forced re-compression (so refresh) of the database. This request can last a couple of seconds and will return a byte with value 1 finally.
  • all other requests (no parameter or invalid) return byte with value 0.