Merge branch 'whatdoineed2do-daap-support-date_released'

This commit is contained in:
ejurgensen 2020-02-23 20:27:13 +01:00
commit d90cf953dc
6 changed files with 9 additions and 2 deletions

View File

@ -101,6 +101,7 @@ DATETAG : 'time_added'
| 'time_modified'
| 'time_played'
| 'time_skipped'
| 'date_released'
;
ENUMTAG : 'data_kind'

View File

@ -426,6 +426,7 @@ static const char *sort_clause[] =
"f.virtual_path COLLATE NOCASE",
"pos",
"shuffle_pos",
"f.date_released DESC, f.title_sort DESC",
};
/* Browse clauses, used for SELECT, WHERE, GROUP BY and for default ORDER BY

View File

@ -30,6 +30,7 @@ enum sort_type {
S_VPATH,
S_POS,
S_SHUFFLE_POS,
S_DATE_RELEASED,
};
#define Q_F_BROWSE (1 << 15)

View File

@ -335,6 +335,9 @@ static const struct db_init_query db_init_table_queries[] =
#define I_FILE_DIR \
"CREATE INDEX IF NOT EXISTS idx_file_dir ON files(disabled, directory_id);"
#define I_DATE_RELEASED \
"CREATE INDEX IF NOT EXISTS idx_date_released ON files(disabled, date_released DESC, media_kind);"
#define I_PL_PATH \
"CREATE INDEX IF NOT EXISTS idx_pl_path ON playlists(path);"
@ -384,6 +387,7 @@ static const struct db_init_query db_init_index_queries[] =
{ I_ALBUM, "create album index" },
{ I_FILELIST, "create filelist index" },
{ I_FILE_DIR, "create file dir index" },
{ I_DATE_RELEASED, "create date_released index" },
{ I_PL_PATH, "create playlist path index" },
{ I_PL_DISABLED, "create playlist state index" },

View File

@ -26,7 +26,7 @@
* is a major upgrade. In other words minor version upgrades permit downgrading
* forked-daapd after the database was upgraded. */
#define SCHEMA_VERSION_MAJOR 21
#define SCHEMA_VERSION_MINOR 02
#define SCHEMA_VERSION_MINOR 03
int
db_init_indices(sqlite3 *hdl);

View File

@ -573,7 +573,7 @@ query_params_set(struct query_params *qp, int *sort_headers, struct httpd_reques
else if (strcmp(param, "artist") == 0 && (type != Q_BROWSE_ARTISTS)) // Only set if non-default sort requested
qp->sort = S_ARTIST;
else if (strcmp(param, "releasedate") == 0)
qp->sort = S_NAME;
qp->sort = S_DATE_RELEASED;
else
DPRINTF(E_DBG, L_DAAP, "Unknown sort param: %s\n", param);