@@ -217,6 +217,40 @@ void TeleBoy::GetAddonCapabilities(PVR_ADDON_CAPABILITIES* pCapabilities)
217217 pCapabilities->bSupportsTimers = true ;
218218}
219219
220+ void TeleBoy::LoadGenres ()
221+ {
222+ Document json;
223+ if (!ApiGet (" /epg/genres" , json))
224+ {
225+ XBMC->Log (LOG_ERROR, " Error loading genres." );
226+ return ;
227+ }
228+ Value& genres = json[" data" ][" items" ];
229+ for (Value::ConstValueIterator itr1 = genres.Begin ();
230+ itr1 != genres.End (); ++itr1)
231+ {
232+ const Value &genre = (*itr1);
233+ TeleboyGenre teleboyGenre;
234+ int id = genre[" id" ].GetInt ();
235+ teleboyGenre.name = GetStringOrEmpty (genre, " name" );
236+ genresById[id] = teleboyGenre;
237+
238+ if (genre.HasMember (" sub_genres" )) {
239+ const Value& subGenres = genre[" sub_genres" ];
240+
241+ for (Value::ConstValueIterator itr1 = subGenres.Begin ();
242+ itr1 != subGenres.End (); ++itr1)
243+ {
244+ const Value &subGenre = (*itr1);
245+ TeleboyGenre teleboySubGenre;
246+ int subId = subGenre[" id" ].GetInt ();
247+ teleboySubGenre.name = GetStringOrEmpty (subGenre, " name" );
248+ genresById[subId] = teleboySubGenre;
249+ }
250+ }
251+ }
252+ }
253+
220254bool TeleBoy::LoadChannels ()
221255{
222256 Document json;
@@ -401,9 +435,11 @@ void TeleBoy::GetEPGForChannelAsync(int uniqueChannelId, time_t iStart,
401435 item.HasMember (" serie_episode" ) ? item[" serie_episode" ].GetInt () : 0 ;
402436 tag.iEpisodePartNumber = 0 ; /* not supported */
403437 tag.strEpisodeName = strdup (GetStringOrEmpty (item, " subtitle" ).c_str ());
404- ; /* not supported */
405- tag.iGenreType = EPG_GENRE_USE_STRING;
406- tag.strGenreDescription = strdup (GetStringOrEmpty (item, " type" ).c_str ());
438+ if (item.HasMember (" genre_id" )) {
439+ tag.iGenreType = EPG_GENRE_USE_STRING;
440+ int genreId = item[" genre_id" ].GetInt ();
441+ tag.strGenreDescription = genresById[genreId].name .c_str ();
442+ }
407443 tag.iFlags = EPG_TAG_FLAG_UNDEFINED;
408444
409445 PVR->EpgEventStateChange (&tag, EPG_EVENT_CREATED);
0 commit comments