From a0e8d4339c6b08c4a2908ebcd342bb542b51f5ad Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 2 Jun 2017 13:06:54 +0200 Subject: added support for specials show name from PV diff --git a/www/js/nextshows.js b/www/js/nextshows.js index ee6eeaf..b6d0a05 100644 --- a/www/js/nextshows.js +++ b/www/js/nextshows.js @@ -32,13 +32,14 @@ var shows = null; rh.ShowList = function() { this.$this = $(this); this.shows = []; + this.pv_names = {}; }; rh.ShowList.prototype.fetch = function() { var self = this; var yd = new Date((new Date()) - 24 * 3600 * 1000); var ydstr = yd.getFullYear() + '-' + Number(yd.getMonth() + 1).pad(2) + '-' + Number(yd.getDate()).pad(2); - $.getJSON( "/rh-bin/schedules.json?DAYS=3&START=" + ydstr, function(data) { + $.getJSON("/rh-bin/schedules.json?DAYS=3&START=" + ydstr, function(data) { if(data.status == "OK") { self.shows = []; $(data.shows).each(function(index, showdata) { @@ -53,6 +54,16 @@ rh.ShowList.prototype.fetch = function() { self.$this.trigger('update'); } }); + + $.getJSON("/pv-export/timeslots_specials.json", function(data) { + self.pv_names = {}; + $.each(data, function(specialid, specialdata) { + if(specialdata.pv_id >= 0) { + self.pv_names[specialdata.id] = specialdata.pv_name; + } + }); + self.$this.trigger('update'); + }); }; rh.Show = function(show) { @@ -61,6 +72,7 @@ rh.Show = function(show) { this.start = new Date(show.start); this.len = show.len; this.end = new Date(this.start.valueOf() + show.len); + this.pv_name = ""; }; @@ -94,6 +106,7 @@ rh.ShowListView.prototype.render = function() { continue; } + this.model.shows[i].pv_name = this.model.pv_names[this.model.shows[i].id]; var showView = new rh.ShowView(this.model.shows[i], this); this.showViews.push(showView); showView.render(now); @@ -122,7 +135,11 @@ rh.ShowView.prototype.render = function(now) { } var end = $('').addClass('show-end').text(endstr); - var title = $('').addClass('show-title').text(this.model.title); + var t = this.model.title; + if(typeof this.model.pv_name !== 'undefined' && this.model.pv_name != "") { + t = this.model.pv_name; + } + var title = $('').addClass('show-title').text(t); this.$el.empty().addClass('show').append(start).append(end).append(title); var until = this.model.start - now; -- cgit v0.10.2