mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-24 19:46:19 -05:00
[db,library] Add "scan_kind" field to playlists, directories and files
(db upgrade to v22.00) `scan_kind` identifies the library "scanner" component that created the item and is responsible to keep it up to date (rescan). The library update now supports passing a `scan_kind` to update only the items of one particular "scanner". This allows e. g. to only update the item from the Spotify library or only update the RSS feeds. The OwnTone database is upgraded to v22.00 and the `scan_kind` columns in `files`, `playlists`, `directories` are identified by: 1. Check if item is part of a RSS playlist (podcast RSS feed), they belong to the "rssscanner" 2. Check if item has a Spotify `virtual_path`, they belong to the "spotifyscanner" 3. Remaining items belong to the "filescanner"
This commit is contained in:
30
src/db.h
30
src/db.h
@@ -141,6 +141,18 @@ enum data_kind {
|
||||
const char *
|
||||
db_data_kind_label(enum data_kind data_kind);
|
||||
|
||||
enum scan_kind {
|
||||
SCAN_KIND_UNKNOWN = 0,
|
||||
SCAN_KIND_FILES = 1,
|
||||
SCAN_KIND_SPOTIFY = 2,
|
||||
SCAN_KIND_RSS = 3,
|
||||
};
|
||||
|
||||
const char *
|
||||
db_scan_kind_label(enum scan_kind scan_kind);
|
||||
|
||||
enum scan_kind
|
||||
db_scan_kind_enum(const char *label);
|
||||
|
||||
/* Indicates user marked status on a track - values can be bitwise enumerated */
|
||||
enum usermark {
|
||||
@@ -234,6 +246,8 @@ struct media_file_info {
|
||||
char *album_sort;
|
||||
char *album_artist_sort;
|
||||
char *composer_sort;
|
||||
|
||||
uint32_t scan_kind; /* Identifies the library_source that created/updates this item */
|
||||
};
|
||||
|
||||
#define mfi_offsetof(field) offsetof(struct media_file_info, field)
|
||||
@@ -269,6 +283,7 @@ struct playlist_info {
|
||||
uint32_t query_limit; /* limit, used by e.g. smart playlists */
|
||||
uint32_t media_kind;
|
||||
char *artwork_url; /* optional artwork */
|
||||
uint32_t scan_kind; /* Identifies the library_source that created/updates this item */
|
||||
uint32_t items; /* number of items (mimc) */
|
||||
uint32_t streams; /* number of internet streams */
|
||||
};
|
||||
@@ -292,6 +307,7 @@ struct db_playlist_info {
|
||||
char *query_limit;
|
||||
char *media_kind;
|
||||
char *artwork_url;
|
||||
char *scan_kind;
|
||||
char *items;
|
||||
char *streams;
|
||||
};
|
||||
@@ -405,6 +421,7 @@ struct db_media_file_info {
|
||||
char *composer_sort;
|
||||
char *channels;
|
||||
char *usermark;
|
||||
char *scan_kind;
|
||||
};
|
||||
|
||||
#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field)
|
||||
@@ -475,6 +492,7 @@ struct directory_info {
|
||||
uint32_t db_timestamp;
|
||||
int64_t disabled;
|
||||
uint32_t parent_id;
|
||||
uint32_t scan_kind; /* Identifies the library_source that created/updates this item */
|
||||
};
|
||||
|
||||
struct directory_enum {
|
||||
@@ -589,6 +607,9 @@ db_hook_post_scan(void);
|
||||
void
|
||||
db_purge_cruft(time_t ref);
|
||||
|
||||
void
|
||||
db_purge_cruft_bysource(time_t ref, enum scan_kind scan_kind);
|
||||
|
||||
void
|
||||
db_purge_all(void);
|
||||
|
||||
@@ -798,16 +819,19 @@ void
|
||||
db_directory_enum_end(struct directory_enum *de);
|
||||
|
||||
int
|
||||
db_directory_addorupdate(char *virtual_path, char *path, int disabled, int parent_id);
|
||||
db_directory_add(struct directory_info *di, int *id);
|
||||
|
||||
int
|
||||
db_directory_update(struct directory_info *di);
|
||||
|
||||
void
|
||||
db_directory_ping_bymatch(char *virtual_path);
|
||||
|
||||
void
|
||||
db_directory_disable_bymatch(char *path, enum strip_type strip, uint32_t cookie);
|
||||
db_directory_disable_bymatch(const char *path, enum strip_type strip, uint32_t cookie);
|
||||
|
||||
int
|
||||
db_directory_enable_bycookie(uint32_t cookie, char *path);
|
||||
db_directory_enable_bycookie(uint32_t cookie, const char *path);
|
||||
|
||||
int
|
||||
db_directory_enable_bypath(char *path);
|
||||
|
||||
Reference in New Issue
Block a user