Use better locking and set channel icon
This commit is contained in:
parent
dc66963046
commit
7c5965e915
3 changed files with 24 additions and 6 deletions
|
@ -308,6 +308,9 @@ channels_load(void)
|
|||
if(v > 1)
|
||||
ch->ch_commercial_detection = v;
|
||||
}
|
||||
|
||||
if((x = config_get_str_sub(&cl, "icon", NULL)) != NULL)
|
||||
ch->ch_icon = strdup(x);
|
||||
}
|
||||
config_free0(&cl);
|
||||
}
|
||||
|
@ -421,7 +424,7 @@ channel_settings_write(th_channel_t *ch)
|
|||
|
||||
fprintf(fp, "name = %s\n", ch->ch_name);
|
||||
fprintf(fp, "channel-group = %s\n", ch->ch_group->tcg_name);
|
||||
|
||||
fprintf(fp, "icon = %s\n", ch->ch_icon);
|
||||
fprintf(fp, "commercial-detect = %s\n",
|
||||
val2str(ch->ch_commercial_detection, commercial_detect_tab) ?: "?");
|
||||
fclose(fp);
|
||||
|
|
8
epg.c
8
epg.c
|
@ -477,8 +477,12 @@ epg_transfer_events(th_channel_t *ch, struct event_queue *src,
|
|||
|
||||
epg_lock();
|
||||
|
||||
free(ch->ch_icon);
|
||||
ch->ch_icon = icon ? strdup(icon) : NULL;
|
||||
|
||||
if(strcmp(icon ?: "", ch->ch_icon ?: "")) {
|
||||
free(ch->ch_icon);
|
||||
ch->ch_icon = icon ? strdup(icon) : NULL;
|
||||
channel_settings_write(ch);
|
||||
}
|
||||
|
||||
TAILQ_FOREACH(e, src, e_link) {
|
||||
|
||||
|
|
17
epg_xmltv.c
17
epg_xmltv.c
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -548,7 +549,6 @@ static void
|
|||
regrab(void *aux, int64_t now)
|
||||
{
|
||||
xmltv_grabber_t *xg = aux;
|
||||
|
||||
xmltv_grabber_enqueue(xg);
|
||||
}
|
||||
|
||||
|
@ -559,10 +559,21 @@ static void
|
|||
xmltv_xfer(void *aux, int64_t now)
|
||||
{
|
||||
xmltv_grabber_t *xg = aux;
|
||||
int t;
|
||||
|
||||
xmltv_transfer_events(xg);
|
||||
/* We don't want to stall waiting for the xml decoding which
|
||||
can take quite some time, instead retry in a second if we fail
|
||||
to obtain mutex */
|
||||
|
||||
dtimer_arm(&xg->xg_xfer_timer, xmltv_xfer, xg, 60);
|
||||
if(pthread_mutex_trylock(&xg->xg_mutex) == EBUSY) {
|
||||
t = 1;
|
||||
} else {
|
||||
xmltv_transfer_events(xg);
|
||||
pthread_mutex_unlock(&xg->xg_mutex);
|
||||
t = 60;
|
||||
}
|
||||
|
||||
dtimer_arm(&xg->xg_xfer_timer, xmltv_xfer, xg, t);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue