summaryrefslogtreecommitdiff
path: root/cmps
diff options
context:
space:
mode:
Diffstat (limited to 'cmps')
-rw-r--r--cmps/main.cc23
-rw-r--r--cmps/nbproject/Makefile-Debug.mk30
-rw-r--r--cmps/nbproject/Makefile-Release.mk12
-rw-r--r--cmps/nbproject/configurations.xml12
-rw-r--r--cmps/tests/StringBuilderTest.cc17
5 files changed, 82 insertions, 12 deletions
diff --git a/cmps/main.cc b/cmps/main.cc
index a5d2b04..e1be73c 100644
--- a/cmps/main.cc
+++ b/cmps/main.cc
@@ -29,6 +29,7 @@
#include <MediaFactory.h>
#include <MediaListHandler.h>
#include <MediaFileHandler.h>
+#include <MediaServerConfig.h>
#include <ConnectionHandler.h>
#include <CommandHandler.h>
#include <JSonListAssembler.h>
@@ -56,10 +57,23 @@ static int refreshScanner(void *opaque, cHTTPRequest &Request)
return -1;
}
+static void appID(void)
+{
+ fprintf(stderr, "\ncmps - the backend of CMP (compound media player)\n");
+}
+
+static void appInfo(void)
+{
+ appID();
+ fprintf(stderr, " is a streaming- and HTTP-server\n");
+ fprintf(stderr, " (c) 2012 - Reinhard Mantey - some rights reserved.\n");
+ fprintf(stderr, " CMP is published as open source under Creative Commons by-sa\n\n");
+}
+
static void usage(void)
{
- fprintf(stderr, "cmps - the backend of CMP (compound media player)\n");
- fprintf(stderr, " is streaming- and HTTP-server and accepts these commandline options:\n");
+ appID();
+ fprintf(stderr, " is streaming- and HTTP-server and accepts these commandline options:\n");
fprintf(stderr, "-h, --help the help, you are reading\n");
fprintf(stderr, "-d, --appDir <path> the directory, where the server may write config files\n");
fprintf(stderr, " (default is /var/lib/cmp)\n");
@@ -107,7 +121,8 @@ static void setup(int argc, char *argv[], cServerConfig &config)
int main(int argc, char** argv)
{
- cServerConfig config("/var/lib/cmp");
+ appInfo();
+ cMediaServerConfig config("/var/lib/cmp");
setup(argc, argv, config);
cFSMediaScanner *scanner = new cFSMediaScanner();
@@ -142,11 +157,13 @@ int main(int argc, char** argv)
* register/enable internal commands
*/
cCommandHandler::RegisterCallback("refresh", refreshScanner, scanner);
+ fprintf(stderr, "start searching for media at %s\n", config.DocumentRoot());
scanner->Refresh();
/*
* now start the server
*/
+ fprintf(stderr, "ok, ready for client connections.\n");
if (!server->Start()) {
fprintf(stderr, "failed to start application (3)");
exit(-3);
diff --git a/cmps/nbproject/Makefile-Debug.mk b/cmps/nbproject/Makefile-Debug.mk
index af8aa89..d825972 100644
--- a/cmps/nbproject/Makefile-Debug.mk
+++ b/cmps/nbproject/Makefile-Debug.mk
@@ -42,6 +42,7 @@ TESTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tests
# Test Files
TESTFILES= \
+ ${TESTDIR}/TestFiles/f8 \
${TESTDIR}/TestFiles/codecTest \
${TESTDIR}/TestFiles/connectionHandlerTest \
${TESTDIR}/TestFiles/fileSystemTest \
@@ -89,7 +90,7 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${OBJECTFILES}
${OBJECTDIR}/main.o: nbproject/Makefile-${CND_CONF}.mk main.cc
${MKDIR} -p ${OBJECTDIR}
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/main.o main.cc
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${OBJECTDIR}/main.o main.cc
# Subprojects
.build-subprojects:
@@ -107,6 +108,10 @@ ${OBJECTDIR}/main.o: nbproject/Makefile-${CND_CONF}.mk main.cc
# Build Test Targets
.build-tests-conf: .build-conf ${TESTFILES}
+${TESTDIR}/TestFiles/f8: ${TESTDIR}/tests/BaseScanTest.o ${OBJECTFILES:%.o=%_nomain.o}
+ ${MKDIR} -p ${TESTDIR}/TestFiles
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/f8 $^ ${LDLIBSOPTIONS}
+
${TESTDIR}/TestFiles/codecTest: ${TESTDIR}/tests/CodecTest.o ${OBJECTFILES:%.o=%_nomain.o}
${MKDIR} -p ${TESTDIR}/TestFiles
${LINK.cc} -o ${TESTDIR}/TestFiles/codecTest $^ ${LDLIBSOPTIONS}
@@ -136,46 +141,52 @@ ${TESTDIR}/TestFiles/stringBuilderTest: ${TESTDIR}/tests/StringBuilderTest.o ${O
${LINK.cc} -o ${TESTDIR}/TestFiles/stringBuilderTest $^ ${LDLIBSOPTIONS}
+${TESTDIR}/tests/BaseScanTest.o: tests/BaseScanTest.cc
+ ${MKDIR} -p ${TESTDIR}/tests
+ ${RM} $@.d
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/BaseScanTest.o tests/BaseScanTest.cc
+
+
${TESTDIR}/tests/CodecTest.o: tests/CodecTest.cc
${MKDIR} -p ${TESTDIR}/tests
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/CodecTest.o tests/CodecTest.cc
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/CodecTest.o tests/CodecTest.cc
${TESTDIR}/tests/ConnectionHandlerTest.o: tests/ConnectionHandlerTest.cc
${MKDIR} -p ${TESTDIR}/tests
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/ConnectionHandlerTest.o tests/ConnectionHandlerTest.cc
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/ConnectionHandlerTest.o tests/ConnectionHandlerTest.cc
${TESTDIR}/tests/FileSystemTest.o: tests/FileSystemTest.cc
${MKDIR} -p ${TESTDIR}/tests
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/FileSystemTest.o tests/FileSystemTest.cc
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/FileSystemTest.o tests/FileSystemTest.cc
${TESTDIR}/tests/FScanTest.o: tests/FScanTest.cc
${MKDIR} -p ${TESTDIR}/tests
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/FScanTest.o tests/FScanTest.cc
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/FScanTest.o tests/FScanTest.cc
${TESTDIR}/tests/JSonTest.o: tests/JSonTest.cc
${MKDIR} -p ${TESTDIR}/tests
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/JSonTest.o tests/JSonTest.cc
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/JSonTest.o tests/JSonTest.cc
${TESTDIR}/tests/MetaScanTest.o: tests/MetaScanTest.cc
${MKDIR} -p ${TESTDIR}/tests
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/MetaScanTest.o tests/MetaScanTest.cc
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/MetaScanTest.o tests/MetaScanTest.cc
${TESTDIR}/tests/StringBuilderTest.o: tests/StringBuilderTest.cc
${MKDIR} -p ${TESTDIR}/tests
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/StringBuilderTest.o tests/StringBuilderTest.cc
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/StringBuilderTest.o tests/StringBuilderTest.cc
${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
@@ -186,7 +197,7 @@ ${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
(echo "$$NMOUTPUT" | ${GREP} 'T _main$$'); \
then \
${RM} $@.d;\
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -Dmain=__nomain -MMD -MP -MF $@.d -o ${OBJECTDIR}/main_nomain.o main.cc;\
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/mediaScan/include -I../libs/networking/include -I../libs/IO/include -I../libs/util/include -I../libs/vdr/include -I. -Dmain=__nomain -MMD -MP -MF $@.d -o ${OBJECTDIR}/main_nomain.o main.cc;\
else \
${CP} ${OBJECTDIR}/main.o ${OBJECTDIR}/main_nomain.o;\
fi
@@ -195,6 +206,7 @@ ${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
.test-conf:
@if [ "${TEST}" = "" ]; \
then \
+ ${TESTDIR}/TestFiles/f8 || true; \
${TESTDIR}/TestFiles/codecTest || true; \
${TESTDIR}/TestFiles/connectionHandlerTest || true; \
${TESTDIR}/TestFiles/fileSystemTest || true; \
diff --git a/cmps/nbproject/Makefile-Release.mk b/cmps/nbproject/Makefile-Release.mk
index 4232298..550c27f 100644
--- a/cmps/nbproject/Makefile-Release.mk
+++ b/cmps/nbproject/Makefile-Release.mk
@@ -48,6 +48,7 @@ TESTFILES= \
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps \
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps \
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps \
+ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps \
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps
# C Compiler Flags
@@ -84,6 +85,10 @@ ${OBJECTDIR}/main.o: nbproject/Makefile-${CND_CONF}.mk main.cc
# Build Test Targets
.build-tests-conf: .build-conf ${TESTFILES}
+${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${TESTDIR}/tests/BaseScanTest.o ${OBJECTFILES:%.o=%_nomain.o}
+ ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
+ ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps $^ ${LDLIBSOPTIONS}
+
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${TESTDIR}/tests/CodecTest.o ${OBJECTFILES:%.o=%_nomain.o}
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps $^ ${LDLIBSOPTIONS}
@@ -113,6 +118,12 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${TESTDIR}/tests/StringBuilderT
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps $^ ${LDLIBSOPTIONS}
+${TESTDIR}/tests/BaseScanTest.o: tests/BaseScanTest.cc
+ ${MKDIR} -p ${TESTDIR}/tests
+ ${RM} $@.d
+ $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${TESTDIR}/tests/BaseScanTest.o tests/BaseScanTest.cc
+
+
${TESTDIR}/tests/CodecTest.o: tests/CodecTest.cc
${MKDIR} -p ${TESTDIR}/tests
${RM} $@.d
@@ -179,6 +190,7 @@ ${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps || true; \
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps || true; \
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps || true; \
+ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps || true; \
else \
./${TEST} || true; \
fi
diff --git a/cmps/nbproject/configurations.xml b/cmps/nbproject/configurations.xml
index de3675f..d2880dd 100644
--- a/cmps/nbproject/configurations.xml
+++ b/cmps/nbproject/configurations.xml
@@ -18,6 +18,12 @@
displayName="Test Files"
projectFiles="false"
kind="TEST_LOGICAL_FOLDER">
+ <logicalFolder name="f8"
+ displayName="BaseScanTest"
+ projectFiles="true"
+ kind="TEST">
+ <itemPath>tests/BaseScanTest.cc</itemPath>
+ </logicalFolder>
<logicalFolder name="f1"
displayName="CodecTest"
projectFiles="true"
@@ -75,6 +81,11 @@
<compilerSet>default</compilerSet>
</toolsSet>
<compileType>
+ <cTool>
+ <incDir>
+ <pElem>.</pElem>
+ </incDir>
+ </cTool>
<ccTool>
<incDir>
<pElem>include</pElem>
@@ -84,6 +95,7 @@
<pElem>../libs/IO/include</pElem>
<pElem>../libs/util/include</pElem>
<pElem>../libs/vdr/include</pElem>
+ <pElem>.</pElem>
</incDir>
<commandLine>-std=gnu++0x -fomit-frame-pointer -fPIC -pthread -Wall -Wno-parentheses -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration</commandLine>
<preprocessorList>
diff --git a/cmps/tests/StringBuilderTest.cc b/cmps/tests/StringBuilderTest.cc
index 9814411..8d2b150 100644
--- a/cmps/tests/StringBuilderTest.cc
+++ b/cmps/tests/StringBuilderTest.cc
@@ -75,6 +75,22 @@ void basicTests()
free(result);
}
+void replaceTest()
+{
+ const char char2Replace[] = { '"', '\0' };
+ const char *replacements[] = { "\\\"", NULL };
+ const char *sample = "mal sehen, was \"hier\" so abgeht?!";
+ cStringBuilder sb(17);
+
+ sb.Append(sample, char2Replace, replacements);
+ char *result = sb.toString();
+
+ std::cout << "result with replace: " << result << std::endl;
+// std::cout << "result with replace (size " << sb.Size() << "): " << result << std::endl;
+ std::cout << "size-check: " << strlen(sample) << " <> " << strlen(result) << std::endl;
+ free(result);
+}
+
void lineReaderTest()
{
cLineReader lr(new cFileReader(new cFile("srclient.conf")));
@@ -92,6 +108,7 @@ int main()
lineReaderTest();
basicTests();
rangeTests();
+ replaceTest();
return 0;
}