/**
 * Add playlist file to DB.
 *
 * This is usually called from plugin's @b parse() callback.
 *
 * @param ldp handle returned by lms_db_playlist_new().
 * @param info playlist information to store.
 *
 * @return On success 0 is returned.
 * @ingroup LMS_Plugins
 */
int
lms_db_playlist_add(lms_db_playlist_t *ldp, struct lms_playlist_info *info)
{
    if (!ldp)
        return -1;
    if (!info)
        return -2;
    if (info->id < 1)
        return -3;

    return _db_insert(ldp, info);
}
/**
 * Add image file to DB.
 *
 * This is usually called from plugin's @b parse() callback.
 *
 * @param ldi handle returned by lms_db_image_new().
 * @param info image information to store.
 *
 * @return On success 0 is returned.
 * @ingroup LMS_Plugins
 */
int
lms_db_image_add(lms_db_image_t *ldi, struct lms_image_info *info)
{
    const struct lms_dlna_image_profile *dlna;

    if (!ldi)
        return -1;
    if (!info)
        return -2;
    if (info->id < 1)
        return -3;

    if (info->dlna_mime.len == 0 && info->dlna_profile.len == 0) {
        dlna = lms_dlna_get_image_profile(info);
        if (dlna) {
            info->dlna_mime = *dlna->dlna_mime;
            info->dlna_profile = *dlna->dlna_profile;
        }
    }

    return _db_insert(ldi, info);
}