#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
-
+#include <ctype.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
th_channel_t *
channel_find(const char *name, int create)
{
+ const char *n2;
th_channel_t *ch;
+ int l, i;
+ char *cp, c;
TAILQ_FOREACH(ch, &channels, ch_global_link)
if(!strcasecmp(name, ch->ch_name))
ch = calloc(1, sizeof(th_channel_t));
ch->ch_name = strdup(name);
+
+ l = strlen(name);
+ ch->ch_sname = cp = malloc(l + 1);
+
+ n2 = utf8toprintable(name);
+
+ for(i = 0; i < strlen(n2); i++) {
+ c = tolower(n2[i]);
+ if(isalnum(c))
+ *cp++ = c;
+ else
+ *cp++ = '-';
+ }
+ *cp = 0;
+
ch->ch_index = nchannels;
TAILQ_INIT(&ch->ch_epg_events);
}
tcp_qprintf(&tq, "<div class=\"over\">");
- tcp_qprintf(&tq, "<strong><a href=\"channel/%d\">%s</a></strong><br>",
+ tcp_qprintf(&tq,
+ "<span style=\"overflow: hidden; height: 15px; "
+ "width: 300px; float: left; font-weight:bold\">"
+ "<a href=\"channel/%d\">%s</a></span>",
ch->ch_tag, ch->ch_name);
+ if(tvheadend_streaming_host != NULL) {
+ tcp_qprintf(&tq, "<i><a href=\"rtsp://%s:%d/%s\">Watch live</a></i><br>",
+ tvheadend_streaming_host, http_port, ch->ch_sname);
+ }
+
e = epg_event_find_current_or_upcoming(ch);
for(i = 0; i < 3 && e != NULL; i++) {
#include "http.h"
#include "rtsp.h"
+int http_port;
+
static LIST_HEAD(, http_path) http_paths;
static struct strtab HTTP_cmdtab[] = {
void
http_start(int port)
{
+ http_port = port;
tcp_create_server(port, sizeof(http_connection_t), "http",
http_tcp_callback);
}
#ifndef HTTP_H_
#define HTTP_H_
+extern int http_port;
+
#include "tcp.h"
#define HTTP_STATUS_OK 200
int running;
int xmltvreload;
int startupcounter;
+const char *tvheadend_streaming_host;
static pthread_mutex_t tag_mutex = PTHREAD_MUTEX_INITIALIZER;
static uint32_t tag_tally;
subscriptions_init();
+ tvheadend_streaming_host = config_get_str("streaming-host", NULL);
+
htmlui_start();
avgen_init();
static th_channel_t *
rtsp_channel_by_url(char *url)
{
+ th_channel_t *ch;
char *c;
- int chid;
c = strrchr(url, '/');
if(c != NULL && c[1] == 0) {
return NULL;
c++;
- if(sscanf(c, "chid-%d", &chid) != 1)
- return NULL;
- return channel_by_index(chid);
+ TAILQ_FOREACH(ch, &channels, ch_global_link)
+ if(!strcasecmp(ch->ch_sname, c))
+ return ch;
+
+ return NULL;
}
/*
int ch_index;
const char *ch_name;
+ const char *ch_sname;
struct pvr_rec *ch_rec;
char *utf8tofilename(const char *in);
const char *htstvstreamtype2txt(tv_streamtype_t s);
uint32_t tag_get(void);
+extern const char *tvheadend_streaming_host;
#endif /* TV_HEAD_H */