mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
[db] add 'channels' to file/queue tbl
This commit is contained in:
parent
c796db251d
commit
b126a2fbc0
16
src/db.c
16
src/db.c
@ -213,6 +213,7 @@ static const struct col_type_map mfi_cols_map[] =
|
||||
{ "album_sort", mfi_offsetof(album_sort), DB_TYPE_STRING, DB_FIXUP_ALBUM_SORT },
|
||||
{ "album_artist_sort", mfi_offsetof(album_artist_sort), DB_TYPE_STRING, DB_FIXUP_ALBUM_ARTIST_SORT },
|
||||
{ "composer_sort", mfi_offsetof(composer_sort), DB_TYPE_STRING, DB_FIXUP_COMPOSER_SORT },
|
||||
{ "channels", mfi_offsetof(channels), DB_TYPE_INT },
|
||||
};
|
||||
|
||||
/* This list must be kept in sync with
|
||||
@ -276,6 +277,7 @@ static const struct col_type_map qi_cols_map[] =
|
||||
{ "type", qi_offsetof(type), DB_TYPE_STRING, DB_FIXUP_CODECTYPE },
|
||||
{ "bitrate", qi_offsetof(bitrate), DB_TYPE_INT },
|
||||
{ "samplerate", qi_offsetof(samplerate), DB_TYPE_INT },
|
||||
{ "chanenls", qi_offsetof(channels), DB_TYPE_INT },
|
||||
};
|
||||
|
||||
/* This list must be kept in sync with
|
||||
@ -346,6 +348,7 @@ static const ssize_t dbmfi_cols_map[] =
|
||||
dbmfi_offsetof(album_sort),
|
||||
dbmfi_offsetof(album_artist_sort),
|
||||
dbmfi_offsetof(composer_sort),
|
||||
dbmfi_offsetof(channels),
|
||||
};
|
||||
|
||||
/* This list must be kept in sync with
|
||||
@ -4644,14 +4647,14 @@ queue_add_file(struct db_media_file_info *dbmfi, int pos, int shuffle_pos, int q
|
||||
"pos, shuffle_pos, path, virtual_path, title, " \
|
||||
"artist, composer, album_artist, album, genre, songalbumid, songartistid," \
|
||||
"time_modified, artist_sort, album_sort, album_artist_sort, year, " \
|
||||
"type, bitrate, samplerate, " \
|
||||
"type, bitrate, samplerate, channels, " \
|
||||
"track, disc, queue_version)" \
|
||||
"VALUES" \
|
||||
"(NULL, %s, %s, %s, %s, " \
|
||||
"%d, %d, %Q, %Q, %Q, " \
|
||||
"%Q, %Q, %Q, %Q, %Q, %s, %s," \
|
||||
"%s, %Q, %Q, %Q, %s, " \
|
||||
"%Q, %s, %s, " \
|
||||
"%Q, %s, %s, %s, " \
|
||||
"%s, %s, %d);"
|
||||
|
||||
char *query;
|
||||
@ -4662,7 +4665,7 @@ queue_add_file(struct db_media_file_info *dbmfi, int pos, int shuffle_pos, int q
|
||||
pos, shuffle_pos, dbmfi->path, dbmfi->virtual_path, dbmfi->title,
|
||||
dbmfi->artist, dbmfi->composer, dbmfi->album_artist, dbmfi->album, dbmfi->genre, dbmfi->songalbumid, dbmfi->songartistid,
|
||||
dbmfi->time_modified, dbmfi->artist_sort, dbmfi->album_sort, dbmfi->album_artist_sort, dbmfi->year,
|
||||
dbmfi->type, dbmfi->bitrate, dbmfi->samplerate,
|
||||
dbmfi->type, dbmfi->bitrate, dbmfi->samplerate, dbmfi->channels,
|
||||
dbmfi->track, dbmfi->disc, queue_version);
|
||||
ret = db_query_run(query, 1, 0);
|
||||
|
||||
@ -4679,14 +4682,14 @@ queue_add_item(struct db_queue_item *item, int pos, int shuffle_pos, int queue_v
|
||||
"pos, shuffle_pos, path, virtual_path, title, " \
|
||||
"artist, composer, album_artist, album, genre, songalbumid, songartistid, " \
|
||||
"time_modified, artist_sort, album_sort, album_artist_sort, year, " \
|
||||
"type, bitrate, samplerate, " \
|
||||
"type, bitrate, samplerate, channels, " \
|
||||
"track, disc, artwork_url, queue_version)" \
|
||||
"VALUES" \
|
||||
"(NULL, %d, %d, %d, %d, " \
|
||||
"%d, %d, %Q, %Q, %Q, " \
|
||||
"%Q, %Q, %Q, %Q, %Q, %" PRIi64 ", %" PRIi64 "," \
|
||||
"%d, %Q, %Q, %Q, %d, " \
|
||||
"%Q, %" PRIu32 ", %" PRIu32 ", " \
|
||||
"%Q, %" PRIu32 ", %" PRIu32 ", %" PRIu32 ", " \
|
||||
"%d, %d, %Q, %d);"
|
||||
|
||||
char *query;
|
||||
@ -4697,7 +4700,7 @@ queue_add_item(struct db_queue_item *item, int pos, int shuffle_pos, int queue_v
|
||||
pos, shuffle_pos, item->path, item->virtual_path, item->title,
|
||||
item->artist, item->composer, item->album_artist, item->album, item->genre, item->songalbumid, item->songartistid,
|
||||
item->time_modified, item->artist_sort, item->album_sort, item->album_artist_sort, item->year,
|
||||
item->type, item->bitrate, item->samplerate,
|
||||
item->type, item->bitrate, item->samplerate, item->channels,
|
||||
item->track, item->disc, item->artwork_url, queue_version);
|
||||
ret = db_query_run(query, 1, 0);
|
||||
|
||||
@ -5129,6 +5132,7 @@ queue_enum_fetch(struct query_params *qp, struct db_queue_item *queue_item, int
|
||||
queue_item->type = strdup_if((char *)sqlite3_column_text(qp->stmt, 26), keep_item);
|
||||
queue_item->bitrate = sqlite3_column_int(qp->stmt, 27);
|
||||
queue_item->samplerate = sqlite3_column_int(qp->stmt, 28);
|
||||
queue_item->channels = sqlite3_column_int(qp->stmt, 29);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
3
src/db.h
3
src/db.h
@ -163,6 +163,7 @@ struct media_file_info {
|
||||
|
||||
uint32_t bitrate;
|
||||
uint32_t samplerate;
|
||||
uint32_t channels;
|
||||
uint32_t song_length;
|
||||
int64_t file_size;
|
||||
uint32_t year; /* TDRC */
|
||||
@ -367,6 +368,7 @@ struct db_media_file_info {
|
||||
char *album_sort;
|
||||
char *album_artist_sort;
|
||||
char *composer_sort;
|
||||
char *channels;
|
||||
};
|
||||
|
||||
#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field)
|
||||
@ -472,6 +474,7 @@ struct db_queue_item {
|
||||
char *type;
|
||||
uint32_t bitrate;
|
||||
uint32_t samplerate;
|
||||
uint32_t channels;
|
||||
|
||||
int64_t songartistid;
|
||||
|
||||
|
@ -95,7 +95,8 @@
|
||||
" artist_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||
" album_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||
" album_artist_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||
" composer_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP" \
|
||||
" composer_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||
" channels INTEGER DEFAULT 0" \
|
||||
");"
|
||||
|
||||
#define T_PL \
|
||||
@ -195,7 +196,8 @@
|
||||
" songartistid INTEGER NOT NULL," \
|
||||
" type VARCHAR(8) DEFAULT NULL," \
|
||||
" bitrate INTEGER DEFAULT 0," \
|
||||
" samplerate INTEGER DEFAULT 0" \
|
||||
" samplerate INTEGER DEFAULT 0," \
|
||||
" channels INTEGER DEFAULT 0" \
|
||||
");"
|
||||
|
||||
#define Q_PL1 \
|
||||
|
@ -1001,6 +1001,10 @@ static const struct db_upgrade_query db_upgrade_v2100_queries[] =
|
||||
"ALTER TABLE queue ADD COLUMN bitrate INTEGER DEFAULT 0;"
|
||||
#define U_v2101_ALTER_QUEUE_ADD_SAMPLERATE \
|
||||
"ALTER TABLE queue ADD COLUMN samplerate INTEGER DEFAULT 0;"
|
||||
#define U_v2101_ALTER_QUEUE_ADD_CHANNELS \
|
||||
"ALTER TABLE queue ADD COLUMN channels INTEGER DEFAULT 0;"
|
||||
#define U_v2101_ALTER_FILES_ADD_CHANNELS \
|
||||
"ALTER TABLE files ADD COLUMN channels INTEGER DEFAULT 0;"
|
||||
|
||||
#define U_v2101_SCVER_MINOR \
|
||||
"UPDATE admin SET value = '01' WHERE key = 'schema_version_minor';"
|
||||
@ -1010,6 +1014,8 @@ static const struct db_upgrade_query db_upgrade_v2101_queries[] =
|
||||
{ U_v2101_ALTER_QUEUE_ADD_TYPE, "alter table queue add column type" },
|
||||
{ U_v2101_ALTER_QUEUE_ADD_BITRATE, "alter table queue add column bitrate" },
|
||||
{ U_v2101_ALTER_QUEUE_ADD_SAMPLERATE, "alter table queue add column samplerate" },
|
||||
{ U_v2101_ALTER_QUEUE_ADD_CHANNELS, "alter table queue add column channels" },
|
||||
{ U_v2101_ALTER_FILES_ADD_CHANNELS, "alter table files add column channels" },
|
||||
|
||||
{ U_v2101_SCVER_MINOR, "set schema_version_minor to 01" },
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user