From 26ccee696e969f6ae45eccebf8d48a501f8ccee6 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 16 Oct 2014 18:06:02 +0200 Subject: [PATCH] fix hard bugs for the profile selection --- src/api/api_dvr.c | 8 ++++---- src/dvr/dvr_config.c | 7 ++++--- src/profile.c | 6 ++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/api/api_dvr.c b/src/api/api_dvr.c index ac01c51d..ce5a54fc 100644 --- a/src/api/api_dvr.c +++ b/src/api/api_dvr.c @@ -195,11 +195,11 @@ api_dvr_entry_create_by_event HTSMSG_FOREACH(f, entries) { if (!(m = htsmsg_get_map_by_field(f))) continue; - if (!(config_uuid = htsmsg_get_str(m, "config_uuid"))) - continue; if (!(s = htsmsg_get_str(m, "event_id"))) continue; + config_uuid = htsmsg_get_str(m, "config_uuid"); + pthread_mutex_lock(&global_lock); if ((e = epg_broadcast_find_by_id(strtoll(s, NULL, 10)))) { dvr_config_t *cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, config_uuid); @@ -287,11 +287,11 @@ api_dvr_autorec_create_by_series HTSMSG_FOREACH(f, entries) { if (!(m = htsmsg_get_map_by_field(f))) continue; - if (!(config_uuid = htsmsg_get_str(m, "config_uuid"))) - continue; if (!(s = htsmsg_get_str(m, "event_id"))) continue; + config_uuid = htsmsg_get_str(m, "config_uuid"); + pthread_mutex_lock(&global_lock); if ((e = epg_broadcast_find_by_id(strtoll(s, NULL, 10)))) { dvr_config_t *cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, config_uuid); diff --git a/src/dvr/dvr_config.c b/src/dvr/dvr_config.c index 5fc299d8..5923ab18 100644 --- a/src/dvr/dvr_config.c +++ b/src/dvr/dvr_config.c @@ -105,8 +105,10 @@ dvr_config_find_by_list(htsmsg_t *uuids, const char *name) htsmsg_field_t *f; const char *uuid, *uuid2; - cfg = dvr_config_find_by_name(name); - uuid = idnode_uuid_as_str(&cfg->dvr_id); + cfg = dvr_config_find_by_uuid(name); + if (!cfg) + cfg = dvr_config_find_by_name(name); + uuid = cfg ? idnode_uuid_as_str(&cfg->dvr_id) : ""; if (uuids) { HTSMSG_FOREACH(f, uuids) { uuid2 = htsmsg_field_get_str(f) ?: ""; @@ -530,7 +532,6 @@ const idclass_t dvr_config_class = { .type = PT_STR, .id = "profile", .name = "Stream Profile", - .off = offsetof(dvr_config_t, dvr_profile), .set = dvr_config_class_profile_set, .get = dvr_config_class_profile_get, .rend = dvr_config_class_profile_rend, diff --git a/src/profile.c b/src/profile.c index 114f281d..b65888b7 100644 --- a/src/profile.c +++ b/src/profile.c @@ -334,8 +334,10 @@ profile_find_by_list(htsmsg_t *uuids, const char *name, const char *alt) htsmsg_field_t *f; const char *uuid, *uuid2; - pro = profile_find_by_name(name, alt); - uuid = idnode_uuid_as_str(&pro->pro_id); + pro = profile_find_by_uuid(name); + if (!pro) + pro = profile_find_by_name(name, alt); + uuid = pro ? idnode_uuid_as_str(&pro->pro_id) : ""; if (uuids) { HTSMSG_FOREACH(f, uuids) { uuid2 = htsmsg_field_get_str(f) ?: "";