summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthlo <t.lohmar@gmx.de>2012-12-26 07:15:03 +0100
committerthlo <t.lohmar@gmx.de>2012-12-26 07:15:03 +0100
commit504925aa69338fc41156cc40b526c79b62ad71a0 (patch)
treeb881d7d8492e71a80cf7edebcadaa397e18ae2c3
parent6399355d20ee87365e19ef94aa8798c602f697e6 (diff)
downloadvdr-plugin-smarttvweb-504925aa69338fc41156cc40b526c79b62ad71a0.tar.gz
vdr-plugin-smarttvweb-504925aa69338fc41156cc40b526c79b62ad71a0.tar.bz2
Better Log support and addition of missing files
-rw-r--r--vdr-smarttvweb/httpresource.c19
-rw-r--r--vdr-smarttvweb/log.c23
-rw-r--r--vdr-smarttvweb/smarttvweb.conf15
-rw-r--r--vdr-smarttvweb/stvw_cfg.c4
-rw-r--r--vdr-smarttvweb/widget.conf11
5 files changed, 58 insertions, 14 deletions
diff --git a/vdr-smarttvweb/httpresource.c b/vdr-smarttvweb/httpresource.c
index c10721b..8ca689a 100644
--- a/vdr-smarttvweb/httpresource.c
+++ b/vdr-smarttvweb/httpresource.c
@@ -1377,6 +1377,10 @@ int cHttpResource::sendChannelsXml (struct stat *statbuf) {
parseQueryLine(&avps);
string mode = "";
bool add_desc = true;
+
+ string no_channels_str = "";
+ int no_channels = -1;
+
if (getQueryAttributeValue(&avps, "mode", mode) == OKAY){
if (mode == "nodesc") {
add_desc = false;
@@ -1390,6 +1394,10 @@ int cHttpResource::sendChannelsXml (struct stat *statbuf) {
<< endl;
}
}
+ if (getQueryAttributeValue(&avps, "channels", no_channels_str) == OKAY){
+ no_channels = atoi(no_channels_str.c_str()) ;
+ }
+
sendHeaders(200, "OK", NULL, "application/xml", -1, statbuf->st_mtime);
@@ -1401,6 +1409,9 @@ int cHttpResource::sendChannelsXml (struct stat *statbuf) {
*mResponseMessage += hdr;
int count = mFactory->getLiveChannels();
+ if (no_channels > 0)
+ count = no_channels +1;
+
cSchedulesLock * lock = new cSchedulesLock(false, 500);
const cSchedules *schedules = cSchedules::Schedules(*lock);
@@ -1526,6 +1537,7 @@ int cHttpResource::sendRecordingsXml(struct stat *statbuf) {
*mResponseMessage += hdr;
+ /*
if (writeXmlItem("HAS - Big Bugs Bunny", "http://192.168.1.122/sm/BBB-DASH/HAS_BigBuckTS.xml|COMPONENT=HAS", "NA", "Big Bucks Bunny - HAS",
"-", 0, 0) == ERROR)
return ERROR;
@@ -1533,11 +1545,7 @@ int cHttpResource::sendRecordingsXml(struct stat *statbuf) {
if (writeXmlItem("HLS - Big Bugs Bunny", "http://192.168.1.122/sm/BBB-DASH/HLS_BigBuckTS.m3u8|COMPONENT=HLS", "NA", "Big Bucks Bunny - HLS",
"-", 0, 0) == ERROR)
return ERROR;
-
- if (writeXmlItem("HAS - The Town", "http://192.168.1.122/sm/TheTown/manifest-seg.mpd|COMPONENT=HAS", "NA", "HD Test",
- "-", 0, 0) == ERROR)
- return ERROR;
-
+*/
//--------------------
cRecordings* recordings = &Recordings;
@@ -1587,7 +1595,6 @@ int cHttpResource::sendRecordingsXml(struct stat *statbuf) {
for (cRecording *recording = recordings->First(); recording; recording = recordings->Next(recording)) {
hdr = "";
- // if (recording->IsPesRecording() or ((recording->FramesPerSecond() > 30.0) and !(mFactory->getConfig()->useHasForHd())))
if (recording->IsPesRecording() or ((recording->FramesPerSecond() > 30.0) and !has_4_hd ))
snprintf(f, sizeof(f), "http://%s:%d%s", mServerAddr.c_str(), mServerPort,
cUrlEncode::doUrlSaveEncode(recording->FileName()).c_str());
diff --git a/vdr-smarttvweb/log.c b/vdr-smarttvweb/log.c
index 08a9ed5..685bce3 100644
--- a/vdr-smarttvweb/log.c
+++ b/vdr-smarttvweb/log.c
@@ -23,6 +23,7 @@
#include "log.h"
#include <time.h>
+#include <cstring>
Log* Log::instance = NULL;
@@ -45,20 +46,30 @@ int Log::init(string fileName) {
time_t now = time(NULL);
strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now));
- mLogFile = new ofstream();
- mLogFile->open(fileName.c_str(), ios::out );
- *mLogFile << "Log Created: " << timebuf << endl;
+ if (fileName != "") {
+ mLogFile = new ofstream();
+
+ mLogFile->open(fileName.c_str(), ios::out );
+ *mLogFile << "Log Created: " << timebuf << endl;
+ }
+ else
+ mLogFile = new ofstream("/dev/null");
return 0;
}
int Log::init(char* fileName) {
+
char timebuf[128];
time_t now = time(NULL);
strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now));
- mLogFile = new ofstream();
- mLogFile->open(fileName, ios::out );
- *mLogFile << "Log Created: " << timebuf << endl;
+ if (strcmp(fileName, "") !=0) {
+ mLogFile = new ofstream();
+ mLogFile->open(fileName, ios::out );
+ *mLogFile << "Log Created: " << timebuf << endl;
+ }
+ else
+ mLogFile = new ofstream("/dev/null");
return 0;
}
diff --git a/vdr-smarttvweb/smarttvweb.conf b/vdr-smarttvweb/smarttvweb.conf
new file mode 100644
index 0000000..6afbbb9
--- /dev/null
+++ b/vdr-smarttvweb/smarttvweb.conf
@@ -0,0 +1,15 @@
+#
+
+LogFile /tmp/smarttvweb.txt
+
+MediaFolder /multimedia/video
+
+SegmentDuration 10
+
+HasMinBufferTime 30
+
+HasBitrate 6000
+
+LiveChannels 30
+
+UseHasForHd false \ No newline at end of file
diff --git a/vdr-smarttvweb/stvw_cfg.c b/vdr-smarttvweb/stvw_cfg.c
index bc0c4f6..0c943b5 100644
--- a/vdr-smarttvweb/stvw_cfg.c
+++ b/vdr-smarttvweb/stvw_cfg.c
@@ -36,9 +36,9 @@ cSmartTvConfig::cSmartTvConfig(string d): mConfigDir(d), mLog(NULL), mCfgFile(NU
mLiveChannels() {
#ifndef STANDALONE
- mLogFile= "/multimedia/video/smartvvweblog.txt";
+ mLogFile= "";
#else
- mLogFile= "/tmp/smartvvweblog-standalone.txt";
+ mLogFile= "./smartvvweblog-standalone.txt";
#endif
// Defaults
diff --git a/vdr-smarttvweb/widget.conf b/vdr-smarttvweb/widget.conf
new file mode 100644
index 0000000..c028671
--- /dev/null
+++ b/vdr-smarttvweb/widget.conf
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config>
+<format>hls</format>
+<tgtBufferBitrate>6000000</tgtBufferBitrate>
+<totalBufferDuration>40</totalBufferDuration>
+<initialBuffer>20</initialBuffer>
+<pendingBuffer>50</pendingBuffer>
+<initialTimeOut>5</initialTimeOut>
+<skipDuration>30</skipDuration>
+<liveChannels>20</liveChannels>
+</config>