Project

General

Profile

Feature #3753 ยป 0001-xmltv-Optionally-disable-mapping-category-to-genre.-.patch

Em Smith, 2017-11-21 12:17

View differences:

src/epggrab.h
182 182
  int                           xmltv_scrape_extra; ///< Scrape actors and extra details
183 183
  int                           xmltv_scrape_onto_desc; ///< Include scraped actors
184 184
    ///< and extra details on to programme description for viewing by legacy clients.
185
  int                           xmltv_use_category_not_genre; ///< Use category tags and don't map to DVB genres.
185 186

  
186 187
  /* Handle data */
187 188
  char*     (*grab)   ( void *mod );
src/epggrab/module/xmltv.c
599 599
{
600 600
  const int scrape_extra = ((epggrab_module_ext_t *)mod)->xmltv_scrape_extra;
601 601
  const int scrape_onto_desc = ((epggrab_module_ext_t *)mod)->xmltv_scrape_onto_desc;
602
  const int use_category_not_genre = ((epggrab_module_int_t *)mod)->xmltv_use_category_not_genre;
602 603
  int save = 0, save2 = 0, save3 = 0;
603 604
  epg_episode_t *ee = NULL;
604 605
  epg_serieslink_t *es = NULL;
......
742 743
    if (subtitle)
743 744
      save3 |= epg_episode_set_subtitle(ee, subtitle, &changes3);
744 745

  
745
    if ((egl = _xmltv_parse_categories(tags))) {
746
    if (!use_category_not_genre && (egl = _xmltv_parse_categories(tags))) {
746 747
      save3 |= epg_episode_set_genre(ee, egl, &changes3);
747 748
      epg_genre_list_destroy(egl);
748 749
    }
......
1003 1004
     "You should not enable this if you use 'duplicate detect if different description' " \
1004 1005
     "since the descriptions will change due to added information.")
1005 1006

  
1007
#define USE_CATEGORY_NOT_GENRE_NAME N_("Use category instead of genre")
1008
#define USE_CATEGORY_NOT_GENRE_DESC \
1009
  N_("Some xmltv providers supply multiple category tags, however mapping "\
1010
     "to genres is imprecise and many categories have no genre mapping "\
1011
     "at all. Some frontends will only pass through categories " \
1012
     "unchanged if there is no genre so for these we can " \
1013
     "avoid the genre mappings and only use categories. " \
1014
     "If this option is not ticked then we continue to map " \
1015
     "xmltv categories to genres and supply both to clients.")
1016

  
1006 1017
static htsmsg_t *
1007 1018
xmltv_dn_chnum_list ( void *o, const char *lang )
1008 1019
{
......
1045 1056
      .off    = offsetof(epggrab_module_int_t, xmltv_scrape_onto_desc),
1046 1057
      .group  = 1
1047 1058
    },
1059
    {
1060
      .type   = PT_BOOL,
1061
      .id     = "use_category_not_genre",
1062
      .name   = USE_CATEGORY_NOT_GENRE_NAME,
1063
      .desc   = USE_CATEGORY_NOT_GENRE_DESC,
1064
      .off    = offsetof(epggrab_module_int_t, xmltv_use_category_not_genre),
1065
      .group  = 1
1066
    },
1048 1067
    {}
1049 1068
  }
1050 1069
};
......
1079 1098
      .off    = offsetof(epggrab_module_int_t, xmltv_scrape_onto_desc),
1080 1099
      .group  = 1
1081 1100
    },
1101
    {
1102
      .type   = PT_BOOL,
1103
      .id     = "use_category_not_genre",
1104
      .name   = USE_CATEGORY_NOT_GENRE_NAME,
1105
      .desc   = USE_CATEGORY_NOT_GENRE_DESC,
1106
      .off    = offsetof(epggrab_module_int_t, xmltv_use_category_not_genre),
1107
      .group  = 1
1108
    },
1082 1109
    {}
1083 1110
  }
1084 1111
};
    (1-1/1)