[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_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 },
|
{ "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 },
|
{ "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
|
/* 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 },
|
{ "type", qi_offsetof(type), DB_TYPE_STRING, DB_FIXUP_CODECTYPE },
|
||||||
{ "bitrate", qi_offsetof(bitrate), DB_TYPE_INT },
|
{ "bitrate", qi_offsetof(bitrate), DB_TYPE_INT },
|
||||||
{ "samplerate", qi_offsetof(samplerate), 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
|
/* 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_sort),
|
||||||
dbmfi_offsetof(album_artist_sort),
|
dbmfi_offsetof(album_artist_sort),
|
||||||
dbmfi_offsetof(composer_sort),
|
dbmfi_offsetof(composer_sort),
|
||||||
|
dbmfi_offsetof(channels),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This list must be kept in sync with
|
/* 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, " \
|
"pos, shuffle_pos, path, virtual_path, title, " \
|
||||||
"artist, composer, album_artist, album, genre, songalbumid, songartistid," \
|
"artist, composer, album_artist, album, genre, songalbumid, songartistid," \
|
||||||
"time_modified, artist_sort, album_sort, album_artist_sort, year, " \
|
"time_modified, artist_sort, album_sort, album_artist_sort, year, " \
|
||||||
"type, bitrate, samplerate, " \
|
"type, bitrate, samplerate, channels, " \
|
||||||
"track, disc, queue_version)" \
|
"track, disc, queue_version)" \
|
||||||
"VALUES" \
|
"VALUES" \
|
||||||
"(NULL, %s, %s, %s, %s, " \
|
"(NULL, %s, %s, %s, %s, " \
|
||||||
"%d, %d, %Q, %Q, %Q, " \
|
"%d, %d, %Q, %Q, %Q, " \
|
||||||
"%Q, %Q, %Q, %Q, %Q, %s, %s," \
|
"%Q, %Q, %Q, %Q, %Q, %s, %s," \
|
||||||
"%s, %Q, %Q, %Q, %s, " \
|
"%s, %Q, %Q, %Q, %s, " \
|
||||||
"%Q, %s, %s, " \
|
"%Q, %s, %s, %s, " \
|
||||||
"%s, %s, %d);"
|
"%s, %s, %d);"
|
||||||
|
|
||||||
char *query;
|
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,
|
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->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->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);
|
dbmfi->track, dbmfi->disc, queue_version);
|
||||||
ret = db_query_run(query, 1, 0);
|
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, " \
|
"pos, shuffle_pos, path, virtual_path, title, " \
|
||||||
"artist, composer, album_artist, album, genre, songalbumid, songartistid, " \
|
"artist, composer, album_artist, album, genre, songalbumid, songartistid, " \
|
||||||
"time_modified, artist_sort, album_sort, album_artist_sort, year, " \
|
"time_modified, artist_sort, album_sort, album_artist_sort, year, " \
|
||||||
"type, bitrate, samplerate, " \
|
"type, bitrate, samplerate, channels, " \
|
||||||
"track, disc, artwork_url, queue_version)" \
|
"track, disc, artwork_url, queue_version)" \
|
||||||
"VALUES" \
|
"VALUES" \
|
||||||
"(NULL, %d, %d, %d, %d, " \
|
"(NULL, %d, %d, %d, %d, " \
|
||||||
"%d, %d, %Q, %Q, %Q, " \
|
"%d, %d, %Q, %Q, %Q, " \
|
||||||
"%Q, %Q, %Q, %Q, %Q, %" PRIi64 ", %" PRIi64 "," \
|
"%Q, %Q, %Q, %Q, %Q, %" PRIi64 ", %" PRIi64 "," \
|
||||||
"%d, %Q, %Q, %Q, %d, " \
|
"%d, %Q, %Q, %Q, %d, " \
|
||||||
"%Q, %" PRIu32 ", %" PRIu32 ", " \
|
"%Q, %" PRIu32 ", %" PRIu32 ", %" PRIu32 ", " \
|
||||||
"%d, %d, %Q, %d);"
|
"%d, %d, %Q, %d);"
|
||||||
|
|
||||||
char *query;
|
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,
|
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->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->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);
|
item->track, item->disc, item->artwork_url, queue_version);
|
||||||
ret = db_query_run(query, 1, 0);
|
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->type = strdup_if((char *)sqlite3_column_text(qp->stmt, 26), keep_item);
|
||||||
queue_item->bitrate = sqlite3_column_int(qp->stmt, 27);
|
queue_item->bitrate = sqlite3_column_int(qp->stmt, 27);
|
||||||
queue_item->samplerate = sqlite3_column_int(qp->stmt, 28);
|
queue_item->samplerate = sqlite3_column_int(qp->stmt, 28);
|
||||||
|
queue_item->channels = sqlite3_column_int(qp->stmt, 29);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
3
src/db.h
3
src/db.h
|
@ -163,6 +163,7 @@ struct media_file_info {
|
||||||
|
|
||||||
uint32_t bitrate;
|
uint32_t bitrate;
|
||||||
uint32_t samplerate;
|
uint32_t samplerate;
|
||||||
|
uint32_t channels;
|
||||||
uint32_t song_length;
|
uint32_t song_length;
|
||||||
int64_t file_size;
|
int64_t file_size;
|
||||||
uint32_t year; /* TDRC */
|
uint32_t year; /* TDRC */
|
||||||
|
@ -367,6 +368,7 @@ struct db_media_file_info {
|
||||||
char *album_sort;
|
char *album_sort;
|
||||||
char *album_artist_sort;
|
char *album_artist_sort;
|
||||||
char *composer_sort;
|
char *composer_sort;
|
||||||
|
char *channels;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field)
|
#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field)
|
||||||
|
@ -472,6 +474,7 @@ struct db_queue_item {
|
||||||
char *type;
|
char *type;
|
||||||
uint32_t bitrate;
|
uint32_t bitrate;
|
||||||
uint32_t samplerate;
|
uint32_t samplerate;
|
||||||
|
uint32_t channels;
|
||||||
|
|
||||||
int64_t songartistid;
|
int64_t songartistid;
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,8 @@
|
||||||
" artist_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
" artist_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||||
" album_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
" album_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||||
" album_artist_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 \
|
#define T_PL \
|
||||||
|
@ -195,7 +196,8 @@
|
||||||
" songartistid INTEGER NOT NULL," \
|
" songartistid INTEGER NOT NULL," \
|
||||||
" type VARCHAR(8) DEFAULT NULL," \
|
" type VARCHAR(8) DEFAULT NULL," \
|
||||||
" bitrate INTEGER DEFAULT 0," \
|
" bitrate INTEGER DEFAULT 0," \
|
||||||
" samplerate INTEGER DEFAULT 0" \
|
" samplerate INTEGER DEFAULT 0," \
|
||||||
|
" channels INTEGER DEFAULT 0" \
|
||||||
");"
|
");"
|
||||||
|
|
||||||
#define Q_PL1 \
|
#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;"
|
"ALTER TABLE queue ADD COLUMN bitrate INTEGER DEFAULT 0;"
|
||||||
#define U_v2101_ALTER_QUEUE_ADD_SAMPLERATE \
|
#define U_v2101_ALTER_QUEUE_ADD_SAMPLERATE \
|
||||||
"ALTER TABLE queue ADD COLUMN samplerate INTEGER DEFAULT 0;"
|
"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 \
|
#define U_v2101_SCVER_MINOR \
|
||||||
"UPDATE admin SET value = '01' WHERE key = 'schema_version_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_TYPE, "alter table queue add column type" },
|
||||||
{ U_v2101_ALTER_QUEUE_ADD_BITRATE, "alter table queue add column bitrate" },
|
{ 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_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" },
|
{ U_v2101_SCVER_MINOR, "set schema_version_minor to 01" },
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue