From: Jaroslav Kysela Date: Tue, 13 Feb 2018 16:09:05 +0000 (+0100) Subject: epg: remove brand support X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d84e1f2d64efc14f6d1de240a2a89f19598bcf92;p=thirdparty%2Ftvheadend.git epg: remove brand support --- diff --git a/src/api/api_epg.c b/src/api/api_epg.c index ec4a33137..788d9aa9e 100644 --- a/src/api/api_epg.c +++ b/src/api/api_epg.c @@ -581,14 +581,7 @@ api_epg_related pthread_mutex_lock(&global_lock); e = epg_broadcast_find_by_id(id); ep = e ? e->episode : NULL; - if (ep && ep->brand) { - LIST_FOREACH(ep2, &ep->brand->episodes, blink) { - if (ep2 == ep) continue; - if (!ep2->title) continue; - api_epg_episode_broadcasts(perm, l, lang, ep2, &entries, e); - entries++; - } - } else if (ep && ep->season) { + if (ep && ep->season) { LIST_FOREACH(ep2, &ep->season->episodes, slink) { if (ep2 == ep) continue; if (!ep2->title) continue; @@ -653,20 +646,6 @@ api_epg_load return 0; } -static int -api_epg_brand_list(access_t *perm, void *opaque, const char *op, - htsmsg_t *args, htsmsg_t **resp) -{ - htsmsg_t *array; - - *resp = htsmsg_create_map(); - pthread_mutex_lock(&global_lock); - array = epg_brand_list(); - pthread_mutex_unlock(&global_lock); - htsmsg_add_msg(*resp, "entries", array); - return 0; -} - static int api_epg_content_type_list(access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp) @@ -689,7 +668,6 @@ void api_epg_init ( void ) { "epg/events/alternative", ACCESS_ANONYMOUS, api_epg_alternative, NULL }, { "epg/events/related", ACCESS_ANONYMOUS, api_epg_related, NULL }, { "epg/events/load", ACCESS_ANONYMOUS, api_epg_load, NULL }, - { "epg/brand/list", ACCESS_ANONYMOUS, api_epg_brand_list, NULL }, { "epg/content_type/list", ACCESS_ANONYMOUS, api_epg_content_type_list, NULL }, { NULL }, diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index 57794234d..8497a3260 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -379,7 +379,6 @@ typedef struct dvr_autorec_entry { struct dvr_entry_list dae_spawns; - epg_brand_t *dae_brand; epg_season_t *dae_season; epg_serieslink_t *dae_serieslink; epg_episode_num_t dae_epnum; @@ -673,7 +672,6 @@ char * dvr_autorec_entry_class_weekdays_rend(uint32_t weekdays, const char *lang const char *dvr_entry_class_image_url_get(const dvr_entry_t *o); void dvr_autorec_check_event(epg_broadcast_t *e); -void dvr_autorec_check_brand(epg_brand_t *b); void dvr_autorec_check_season(epg_season_t *s); void dvr_autorec_check_serieslink(epg_serieslink_t *s); diff --git a/src/dvr/dvr_autorec.c b/src/dvr/dvr_autorec.c index 531d6a62e..c174701cb 100644 --- a/src/dvr/dvr_autorec.c +++ b/src/dvr/dvr_autorec.c @@ -163,7 +163,6 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e) (dae->dae_cat1 == NULL || *dae->dae_cat1 == 0) && (dae->dae_cat2 == NULL || *dae->dae_cat2 == 0) && (dae->dae_cat3 == NULL || *dae->dae_cat3 == 0) && - dae->dae_brand == NULL && dae->dae_season == NULL && dae->dae_minduration <= 0 && (dae->dae_maxduration <= 0 || dae->dae_maxduration > 24 * 3600) && @@ -177,8 +176,6 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e) } else { if(dae->dae_season) if (!e->episode->season || dae->dae_season != e->episode->season) return 0; - if(dae->dae_brand) - if (!e->episode->brand || dae->dae_brand != e->episode->brand) return 0; } if(dae->dae_btype != DVR_AUTOREC_BTYPE_ALL) { @@ -464,8 +461,6 @@ autorec_entry_destroy(dvr_autorec_entry_t *dae, int delconf) if(dae->dae_channel_tag != NULL) LIST_REMOVE(dae, dae_channel_tag_link); - if(dae->dae_brand) - dae->dae_brand->ops->putref(dae->dae_brand); if(dae->dae_season) dae->dae_season->ops->putref(dae->dae_season); if(dae->dae_serieslink) @@ -868,39 +863,6 @@ dvr_autorec_entry_class_weekdays_rend_(void *o, const char *lang) return dvr_autorec_entry_class_weekdays_rend(dae->dae_weekdays, lang); } -static int -dvr_autorec_entry_class_brand_set(void *o, const void *v) -{ - dvr_autorec_entry_t *dae = (dvr_autorec_entry_t *)o; - int save; - epg_brand_t *brand; - - v = tvh_str_default(v, NULL); - brand = v ? epg_brand_find_by_uri(v, NULL, 1, &save, NULL) : NULL; - if (brand && dae->dae_brand != brand) { - if (dae->dae_brand) - dae->dae_brand->ops->putref((epg_object_t*)dae->dae_brand); - brand->ops->getref((epg_object_t*)brand); - dae->dae_brand = brand; - return 1; - } else if (brand == NULL && dae->dae_brand) { - dae->dae_brand->ops->putref((epg_object_t*)dae->dae_brand); - dae->dae_brand = NULL; - return 1; - } - return 0; -} - -static const void * -dvr_autorec_entry_class_brand_get(void *o) -{ - dvr_autorec_entry_t *dae = (dvr_autorec_entry_t *)o; - prop_ptr = dae->dae_brand ? dae->dae_brand->uri : NULL; - if (prop_ptr == NULL) - prop_ptr = ""; - return &prop_ptr; -} - static int dvr_autorec_entry_class_season_set(void *o, const void *v) { @@ -1397,15 +1359,6 @@ const idclass_t dvr_autorec_entry_class = { .list = dvr_entry_class_config_name_list, .opts = PO_ADVANCED }, - { - .type = PT_STR, - .id = "brand", - .name = N_("Brand"), - .desc = N_("Branding information (if available)."), - .set = dvr_autorec_entry_class_brand_set, - .get = dvr_autorec_entry_class_brand_get, - .opts = PO_RDONLY | PO_ADVANCED, - }, { .type = PT_STR, .id = "season", @@ -1512,13 +1465,6 @@ dvr_autorec_check_event(epg_broadcast_t *e) // anyway } -void dvr_autorec_check_brand(epg_brand_t *b) -{ -// Note: for the most part this will only be relevant should an episode -// to which a broadcast is linked suddenly get added to a new brand -// this is pretty damn unlikely! -} - void dvr_autorec_check_season(epg_season_t *s) { // Note: I guess new episodes might have been added, but again its likely diff --git a/src/epg.c b/src/epg.c index 1f840dede..3a80602c5 100644 --- a/src/epg.c +++ b/src/epg.c @@ -45,7 +45,6 @@ epg_object_tree_t epg_objects[EPG_HASH_WIDTH]; /* URI lists */ -epg_object_tree_t epg_brands; epg_object_tree_t epg_seasons; epg_object_tree_t epg_episodes; epg_object_tree_t epg_serieslinks; @@ -86,15 +85,6 @@ static int _ebc_start_cmp ( const void *a, const void *b ) return ((epg_broadcast_t*)a)->start - ((epg_broadcast_t*)b)->start; } -static int _season_order ( const void *_a, const void *_b ) -{ - const epg_season_t *a = (const epg_season_t*)_a; - const epg_season_t *b = (const epg_season_t*)_b; - if (!a || !a->number) return 1; - if (!b || !b->number) return -1; - return a->number - b->number; -} - // Note: this will do nothing with text episode numbering static int _episode_order ( const void *_a, const void *_b ) { @@ -128,7 +118,7 @@ void epg_updated ( void ) eo->ops->destroy(eo); } // Note: we do things this way around since unref'd objects are not likely - // to be useful to DVR since they will relate to episode/seasons/brands + // to be useful to DVR since they will relate to episode/seasons // with no valid broadcasts etc.. /* Update updated */ @@ -395,8 +385,6 @@ htsmsg_t *epg_object_serialize ( epg_object_t *eo ) { if (!eo) return NULL; switch (eo->type) { - case EPG_BRAND: - return epg_brand_serialize((epg_brand_t*)eo); case EPG_SEASON: return epg_season_serialize((epg_season_t*)eo); case EPG_EPISODE: @@ -416,8 +404,6 @@ epg_object_t *epg_object_deserialize ( htsmsg_t *msg, int create, int *save ) if (!msg) return NULL; type = htsmsg_get_u32_or_default(msg, "type", 0); switch (type) { - case EPG_BRAND: - return (epg_object_t*)epg_brand_deserialize(msg, create, save); case EPG_SEASON: return (epg_object_t*)epg_season_deserialize(msg, create, save); case EPG_EPISODE: @@ -430,223 +416,6 @@ epg_object_t *epg_object_deserialize ( htsmsg_t *msg, int create, int *save ) return NULL; } -/* ************************************************************************** - * Brand - * *************************************************************************/ - -static void _epg_brand_destroy ( void *eo ) -{ - epg_brand_t *eb = (epg_brand_t*)eo; - if (LIST_FIRST(&eb->seasons)) { - tvhlog(LOG_CRIT, LS_EPG, "attempt to destroy brand with seasons"); - assert(0); - } - if (LIST_FIRST(&eb->episodes)) { - tvhlog(LOG_CRIT, LS_EPG, "attempt to destroy brand with episodes"); - assert(0); - } - if (eb->title) lang_str_destroy(eb->title); - if (eb->summary) lang_str_destroy(eb->summary); - if (eb->image) free(eb->image); - _epg_object_destroy(eo, &epg_brands); - free(eb); -} - -static void _epg_brand_updated ( void *o ) -{ - dvr_autorec_check_brand((epg_brand_t*)o); -} - -static epg_object_ops_t _epg_brand_ops = { - .getref = _epg_object_getref, - .putref = _epg_object_putref, - .destroy = _epg_brand_destroy, - .update = _epg_brand_updated, -}; - -static epg_object_t **_epg_brand_skel ( void ) -{ - static epg_object_t *skel = NULL; - if (!skel) { - skel = calloc(1, sizeof(epg_brand_t)); - skel->type = EPG_BRAND; - skel->ops = &_epg_brand_ops; - } - return &skel; -} - -epg_brand_t* epg_brand_find_by_uri - ( const char *uri, epggrab_module_t *src, - int create, int *save, uint32_t *changed ) -{ - return (epg_brand_t*) - _epg_object_find_by_uri(uri, src, create, save, changed, - &epg_brands, - _epg_brand_skel()); -} - -epg_brand_t *epg_brand_find_by_id ( uint32_t id ) -{ - return (epg_brand_t*)epg_object_find_by_id(id, EPG_BRAND); -} - -int epg_brand_change_finish - ( epg_brand_t *brand, uint32_t changes, int merge ) -{ - int save = 0; - if (merge) return 0; - if (changes & EPG_CHANGED_CREATE) return 0; - if (!(changes & EPG_CHANGED_TITLE)) - save |= epg_brand_set_title(brand, NULL, NULL); - if (!(changes & EPG_CHANGED_SUMMARY)) - save |= epg_brand_set_summary(brand, NULL, NULL); - if (!(changes & EPG_CHANGED_IMAGE)) - save |= epg_brand_set_image(brand, NULL, NULL); - if (!(changes & EPG_CHANGED_SEASON_COUNT)) - save |= epg_brand_set_season_count(brand, 0, NULL); - return save; -} - -int epg_brand_set_title - ( epg_brand_t *brand, const lang_str_t *title, uint32_t *changed ) -{ - if (!brand) return 0; - return _epg_object_set_lang_str(brand, &brand->title, title, - changed, EPG_CHANGED_TITLE); -} - -int epg_brand_set_summary - ( epg_brand_t *brand, const lang_str_t *summary, uint32_t *changed ) -{ - if (!brand) return 0; - return _epg_object_set_lang_str(brand, &brand->summary, summary, - changed, EPG_CHANGED_SUMMARY); -} - -int epg_brand_set_image - ( epg_brand_t *brand, const char *image, uint32_t *changed ) -{ - int save; - if (!brand) return 0; - save = _epg_object_set_str(brand, &brand->image, image, - changed, EPG_CHANGED_IMAGE); - if (save) - imagecache_get_id(image); - return save; -} - -int epg_brand_set_season_count - ( epg_brand_t *brand, uint16_t count, uint32_t *changed ) -{ - if (!brand) return 0; - return _epg_object_set_u16(brand, &brand->season_count, count, - changed, EPG_CHANGED_SEASON_COUNT); -} - -static void _epg_brand_add_season - ( epg_brand_t *brand, epg_season_t *season ) -{ - _epg_object_getref(brand); - _epg_object_set_updated(brand); - LIST_INSERT_SORTED(&brand->seasons, season, blink, _season_order); -} - -static void _epg_brand_rem_season - ( epg_brand_t *brand, epg_season_t *season ) -{ - LIST_REMOVE(season, blink); - _epg_object_set_updated(brand); - _epg_object_putref(brand); -} - -static void _epg_brand_add_episode - ( epg_brand_t *brand, epg_episode_t *episode ) -{ - _epg_object_getref(brand); - _epg_object_set_updated(brand); - LIST_INSERT_SORTED(&brand->episodes, episode, blink, _episode_order); -} - -static void _epg_brand_rem_episode - ( epg_brand_t *brand, epg_episode_t *episode ) -{ - LIST_REMOVE(episode, blink); - _epg_object_set_updated(brand); - _epg_object_putref(brand); -} - -htsmsg_t *epg_brand_serialize ( epg_brand_t *brand ) -{ - htsmsg_t *m; - if (!brand || !brand->uri) return NULL; - if (!(m = _epg_object_serialize(brand))) return NULL; - if (brand->title) - lang_str_serialize(brand->title, m, "title"); - if (brand->summary) - lang_str_serialize(brand->summary, m, "summary"); - if (brand->season_count) - htsmsg_add_u32(m, "season-count", brand->season_count); - if (brand->image) - htsmsg_add_str(m, "image", brand->image); - return m; -} - -epg_brand_t *epg_brand_deserialize ( htsmsg_t *m, int create, int *save ) -{ - epg_object_t **skel = _epg_brand_skel(); - epg_brand_t *eb; - uint32_t u32, changes = 0; - const char *str; - lang_str_t *ls; - - if (!_epg_object_deserialize(m, *skel)) return NULL; - if (!(eb = epg_brand_find_by_uri((*skel)->uri, (*skel)->grabber, - create, save, &changes))) - return NULL; - - if ((ls = lang_str_deserialize(m, "title"))) { - *save |= epg_brand_set_title(eb, ls, &changes); - lang_str_destroy(ls); - } - if ((ls = lang_str_deserialize(m, "summary"))) { - *save |= epg_brand_set_summary(eb, ls, &changes); - lang_str_destroy(ls); - } - if (!htsmsg_get_u32(m, "season-count", &u32)) - *save |= epg_brand_set_season_count(eb, u32, NULL); - if ((str = htsmsg_get_str(m, "image"))) - *save |= epg_brand_set_image(eb, str, &changes); - - *save |= epg_brand_change_finish(eb, changes, 0); - - return eb; -} - -htsmsg_t *epg_brand_list ( void ) -{ - epg_object_t *eo; - htsmsg_t *a, *e; - a = htsmsg_create_list(); - RB_FOREACH(eo, &epg_brands, uri_link) { - assert(eo->type == EPG_BRAND); - e = epg_brand_serialize((epg_brand_t*)eo); - htsmsg_add_msg(a, NULL, e); - } - return a; -} - -const char *epg_brand_get_title ( const epg_brand_t *b, const char *lang ) -{ - if (!b || !b->title) return NULL; - return lang_str_get(b->title, lang); -} - -const char *epg_brand_get_summary ( const epg_brand_t *b, const char *lang ) -{ - if (!b || !b->summary) return NULL; - return lang_str_get(b->summary, lang); -} - /* ************************************************************************** * Season * *************************************************************************/ @@ -658,7 +427,6 @@ static void _epg_season_destroy ( void *eo ) tvhlog(LOG_CRIT, LS_EPG, "attempt to destory season with episodes"); assert(0); } - if (es->brand) _epg_brand_rem_season(es->brand, es); if (es->summary) lang_str_destroy(es->summary); if (es->image) free(es->image); _epg_object_destroy(eo, &epg_seasons); @@ -717,8 +485,6 @@ int epg_season_change_finish save |= epg_season_set_episode_count(season, 0, NULL); if (!(changes & EPG_CHANGED_SEASON_NUMBER)) save |= epg_season_set_number(season, 0, NULL); - if (!(changes & EPG_CHANGED_BRAND)) - save |= epg_season_set_brand(season, 0, NULL); return save; } @@ -758,22 +524,6 @@ int epg_season_set_number changed, EPG_CHANGED_SEASON_NUMBER); } -int epg_season_set_brand - ( epg_season_t *season, epg_brand_t *brand, uint32_t *changed ) -{ - int save = 0; - if (!season) return 0; - if (changed) *changed |= EPG_CHANGED_BRAND; - if (season->brand != brand) { - if (season->brand) _epg_brand_rem_season(season->brand, season); - season->brand = brand; - if (brand) _epg_brand_add_season(brand, season); - _epg_object_set_updated(season); - save = 1; - } - return save; -} - static void _epg_season_add_episode ( epg_season_t *season, epg_episode_t *episode ) { @@ -801,8 +551,6 @@ htsmsg_t *epg_season_serialize ( epg_season_t *season ) htsmsg_add_u32(m, "number", season->number); if (season->episode_count) htsmsg_add_u32(m, "episode-count", season->episode_count); - if (season->brand) - htsmsg_add_str(m, "brand", season->brand->uri); if (season->image) htsmsg_add_str(m, "image", season->image); return m; @@ -812,7 +560,6 @@ epg_season_t *epg_season_deserialize ( htsmsg_t *m, int create, int *save ) { epg_object_t **skel = _epg_season_skel(); epg_season_t *es; - epg_brand_t *eb; uint32_t u32, changes = 0; const char *str; lang_str_t *ls; @@ -832,10 +579,6 @@ epg_season_t *epg_season_deserialize ( htsmsg_t *m, int create, int *save ) if (!htsmsg_get_u32(m, "episode-count", &u32)) *save |= epg_season_set_episode_count(es, u32, &changes); - if ((str = htsmsg_get_str(m, "brand"))) - if ((eb = epg_brand_find_by_uri(str, es->grabber, 0, NULL, NULL))) - *save |= epg_season_set_brand(es, eb, &changes); - if ((str = htsmsg_get_str(m, "image"))) *save |= epg_season_set_image(es, str, &changes); @@ -910,7 +653,6 @@ static void _epg_episode_destroy ( void *eo ) tvhlog(LOG_CRIT, LS_EPG, "attempt to destroy episode with broadcasts"); assert(0); } - if (ee->brand) _epg_brand_rem_episode(ee->brand, ee); if (ee->season) _epg_season_rem_episode(ee->season, ee); if (ee->title) lang_str_destroy(ee->title); if (ee->subtitle) lang_str_destroy(ee->subtitle); @@ -1009,10 +751,8 @@ int epg_episode_change_finish save |= _epg_object_set_u16(episode, &episode->epnum.p_cnt, 0, NULL, 0); if (!(changes & EPG_CHANGED_EPTEXT)) save |= _epg_object_set_str(episode, &episode->epnum.text, NULL, NULL, 0); - if (!(changes & EPG_CHANGED_BRAND)) - save |= epg_episode_set_brand(episode, NULL, NULL); if (!(changes & EPG_CHANGED_SEASON)) - save |= epg_episode_set_brand(episode, NULL, NULL); + save |= epg_episode_set_season(episode, NULL, NULL); if (!(changes & EPG_CHANGED_GENRE)) save |= epg_episode_set_genre(episode, NULL, NULL); if (!(changes & EPG_CHANGED_IS_BW)) @@ -1126,22 +866,6 @@ int epg_episode_set_epnum return save; } -int epg_episode_set_brand - ( epg_episode_t *episode, epg_brand_t *brand, uint32_t *changed ) -{ - int save = 0; - if (!episode) return 0; - if (changed) *changed |= EPG_CHANGED_BRAND; - if (episode->brand != brand) { - if (episode->brand) _epg_brand_rem_episode(episode->brand, episode); - episode->brand = brand; - if (brand) _epg_brand_add_episode(brand, episode); - _epg_object_set_updated(episode); - save = 1; - } - return save; -} - int epg_episode_set_season ( epg_episode_t *episode, epg_season_t *season, uint32_t *changed ) { @@ -1153,9 +877,6 @@ int epg_episode_set_season episode->season = season; if (season) { _epg_season_add_episode(season, episode); - save |= epg_episode_set_brand(episode, season->brand ?: NULL, changed); - } else { - save |= epg_episode_set_brand(episode, NULL, changed); } _epg_object_set_updated(episode); save |= 1; @@ -1308,9 +1029,6 @@ void epg_episode_get_epnum ( const epg_episode_t *ee, epg_episode_num_t *num ) num->e_cnt = ee->season->episode_count; num->s_num = ee->season->number; } - if (ee->brand) { - num->s_cnt = ee->brand->season_count; - } } int epg_episode_number_cmp ( const epg_episode_num_t *a, const epg_episode_num_t *b ) @@ -1381,8 +1099,6 @@ htsmsg_t *epg_episode_serialize ( epg_episode_t *episode ) htsmsg_add_u32(a, NULL, eg->code); } if (a) htsmsg_add_msg(m, "genre", a); - if (episode->brand) - htsmsg_add_str(m, "brand", episode->brand->uri); if (episode->season) htsmsg_add_str(m, "season", episode->season->uri); if (episode->is_bw) @@ -1406,7 +1122,6 @@ epg_episode_t *epg_episode_deserialize ( htsmsg_t *m, int create, int *save ) epg_object_t **skel = _epg_episode_skel(); epg_episode_t *ee; epg_season_t *es; - epg_brand_t *eb; const char *str; epg_episode_num_t num; htsmsg_t *sub; @@ -1455,9 +1170,6 @@ epg_episode_t *epg_episode_deserialize ( htsmsg_t *m, int create, int *save ) if ((str = htsmsg_get_str(m, "season"))) if ((es = epg_season_find_by_uri(str, ee->grabber, 0, NULL, &changes))) *save |= epg_episode_set_season(ee, es, NULL); - if ((str = htsmsg_get_str(m, "brand"))) - if ((eb = epg_brand_find_by_uri(str, ee->grabber, 0, NULL, &changes))) - *save |= epg_episode_set_brand(ee, eb, NULL); if (!htsmsg_get_u32(m, "is_bw", &u32)) *save |= epg_episode_set_is_bw(ee, u32, &changes); @@ -3386,8 +3098,6 @@ void epg_skel_done(void) epg_object_t **skel; epg_broadcast_t **broad; - skel = _epg_brand_skel(); - free(*skel); *skel = NULL; skel = _epg_season_skel(); free(*skel); *skel = NULL; skel = _epg_episode_skel(); diff --git a/src/epg.h b/src/epg.h index 2effa80f3..df864a208 100644 --- a/src/epg.h +++ b/src/epg.h @@ -38,7 +38,6 @@ struct epggrab_module; */ typedef LIST_HEAD(,epg_object) epg_object_list_t; typedef RB_HEAD (,epg_object) epg_object_tree_t; -typedef LIST_HEAD(,epg_brand) epg_brand_list_t; typedef LIST_HEAD(,epg_season) epg_season_list_t; typedef LIST_HEAD(,epg_episode) epg_episode_list_t; typedef LIST_HEAD(,epg_broadcast) epg_broadcast_list_t; @@ -50,7 +49,6 @@ typedef LIST_HEAD(,epg_genre) epg_genre_list_t; */ typedef struct epg_genre epg_genre_t; typedef struct epg_object epg_object_t; -typedef struct epg_brand epg_brand_t; typedef struct epg_season epg_season_t; typedef struct epg_episode epg_episode_t; typedef struct epg_broadcast epg_broadcast_t; @@ -109,7 +107,6 @@ htsmsg_t *epg_genres_list_all ( int major_only, int major_prefix, const char *la typedef enum epg_object_type { EPG_UNDEF, - EPG_BRAND, EPG_SEASON, EPG_EPISODE, EPG_BROADCAST, @@ -164,66 +161,6 @@ epg_object_t *epg_object_find_by_id ( uint32_t id, epg_object_type_t type ); htsmsg_t *epg_object_serialize ( epg_object_t *eo ); epg_object_t *epg_object_deserialize ( htsmsg_t *msg, int create, int *save ); -/* ************************************************************************ - * Brand - Represents a specific show - * e.g. The Simpsons, 24, Eastenders, etc... - * ***********************************************************************/ - -/* Change flags */ -#define EPG_CHANGED_SEASON_COUNT (1<<(EPG_CHANGED_SLAST+1)) -#define EPG_CHANGED_SEASONS (1<<(EPG_CHANGED_SLAST+2)) -#define EPG_CHANGED_EPISODES (1<<(EPG_CHANGED_SLAST+3)) - -/* Object */ -struct epg_brand -{ - epg_object_t; ///< Base object - - lang_str_t *title; ///< Brand name - lang_str_t *summary; ///< Brand summary - uint16_t season_count; ///< Total number of seasons - char *image; ///< Brand image - - epg_season_list_t seasons; ///< Season list - epg_episode_list_t episodes; ///< Episode list -}; - -/* Lookup */ -epg_brand_t *epg_brand_find_by_uri - ( const char *uri, struct epggrab_module *src, int create, int *save, uint32_t *changes ); -epg_brand_t *epg_brand_find_by_id ( uint32_t id ); - -/* Post-modify */ -int epg_brand_change_finish( epg_brand_t *b, uint32_t changed, int merge ) - __attribute__((warn_unused_result)); - -/* Accessors */ -const char *epg_brand_get_title - ( const epg_brand_t *b, const char *lang ); -const char *epg_brand_get_summary - ( const epg_brand_t *b, const char *lang ); - -/* Mutators */ -int epg_brand_set_title - ( epg_brand_t *b, const lang_str_t *title, uint32_t *changed ) - __attribute__((warn_unused_result)); -int epg_brand_set_summary - ( epg_brand_t *b, const lang_str_t *summary, uint32_t *changed ) - __attribute__((warn_unused_result)); -int epg_brand_set_season_count - ( epg_brand_t *b, uint16_t season_count, uint32_t *changed ) - __attribute__((warn_unused_result)); -int epg_brand_set_image - ( epg_brand_t *b, const char *i, uint32_t *changed ) - __attribute__((warn_unused_result)); - -/* Serialization */ -htsmsg_t *epg_brand_serialize ( epg_brand_t *b ); -epg_brand_t *epg_brand_deserialize ( htsmsg_t *m, int create, int *save ); - -/* List all brands (serialized) */ -htsmsg_t *epg_brand_list ( void ); - /* ************************************************************************ * Season * ***********************************************************************/ @@ -243,7 +180,6 @@ struct epg_season char *image; ///< Season image LIST_ENTRY(epg_season) blink; ///< Brand list link - epg_brand_t *brand; ///< Parent brand epg_episode_list_t episodes; ///< Episode list }; @@ -271,9 +207,6 @@ int epg_season_set_number int epg_season_set_episode_count ( epg_season_t *s, uint16_t episode_count, uint32_t *changed ) __attribute__((warn_unused_result)); -int epg_season_set_brand - ( epg_season_t *s, epg_brand_t *b, uint32_t *changed ) - __attribute__((warn_unused_result)); int epg_season_set_image ( epg_season_t *s, const char *image, uint32_t *changed ) __attribute__((warn_unused_result)); @@ -299,9 +232,8 @@ epg_season_t *epg_season_deserialize ( htsmsg_t *m, int create, int *save ); #define EPG_CHANGED_STAR_RATING (1<<(EPG_CHANGED_SLAST+10)) #define EPG_CHANGED_AGE_RATING (1<<(EPG_CHANGED_SLAST+11)) #define EPG_CHANGED_FIRST_AIRED (1<<(EPG_CHANGED_SLAST+12)) -#define EPG_CHANGED_BRAND (1<<(EPG_CHANGED_SLAST+13)) -#define EPG_CHANGED_SEASON (1<<(EPG_CHANGED_SLAST+14)) -#define EPG_CHANGED_COPYRIGHT_YEAR (1<<(EPG_CHANGED_SLAST+15)) +#define EPG_CHANGED_SEASON (1<<(EPG_CHANGED_SLAST+13)) +#define EPG_CHANGED_COPYRIGHT_YEAR (1<<(EPG_CHANGED_SLAST+14)) /* Episode numbering object - this is for some back-compat and also * to allow episode information to be "collated" into easy to use object @@ -342,7 +274,6 @@ struct epg_episode ///< year since we only get year not month and day. LIST_ENTRY(epg_episode) blink; ///< Brand link LIST_ENTRY(epg_episode) slink; ///< Season link - epg_brand_t *brand; ///< (Grand-)Parent brand epg_season_t *season; ///< Parent season epg_broadcast_list_t broadcasts; ///< Broadcast list }; @@ -390,9 +321,6 @@ int epg_episode_set_part int epg_episode_set_epnum ( epg_episode_t *e, epg_episode_num_t *num, uint32_t *changed ) __attribute__((warn_unused_result)); -int epg_episode_set_brand - ( epg_episode_t *e, epg_brand_t *b, uint32_t *changed ) - __attribute__((warn_unused_result)); int epg_episode_set_season ( epg_episode_t *e, epg_season_t *s, uint32_t *changed ) __attribute__((warn_unused_result)); diff --git a/src/epgdb.c b/src/epgdb.c index 82cc8cd73..a46a64bd4 100644 --- a/src/epgdb.c +++ b/src/epgdb.c @@ -39,7 +39,6 @@ #define EPG_DB_VERSION 2 #define EPG_DB_ALLOC_STEP (1024*1024) -extern epg_object_tree_t epg_brands; extern epg_object_tree_t epg_seasons; extern epg_object_tree_t epg_episodes; extern epg_object_tree_t epg_serieslinks; @@ -120,7 +119,7 @@ _epgdb_v2_process( char **sect, htsmsg_t *m, epggrab_stats_t *stats ) /* Brand */ } else if ( !strcmp(*sect, "brands") ) { - if (epg_brand_deserialize(m, 1, &save)) stats->brands.total++; + /* skip */ /* Season */ } else if ( !strcmp(*sect, "seasons") ) { @@ -153,29 +152,6 @@ _epgdb_v2_process( char **sect, htsmsg_t *m, epggrab_stats_t *stats ) * Memoryinfo */ -static void epg_memoryinfo_brands_update(memoryinfo_t *my) -{ - epg_object_t *eo; - epg_brand_t *eb; - int64_t size = 0, count = 0; - - RB_FOREACH(eo, &epg_brands, uri_link) { - eb = (epg_brand_t *)eo; - size += sizeof(*eb); - size += tvh_strlen(eb->uri); - size += lang_str_size(eb->title); - size += lang_str_size(eb->summary); - size += tvh_strlen(eb->image); - count++; - } - memoryinfo_update(my, size, count); -} - -static memoryinfo_t epg_memoryinfo_brands = { - .my_name = "EPG Brands", - .my_update = epg_memoryinfo_brands_update -}; - static void epg_memoryinfo_seasons_update(memoryinfo_t *my) { epg_object_t *eo; @@ -292,7 +268,6 @@ void epg_init ( void ) struct sigaction act, oldact; char *sect = NULL; - memoryinfo_register(&epg_memoryinfo_brands); memoryinfo_register(&epg_memoryinfo_seasons); memoryinfo_register(&epg_memoryinfo_episodes); memoryinfo_register(&epg_memoryinfo_serieslinks); @@ -410,8 +385,6 @@ void epg_init ( void ) /* Stats */ tvhinfo(LS_EPGDB, "loaded v%d", ver); tvhinfo(LS_EPGDB, " config %d", stats.config.total); - //tvhinfo(LS_EPGDB, " channels %d", stats.channels.total); - tvhinfo(LS_EPGDB, " brands %d", stats.brands.total); tvhinfo(LS_EPGDB, " seasons %d", stats.seasons.total); tvhinfo(LS_EPGDB, " episodes %d", stats.episodes.total); tvhinfo(LS_EPGDB, " broadcasts %d", stats.broadcasts.total); @@ -432,7 +405,6 @@ void epg_done ( void ) CHANNEL_FOREACH(ch) epg_channel_unlink(ch); epg_skel_done(); - memoryinfo_unregister(&epg_memoryinfo_brands); memoryinfo_unregister(&epg_memoryinfo_seasons); memoryinfo_unregister(&epg_memoryinfo_episodes); memoryinfo_unregister(&epg_memoryinfo_serieslinks); @@ -545,11 +517,6 @@ void epg_save ( void ) memset(&stats, 0, sizeof(stats)); if ( _epg_write_sect(sb, "config") ) goto error; if (_epg_write(sb, epg_config_serialize())) goto error; - if ( _epg_write_sect(sb, "brands") ) goto error; - RB_FOREACH(eo, &epg_brands, uri_link) { - if (_epg_write(sb, epg_brand_serialize((epg_brand_t*)eo))) goto error; - stats.brands.total++; - } if ( _epg_write_sect(sb, "seasons") ) goto error; RB_FOREACH(eo, &epg_seasons, uri_link) { if (_epg_write(sb, epg_season_serialize((epg_season_t*)eo))) goto error; @@ -578,7 +545,6 @@ void epg_save ( void ) /* Stats */ tvhinfo(LS_EPGDB, "queued to save (size %d)", sb->sb_ptr); - tvhinfo(LS_EPGDB, " brands %d", stats.brands.total); tvhinfo(LS_EPGDB, " seasons %d", stats.seasons.total); tvhinfo(LS_EPGDB, " episodes %d", stats.episodes.total); tvhinfo(LS_EPGDB, " broadcasts %d", stats.broadcasts.total); diff --git a/src/htsp_server.c b/src/htsp_server.c index 1337be870..97c29bdef 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -1253,7 +1253,6 @@ htsp_build_event else if (e->serieslink && e->serieslink->updated > update) ignore = 0; else if (ee) { if (ee->updated > update) ignore = 0; - else if (ee->brand && ee->brand->updated > update) ignore = 0; else if (ee->season && ee->season->updated > update) ignore = 0; } if (ignore) return NULL; @@ -1314,8 +1313,6 @@ htsp_build_event htsmsg_add_u32(out, "episodeId", ee->id); if (ee->uri && strncasecmp(ee->uri,"tvh://",6)) /* tvh:// uris are internal */ htsmsg_add_str(out, "episodeUri", ee->uri); - if (ee->brand) - htsmsg_add_u32(out, "brandId", ee->brand->id); if (ee->season) htsmsg_add_u32(out, "seasonId", ee->season->id); if((g = LIST_FIRST(&ee->genre))) {