mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 22:23:17 -05:00
[db] RSS support: new PL_RSS db value and new pl purge
This commit is contained in:
parent
9bb9576849
commit
57b0626906
36
src/db.c
36
src/db.c
@ -511,7 +511,7 @@ db_data_kind_label(enum data_kind data_kind)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Keep in sync with enum pl_type */
|
/* Keep in sync with enum pl_type */
|
||||||
static char *pl_type_label[] = { "special", "folder", "smart", "plain" };
|
static char *pl_type_label[] = { "special", "folder", "smart", "plain", "rss" };
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
db_pl_type_label(enum pl_type pl_type)
|
db_pl_type_label(enum pl_type pl_type)
|
||||||
@ -1876,6 +1876,7 @@ db_build_query_plitems(struct query_params *qp, struct query_clause *qc)
|
|||||||
query = db_build_query_plitems_smart(qp, pli);
|
query = db_build_query_plitems_smart(qp, pli);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PL_RSS:
|
||||||
case PL_PLAIN:
|
case PL_PLAIN:
|
||||||
case PL_FOLDER:
|
case PL_FOLDER:
|
||||||
query = db_build_query_plitems_plain(qp, qc);
|
query = db_build_query_plitems_plain(qp, qc);
|
||||||
@ -3679,6 +3680,39 @@ db_pl_delete_bypath(const char *path)
|
|||||||
free(qp.filter);
|
free(qp.filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
db_pl_purge_byid(int id)
|
||||||
|
{
|
||||||
|
#define Q_TMPL "DELETE FROM files WHERE path in (SELECT filepath FROM playlistitems WHERE playlistid = %d)"
|
||||||
|
|
||||||
|
char *query;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
query = sqlite3_mprintf(Q_TMPL, id);
|
||||||
|
if (!query)
|
||||||
|
{
|
||||||
|
DPRINTF(E_LOG, L_DB, "Out of memory for query string\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
db_transaction_begin();
|
||||||
|
ret = db_query_run(query, 1, LISTENER_DATABASE);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
db_transaction_rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINTF(E_DBG, L_DB, "Deleted %d pl rows\n", sqlite3_changes(hdl));
|
||||||
|
|
||||||
|
db_pl_delete(id);
|
||||||
|
db_transaction_end();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#undef Q_TMPL
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
db_pl_disable_bypath(const char *path, enum strip_type strip, uint32_t cookie)
|
db_pl_disable_bypath(const char *path, enum strip_type strip, uint32_t cookie)
|
||||||
{
|
{
|
||||||
|
4
src/db.h
4
src/db.h
@ -236,6 +236,7 @@ enum pl_type {
|
|||||||
PL_FOLDER = 1,
|
PL_FOLDER = 1,
|
||||||
PL_SMART = 2,
|
PL_SMART = 2,
|
||||||
PL_PLAIN = 3,
|
PL_PLAIN = 3,
|
||||||
|
PL_RSS = 4,
|
||||||
PL_MAX,
|
PL_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -706,6 +707,9 @@ db_pl_delete(int id);
|
|||||||
void
|
void
|
||||||
db_pl_delete_bypath(const char *path);
|
db_pl_delete_bypath(const char *path);
|
||||||
|
|
||||||
|
int
|
||||||
|
db_pl_purge_byid(int id);
|
||||||
|
|
||||||
void
|
void
|
||||||
db_pl_disable_bypath(const char *path, enum strip_type strip, uint32_t cookie);
|
db_pl_disable_bypath(const char *path, enum strip_type strip, uint32_t cookie);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user