#include "imagecache.h"
#include "dvr/dvr.h"
#include "lang_codes.h"
+#include "string_list.h"
static htsmsg_t *
api_epg_get_list ( const char *s )
htsmsg_add_str(m, "summary", s);
if ((s = epg_broadcast_get_description(eb, lang)))
htsmsg_add_str(m, "description", s);
+ if (eb->credits) {
+ htsmsg_add_msg(m, "credits", htsmsg_copy(eb->credits));
+ }
+ if (eb->category) {
+ htsmsg_add_msg(m, "category", string_list_to_htsmsg(eb->category));
+ }
+ if (eb->keyword) {
+ htsmsg_add_msg(m, "keyword", string_list_to_htsmsg(eb->keyword));
+ }
if (eb->is_new)
htsmsg_add_u32(m, "new", eb->is_new);
content += '<div class="x-epg-desc">' + event.description + '</div>';
if (event.summary || event.description)
content += '<hr class="x-epg-hr"/>';
+
+ // Helper function for common code to sort an array, convert to CSV and
+ // return the string to add to the content.
+ function sortAndAddArray(arr, title) {
+ arr.sort();
+ var csv = arr.join(", ");
+ if (csv)
+ return '<div class="x-epg-meta"><span class="x-epg-prefix">' + title + ':</span><span class="x-epg-body">' + csv + '</span></div>';
+ else
+ return '';
+ }
+
+ if (event.credits) {
+ // Our cast (credits) map contains details of actors, writers,
+ // etc. so split in to separate categories for displaying.
+ var castArr = [];
+ var crewArr = [];
+ var directorArr = [];
+ var writerArr = [];
+ var cast = ["actor", "guest", "presenter"];
+ // We use arrays here in case more tags in the future map on to
+ // director/writer, e.g., SchedulesDirect breaks it down in to
+ // writer, writer (adaptation) writer (screenplay), etc. but
+ // currently we just have them all as writer.
+ var director = ["director"];
+ var writer = ["writer"];
+
+ for (key in event.credits) {
+ var type = event.credits[key];
+ if (cast.indexOf(type) != -1)
+ castArr.push(key);
+ else if (director.indexOf(type) != -1)
+ directorArr.push(key);
+ else if (writer.indexOf(type) != -1)
+ writerArr.push(key);
+ else
+ crewArr.push(key);
+ };
+
+ content += sortAndAddArray(castArr, _('Starring'));
+ content += sortAndAddArray(directorArr, _('Director'));
+ content += sortAndAddArray(writerArr, _('Writer'));
+ content += sortAndAddArray(crewArr, _('Crew'));
+ }
+ if (event.keyword)
+ content += sortAndAddArray(event.keyword, _('Keywords'));
+ if (event.category)
+ content += sortAndAddArray(event.category, _('Categories'));
if (event.starRating)
content += '<div class="x-epg-meta"><span class="x-epg-prefix">' + _('Star Rating') + ':</span><span class="x-epg-body">' + event.starRating + '</span></div>';
if (event.ageRating)
dateFormat: 'U' /* unix time */
},
{ name: 'starRating' },
+ { name: 'credits' },
+ { name: 'category' },
+ { name: 'keyword' },
{ name: 'ageRating' },
{ name: 'genre' },
{ name: 'dvrUuid' },