Project

General

Profile

XMLTV: It´s possible get the star rating?

Added by Nicolas Rioja almost 8 years ago

Hi,
I get the EPG info from xmltv and inside I can see the star rating value but I´ve tried to get that info from tvheadend without success.

This is the original input of the .xml file:

<programme start="20161129120500 +0100" stop="20161129135500 +0100" channel="Atreseries">
<title lang="es">El síndrome de Ulises</title>
<desc lang="es">Episodio: S1
Descripción:Ulises es un joven niño rico, que acaba de venir de los Estados Unidos, donde, a parte de salir de fiesta y conocer a chicas, ha terminado sus estudios de medicina. A la vuelta a España, le espera un panorama muy distinto al que está acostumbrado, ya que se convierte en el coordinador de una clínica ubicada en las afueras de la ciudad. Allí, tendrá que lidiar con sus nuevos compañeros: Reyes, una atractiva enfermera que tiene mucha empatía con los pacientes; Cristóbal, el divertido médico de cabecera, y Estela, la trabajadora social del centro.Esta comedia social narra el estrés que sufre un 'niño de papá', acostumbrado a una vida guiada por el ocio y el placer, al conseguir un trabajo de responsabilidad en un hospital. Interpretada por Miguel Ángel Muñoz, le acompañan en el reparto rostros populares del celuloide (Nancho Novo, ''La Celestina'') y la televisión (Toni Acosta, quien ya había coincidido con el protagonista en la serie ''Un paso adelante'', y Olivia Molina de ''Al salir de clase'').
¤ Fecha de producción:2007.
¤ Intérpretes: Miguel Ángel Muñoz, Carla Antonelli, Toni Acosta, Nancho Novo, Olivia Molina.
¤ Género:Series de comedia españolas.
¤ Calificación: +7.</desc>
<category lang="es">Series de comedia españolas</category>
<icon src="http://cdn.sincroguia.tv/uploads/programs/e/l/-/el-sindrome-de-ulises-103471_SPA-28.jpg" />
<country>España</country>
<episode-num system="onscreen">S1</episode-num>
<rating system="ES">
<value>+7</value>
</rating>
<star-rating>
<value>1.0</value>
</star-rating>
<review type="text">+7</review>
</programme>

I´ve been reading this info:
https://tvheadend.org/projects/tvheadend/wiki/Epgdb

And I´ve tried the next changes in the line but wihtout success.
In the same line:
<star-rating><value>1.0</value></star-rating>

Changing the value to this:
<star-rating><value>1.5</value></star-rating>
<star-rating><value>1/5</value></star-rating>
<star-rating><value>1</value></star-rating>

And even changing <star-rating> by <star_rating> based in the episode objects:
https://tvheadend.org/projects/tvheadend/wiki/Epgdb#Episode-object-epg_episode_t
<star_rating><value>1.5</value></star_rating>
<star_rating><value>1/5</value></star_rating>
<star_rating><value>1</value></star_rating>

But tvheadend is unable to recognize the star in the EPG section:

So the question is if it´s possible to do with an xmltv file and how should appear the line to be recognized by tvheadend.

Thanks a lot!


Replies (3)

RE: XMLTV: It´s possible get the star rating? - Added by K Shea almost 8 years ago

I don't get it, unless maybe you have an older version of TVHeadEnd or the code is buggy. I am looking at https://github.com/tvheadend/tvheadend/blob/master/src/epggrab/module/xmltv.c but I am not a programmer (especially not a C programmer) but I suspect the section that is relevant is this:

/*
 * Star rating
 *   <star-rating>
 *     <value>3.3/5</value>
 *   </star-rating>
 */
static int _xmltv_parse_star_rating
  ( epg_episode_t *ee, htsmsg_t *body, uint32_t *changes )
{
  double a, b;
  htsmsg_t *stars, *tags;
  const char *s1, *s2;
  char *s1end, *s2end;

  if (!ee || !body) return 0;
  if (!(stars = htsmsg_get_map(body, "star-rating"))) return 0;
  if (!(tags  = htsmsg_get_map(stars, "tags"))) return 0;
  if (!(s1 = htsmsg_xml_get_cdata_str(tags, "value"))) return 0;
  if (!(s2 = strstr(s1, "/"))) return 0;

  a = strtod(s1, &s1end);
  b = strtod(s2 + 1, &s2end);
  if ( a == 0.0f || b == 0.0f) return 0;

  return epg_episode_set_star_rating(ee, (100 * a) / b, changes);
}

My only guess would be that your code sample shows

<star-rating>
<value>1.0</value>
</star-rating>

And TVHeadEnd is looking for

<star-rating>
  <value>1/5</value>
</star-rating>

or something similar. But if you have an older version of TVHeadEnd the code may be different, or the current code might be buggy, I don't know.

RE: XMLTV: It´s possible get the star rating? - Added by Nicolas Rioja almost 8 years ago

Hi K Shea,

Following your indications I´ve changed one program like you wrote above where TVHeadEnd is expecting... but unfortunately without success.

Anyway I would like to share with you my setup to get more details:

TVHeadEnd | Version: 4.1-2195~g65dfd15
XMLTV | Version: 0.5.68

Configure arguments:
  --disable-avahi --enable-bundle --disable-dbus_1 --disable-hdhomerun_client --disable-hdhomerun_static --disable-libx265

Compiler:
  Using C compiler:                        cc
  Build for arch:                          x86_64

Binaries:
  Using PYTHON:                            python
  Using GZIP:                              gzip
  Using BZIP2:                             bzip2

Options:
  pie                                      yes
  ccdebug                                  no
  cwc                                      yes
  capmt                                    yes
  constcw                                  yes
  linuxdvb                                 yes
  satip_server                             yes
  satip_client                             yes
  hdhomerun_client                         no
  hdhomerun_static                         no
  iptv                                     yes
  tsfile                                   yes
  dvbscan                                  yes
  timeshift                                yes
  trace                                    yes
  imagecache                               yes
  avahi                                    no
  zlib                                     yes
  libav                                    yes
  ffmpeg_static                            yes
  libx264                                  yes
  libx264_static                           yes
  libx265                                  no
  libx265_static                           no
  libvpx                                   yes
  libvpx_static                            yes
  libtheora                                yes
  libtheora_static                         yes
  libvorbis                                yes
  libvorbis_static                         yes
  libfdkaac                                yes
  libfdkaac_static                         yes
  nvenc                                    no
  qsv                                      no
  libmfx_static                            no
  inotify                                  yes
  epoll                                    yes
  uriparser                                no
  ccache                                   no
  tvhcsa                                   yes
  bundle                                   yes
  dvbcsa                                   no
  dvben50221                               no
  kqueue                                   no
  dbus_1                                   no
  android                                  no
  tsdebug                                  no
  gtimer_check                             no
  slow_memoryinfo                          no
  libsystemd_daemon                        no
  bintray_cache                            yes
  execinfo                                 yes
  mmx                                      yes
  sse2                                     yes
  W_unused_result                          yes
  getloadavg                               yes
  atomic64                                 yes
  atomic_time_t                            yes
  lockowner                                yes
  qsort_r                                  yes
  stime                                    yes
  gmtoff                                   yes
  ifnames                                  yes
  py_gzip                                  yes
  bin_pkg_config                           yes
  bin_xgettext                             yes
  bin_msgmerge                             yes
  bin_gzip                                 yes
  bin_bzip2                                yes
  ssl                                      yes
  linuxdvbapi                              yes
  upnp                                     yes
  libogg_static                            yes
  inotify_h                                yes
  mpegts                                   yes
  mpegts_dvb                               yes

Packages:
  openssl                                  0.9.8o
  zlib                                     1.2.3.4

Installation paths:
  Prefix:                                  /usr/local
  Binaries:                                ${prefix}/bin
  Libraries:                               ${prefix}/lib
  Data files:                              ${prefix}/share
  Man pages:                               ${datadir}/man

I´m using xmltv to inyect the .xml file generated vía WegGrabPlus (http://www.webgrabplus.com/) to tvheadend.

So, not sure if there is a bug or is another type of problem.

Regards.
Nicolás

RE: XMLTV: It´s possible get the star rating? - Added by Anonymous almost 8 years ago

You need to adjust your WebGrabPlus sincroguia.tv.ini file like this:
starrating.modify {addend('starrating' not="")|/5}

Maybe you need this if Tvheadend wants 10 as maximum:
starrating.modify {calculate(not "" format=F1)|'starrating' 2 *}
starrating.modify {addend('starrating' not="")|/10}

I have IMDb ratings in my XMLTV files like this:
<star-rating>
<value>6.1/10</value>
</star-rating>

And it shows fine in Tvheadned webui.

Sometimes you have to start with clean EPG db in Tvheadend to see the changes in XMLTV files.

    (1-3/3)