@@ -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;
@@ -400,9 +434,11 @@ void TeleBoy::GetEPGForChannelAsync(int uniqueChannelId, time_t iStart,
400434 item.HasMember (" serie_episode" ) ? item[" serie_episode" ].GetInt () : 0 ;
401435 tag.iEpisodePartNumber = 0 ; /* not supported */
402436 tag.strEpisodeName = strdup (GetStringOrEmpty (item, " subtitle" ).c_str ());
403- ; /* not supported */
404- tag.iGenreType = EPG_GENRE_USE_STRING;
405- tag.strGenreDescription = strdup (GetStringOrEmpty (item, " type" ).c_str ());
437+ if (item.HasMember (" genre_id" )) {
438+ tag.iGenreType = EPG_GENRE_USE_STRING;
439+ int genreId = item[" genre_id" ].GetInt ();
440+ tag.strGenreDescription = genresById[genreId].name .c_str ();
441+ }
406442 tag.iFlags = EPG_TAG_FLAG_UNDEFINED;
407443
408444 PVR->EpgEventStateChange (&tag, EPG_EVENT_CREATED);
0 commit comments