mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-25 22:55:56 -05:00
[db] Transfer some library tag fixup to the db's generic fixup
Transfer setting defaults for media_kind and item_kind. Also sets default media_kind for queue_items.
This commit is contained in:
parent
c3eb95d201
commit
734b4e9851
14
src/db.c
14
src/db.c
@ -82,6 +82,7 @@ enum fixup_type {
|
|||||||
DB_FIXUP_TYPE,
|
DB_FIXUP_TYPE,
|
||||||
DB_FIXUP_CODECTYPE,
|
DB_FIXUP_CODECTYPE,
|
||||||
DB_FIXUP_MEDIA_KIND,
|
DB_FIXUP_MEDIA_KIND,
|
||||||
|
DB_FIXUP_ITEM_KIND,
|
||||||
DB_FIXUP_TITLE_SORT,
|
DB_FIXUP_TITLE_SORT,
|
||||||
DB_FIXUP_ARTIST_SORT,
|
DB_FIXUP_ARTIST_SORT,
|
||||||
DB_FIXUP_ALBUM_SORT,
|
DB_FIXUP_ALBUM_SORT,
|
||||||
@ -178,7 +179,7 @@ static const struct col_type_map mfi_cols_map[] =
|
|||||||
{ "seek", mfi_offsetof(seek), DB_TYPE_INT },
|
{ "seek", mfi_offsetof(seek), DB_TYPE_INT },
|
||||||
{ "data_kind", mfi_offsetof(data_kind), DB_TYPE_INT },
|
{ "data_kind", mfi_offsetof(data_kind), DB_TYPE_INT },
|
||||||
{ "media_kind", mfi_offsetof(media_kind), DB_TYPE_INT, DB_FIXUP_MEDIA_KIND },
|
{ "media_kind", mfi_offsetof(media_kind), DB_TYPE_INT, DB_FIXUP_MEDIA_KIND },
|
||||||
{ "item_kind", mfi_offsetof(item_kind), DB_TYPE_INT },
|
{ "item_kind", mfi_offsetof(item_kind), DB_TYPE_INT, DB_FIXUP_ITEM_KIND },
|
||||||
{ "description", mfi_offsetof(description), DB_TYPE_STRING },
|
{ "description", mfi_offsetof(description), DB_TYPE_STRING },
|
||||||
{ "db_timestamp", mfi_offsetof(db_timestamp), DB_TYPE_INT },
|
{ "db_timestamp", mfi_offsetof(db_timestamp), DB_TYPE_INT },
|
||||||
{ "time_added", mfi_offsetof(time_added), DB_TYPE_INT, DB_FIXUP_TIME_ADDED },
|
{ "time_added", mfi_offsetof(time_added), DB_TYPE_INT, DB_FIXUP_TIME_ADDED },
|
||||||
@ -924,6 +925,17 @@ fixup_defaults(char **tag, enum fixup_type fixup, struct fixup_ctx *ctx)
|
|||||||
case DB_FIXUP_MEDIA_KIND:
|
case DB_FIXUP_MEDIA_KIND:
|
||||||
if (ctx->mfi && ctx->mfi->tv_series_name)
|
if (ctx->mfi && ctx->mfi->tv_series_name)
|
||||||
ctx->mfi->media_kind = MEDIA_KIND_TVSHOW;
|
ctx->mfi->media_kind = MEDIA_KIND_TVSHOW;
|
||||||
|
else if (ctx->mfi && !ctx->mfi->media_kind)
|
||||||
|
ctx->mfi->media_kind = MEDIA_KIND_MUSIC;
|
||||||
|
else if (ctx->queue_item && !ctx->queue_item->media_kind)
|
||||||
|
ctx->queue_item->media_kind = MEDIA_KIND_MUSIC;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DB_FIXUP_ITEM_KIND:
|
||||||
|
if (ctx->mfi && !ctx->mfi->item_kind)
|
||||||
|
ctx->mfi->item_kind = 2; // music
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DB_FIXUP_TIME_ADDED:
|
case DB_FIXUP_TIME_ADDED:
|
||||||
|
@ -128,11 +128,6 @@ library_add_media(struct media_file_info *mfi)
|
|||||||
mfi->path, mfi->directory_id, mfi->virtual_path);
|
mfi->path, mfi->directory_id, mfi->virtual_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mfi->item_kind)
|
|
||||||
mfi->item_kind = 2; /* music */
|
|
||||||
if (!mfi->media_kind)
|
|
||||||
mfi->media_kind = MEDIA_KIND_MUSIC; /* music */
|
|
||||||
|
|
||||||
if (mfi->id == 0)
|
if (mfi->id == 0)
|
||||||
db_file_add(mfi);
|
db_file_add(mfi);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user