summaryrefslogtreecommitdiff
path: root/cmps
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-08-01 15:29:31 (GMT)
committergeronimo <geronimo013@gmx.de>2012-08-01 15:29:31 (GMT)
commitcca6e883c8141c3a67c3c5b232ce0c9b18e7fd59 (patch)
tree7149351cb466316771ab0ce0bd4ea64b2ba17aa1 /cmps
parent76c51473ee29a9103201618c8dbbc11fe9b7149e (diff)
downloadcmp-cca6e883c8141c3a67c3c5b232ce0c9b18e7fd59.tar.gz
cmp-cca6e883c8141c3a67c3c5b232ce0c9b18e7fd59.tar.bz2
added mediatypes for interlaced video and selective configuration of deepscan
Diffstat (limited to 'cmps')
-rw-r--r--cmps/nbproject/Makefile-Debug.mk64
-rw-r--r--cmps/nbproject/Makefile-Release.mk14
-rw-r--r--cmps/nbproject/configurations.xml34
-rw-r--r--cmps/serverlib/include/MediaServerConfig.h39
-rw-r--r--cmps/serverlib/nbproject/Makefile-Debug.mk20
-rw-r--r--cmps/serverlib/nbproject/Makefile-Release.mk20
-rw-r--r--cmps/serverlib/nbproject/configurations.xml2
-rw-r--r--cmps/serverlib/src/MediaServerConfig.cc128
-rw-r--r--cmps/tests/CredentialPersistence.cc103
-rw-r--r--cmps/tests/FScanTest.cc46
-rw-r--r--cmps/tests/MetaScanTest.cc54
11 files changed, 446 insertions, 78 deletions
diff --git a/cmps/nbproject/Makefile-Debug.mk b/cmps/nbproject/Makefile-Debug.mk
index 612b14e..af8aa89 100644
--- a/cmps/nbproject/Makefile-Debug.mk
+++ b/cmps/nbproject/Makefile-Debug.mk
@@ -42,12 +42,13 @@ TESTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tests
# Test Files
TESTFILES= \
- ${TESTDIR}/TestFiles/f1 \
- ${TESTDIR}/TestFiles/f3 \
- ${TESTDIR}/TestFiles/f5 \
- ${TESTDIR}/TestFiles/f2 \
- ${TESTDIR}/TestFiles/f4 \
- ${TESTDIR}/TestFiles/f6
+ ${TESTDIR}/TestFiles/codecTest \
+ ${TESTDIR}/TestFiles/connectionHandlerTest \
+ ${TESTDIR}/TestFiles/fileSystemTest \
+ ${TESTDIR}/TestFiles/fsScanTest \
+ ${TESTDIR}/TestFiles/jsonTest \
+ ${TESTDIR}/TestFiles/metaScanTest \
+ ${TESTDIR}/TestFiles/stringBuilderTest
# C Compiler Flags
CFLAGS=
@@ -63,7 +64,7 @@ FFLAGS=
ASFLAGS=
# Link Libraries and Options
-LDLIBSOPTIONS=serverlib/dist/Debug/GNU-Linux-x86/libserverlib.a ../libs/mediaScan/dist/Debug/GNU-Linux-x86/libmediascan.a ../libs/networking/dist/Debug/GNU-Linux-x86/libnetworking.a ../libs/IO/dist/Debug/GNU-Linux-x86/libio.a ../libs/util/dist/Debug/GNU-Linux-x86/libutil.a ../libs/vdr/dist/Debug/GNU-Linux-x86/libvdr.a -lpthread -lrt -lssl -lpcrecpp
+LDLIBSOPTIONS=serverlib/dist/Debug/GNU-Linux-x86/libserverlib.a ../libs/mediaScan/dist/Debug/GNU-Linux-x86/libmediascan.a ../libs/networking/dist/Debug/GNU-Linux-x86/libnetworking.a ../libs/IO/dist/Debug/GNU-Linux-x86/libio.a ../libs/util/dist/Debug/GNU-Linux-x86/libutil.a ../libs/vdr/dist/Debug/GNU-Linux-x86/libvdr.a -lpthread -lrt -lssl -lpcrecpp -lmediainfo
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
@@ -85,7 +86,7 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${OBJECTFILES}
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps ${OBJECTFILES} ${LDLIBSOPTIONS}
-${OBJECTDIR}/main.o: main.cc
+${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
@@ -106,29 +107,33 @@ ${OBJECTDIR}/main.o: main.cc
# Build Test Targets
.build-tests-conf: .build-conf ${TESTFILES}
-${TESTDIR}/TestFiles/f1: ${TESTDIR}/tests/CodecTest.o ${OBJECTFILES:%.o=%_nomain.o}
+${TESTDIR}/TestFiles/codecTest: ${TESTDIR}/tests/CodecTest.o ${OBJECTFILES:%.o=%_nomain.o}
${MKDIR} -p ${TESTDIR}/TestFiles
- ${LINK.cc} -o ${TESTDIR}/TestFiles/f1 $^ ${LDLIBSOPTIONS}
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/codecTest $^ ${LDLIBSOPTIONS}
-${TESTDIR}/TestFiles/f3: ${TESTDIR}/tests/ConnectionHandlerTest.o ${OBJECTFILES:%.o=%_nomain.o}
+${TESTDIR}/TestFiles/connectionHandlerTest: ${TESTDIR}/tests/ConnectionHandlerTest.o ${OBJECTFILES:%.o=%_nomain.o}
${MKDIR} -p ${TESTDIR}/TestFiles
- ${LINK.cc} -o ${TESTDIR}/TestFiles/f3 $^ ${LDLIBSOPTIONS}
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/connectionHandlerTest $^ ${LDLIBSOPTIONS}
-${TESTDIR}/TestFiles/f5: ${TESTDIR}/tests/FileSystemTest.o ${OBJECTFILES:%.o=%_nomain.o}
+${TESTDIR}/TestFiles/fileSystemTest: ${TESTDIR}/tests/FileSystemTest.o ${OBJECTFILES:%.o=%_nomain.o}
${MKDIR} -p ${TESTDIR}/TestFiles
- ${LINK.cc} -o ${TESTDIR}/TestFiles/f5 $^ ${LDLIBSOPTIONS}
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/fileSystemTest $^ ${LDLIBSOPTIONS}
-${TESTDIR}/TestFiles/f2: ${TESTDIR}/tests/FScanTest.o ${OBJECTFILES:%.o=%_nomain.o}
+${TESTDIR}/TestFiles/fsScanTest: ${TESTDIR}/tests/FScanTest.o ${OBJECTFILES:%.o=%_nomain.o}
${MKDIR} -p ${TESTDIR}/TestFiles
- ${LINK.cc} -o ${TESTDIR}/TestFiles/f2 $^ ${LDLIBSOPTIONS}
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/fsScanTest $^ ${LDLIBSOPTIONS}
-${TESTDIR}/TestFiles/f4: ${TESTDIR}/tests/JSonTest.o ${OBJECTFILES:%.o=%_nomain.o}
+${TESTDIR}/TestFiles/jsonTest: ${TESTDIR}/tests/JSonTest.o ${OBJECTFILES:%.o=%_nomain.o}
${MKDIR} -p ${TESTDIR}/TestFiles
- ${LINK.cc} -o ${TESTDIR}/TestFiles/f4 $^ ${LDLIBSOPTIONS}
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/jsonTest $^ ${LDLIBSOPTIONS}
-${TESTDIR}/TestFiles/f6: ${TESTDIR}/tests/MetaScanTest.o ${OBJECTFILES:%.o=%_nomain.o}
+${TESTDIR}/TestFiles/metaScanTest: ${TESTDIR}/tests/MetaScanTest.o ${OBJECTFILES:%.o=%_nomain.o}
${MKDIR} -p ${TESTDIR}/TestFiles
- ${LINK.cc} -o ${TESTDIR}/TestFiles/f6 $^ ${LDLIBSOPTIONS}
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/metaScanTest $^ ${LDLIBSOPTIONS}
+
+${TESTDIR}/TestFiles/stringBuilderTest: ${TESTDIR}/tests/StringBuilderTest.o ${OBJECTFILES:%.o=%_nomain.o}
+ ${MKDIR} -p ${TESTDIR}/TestFiles
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/stringBuilderTest $^ ${LDLIBSOPTIONS}
${TESTDIR}/tests/CodecTest.o: tests/CodecTest.cc
@@ -167,6 +172,12 @@ ${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. -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
+
+
${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
${MKDIR} -p ${OBJECTDIR}
@NMOUTPUT=`${NM} ${OBJECTDIR}/main.o`; \
@@ -184,12 +195,13 @@ ${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
.test-conf:
@if [ "${TEST}" = "" ]; \
then \
- ${TESTDIR}/TestFiles/f1 || true; \
- ${TESTDIR}/TestFiles/f3 || true; \
- ${TESTDIR}/TestFiles/f5 || true; \
- ${TESTDIR}/TestFiles/f2 || true; \
- ${TESTDIR}/TestFiles/f4 || true; \
- ${TESTDIR}/TestFiles/f6 || true; \
+ ${TESTDIR}/TestFiles/codecTest || true; \
+ ${TESTDIR}/TestFiles/connectionHandlerTest || true; \
+ ${TESTDIR}/TestFiles/fileSystemTest || true; \
+ ${TESTDIR}/TestFiles/fsScanTest || true; \
+ ${TESTDIR}/TestFiles/jsonTest || true; \
+ ${TESTDIR}/TestFiles/metaScanTest || true; \
+ ${TESTDIR}/TestFiles/stringBuilderTest || true; \
else \
./${TEST} || true; \
fi
diff --git a/cmps/nbproject/Makefile-Release.mk b/cmps/nbproject/Makefile-Release.mk
index c4c3c75..4232298 100644
--- a/cmps/nbproject/Makefile-Release.mk
+++ b/cmps/nbproject/Makefile-Release.mk
@@ -47,6 +47,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
@@ -73,7 +74,7 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${OBJECTFILES}
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps ${OBJECTFILES} ${LDLIBSOPTIONS}
-${OBJECTDIR}/main.o: main.cc
+${OBJECTDIR}/main.o: nbproject/Makefile-${CND_CONF}.mk main.cc
${MKDIR} -p ${OBJECTDIR}
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/main.o main.cc
@@ -107,6 +108,10 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${TESTDIR}/tests/MetaScanTest.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/StringBuilderTest.o ${OBJECTFILES:%.o=%_nomain.o}
+ ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
+ ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps $^ ${LDLIBSOPTIONS}
+
${TESTDIR}/tests/CodecTest.o: tests/CodecTest.cc
${MKDIR} -p ${TESTDIR}/tests
@@ -144,6 +149,12 @@ ${TESTDIR}/tests/MetaScanTest.o: tests/MetaScanTest.cc
$(COMPILE.cc) -O2 -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) -O2 -MMD -MP -MF $@.d -o ${TESTDIR}/tests/StringBuilderTest.o tests/StringBuilderTest.cc
+
+
${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
${MKDIR} -p ${OBJECTDIR}
@NMOUTPUT=`${NM} ${OBJECTDIR}/main.o`; \
@@ -167,6 +178,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 ba892d1..8f12212 100644
--- a/cmps/nbproject/configurations.xml
+++ b/cmps/nbproject/configurations.xml
@@ -51,6 +51,12 @@
kind="TEST">
<itemPath>tests/MetaScanTest.cc</itemPath>
</logicalFolder>
+ <logicalFolder name="f7"
+ displayName="StringBuilderTest"
+ projectFiles="true"
+ kind="TEST">
+ <itemPath>tests/StringBuilderTest.cc</itemPath>
+ </logicalFolder>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
@@ -164,6 +170,7 @@
<linkerLibLibItem>rt</linkerLibLibItem>
<linkerLibLibItem>ssl</linkerLibLibItem>
<linkerLibLibItem>pcrecpp</linkerLibLibItem>
+ <linkerLibLibItem>mediainfo</linkerLibLibItem>
</linkerLibItems>
</linkerTool>
<requiredProjects>
@@ -241,7 +248,7 @@
</incDir>
</ccTool>
<linkerTool>
- <output>${TESTDIR}/TestFiles/f1</output>
+ <output>${TESTDIR}/TestFiles/codecTest</output>
</linkerTool>
</folder>
<folder path="TestFiles/f2">
@@ -256,7 +263,7 @@
</incDir>
</ccTool>
<linkerTool>
- <output>${TESTDIR}/TestFiles/f2</output>
+ <output>${TESTDIR}/TestFiles/fsScanTest</output>
</linkerTool>
</folder>
<folder path="TestFiles/f3">
@@ -271,7 +278,7 @@
</incDir>
</ccTool>
<linkerTool>
- <output>${TESTDIR}/TestFiles/f3</output>
+ <output>${TESTDIR}/TestFiles/connectionHandlerTest</output>
</linkerTool>
</folder>
<folder path="TestFiles/f4">
@@ -286,7 +293,7 @@
</incDir>
</ccTool>
<linkerTool>
- <output>${TESTDIR}/TestFiles/f4</output>
+ <output>${TESTDIR}/TestFiles/jsonTest</output>
</linkerTool>
</folder>
<folder path="TestFiles/f5">
@@ -301,7 +308,7 @@
</incDir>
</ccTool>
<linkerTool>
- <output>${TESTDIR}/TestFiles/f5</output>
+ <output>${TESTDIR}/TestFiles/fileSystemTest</output>
</linkerTool>
</folder>
<folder path="TestFiles/f6">
@@ -316,7 +323,22 @@
</incDir>
</ccTool>
<linkerTool>
- <output>${TESTDIR}/TestFiles/f6</output>
+ <output>${TESTDIR}/TestFiles/metaScanTest</output>
+ </linkerTool>
+ </folder>
+ <folder path="TestFiles/f7">
+ <cTool>
+ <incDir>
+ <pElem>.</pElem>
+ </incDir>
+ </cTool>
+ <ccTool>
+ <incDir>
+ <pElem>.</pElem>
+ </incDir>
+ </ccTool>
+ <linkerTool>
+ <output>${TESTDIR}/TestFiles/stringBuilderTest</output>
</linkerTool>
</folder>
</conf>
diff --git a/cmps/serverlib/include/MediaServerConfig.h b/cmps/serverlib/include/MediaServerConfig.h
new file mode 100644
index 0000000..9e07ea3
--- /dev/null
+++ b/cmps/serverlib/include/MediaServerConfig.h
@@ -0,0 +1,39 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: MediaServerConfig.h
+ * Created: 1. August 2012, 10:58
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: cmps - the backend (server) part of compound media player
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef MEDIASERVERCONFIG_H
+#define MEDIASERVERCONFIG_H
+
+#include <ServerConfig.h>
+
+class cMediaServerConfig : public cServerConfig {
+public:
+ cMediaServerConfig(const char *ConfigBaseDir);
+ virtual ~cMediaServerConfig();
+
+ virtual bool Eval(cConfigReader::ConfigEntry *Entry);
+ };
+
+#endif /* MEDIASERVERCONFIG_H */
+
diff --git a/cmps/serverlib/nbproject/Makefile-Debug.mk b/cmps/serverlib/nbproject/Makefile-Debug.mk
index 9b947b0..96d3da9 100644
--- a/cmps/serverlib/nbproject/Makefile-Debug.mk
+++ b/cmps/serverlib/nbproject/Makefile-Debug.mk
@@ -36,6 +36,7 @@ OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
# Object Files
OBJECTFILES= \
${OBJECTDIR}/src/JSonListAssembler.o \
+ ${OBJECTDIR}/src/MediaServerConfig.o \
${OBJECTDIR}/src/CommandHandler.o \
${OBJECTDIR}/src/HTMLListAssembler.o \
${OBJECTDIR}/src/AbstractMediaRequestHandler.o \
@@ -70,37 +71,42 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libserverlib.a: ${OBJECTFILES}
${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libserverlib.a ${OBJECTFILES}
$(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libserverlib.a
-${OBJECTDIR}/src/JSonListAssembler.o: src/JSonListAssembler.cc
+${OBJECTDIR}/src/JSonListAssembler.o: nbproject/Makefile-${CND_CONF}.mk src/JSonListAssembler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -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}/src/JSonListAssembler.o src/JSonListAssembler.cc
-${OBJECTDIR}/src/CommandHandler.o: src/CommandHandler.cc
+${OBJECTDIR}/src/MediaServerConfig.o: nbproject/Makefile-${CND_CONF}.mk src/MediaServerConfig.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -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}/src/MediaServerConfig.o src/MediaServerConfig.cc
+
+${OBJECTDIR}/src/CommandHandler.o: nbproject/Makefile-${CND_CONF}.mk src/CommandHandler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -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}/src/CommandHandler.o src/CommandHandler.cc
-${OBJECTDIR}/src/HTMLListAssembler.o: src/HTMLListAssembler.cc
+${OBJECTDIR}/src/HTMLListAssembler.o: nbproject/Makefile-${CND_CONF}.mk src/HTMLListAssembler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -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}/src/HTMLListAssembler.o src/HTMLListAssembler.cc
-${OBJECTDIR}/src/AbstractMediaRequestHandler.o: src/AbstractMediaRequestHandler.cc
+${OBJECTDIR}/src/AbstractMediaRequestHandler.o: nbproject/Makefile-${CND_CONF}.mk src/AbstractMediaRequestHandler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -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}/src/AbstractMediaRequestHandler.o src/AbstractMediaRequestHandler.cc
-${OBJECTDIR}/src/HTTPMediaResponse.o: src/HTTPMediaResponse.cc
+${OBJECTDIR}/src/HTTPMediaResponse.o: nbproject/Makefile-${CND_CONF}.mk src/HTTPMediaResponse.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -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}/src/HTTPMediaResponse.o src/HTTPMediaResponse.cc
-${OBJECTDIR}/src/MediaListHandler.o: src/MediaListHandler.cc
+${OBJECTDIR}/src/MediaListHandler.o: nbproject/Makefile-${CND_CONF}.mk src/MediaListHandler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -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}/src/MediaListHandler.o src/MediaListHandler.cc
-${OBJECTDIR}/src/MediaFileHandler.o: src/MediaFileHandler.cc
+${OBJECTDIR}/src/MediaFileHandler.o: nbproject/Makefile-${CND_CONF}.mk src/MediaFileHandler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -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}/src/MediaFileHandler.o src/MediaFileHandler.cc
diff --git a/cmps/serverlib/nbproject/Makefile-Release.mk b/cmps/serverlib/nbproject/Makefile-Release.mk
index 55f83a2..4ba9a41 100644
--- a/cmps/serverlib/nbproject/Makefile-Release.mk
+++ b/cmps/serverlib/nbproject/Makefile-Release.mk
@@ -36,6 +36,7 @@ OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
# Object Files
OBJECTFILES= \
${OBJECTDIR}/src/JSonListAssembler.o \
+ ${OBJECTDIR}/src/MediaServerConfig.o \
${OBJECTDIR}/src/CommandHandler.o \
${OBJECTDIR}/src/HTMLListAssembler.o \
${OBJECTDIR}/src/AbstractMediaRequestHandler.o \
@@ -70,37 +71,42 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libserverlib.a: ${OBJECTFILES}
${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libserverlib.a ${OBJECTFILES}
$(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libserverlib.a
-${OBJECTDIR}/src/JSonListAssembler.o: src/JSonListAssembler.cc
+${OBJECTDIR}/src/JSonListAssembler.o: nbproject/Makefile-${CND_CONF}.mk src/JSonListAssembler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/JSonListAssembler.o src/JSonListAssembler.cc
-${OBJECTDIR}/src/CommandHandler.o: src/CommandHandler.cc
+${OBJECTDIR}/src/MediaServerConfig.o: nbproject/Makefile-${CND_CONF}.mk src/MediaServerConfig.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediaServerConfig.o src/MediaServerConfig.cc
+
+${OBJECTDIR}/src/CommandHandler.o: nbproject/Makefile-${CND_CONF}.mk src/CommandHandler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/CommandHandler.o src/CommandHandler.cc
-${OBJECTDIR}/src/HTMLListAssembler.o: src/HTMLListAssembler.cc
+${OBJECTDIR}/src/HTMLListAssembler.o: nbproject/Makefile-${CND_CONF}.mk src/HTMLListAssembler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/HTMLListAssembler.o src/HTMLListAssembler.cc
-${OBJECTDIR}/src/AbstractMediaRequestHandler.o: src/AbstractMediaRequestHandler.cc
+${OBJECTDIR}/src/AbstractMediaRequestHandler.o: nbproject/Makefile-${CND_CONF}.mk src/AbstractMediaRequestHandler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMediaRequestHandler.o src/AbstractMediaRequestHandler.cc
-${OBJECTDIR}/src/HTTPMediaResponse.o: src/HTTPMediaResponse.cc
+${OBJECTDIR}/src/HTTPMediaResponse.o: nbproject/Makefile-${CND_CONF}.mk src/HTTPMediaResponse.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/HTTPMediaResponse.o src/HTTPMediaResponse.cc
-${OBJECTDIR}/src/MediaListHandler.o: src/MediaListHandler.cc
+${OBJECTDIR}/src/MediaListHandler.o: nbproject/Makefile-${CND_CONF}.mk src/MediaListHandler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediaListHandler.o src/MediaListHandler.cc
-${OBJECTDIR}/src/MediaFileHandler.o: src/MediaFileHandler.cc
+${OBJECTDIR}/src/MediaFileHandler.o: nbproject/Makefile-${CND_CONF}.mk src/MediaFileHandler.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediaFileHandler.o src/MediaFileHandler.cc
diff --git a/cmps/serverlib/nbproject/configurations.xml b/cmps/serverlib/nbproject/configurations.xml
index b37dc04..3bf0fb8 100644
--- a/cmps/serverlib/nbproject/configurations.xml
+++ b/cmps/serverlib/nbproject/configurations.xml
@@ -11,6 +11,7 @@
<itemPath>include/JSonListAssembler.h</itemPath>
<itemPath>include/MediaFileHandler.h</itemPath>
<itemPath>include/MediaListHandler.h</itemPath>
+ <itemPath>include/MediaServerConfig.h</itemPath>
</logicalFolder>
<logicalFolder name="ResourceFiles"
displayName="Resource Files"
@@ -26,6 +27,7 @@
<itemPath>src/JSonListAssembler.cc</itemPath>
<itemPath>src/MediaFileHandler.cc</itemPath>
<itemPath>src/MediaListHandler.cc</itemPath>
+ <itemPath>src/MediaServerConfig.cc</itemPath>
</logicalFolder>
<logicalFolder name="TestFiles"
displayName="Test Files"
diff --git a/cmps/serverlib/src/MediaServerConfig.cc b/cmps/serverlib/src/MediaServerConfig.cc
new file mode 100644
index 0000000..5ef3646
--- /dev/null
+++ b/cmps/serverlib/src/MediaServerConfig.cc
@@ -0,0 +1,128 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: MediaServerConfig.cc
+ * Created: 1. August 2012, 10:58
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: cmps - the backend (server) part of compound media player
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#include <MediaServerConfig.h>
+#include <AbstractMedia.h>
+#include <Audio.h>
+#include <DVDImage.h>
+#include <Movie.h>
+#include <Picture.h>
+#include <LegacyVdrRecording.h>
+#include <VdrRecording.h>
+#include <pcrecpp.h>
+
+static pcrecpp::RE sequence("\\s*(\\S+)\\s*,\\s*(.+)");
+static pcrecpp::RE sequenceLast("(\\S+)\\s*");
+
+cMediaServerConfig::cMediaServerConfig(const char *ConfigBaseDir)
+ : cServerConfig(ConfigBaseDir)
+{
+}
+
+cMediaServerConfig::~cMediaServerConfig()
+{
+}
+
+bool cMediaServerConfig::Eval(cConfigReader::ConfigEntry* Entry)
+{
+ std::string name = std::get<0>(*Entry);
+
+ if (!strcmp("no-deep-scan", name.c_str())) {
+ int es[cAbstractMedia::Unknown] = {1};
+ int mx = sizeof(es) / sizeof(int);
+ const char *rawValue = std::get<1>(*Entry).c_str();
+ SetWantExtendedScan(true);
+ std::string cur, rest;
+
+ for (int i=0; i < mx; ++i) es[i] = 1;
+ while (sequence.FullMatch(rawValue, &cur, &rest)) {
+ if (!strcmp("Audio", cur.c_str())) es[cAbstractMedia::Audio] = 0;
+ else if (!strcmp("Movie", cur.c_str())) es[cAbstractMedia::Movie] = 0;
+ else if (!strcmp("DVDImage", cur.c_str())) es[cAbstractMedia::DVDImage] = 0;
+ else if (!strcmp("LegacyVdrRecording", cur.c_str())) es[cAbstractMedia::LegacyVdrRecording] = 0;
+ else if (!strcmp("VdrRecording", cur.c_str())) es[cAbstractMedia::VdrRecording] = 0;
+ else if (!strcmp("Picture", cur.c_str())) es[cAbstractMedia::Picture] = 0;
+ rawValue = rest.c_str();
+ }
+ cur = rawValue;
+ if (!strcmp("Audio", cur.c_str())) es[cAbstractMedia::Audio] = 0;
+ else if (!strcmp("Movie", cur.c_str())) es[cAbstractMedia::Movie] = 0;
+ else if (!strcmp("DVDImage", cur.c_str())) es[cAbstractMedia::DVDImage] = 0;
+ else if (!strcmp("LegacyVdrRecording", cur.c_str())) es[cAbstractMedia::LegacyVdrRecording] = 0;
+ else if (!strcmp("VdrRecording", cur.c_str())) es[cAbstractMedia::VdrRecording] = 0;
+ else if (!strcmp("Picture", cur.c_str())) es[cAbstractMedia::Picture] = 0;
+
+ for (int i=0; i < mx; ++i) {
+ switch ((cAbstractMedia::SupportedMediaType) i) {
+ case cAbstractMedia::Audio: cAudio::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::DVDImage: cDVDImage::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::LegacyVdrRecording: cLegacyVdrRecording::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::Movie: cMovie::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::Picture: cPicture::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::VdrRecording: cVdrRecording::EnableDeepScan(es[i]); break;
+ default: break;
+ }
+ }
+ return true;
+ }
+ else if (!strcmp("deep-scan", name.c_str())) {
+ int es[cAbstractMedia::Unknown] = {0};
+ int mx = sizeof(es) / sizeof(int);
+ const char *rawValue = std::get<1>(*Entry).c_str();
+ SetWantExtendedScan(true);
+ std::string cur, rest;
+
+ for (int i=0; i < mx; ++i) es[i] = 0;
+ while (sequence.FullMatch(rawValue, &cur, &rest)) {
+ if (!strcmp("Audio", cur.c_str())) es[cAbstractMedia::Audio] = 1;
+ else if (!strcmp("Movie", cur.c_str())) es[cAbstractMedia::Movie] = 1;
+ else if (!strcmp("DVDImage", cur.c_str())) es[cAbstractMedia::DVDImage] = 1;
+ else if (!strcmp("LegacyVdrRecording", cur.c_str())) es[cAbstractMedia::LegacyVdrRecording] = 1;
+ else if (!strcmp("VdrRecording", cur.c_str())) es[cAbstractMedia::VdrRecording] = 1;
+ else if (!strcmp("Picture", cur.c_str())) es[cAbstractMedia::Picture] = 1;
+ rawValue = rest.c_str();
+ }
+ cur = rawValue;
+ if (!strcmp("Audio", cur.c_str())) es[cAbstractMedia::Audio] = 1;
+ else if (!strcmp("Movie", cur.c_str())) es[cAbstractMedia::Movie] = 1;
+ else if (!strcmp("DVDImage", cur.c_str())) es[cAbstractMedia::DVDImage] = 1;
+ else if (!strcmp("LegacyVdrRecording", cur.c_str())) es[cAbstractMedia::LegacyVdrRecording] = 1;
+ else if (!strcmp("VdrRecording", cur.c_str())) es[cAbstractMedia::VdrRecording] = 1;
+ else if (!strcmp("Picture", cur.c_str())) es[cAbstractMedia::Picture] = 1;
+
+ for (int i=0; i < mx; ++i) {
+ switch ((cAbstractMedia::SupportedMediaType) i) {
+ case cAbstractMedia::Audio: cAudio::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::DVDImage: cDVDImage::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::LegacyVdrRecording: cLegacyVdrRecording::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::Movie: cMovie::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::Picture: cPicture::EnableDeepScan(es[i]); break;
+ case cAbstractMedia::VdrRecording: cVdrRecording::EnableDeepScan(es[i]); break;
+ default: break;
+ }
+ }
+ return true;
+ }
+ else return cServerConfig::Eval(Entry);
+} \ No newline at end of file
diff --git a/cmps/tests/CredentialPersistence.cc b/cmps/tests/CredentialPersistence.cc
new file mode 100644
index 0000000..8e6df4b
--- /dev/null
+++ b/cmps/tests/CredentialPersistence.cc
@@ -0,0 +1,103 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: CredentialPersistence.cc
+ * Created: 03.07.2012, 14:16:35
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: cmps - the backend (server) part of compound media player
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#include <Principal.h>
+#include <Credentials.h>
+#include <stdlib.h>
+#include <iostream>
+
+/*
+ * Simple C++ Test Suite
+ */
+static void setupTestCredentials() {
+ Credentials.SetApplicationRealm("supportedUsers@myTestApp");
+ cPrincipal *p = new cPrincipal("Nasenbär", Credentials.ApplicationRealm());
+
+ p->CreateHash("Nasenwasser");
+ Credentials.Put(p->Name(), p);
+
+ p = new cPrincipal("Admin", Credentials.ApplicationRealm());
+ p->CreateHash("very secret");
+ Credentials.Put(p->Name(), p);
+
+ p = new cPrincipal("Sepp", Credentials.ApplicationRealm());
+ p->CreateHash("keine Ahnung");
+ Credentials.Put(p->Name(), p);
+}
+
+static void dumpCredentials() {
+ cCredentials::const_iterator principals = Credentials.begin();
+
+ while (principals != Credentials.end()) {
+ principals->second->Dump();
+ ++principals;
+ }
+
+}
+
+void test1()
+{
+ setupTestCredentials();
+ std::cout << "CredentialPersistence test 1" << std::endl;
+
+ int rv = Credentials.Store("/tmp/testCredentials.x9");
+
+ if (!rv) std::cout << "%TEST_FAILED% time=0 testname=test1 (CredentialPersistence) message=failed to write credentials" << std::endl;
+ else std::cout << "saved " << rv << " principals." << std::endl;
+
+ dumpCredentials();
+}
+
+void test2()
+{
+ std::cout << "CredentialPersistence test 2" << std::endl;
+
+ Credentials.Clear();
+
+ int rv = Credentials.Load("/tmp/testCredentials.x9");
+
+ if (!rv) std::cout << "%TEST_FAILED% time=0 testname=test2 (CredentialPersistence) message=failed to load credentials" << std::endl;
+ else std::cout << "loaded " << rv << " principals." << std::endl;
+
+ dumpCredentials();
+}
+
+int main(int argc, char** argv)
+{
+ std::cout << "%SUITE_STARTING% CredentialPersistence" << std::endl;
+ std::cout << "%SUITE_STARTED%" << std::endl;
+
+ std::cout << "%TEST_STARTED% test1 (CredentialPersistence)" << std::endl;
+ test1();
+ std::cout << "%TEST_FINISHED% time=0 test1 (CredentialPersistence)" << std::endl;
+
+ std::cout << "%TEST_STARTED% test2 (CredentialPersistence)\n" << std::endl;
+ test2();
+ std::cout << "%TEST_FINISHED% time=0 test2 (CredentialPersistence)" << std::endl;
+
+ std::cout << "%SUITE_FINISHED% time=0" << std::endl;
+
+ return (EXIT_SUCCESS);
+}
+
diff --git a/cmps/tests/FScanTest.cc b/cmps/tests/FScanTest.cc
index a426c0d..8ca4498 100644
--- a/cmps/tests/FScanTest.cc
+++ b/cmps/tests/FScanTest.cc
@@ -22,13 +22,15 @@
*
* --------------------------------------------------------------
*/
-#include <stdlib.h>
-#include <iostream>
#include <Audio.h>
#include <Movie.h>
-#include <PictuFSMediaScannerner.h>
+#include <Picture.h>
+#include <FSMediaScanner.h>
#include <MediaFactory.h>
+#include <MediaServerConfig.h>
#include <TimeMs.h>
+#include <stdlib.h>
+#include <iostream>
class FScanTest {
public:
@@ -66,30 +68,45 @@ void FScanTest::test3()
}
void FScanTest::test4()
-///< result from java pendant: FSScanner - scanning of 9970 media took 46 ms
-///< own result: found 9970 media, in 58 ms.
-///< file server (mostly recordings) found 2828 media, in 53525 ms.
-///< file server (added 18G audio) found 5698 media, in 44653 ms.
-///< file server (same files, fresh reboot) found 5698 media, in 54723 ms.
+///< result from java pendant: FSScanner - scanning of 9970 media took 46 ms
+///< own result: found 9970 media, in 58 ms.
+///< file server (mostly recordings) found 2828 media, in 53525 ms.
+///< file server (added 18G audio) found 5698 media, in 44653 ms.
+///< file server (same files, fresh reboot) found 5698 media, in 54723 ms.
+///< new own result using cFile found 10002 media, in 601 ms. (first run)
+///< new own result using cFile found 10002 media, in 177 ms. (second run)
+///< with mediascan found 10002 media, in 80570 ms.
+///< with mediascan and saving values found 10002 media, in 93675 ms.
+///< with mediascan, scanning each media found 10002 media, in 247096 ms.
+///< java - mediascan for each media scanning of 9312 media took 215037 ms. (with key file)
{
+ cMediaServerConfig config("/var/lib/cmp");
cFSMediaScanner scanner;
cAbstractMedia *media;
+ config.Load("srserver.conf");
+ config.SetAuthorizationRequired(false);
+ config.Dump();
+
std::cout << "FScanTest test 4" << std::endl;
- scanner.SetMediaFactory(new cMediaFactory("/media/video"));
+ scanner.SetMediaFactory(new cMediaFactory(config));
uint64_t start = cTimeMs::Now();
scanner.Refresh();
uint64_t end = cTimeMs::Now();
+ size_t grouped[cAbstractMedia::Unknown];
+ int mx = sizeof(grouped) / sizeof(size_t);
+ for (int i=0; i < mx; ++i) grouped[i] = 0;
for (size_t i=0; i < scanner.MediaPool().size(); ++i) {
media = (cAbstractMedia *) scanner.MediaPool()[i];
- std::cout << media->Name() << " [" << media->MimeType() << "] => " << media->AbsolutePath() << std::endl;
+ ++grouped[media->MediaType()];
+ media->Dump();
}
std::cout << std::endl << "found " << scanner.MediaPool().size() << " media, in " << end - start << " ms." << std::endl;
- const char *file2Search = "/pretty/unsupported/media/file/in/any/workstation.unknown";
+ const char *file2Search = "/pretty/unsupported/media/file/in/any/known.workstation";
// search (worst case)
start = cTimeMs::Now();
@@ -97,11 +114,18 @@ void FScanTest::test4()
end = cTimeMs::Now();
std::cout << "array search took " << end - start << " ms." << std::endl;
+
+ for (int i=0; i < mx; ++i) {
+ std::cout << cAbstractMedia::MediaType2Text(i) << " has " << grouped[i] << " members." << std::endl;
+ }
cFile::Cleanup();
}
int main(int argc, char** argv)
{
+ int MaxPossibleFileDescriptors = getdtablesize();
+
+ std::cout << "maximum of open files #" << MaxPossibleFileDescriptors << std::endl << std::endl;
uint64_t t0 = cTimeMs::Now();
std::cout << "%SUITE_STARTING% FScanTest" << std::endl;
std::cout << "%SUITE_STARTED%" << std::endl;
diff --git a/cmps/tests/MetaScanTest.cc b/cmps/tests/MetaScanTest.cc
index 918ad9f..1b57752 100644
--- a/cmps/tests/MetaScanTest.cc
+++ b/cmps/tests/MetaScanTest.cc
@@ -28,6 +28,8 @@
#include <ConfigReader.h>
#include <CommandReader.h>
#include <MediainfoReader.h>
+#include <MediaInfo/MediaInfo.h>
+#include <MediaServerConfig.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
@@ -35,8 +37,9 @@
#include <unistd.h>
#include <tr1/tuple>
-static void parseConfig(const char *FileName)
+void parseConfig(const char *FileName)
{
+#ifdef OLD_STUFF
cConfigReader *cr = new cConfigReader(new cLineReader(new cFileReader(new cFile(FileName))));
cConfigReader::ConfigEntry *ce;
@@ -46,9 +49,15 @@ static void parseConfig(const char *FileName)
}
cr->Close();
delete cr;
+#else
+ cMediaServerConfig msc("/var/lib/cmp");
+
+ msc.Load("srserver.conf");
+ msc.Dump();
+#endif
}
-static void dumpTextfile(const char *FileName)
+void dumpTextfile(const char *FileName)
{
cLineReader *lr = new cLineReader(new cFileReader(new cFile(FileName)));
const char *line;
@@ -59,32 +68,34 @@ static void dumpTextfile(const char *FileName)
delete lr;
}
-static void setupMediainfoReader(cMediainfoReader *mir)
+void setupMediainfo(void)
{
- mir->AddValuableKey("Format");
+ static const char *MetaKeys[] = {
+ "Format"
//Audio
- mir->AddValuableKey("Duration");
- mir->AddValuableKey("Album");
- mir->AddValuableKey("Track name");
- mir->AddValuableKey("Performer");
- mir->AddValuableKey("Bit rate");
+, "Duration"
+, "Album"
+, "Track name"
+, "Performer"
+, "Bit rate"
//Image
- mir->AddValuableKey("Width");
- mir->AddValuableKey("Height");
+, "Width"
+, "Height"
//Video
- mir->AddValuableKey("Display aspect ratio");
- mir->AddValuableKey("Scan type");
+, "Display aspect ratio"
+, "Scan type"
+, NULL
+ };
+ cMediainfoReader::Setup(MetaKeys);
}
-static void testMediaInfo(const char *FileName)
+void testMediaInfo(const char *FileName)
{
cCommandReader *cr = new cCommandReader("/usr/bin/mediainfo");
-// cFileReader *fr = new cFileReader(new cFile("mi.output"));
cMediainfoReader *mir = new cMediainfoReader(new cLineReader(cr));
cMediainfoReader::InfoEntry *ie;
cr->AddCommandParameter(FileName);
- setupMediainfoReader(mir);
while ((ie = mir->ReadEntry())) {
std::cout << "media info - [" << std::get<0>(*ie) << "] ==> " << std::get<1>(*ie) << std::endl;
delete ie;
@@ -98,6 +109,7 @@ void testMediaFiles(const char *FileName)
cLineReader *lr = new cLineReader(new cFileReader(new cFile(FileName)));
const char *line;
+ setupMediainfo();
while ((line = lr->ReadLine())) {
std::cout << std::endl << "media-test-file: " << line << std::endl;
testMediaInfo(line);
@@ -112,7 +124,7 @@ enum PipeFileDescriptors {
WRITE_FD = 1
};
-static void testCommandReader()
+void testCommandReader()
{
cCommandReader *cr = new cCommandReader("/bin/ls");
cLineReader *lr = new cLineReader(cr);
@@ -129,7 +141,9 @@ static void testCommandReader()
int main()
{
-// testMediaInfo("blah");
+ char buf[256];
+
+ std::cout << "working directory is: " << getcwd(buf, sizeof(buf)) << std::endl;
dumpTextfile("srclient.conf");
std::cout << std::endl << "===========================================" << std::endl << std::endl;
@@ -138,8 +152,8 @@ int main()
std::cout << std::endl << "===========================================" << std::endl << std::endl;
testCommandReader();
- std::cout << std::endl << "===========================================" << std::endl << std::endl;
- testMediaFiles("testMedia.files");
+// std::cout << std::endl << "===========================================" << std::endl << std::endl;
+// testMediaFiles("testMedia.txt");
cFile::Cleanup();
return 0;