Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI: EPG - cleanups in the comet code
  • Loading branch information
perexg committed Oct 12, 2015
1 parent 054fc2e commit 71861fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/webui/static/app/epg.js
Expand Up @@ -938,18 +938,9 @@ tvheadend.epg = function() {
},
success: function(d) {
d = json_decode(d);
for (var i = 0; i < d.length; i++) {
var r = epgStore.getById(d[i].eventId);
if (r) {
for (var j = 0; j < r.store.fields.items.length; j++) {
var n = r.store.fields.items[j];
var v = d[i][n.name];
r.data[n.name] = n.convert((v !== undefined) ? v : n.defaultValue, v);
}
r.json = d[i];
r.commit();
}
}
Ext.each(d, function(jd) {
tvheadend.replace_entry(epgStore.getById(jd.eventId), jd);
});
},
failure: function(response, options) {
Ext.MessageBox.alert(_('EPG Update'), response.statusText);
Expand Down
14 changes: 14 additions & 0 deletions src/webui/static/app/tvheadend.js
Expand Up @@ -164,6 +164,20 @@ tvheadend.doQueryAnyMatch = function(q, forceAll) {
}
}

/*
* Replace one entry
*/

tvheadend.replace_entry = function(r, d) {
if (!r) return;
r.store.fields.each(function (n) {
var v = d[n.name];
r.data[n.name] = n.convert((v !== undefined) ? v : n.defaultValue, v);
});
r.json = d;
r.commit();
}

/*
* General capabilities
*/
Expand Down

0 comments on commit 71861fd

Please sign in to comment.