Keep the channel list in a global JsonStore in the web app.
This commit is contained in:
parent
2b854cb48d
commit
168736e9b0
4 changed files with 39 additions and 45 deletions
19
channels.c
19
channels.c
|
@ -40,6 +40,7 @@
|
|||
#include "autorec.h"
|
||||
#include "xmltv.h"
|
||||
#include "dtable.h"
|
||||
#include "notify.h"
|
||||
|
||||
struct channel_list channels_not_xmltv_mapped;
|
||||
|
||||
|
@ -51,6 +52,18 @@ static void channel_tag_map(channel_t *ch, channel_tag_t *ct, int check);
|
|||
static channel_tag_t *channel_tag_find(const char *id, int create);
|
||||
static void channel_tag_mapping_destroy(channel_tag_mapping_t *ctm);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void
|
||||
channel_list_changed(void)
|
||||
{
|
||||
htsmsg_t *m = htsmsg_create();
|
||||
htsmsg_add_u32(m, "reload", 1);
|
||||
notify_by_msg("channels", m);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dictcmp(const char *a, const char *b)
|
||||
{
|
||||
|
@ -134,6 +147,10 @@ channel_set_name(channel_t *ch, const char *name)
|
|||
|
||||
x = RB_INSERT_SORTED(&channel_name_tree, ch, ch_name_link, channelcmp);
|
||||
assert(x == NULL);
|
||||
|
||||
/* Notify clients */
|
||||
channel_list_changed();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -385,6 +402,8 @@ channel_delete(channel_t *ch)
|
|||
free(ch->ch_name);
|
||||
free(ch->ch_sname);
|
||||
free(ch->ch_icon);
|
||||
|
||||
channel_list_changed();
|
||||
|
||||
free(ch);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
/**
|
||||
* Channel tags
|
||||
*/
|
||||
|
||||
tvheadend.channelTags = new Ext.data.JsonStore({
|
||||
autoLoad:true,
|
||||
root:'entries',
|
||||
|
@ -11,6 +10,15 @@ tvheadend.channelTags = new Ext.data.JsonStore({
|
|||
baseParams: {op: 'listTags'}
|
||||
});
|
||||
|
||||
/**
|
||||
* Channels
|
||||
*/
|
||||
tvheadend.channels = new Ext.data.JsonStore({
|
||||
autoLoad: true,
|
||||
root:'entries',
|
||||
fields: [{name: 'name'}, {name: 'chid'}],
|
||||
url: "chlist",
|
||||
});
|
||||
|
||||
/**
|
||||
* Channel details
|
||||
|
@ -180,14 +188,6 @@ tvheadend.channeldetails = function(chid, chname) {
|
|||
confpanel.getForm().submit({url:'/channel',
|
||||
params:{'chid': chid, 'op':'save'},
|
||||
waitMsg:'Saving Data...',
|
||||
|
||||
success: function(form, action) {
|
||||
|
||||
if(action.result.reloadchlist) {
|
||||
tvheadend.chconfliststore.reload();
|
||||
}
|
||||
},
|
||||
|
||||
failure: function(form, action) {
|
||||
Ext.Msg.alert('Save failed', action.result.errormsg);
|
||||
}
|
||||
|
@ -203,7 +203,6 @@ tvheadend.channeldetails = function(chid, chname) {
|
|||
Ext.Ajax.request({url: '/channel',
|
||||
params:{'chid': chid, 'op':'delete'},
|
||||
success: function() {
|
||||
tvheadend.chconfliststore.reload();
|
||||
panel.destroy();
|
||||
}
|
||||
});
|
||||
|
@ -262,7 +261,6 @@ tvheadend.channeldetails = function(chid, chname) {
|
|||
srcch: selectedRecord.data.chid},
|
||||
success: function() {
|
||||
transportsstore.reload();
|
||||
tvheadend.chconfliststore.reload();
|
||||
}});
|
||||
}
|
||||
);
|
||||
|
@ -277,20 +275,6 @@ tvheadend.channeldetails = function(chid, chname) {
|
|||
*
|
||||
*/
|
||||
tvheadend.chconf = function() {
|
||||
|
||||
var ChannelRecord = Ext.data.Record.create([
|
||||
{name: 'name'},
|
||||
{name: 'chid'}]);
|
||||
|
||||
var store = new Ext.data.JsonStore({root: 'entries',
|
||||
fields: ChannelRecord,
|
||||
url: "chlist",
|
||||
autoLoad: true,
|
||||
id: 'id',
|
||||
storeid: 'id'
|
||||
});
|
||||
|
||||
|
||||
var chlist = new Ext.grid.GridPanel({
|
||||
ddGroup: 'chconfddgroup',
|
||||
enableDragDrop: true,
|
||||
|
@ -303,7 +287,7 @@ tvheadend.chconf = function() {
|
|||
dataIndex: 'name'}
|
||||
],
|
||||
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
|
||||
store: store,
|
||||
store: tvheadend.channels,
|
||||
});
|
||||
|
||||
var details = new Ext.Panel({
|
||||
|
@ -313,7 +297,6 @@ tvheadend.chconf = function() {
|
|||
|
||||
|
||||
var panel = new Ext.Panel({
|
||||
listeners: {activate: handleActivate},
|
||||
border: false,
|
||||
title:'Channels',
|
||||
layout:'border',
|
||||
|
@ -326,12 +309,9 @@ tvheadend.chconf = function() {
|
|||
|
||||
});
|
||||
|
||||
function handleActivate(tab){
|
||||
store.reload();
|
||||
}
|
||||
|
||||
chlist.on('rowclick', function(grid, n) {
|
||||
var rec = store.getAt(n);
|
||||
var rec = tvheadend.channels.getAt(n);
|
||||
|
||||
details.remove(details.getComponent(0));
|
||||
details.doLayout();
|
||||
|
@ -376,8 +356,5 @@ tvheadend.chconf = function() {
|
|||
console.log(parent);
|
||||
});
|
||||
*/
|
||||
|
||||
tvheadend.chconfliststore = store;
|
||||
|
||||
return panel;
|
||||
}
|
|
@ -99,20 +99,14 @@ tvheadend.epg = function() {
|
|||
});
|
||||
|
||||
|
||||
// Channels, XXX: Perhaps we should make channes a global store as well
|
||||
|
||||
var epgFilterChannelsStore = new Ext.data.JsonStore({
|
||||
root:'entries',
|
||||
fields: [{name: 'name'}],
|
||||
url:'chlist'
|
||||
});
|
||||
// Channels, uses global store
|
||||
|
||||
var epgFilterChannels = new Ext.form.ComboBox({
|
||||
loadingText: 'Loading...',
|
||||
width: 200,
|
||||
displayField:'name',
|
||||
store: epgFilterChannelsStore,
|
||||
mode: 'remote',
|
||||
store: tvheadend.channels,
|
||||
mode: 'local',
|
||||
editable: false,
|
||||
triggerAction: 'all',
|
||||
emptyText: 'Only include channel...'
|
||||
|
|
|
@ -15,9 +15,13 @@ tvheadend.comet_poller = function() {
|
|||
|
||||
switch(m.notificationClass) {
|
||||
case 'channeltags':
|
||||
if(m.reload != null) {
|
||||
if(m.reload != null)
|
||||
tvheadend.channelTags.reload();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'channels':
|
||||
if(m.reload != null)
|
||||
tvheadend.channels.reload();
|
||||
break;
|
||||
|
||||
case 'logmessage':
|
||||
|
|
Loading…
Add table
Reference in a new issue