Add a per-channel "number" that can be used by clients to order channels, map to remote control id, etc
This commit is contained in:
parent
c604ef0477
commit
fdeb377d61
5 changed files with 33 additions and 5 deletions
|
@ -273,6 +273,7 @@ channel_load_one(htsmsg_t *c, int id)
|
|||
|
||||
htsmsg_get_s32(c, "dvr_extra_time_pre", &ch->ch_dvr_extra_time_pre);
|
||||
htsmsg_get_s32(c, "dvr_extra_time_post", &ch->ch_dvr_extra_time_post);
|
||||
htsmsg_get_s32(c, "channel_number", &ch->ch_number);
|
||||
|
||||
if((tags = htsmsg_get_list(c, "tags")) != NULL) {
|
||||
HTSMSG_FOREACH(f, tags) {
|
||||
|
@ -335,6 +336,7 @@ channel_save(channel_t *ch)
|
|||
|
||||
htsmsg_add_u32(m, "dvr_extra_time_pre", ch->ch_dvr_extra_time_pre);
|
||||
htsmsg_add_u32(m, "dvr_extra_time_post", ch->ch_dvr_extra_time_post);
|
||||
htsmsg_add_s32(m, "channel_number", ch->ch_number);
|
||||
|
||||
hts_settings_save(m, "channels/%d", ch->ch_id);
|
||||
htsmsg_destroy(m);
|
||||
|
@ -460,7 +462,6 @@ channel_set_icon(channel_t *ch, const char *icon)
|
|||
/**
|
||||
* Set the amount of minutes to start before / end after recording on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_set_epg_postpre_time(channel_t *ch, int pre, int mins)
|
||||
{
|
||||
|
@ -488,6 +489,19 @@ channel_set_epg_postpre_time(channel_t *ch, int pre, int mins)
|
|||
htsp_channel_update(ch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the channel number
|
||||
*/
|
||||
void
|
||||
channel_set_number(channel_t *ch, int number)
|
||||
{
|
||||
if(ch->ch_number == number)
|
||||
return;
|
||||
ch->ch_number = number;
|
||||
channel_save(ch);
|
||||
htsp_channel_update(ch);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef struct channel {
|
|||
gtimer_t ch_epg_timer_current;
|
||||
int ch_dvr_extra_time_pre;
|
||||
int ch_dvr_extra_time_post;
|
||||
|
||||
int ch_number; // User configurable number
|
||||
char *ch_icon;
|
||||
|
||||
struct dvr_entry_list ch_dvrs;
|
||||
|
@ -117,6 +117,8 @@ void channel_merge(channel_t *dst, channel_t *src);
|
|||
|
||||
void channel_set_epg_postpre_time(channel_t *ch, int pre, int mins);
|
||||
|
||||
void channel_set_number(channel_t *ch, int number);
|
||||
|
||||
void channel_set_icon(channel_t *ch, const char *icon);
|
||||
|
||||
struct xmltv_channel;
|
||||
|
|
|
@ -300,6 +300,7 @@ htsp_build_channel(channel_t *ch, const char *method)
|
|||
htsmsg_t *tags = htsmsg_create_list();
|
||||
|
||||
htsmsg_add_u32(out, "channelId", ch->ch_id);
|
||||
htsmsg_add_u32(out, "channelNumber", ch->ch_number);
|
||||
|
||||
htsmsg_add_str(out, "channelName", ch->ch_name);
|
||||
if(ch->ch_icon != NULL)
|
||||
|
|
|
@ -336,6 +336,9 @@ extjs_channels_update(htsmsg_t *in)
|
|||
|
||||
if((s = htsmsg_get_str(c, "epg_post_end")) != NULL)
|
||||
channel_set_epg_postpre_time(ch, 0, atoi(s));
|
||||
|
||||
if((s = htsmsg_get_str(c, "number")) != NULL)
|
||||
channel_set_number(ch, atoi(s));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -381,6 +384,7 @@ extjs_channels(http_connection_t *hc, const char *remain, void *opaque)
|
|||
|
||||
htsmsg_add_s32(c, "epg_pre_start", ch->ch_dvr_extra_time_pre);
|
||||
htsmsg_add_s32(c, "epg_post_end", ch->ch_dvr_extra_time_post);
|
||||
htsmsg_add_s32(c, "number", ch->ch_number);
|
||||
|
||||
htsmsg_add_msg(array, NULL, c);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ tvheadend.channels = new Ext.data.JsonStore({
|
|||
autoLoad: true,
|
||||
root:'entries',
|
||||
fields: ['name', 'chid', 'xmltvsrc', 'tags',
|
||||
'epg_pre_start', 'epg_post_end'],
|
||||
'epg_pre_start', 'epg_post_end', 'number'],
|
||||
id: 'chid',
|
||||
url: "channels",
|
||||
baseParams: {
|
||||
|
@ -133,9 +133,16 @@ tvheadend.chconf = function()
|
|||
|
||||
var cm = new Ext.grid.ColumnModel([
|
||||
{
|
||||
header: "ChannelID",
|
||||
dataIndex: 'chid',
|
||||
header: "Number",
|
||||
dataIndex: 'number',
|
||||
width: 50,
|
||||
renderer: function(value, metadata, record, row, col, store) {
|
||||
if (!value) {
|
||||
return '<span class="tvh-grid-unset">Not set</span>';
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
},
|
||||
|
||||
editor: new fm.NumberField({
|
||||
minValue: 0,
|
||||
|
|
Loading…
Add table
Reference in a new issue