Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
service: don't create the standard nice name with adapter/input name
  • Loading branch information
perexg committed Jun 7, 2016
1 parent 17f2d92 commit 7b28d75
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
39 changes: 29 additions & 10 deletions src/service.c
Expand Up @@ -53,6 +53,7 @@
static void service_data_timeout(void *aux);
static void service_class_delete(struct idnode *self);
static htsmsg_t *service_class_save(struct idnode *self, char *filename, size_t fsize);
static int service_make_nicename0(service_t *t, char *buf, size_t len, int adapter);

struct service_queue service_all;
struct service_queue service_raw_all;
Expand Down Expand Up @@ -1072,12 +1073,11 @@ service_stream_make_nicename(service_t *t, elementary_stream_t *st)
/**
*
*/
void
service_make_nicename(service_t *t)
static int
service_make_nicename0(service_t *t, char *buf, size_t len, int adapter)
{
char buf[256], buf2[16];
char buf2[16];
source_info_t si;
elementary_stream_t *st;
char *service_name;
int prefidx;

Expand All @@ -1091,20 +1091,36 @@ service_make_nicename(service_t *t)
service_name = buf2;
}

snprintf(buf, sizeof(buf),
snprintf(buf, len,
"%s%s%s%s%s%s%s",
si.si_adapter ?: "", si.si_adapter && si.si_network ? "/" : "",
adapter && si.si_adapter ? si.si_adapter : "",
adapter && si.si_adapter && si.si_network ? "/" : "",
si.si_network ?: "", si.si_network && si.si_mux ? "/" : "",
si.si_mux ?: "", si.si_mux && service_name ? "/" : "",
service_name ?: "");
prefidx = (si.si_adapter ? strlen(si.si_adapter) : 0) +
(si.si_adapter && si.si_network ? 1 : 0) +
prefidx = (adapter && si.si_adapter ? strlen(si.si_adapter) : 0) +
(adapter && si.si_adapter && si.si_network ? 1 : 0) +
(si.si_network ? strlen(si.si_network) : 0) +
(si.si_network && si.si_mux ? 1 : 0) +
(si.si_mux ? strlen(si.si_mux) : 0);

service_source_info_free(&si);

return prefidx;
}

/**
*
*/
void
service_make_nicename(service_t *t)
{
int prefidx;
char buf[256];
elementary_stream_t *st;

prefidx = service_make_nicename0(t, buf, sizeof(buf), 0);

free(t->s_nicename);
t->s_nicename = strdup(buf);
t->s_nicename_prefidx = prefidx;
Expand Down Expand Up @@ -1678,9 +1694,12 @@ service_component_nicename(elementary_stream_t *st)
}

const char *
service_adapter_nicename(service_t *t)
service_adapter_nicename(service_t *t, char *buf, size_t len)
{
return "Adapter";
pthread_mutex_lock(&t->s_stream_mutex);
service_make_nicename0(t, buf, len, 1);
pthread_mutex_unlock(&t->s_stream_mutex);
return buf;
}

const char *
Expand Down
2 changes: 1 addition & 1 deletion src/service.h
Expand Up @@ -600,7 +600,7 @@ const char *service_nicename(service_t *t);

const char *service_component_nicename(elementary_stream_t *st);

const char *service_adapter_nicename(service_t *t);
const char *service_adapter_nicename(service_t *t, char *buf, size_t len);

const char *service_tss2text(int flags);

Expand Down
5 changes: 2 additions & 3 deletions src/subscriptions.c
Expand Up @@ -896,12 +896,12 @@ subscription_create_msg(th_subscription_t *s, const char *lang)
service_t *t;
profile_t *pro;
char buf[256];
const char *state;

htsmsg_add_u32(m, "id", s->ths_id);
htsmsg_add_u32(m, "start", s->ths_start);
htsmsg_add_u32(m, "errors", atomic_get(&s->ths_total_err));

const char *state;
switch(subgetstate(s)) {
default:
state = N_("Idle");
Expand All @@ -920,7 +920,6 @@ subscription_create_msg(th_subscription_t *s, const char *lang)
break;
}


htsmsg_add_str(m, "state", lang ? tvh_gettext_lang(lang, state) : state);

if(s->ths_hostname != NULL)
Expand All @@ -938,7 +937,7 @@ subscription_create_msg(th_subscription_t *s, const char *lang)
htsmsg_add_str(m, "channel", channel_get_name(s->ths_channel));

if((t = s->ths_service) != NULL) {
htsmsg_add_str(m, "service", t->s_nicename ?: "");
htsmsg_add_str(m, "service", service_adapter_nicename(t, buf, sizeof(buf)));

pthread_mutex_lock(&t->s_stream_mutex);
if ((di = s->ths_service->s_descramble_info) != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/webui/static/app/status.js
Expand Up @@ -107,7 +107,7 @@ tvheadend.status_subs = function(panel, index)
dataIndex: 'channel'
},
{
width: 200,
width: 250,
id: 'service',
header: _("Service"),
dataIndex: 'service'
Expand Down

0 comments on commit 7b28d75

Please sign in to comment.