* Add support for merging one channel into another.

Useful if you have multiple providers offering the same DVB service
    but with different names.
This commit is contained in:
Andreas Öman 2009-07-19 21:19:23 +00:00
parent b65f03515c
commit e399720132
5 changed files with 131 additions and 1 deletions

4
debian/changelog vendored
View file

@ -8,6 +8,10 @@ hts-tvheadend (2.4) hts; urgency=low
* Make sure channel <> service mappings are saved when edited from
DVB service grid
* Add support for merging one channel into another.
Useful if you have multiple providers offering the same DVB service
but with different names.
hts-tvheadend (2.3) hts; urgency=low
* A simple web interface has been added. To access it, visit

View file

@ -1472,6 +1472,53 @@ extjs_dvb_addmux(http_connection_t *hc, const char *remain, void *opaque)
return 0;
}
/**
*
*/
static int
extjs_mergechannel(http_connection_t *hc, const char *remain, void *opaque)
{
htsbuf_queue_t *hq = &hc->hc_reply;
const char *target = http_arg_get(&hc->hc_req_args, "targetID");
htsmsg_t *out;
channel_t *src, *dst;
if(remain == NULL || target == NULL)
return 400;
pthread_mutex_lock(&global_lock);
src = channel_find_by_identifier(atoi(remain));
dst = channel_find_by_identifier(atoi(target));
if(src == NULL || dst == NULL) {
pthread_mutex_unlock(&global_lock);
return 404;
}
out = htsmsg_create_map();
if(src != dst) {
channel_merge(dst, src);
htsmsg_add_u32(out, "success", 1);
} else {
htsmsg_add_u32(out, "success", 0);
htsmsg_add_str(out, "msg", "Target same as source");
}
pthread_mutex_unlock(&global_lock);
htsmsg_json_serialize(out, hq, 0);
htsmsg_destroy(out);
http_output_content(hc, "text/x-json; charset=UTF-8");
return 0;
}
/**
* WEB user interface
*/
@ -1490,6 +1537,9 @@ extjs_start(void)
http_path_add("/dvrlist", NULL, extjs_dvrlist, ACCESS_WEB_INTERFACE);
http_path_add("/ecglist", NULL, extjs_ecglist, ACCESS_WEB_INTERFACE);
http_path_add("/mergechannel",
NULL, extjs_mergechannel, ACCESS_ADMIN);
http_path_add("/dvb/adapter",
NULL, extjs_dvbadapter, ACCESS_ADMIN);

View file

@ -39,6 +39,61 @@ tvheadend.comet.on('channels', function(m) {
});
/**
*
*/
tvheadend.mergeChannel = function(chan) {
function doMerge() {
panel.getForm().submit({
url:'mergechannel/' + chan.chid,
success: function() {
win.close();
}
});
}
var panel = new Ext.FormPanel({
frame:true,
border:true,
bodyStyle:'padding:5px',
labelAlign: 'right',
labelWidth: 110,
defaultType: 'textfield',
items: [
new Ext.form.ComboBox({
store: tvheadend.channels,
fieldLabel: 'Target channel',
name: 'targetchannel',
hiddenName: 'targetID',
editable: false,
allowBlank: false,
triggerAction: 'all',
mode: 'remote',
displayField:'name',
valueField:'chid',
emptyText: 'Select a channel...'
})
],
buttons: [{
text: 'Merge',
handler: doMerge
}]
});
win = new Ext.Window({
title: 'Merge channel ' + chan.name + ' into...',
layout: 'fit',
width: 500,
height: 120,
modal: true,
plain: true,
items: panel
});
win.show();
}
/**
*
@ -57,6 +112,22 @@ tvheadend.chconf = function()
var fm = Ext.form;
var actions = new Ext.ux.grid.RowActions({
header:'',
dataIndex: 'actions',
width: 45,
actions: [
{
iconCls:'merge',
qtip:'Merge this channel with another channel',
cb: function(grid, record, action, row, col) {
tvheadend.mergeChannel(record.data);
}
}
]
});
var cm = new Ext.grid.ColumnModel([
{
header: "Name",
@ -108,7 +179,7 @@ tvheadend.chconf = function()
valueField: 'identifier',
displayField: 'name'
})
}
}, actions
]);
@ -206,6 +277,7 @@ tvheadend.chconf = function()
title: 'Channels',
iconCls: 'television',
store: tvheadend.channels,
plugins: [actions],
clicksToEdit: 2,
cm: cm,
viewConfig: {

View file

@ -181,6 +181,10 @@
background-image:url(../icons/wand.png) !important;
}
.merge {
background-image:url(../icons/arrow_join.png) !important;
}
.x-smallhdr {
float:left;

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B