From aae5ac1f02ddba30cdd599f5b9f45233b7f3d9bf Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 5 Nov 2014 10:23:30 +0100 Subject: [PATCH] bouquet: add map radio --- src/bouquet.c | 36 ++++++++++++++++++++++++++++++-- src/bouquet.h | 1 + src/webui/static/app/cteditor.js | 1 + 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/bouquet.c b/src/bouquet.c index 0524147a..7bd2d430 100644 --- a/src/bouquet.c +++ b/src/bouquet.c @@ -222,7 +222,11 @@ bouquet_map_channel(bouquet_t *bq, service_t *t) channel_t *ch = NULL; channel_service_mapping_t *csm; - if (!bq->bq_mapnolcn && service_get_channel_number(t) <= 0) + if (!bq->bq_mapradio && service_is_radio(t)) + return; + if (!bq->bq_mapnolcn && + service_get_channel_number(t) <= 0 && + bouquet_get_channel_number(bq, t) <= 0) return; if (!bq->bq_mapnoname && noname(service_get_channel_name(t))) return; @@ -492,7 +496,8 @@ bouquet_class_mapnolcn_notify ( void *obj ) if (!bq->bq_mapnolcn && bq->bq_enabled && bq->bq_maptoch) { for (z = 0; z < bq->bq_services->is_count; z++) { t = (service_t *)bq->bq_services->is_array[z]; - if (service_get_channel_number(t) <= 0) + if (service_get_channel_number(t) <= 0 && + bouquet_get_channel_number(bq, t) <= 0) bouquet_unmap_channel(bq, t); } } else { @@ -520,6 +525,26 @@ bouquet_class_mapnoname_notify ( void *obj ) } } +static void +bouquet_class_mapradio_notify ( void *obj ) +{ + bouquet_t *bq = obj; + service_t *t; + size_t z; + + if (bq->bq_in_load) + return; + if (!bq->bq_mapradio && bq->bq_enabled && bq->bq_maptoch) { + for (z = 0; z < bq->bq_services->is_count; z++) { + t = (service_t *)bq->bq_services->is_array[z]; + if (service_is_radio(t)) + bouquet_unmap_channel(bq, t); + } + } else { + bouquet_map_to_channels(bq); + } +} + static void bouquet_class_chtag_notify ( void *obj ) { @@ -678,6 +703,13 @@ const idclass_t bouquet_class = { .off = offsetof(bouquet_t, bq_mapnoname), .notify = bouquet_class_mapnoname_notify, }, + { + .type = PT_BOOL, + .id = "mapradio", + .name = "Map Radio", + .off = offsetof(bouquet_t, bq_mapradio), + .notify = bouquet_class_mapradio_notify, + }, { .type = PT_BOOL, .id = "chtag", diff --git a/src/bouquet.h b/src/bouquet.h index 293a97d6..1ea5e612 100644 --- a/src/bouquet.h +++ b/src/bouquet.h @@ -37,6 +37,7 @@ typedef struct bouquet { int bq_maptoch; int bq_mapnolcn; int bq_mapnoname; + int bq_mapradio; int bq_chtag; channel_tag_t*bq_chtag_ptr; const char *bq_chtag_waiting; diff --git a/src/webui/static/app/cteditor.js b/src/webui/static/app/cteditor.js index 2755c2dc..5be943a6 100644 --- a/src/webui/static/app/cteditor.js +++ b/src/webui/static/app/cteditor.js @@ -45,6 +45,7 @@ tvheadend.bouquet = function(panel, index) name: { width: 200 }, maptoch: { width: 100 }, mapnolcn: { width: 100 }, + mapradio: { width: 100 }, lcn_off: { width: 100 }, mapnoname: { width: 100 }, chtag: { width: 100 },