Feature #361 » tvh.diff
src/channels.c | ||
---|---|---|
166 | 166 |
channel_t *ch, *x; |
167 | 167 |
xmltv_channel_t *xc; |
168 | 168 |
int id; |
169 |
caid_t *c; |
|
169 | 170 | |
170 | 171 |
ch = RB_LAST(&channel_identifier_tree); |
171 | 172 |
if(ch == NULL) { |
... | ... | |
174 | 175 |
id = ch->ch_id + 1; |
175 | 176 |
} |
176 | 177 | |
178 |
c = calloc(1, sizeof(caid_t)); |
|
177 | 179 |
ch = calloc(1, sizeof(channel_t)); |
178 | 180 |
RB_INIT(&ch->ch_epg_events); |
179 | 181 |
LIST_INSERT_HEAD(&channels_not_xmltv_mapped, ch, ch_xc_link); |
... | ... | |
192 | 194 |
channel_set_icon(ch, xc->xc_icon); |
193 | 195 |
} |
194 | 196 | |
197 |
ch->ch_prov_id = 0; |
|
198 | ||
195 | 199 |
htsp_channel_add(ch); |
196 | 200 |
return ch; |
197 | 201 |
} |
... | ... | |
275 | 279 |
htsmsg_get_s32(c, "dvr_extra_time_post", &ch->ch_dvr_extra_time_post); |
276 | 280 |
htsmsg_get_s32(c, "channel_number", &ch->ch_number); |
277 | 281 | |
282 |
if ((s = htsmsg_get_str(c, "chan_pid")) != NULL) |
|
283 |
tvh_str_update(&ch->ch_prov_id, htsmsg_get_str(c, "chan_pid")); |
|
278 | 284 |
if((tags = htsmsg_get_list(c, "tags")) != NULL) { |
279 | 285 |
HTSMSG_FOREACH(f, tags) { |
280 | 286 |
if(f->hmf_type == HMF_S64) { |
... | ... | |
338 | 344 |
htsmsg_add_u32(m, "dvr_extra_time_post", ch->ch_dvr_extra_time_post); |
339 | 345 |
htsmsg_add_s32(m, "channel_number", ch->ch_number); |
340 | 346 | |
347 |
if(ch->ch_prov_id != NULL) |
|
348 |
htsmsg_add_str(m, "chan_pid", ch->ch_prov_id); |
|
349 | ||
341 | 350 |
hts_settings_save(m, "channels/%d", ch->ch_id); |
342 | 351 |
htsmsg_destroy(m); |
343 | 352 |
} |
... | ... | |
460 | 469 |
} |
461 | 470 | |
462 | 471 |
/** |
472 |
* Set the channel manual provid |
|
473 |
*/ |
|
474 |
void |
|
475 |
channel_set_mprovid(channel_t *ch, const char *prov_id) |
|
476 |
{ |
|
477 |
lock_assert(&global_lock); |
|
478 | ||
479 |
if(ch->ch_prov_id != NULL && !strcmp(ch->ch_prov_id, prov_id)) |
|
480 |
return; |
|
481 |
free(ch->ch_prov_id); |
|
482 |
ch->ch_prov_id = strdup(prov_id); |
|
483 |
channel_save(ch); |
|
484 |
htsp_channel_update(ch); |
|
485 |
} |
|
486 | ||
487 |
/** |
|
463 | 488 |
* Set the amount of minutes to start before / end after recording on a channel |
464 | 489 |
*/ |
465 | 490 |
void |
src/channels.h | ||
---|---|---|
52 | 52 |
int ch_dvr_extra_time_post; |
53 | 53 |
int ch_number; // User configurable number |
54 | 54 |
char *ch_icon; |
55 |
char *ch_prov_id; |
|
55 | 56 | |
56 | 57 |
struct dvr_entry_list ch_dvrs; |
57 | 58 |
|
... | ... | |
119 | 120 | |
120 | 121 |
void channel_set_number(channel_t *ch, int number); |
121 | 122 | |
123 |
void channel_set_mprovid(channel_t *ch, const char *prov_id); |
|
124 | ||
122 | 125 |
void channel_set_icon(channel_t *ch, const char *icon); |
123 | 126 | |
124 | 127 |
struct xmltv_channel; |
src/cwc.c | ||
---|---|---|
38 | 38 |
#include "atomic.h" |
39 | 39 |
#include "dtable.h" |
40 | 40 |
#include "subscriptions.h" |
41 |
#include "channels.h" |
|
42 |
#include "settings.h" |
|
41 | 43 | |
42 | 44 |
#include <openssl/des.h> |
43 | 45 | |
... | ... | |
1462 | 1464 |
ecm_section_t *es; |
1463 | 1465 |
char chaninfo[32]; |
1464 | 1466 |
caid_t *c; |
1467 |
channel_t *ch = NULL; |
|
1468 |
htsmsg_t *ll, *cc; |
|
1469 |
htsmsg_field_t *ff; |
|
1470 |
char *pEnd; |
|
1471 |
int provid = 0; |
|
1465 | 1472 | |
1466 | 1473 |
if(len > 4096) |
1467 | 1474 |
return; |
... | ... | |
1492 | 1499 |
if(!verify_provider(cwc, c->providerid)) |
1493 | 1500 |
return; |
1494 | 1501 | |
1502 |
if (t->s_ch != NULL) { |
|
1503 |
if((ll = hts_settings_load("channels")) != NULL) { |
|
1504 |
ch = calloc(1, sizeof(channel_t)); |
|
1505 |
HTSMSG_FOREACH(ff, ll) { |
|
1506 |
if(((cc = htsmsg_get_map_by_field(ff)) == NULL) || (strcoll(t->s_ch->ch_name, htsmsg_get_str(cc, "name")) != 0)) |
|
1507 |
continue; |
|
1508 | ||
1509 |
const char *name = htsmsg_get_str(cc, "name"); |
|
1510 |
if(name == NULL) { |
|
1511 |
htsmsg_destroy(ll); |
|
1512 |
return; |
|
1513 |
} |
|
1514 |
tvh_str_update(&ch->ch_prov_id, htsmsg_get_str(cc, "chan_pid")); |
|
1515 |
if (ch->ch_prov_id != NULL ) provid = strtol(ch->ch_prov_id, &pEnd, 16); |
|
1516 |
if (provid != 0 ) { |
|
1517 |
if (provid != c->providerid) { |
|
1518 |
htsmsg_destroy(ll); |
|
1519 |
return; |
|
1520 |
} |
|
1521 |
} |
|
1522 |
} |
|
1523 |
} |
|
1524 |
free(ch); |
|
1525 |
htsmsg_destroy(ll); |
|
1526 |
} |
|
1527 |
t->s_last_providerid = c->providerid; |
|
1528 | ||
1495 | 1529 |
switch(data[0]) { |
1496 | 1530 |
case 0x80: |
1497 | 1531 |
case 0x81: |
src/service.h | ||
---|---|---|
299 | 299 |
uint16_t s_dvb_service_id; |
300 | 300 | |
301 | 301 |
uint16_t s_channel_number; |
302 |
|
|
303 |
int s_last_providerid; |
|
302 | 304 | |
303 | 305 |
/** |
304 | 306 |
* Service name (eg. DVB service name as specified by EN 300 468) |
src/serviceprobe.c | ||
---|---|---|
198 | 198 |
tvhlog(LOG_INFO, "serviceprobe", "%20s: joined tag \"%s\"", |
199 | 199 |
t->s_svcname, t->s_provider); |
200 | 200 |
} |
201 |
if (t->s_last_providerid != 0) { |
|
202 |
char buf[16]; |
|
203 |
snprintf(buf, sizeof(buf), "%06x", t->s_last_providerid); |
|
204 |
channel_set_mprovid(ch, buf); |
|
205 |
tvhlog(LOG_INFO, "serviceprobe", "%20s: save ProviderID \"%s\"", |
|
206 |
t->s_svcname, buf); |
|
207 |
} |
|
208 |
|
|
201 | 209 |
channel_save(ch); |
202 | 210 |
} |
203 | 211 |
src/webui/extjs.c | ||
---|---|---|
313 | 313 |
htsmsg_t *c; |
314 | 314 |
uint32_t id; |
315 | 315 |
const char *s; |
316 |
char *endptr; |
|
317 |
int schan_pid; |
|
316 | 318 | |
317 | 319 |
TAILQ_FOREACH(f, &in->hm_fields, hmf_link) { |
318 | 320 |
if((c = htsmsg_get_map_by_field(f)) == NULL || |
... | ... | |
342 | 344 | |
343 | 345 |
if((s = htsmsg_get_str(c, "number")) != NULL) |
344 | 346 |
channel_set_number(ch, atoi(s)); |
347 | ||
348 |
if((s = htsmsg_get_str(c, "chan_pid")) != NULL) { |
|
349 |
channel_set_mprovid(ch, s); |
|
350 |
schan_pid = strtol(s, &endptr, 16); |
|
351 |
} |
|
345 | 352 |
} |
346 | 353 |
} |
347 | 354 | |
... | ... | |
395 | 402 |
htsmsg_add_s32(c, "epg_post_end", ch->ch_dvr_extra_time_post); |
396 | 403 |
htsmsg_add_s32(c, "number", ch->ch_number); |
397 | 404 | |
405 |
if(ch->ch_prov_id != NULL) |
|
406 |
htsmsg_add_str(c, "chan_pid", ch->ch_prov_id); |
|
407 | ||
398 | 408 |
htsmsg_add_msg(array, NULL, c); |
399 | 409 |
} |
400 | 410 |
|
src/webui/static/app/chconf.js | ||
---|---|---|
27 | 27 |
tvheadend.channels = new Ext.data.JsonStore({ |
28 | 28 |
autoLoad: true, |
29 | 29 |
root:'entries', |
30 |
fields: ['name', 'chid', 'xmltvsrc', 'tags', 'ch_icon', |
|
30 |
fields: ['name', 'chid', 'xmltvsrc', 'tags', 'chan_pid', 'ch_icon',
|
|
31 | 31 |
'epg_pre_start', 'epg_post_end', 'number'], |
32 | 32 |
id: 'chid', |
33 | 33 |
url: "channels", |
... | ... | |
211 | 211 |
}) |
212 | 212 |
}, |
213 | 213 |
{ |
214 |
header: "ProviderID", |
|
215 |
dataIndex: 'chan_pid', |
|
216 |
width: 50, |
|
217 |
sortable: true, |
|
218 |
hidden: false, |
|
219 |
editor: new fm.TextField() |
|
220 |
}, |
|
221 |
{ |
|
214 | 222 |
header: "Icon (full URL)", |
215 | 223 |
dataIndex: 'ch_icon', |
216 | 224 |
width: 200, |
- « Previous
- 1
- 2
- Next »