summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmps/main.cc12
-rw-r--r--cmps/nbproject/Makefile-Debug.mk14
-rw-r--r--cmps/nbproject/Makefile-Release.mk12
-rw-r--r--cmps/nbproject/configurations.xml21
-rw-r--r--cmps/serverlib/serverlib.layout10
-rw-r--r--cmps/tests/MetaScanTest.cc177
-rw-r--r--libs/IO/IO.cbp4
-rw-r--r--libs/IO/IO.layout20
-rw-r--r--libs/IO/include/CommandReader.h49
-rw-r--r--libs/IO/include/ConfigReader.h3
-rw-r--r--libs/IO/include/FileReader.h11
-rw-r--r--libs/IO/include/FileRepresentation.h12
-rw-r--r--libs/IO/include/LineReader.h10
-rw-r--r--libs/IO/include/Reader.h41
-rw-r--r--libs/IO/nbproject/Makefile-Debug.mk12
-rw-r--r--libs/IO/nbproject/Makefile-Release.mk12
-rw-r--r--libs/IO/nbproject/configurations.xml4
-rw-r--r--libs/IO/src/CommandReader.cc120
-rw-r--r--libs/IO/src/File.cc12
-rw-r--r--libs/IO/src/FileReader.cc18
-rw-r--r--libs/IO/src/FileRepresentation.cc12
-rw-r--r--libs/IO/src/LineReader.cc4
-rw-r--r--libs/IO/src/Reader.cc44
-rw-r--r--libs/fsScan/mediaScan.cbp74
-rw-r--r--libs/fsScan/mediaScan.depend1
-rw-r--r--libs/fsScan/mediaScan.layout34
-rw-r--r--libs/fsScan/summary.txt2
-rw-r--r--libs/networking/include/ServerConfig.h12
-rw-r--r--libs/networking/networking.layout26
-rw-r--r--libs/networking/src/ServerConfig.cc12
-rw-r--r--libs/util/include/util.h10
-rw-r--r--libs/util/util.layout34
-rw-r--r--libs/vdr/vdr.layout28
-rw-r--r--tests/FilesystemTest/FilesystemTest.layout4
-rw-r--r--tests/MetaScanTest/MetaScanTest.layout4
-rw-r--r--tests/MetaScanTest/main.cpp34
36 files changed, 770 insertions, 139 deletions
diff --git a/cmps/main.cc b/cmps/main.cc
index da5b260..a5d2b04 100644
--- a/cmps/main.cc
+++ b/cmps/main.cc
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: main.cc
* Created: 2. Juli 2012, 16
* 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 <HTTPServer.h>
diff --git a/cmps/nbproject/Makefile-Debug.mk b/cmps/nbproject/Makefile-Debug.mk
index b3558ee..fc3eebf 100644
--- a/cmps/nbproject/Makefile-Debug.mk
+++ b/cmps/nbproject/Makefile-Debug.mk
@@ -46,7 +46,8 @@ TESTFILES= \
${TESTDIR}/TestFiles/f3 \
${TESTDIR}/TestFiles/f5 \
${TESTDIR}/TestFiles/f2 \
- ${TESTDIR}/TestFiles/f4
+ ${TESTDIR}/TestFiles/f4 \
+ ${TESTDIR}/TestFiles/f6
# C Compiler Flags
CFLAGS=
@@ -126,6 +127,10 @@ ${TESTDIR}/TestFiles/f4: ${TESTDIR}/tests/JSonTest.o ${OBJECTFILES:%.o=%_nomain.
${MKDIR} -p ${TESTDIR}/TestFiles
${LINK.cc} -o ${TESTDIR}/TestFiles/f4 $^ ${LDLIBSOPTIONS}
+${TESTDIR}/TestFiles/f6: ${TESTDIR}/tests/MetaScanTest.o ${OBJECTFILES:%.o=%_nomain.o}
+ ${MKDIR} -p ${TESTDIR}/TestFiles
+ ${LINK.cc} -o ${TESTDIR}/TestFiles/f6 $^ ${LDLIBSOPTIONS}
+
${TESTDIR}/tests/CodecTest.o: tests/CodecTest.cc
${MKDIR} -p ${TESTDIR}/tests
@@ -157,6 +162,12 @@ ${TESTDIR}/tests/JSonTest.o: tests/JSonTest.cc
$(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/fsScan/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
+${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/fsScan/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
+
+
${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
${MKDIR} -p ${OBJECTDIR}
@NMOUTPUT=`${NM} ${OBJECTDIR}/main.o`; \
@@ -179,6 +190,7 @@ ${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
${TESTDIR}/TestFiles/f5 || true; \
${TESTDIR}/TestFiles/f2 || true; \
${TESTDIR}/TestFiles/f4 || true; \
+ ${TESTDIR}/TestFiles/f6 || true; \
else \
./${TEST} || true; \
fi
diff --git a/cmps/nbproject/Makefile-Release.mk b/cmps/nbproject/Makefile-Release.mk
index 29abff0..c4c3c75 100644
--- a/cmps/nbproject/Makefile-Release.mk
+++ b/cmps/nbproject/Makefile-Release.mk
@@ -46,6 +46,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
@@ -102,6 +103,10 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${TESTDIR}/tests/JSonTest.o ${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/MetaScanTest.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
@@ -133,6 +138,12 @@ ${TESTDIR}/tests/JSonTest.o: tests/JSonTest.cc
$(COMPILE.cc) -O2 -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) -O2 -MMD -MP -MF $@.d -o ${TESTDIR}/tests/MetaScanTest.o tests/MetaScanTest.cc
+
+
${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc
${MKDIR} -p ${OBJECTDIR}
@NMOUTPUT=`${NM} ${OBJECTDIR}/main.o`; \
@@ -155,6 +166,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 7793b21..e9180ff 100644
--- a/cmps/nbproject/configurations.xml
+++ b/cmps/nbproject/configurations.xml
@@ -45,6 +45,12 @@
<logicalFolder name="f4" displayName="JSonTest" projectFiles="true" kind="TEST">
<itemPath>tests/JSonTest.cc</itemPath>
</logicalFolder>
+ <logicalFolder name="f6"
+ displayName="MetaScanTest"
+ projectFiles="true"
+ kind="TEST">
+ <itemPath>tests/MetaScanTest.cc</itemPath>
+ </logicalFolder>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
@@ -298,6 +304,21 @@
<output>${TESTDIR}/TestFiles/f5</output>
</linkerTool>
</folder>
+ <folder path="TestFiles/f6">
+ <cTool>
+ <incDir>
+ <pElem>.</pElem>
+ </incDir>
+ </cTool>
+ <ccTool>
+ <incDir>
+ <pElem>.</pElem>
+ </incDir>
+ </ccTool>
+ <linkerTool>
+ <output>${TESTDIR}/TestFiles/f6</output>
+ </linkerTool>
+ </folder>
</conf>
<conf name="Release" type="1">
<toolsSet>
diff --git a/cmps/serverlib/serverlib.layout b/cmps/serverlib/serverlib.layout
index 4ad7fb3..43baef8 100644
--- a/cmps/serverlib/serverlib.layout
+++ b/cmps/serverlib/serverlib.layout
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
+ <File name="src/AbstractMediaRequestHandler.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="0" topLine="0" />
+ </Cursor>
+ </File>
<File name="src/JSonListAssembler.cc" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1183" topLine="0" />
@@ -16,9 +21,4 @@
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="src/AbstractMediaRequestHandler.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor>
- <Cursor1 position="0" topLine="0" />
- </Cursor>
- </File>
</CodeBlocks_layout_file>
diff --git a/cmps/tests/MetaScanTest.cc b/cmps/tests/MetaScanTest.cc
new file mode 100644
index 0000000..bdd51ae
--- /dev/null
+++ b/cmps/tests/MetaScanTest.cc
@@ -0,0 +1,177 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: MetaScanTest.cc
+ * Created: 27.07.2012, 10:03
+ * 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 <File.h>
+#include <FileReader.h>
+#include <LineReader.h>
+#include <ConfigReader.h>
+#include <iostream>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <wait.h>
+#include <tr1/tuple>
+#include <util.h>
+
+static void testPipe(const char *chk = NULL);
+
+static void parseConfig(const char *FileName)
+{
+ cConfigReader *cr = new cConfigReader(new cLineReader(new cFileReader(new cFile(FileName))));
+ cConfigReader::ConfigEntry *ce;
+
+ while ((ce = cr->ReadValue())) {
+ std::cout << "config entry [" << std::get<0>(*ce) << "] => " << std::get<1>(*ce) << std::endl;
+ delete ce;
+ }
+ cr->Close();
+ delete cr;
+}
+
+static void testMediaFiles(const char *FileName)
+{
+ cLineReader *lr = new cLineReader(new cFileReader(new cFile(FileName)));
+ const char *line;
+
+ while ((line = lr->ReadLine())) {
+ std::cout << "media-test-file: " << line << std::endl;
+ testPipe(line);
+ }
+ lr->Close();
+ delete lr;
+}
+
+static const short BufferSize = 100;
+enum PipeFileDescriptors {
+ READ_FD = 0,
+ WRITE_FD = 1
+};
+
+static void testCommandReader()
+{
+ cCommandReader *cr = new cCommandReader("/bin/ls");
+ cLineReader *lr = new cLineReader(cr);
+ char *line;
+
+ cr.AddCommandParameter("-al");
+ cr.AddCommandParameter("--color");
+
+ while ((line = lr->ReadLine())) {
+ std::cout << "from command: " << line << std::endl;
+ }
+};
+
+static void testPipe(const char *chk)
+{
+ int parent2Child[2];
+ int child2Parent[2];
+ pid_t pid;
+ std::string dataReadFromChild;
+ char buffer[BufferSize + 1];
+ ssize_t readResult;
+ bool run = true;
+ int status;
+
+ ASSERT_IS(0, pipe(parent2Child));
+ ASSERT_IS(0, pipe(child2Parent));
+
+ switch (pid = fork()) {
+ case -1:
+ FAIL("fork failed");
+ exit(-1);
+
+ case 0: /* child */
+ ASSERT_NOT(-1, dup2(parent2Child[READ_FD], STDIN_FILENO));
+ ASSERT_NOT(-1, dup2(child2Parent[WRITE_FD], STDOUT_FILENO));
+ ASSERT_NOT(-1, dup2(child2Parent[WRITE_FD], STDERR_FILENO));
+ ASSERT_IS(0, close(parent2Child[WRITE_FD]));
+ ASSERT_IS(0, close(child2Parent[READ_FD]));
+
+ if (chk) {
+ execlp("mediainfo", "mediainfo", chk, NULL);
+ }
+ else execlp("ls", "ls", "-al", "--color", NULL);
+ FAIL("this line should never be reached!");
+ exit(-1);
+
+ default: /* parent */
+ std::cout << "child " << pid << " process running ..." << std::endl;
+
+ ASSERT_IS(0, close(parent2Child[READ_FD]));
+ ASSERT_IS(0, close(child2Parent[WRITE_FD]));
+
+ while (run) {
+ switch (readResult = read(child2Parent[READ_FD], buffer, BufferSize)) {
+ case 0: /* end of file, or non-blocking read. */
+ std::cout << "End of File reached ..." << std::endl
+ << "Data received was ("
+ << dataReadFromChild.size() << "):" << std::endl
+ << dataReadFromChild << std::endl;
+ ASSERT_IS(pid, waitpid(pid, &status, 0));
+
+ std::cout << std::endl
+ << "child exit status is: " << WEXITSTATUS(status) << std::endl << std::endl;
+// exit(0);
+ run = false;
+ break;
+
+ case -1:
+ if ((errno == EINTR) || (errno == EAGAIN)) {
+ errno = 0;
+ }
+ else {
+ FAIL("read() failed");
+ run = false;
+ } break;
+
+ default:
+ dataReadFromChild.append(buffer, readResult);
+ break;
+ }
+ }
+ }
+}
+
+
+// mediainfo ${media} | grep "Scan type"
+// ffmpeg -i ${media}
+int main()
+{
+ parseConfig("srclient.conf");
+
+ std::cout << std::endl << "===========================================" << std::endl << std::endl;
+ parseConfig("srserver.conf");
+
+ std::cout << std::endl << "===========================================" << std::endl << std::endl;
+ testCommandReader();
+
+// std::cout << std::endl << "===========================================" << std::endl << std::endl;
+// testMediaFiles("testMedia.files");
+
+ cFile::Cleanup();
+ return 0;
+}
diff --git a/libs/IO/IO.cbp b/libs/IO/IO.cbp
index 36f087a..e1377fc 100644
--- a/libs/IO/IO.cbp
+++ b/libs/IO/IO.cbp
@@ -48,18 +48,22 @@
<Add directory="../util/include" />
<Add directory="../vdr/include" />
</Compiler>
+ <Unit filename="include/CommandReader.h" />
<Unit filename="include/ConfigReader.h" />
<Unit filename="include/File.h" />
<Unit filename="include/FileReader.h" />
<Unit filename="include/FileRepresentation.h" />
<Unit filename="include/FileSystem.h" />
<Unit filename="include/LineReader.h" />
+ <Unit filename="include/Reader.h" />
+ <Unit filename="src/CommandReader.cc" />
<Unit filename="src/ConfigReader.cc" />
<Unit filename="src/File.cc" />
<Unit filename="src/FileReader.cc" />
<Unit filename="src/FileRepresentation.cc" />
<Unit filename="src/FileSystem.cc" />
<Unit filename="src/LineReader.cc" />
+ <Unit filename="src/Reader.cc" />
<Extensions>
<code_completion />
<envvars />
diff --git a/libs/IO/IO.layout b/libs/IO/IO.layout
index 0e6cd97..4af9097 100644
--- a/libs/IO/IO.layout
+++ b/libs/IO/IO.layout
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="src/File.cc" open="1" top="1" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/FileReader.cc" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1130" topLine="0" />
+ <Cursor1 position="737" topLine="0" />
</Cursor>
</File>
- <File name="include/File.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/ConfigReader.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="0" topLine="0" />
+ <Cursor1 position="459" topLine="0" />
</Cursor>
</File>
- <File name="include/ConfigReader.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/File.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="475" topLine="0" />
+ <Cursor1 position="1130" topLine="0" />
</Cursor>
</File>
- <File name="src/FileReader.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/ConfigReader.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1320" topLine="0" />
+ <Cursor1 position="475" topLine="0" />
</Cursor>
</File>
<File name="src/FileRepresentation.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -31,9 +31,9 @@
<Cursor1 position="854" topLine="0" />
</Cursor>
</File>
- <File name="src/ConfigReader.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/File.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="459" topLine="0" />
+ <Cursor1 position="0" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>
diff --git a/libs/IO/include/CommandReader.h b/libs/IO/include/CommandReader.h
new file mode 100644
index 0000000..e54a64c
--- /dev/null
+++ b/libs/IO/include/CommandReader.h
@@ -0,0 +1,49 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: CommandReader.h
+ * Created: 30. Juli 2012, 06:42
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libIO: classes for files, filesystem and input/output
+ *
+ * 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 COMMANDREADER_H
+#define COMMANDREADER_H
+
+#include <Reader.h>
+#include <vector>
+#include <string>
+
+class cCommandReader : public cReader {
+public:
+ cCommandReader(const char *cmd);
+ virtual ~cCommandReader();
+
+ void AddCommandParameter(const char *Param);
+
+protected:
+ virtual bool Open(void);
+ virtual void Close(void);
+
+private:
+ pid_t pid;
+ std::vector<std::string> args;
+ };
+
+#endif /* COMMANDREADER_H */
+
diff --git a/libs/IO/include/ConfigReader.h b/libs/IO/include/ConfigReader.h
index f3aa5eb..6d0cd30 100644
--- a/libs/IO/include/ConfigReader.h
+++ b/libs/IO/include/ConfigReader.h
@@ -29,8 +29,7 @@
#include <string>
class cLineReader;
-class cConfigReader
-{
+class cConfigReader {
public:
typedef std::tuple <std::string, std::string> ConfigEntry;
diff --git a/libs/IO/include/FileReader.h b/libs/IO/include/FileReader.h
index 31cb7d6..816b140 100644
--- a/libs/IO/include/FileReader.h
+++ b/libs/IO/include/FileReader.h
@@ -25,18 +25,19 @@
#ifndef FILEREADER_H
#define FILEREADER_H
+#include <Reader.h>
+
class cFile;
-class cFileReader
-{
+class cFileReader : public cReader {
public:
cFileReader(cFile *Input);
virtual ~cFileReader();
- int Read(char *buf, int bufSize);
- void Close();
+protected:
+ virtual bool Open(void);
+ virtual void Close(void);
private:
- int fd;
cFile *file;
};
diff --git a/libs/IO/include/FileRepresentation.h b/libs/IO/include/FileRepresentation.h
index 8bc9d9b..2c2db5a 100644
--- a/libs/IO/include/FileRepresentation.h
+++ b/libs/IO/include/FileRepresentation.h
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: FileRepresentation.h
* Created: 21. Juli 2012, 12
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libIO: classes for files, filesystem and input/output
- *
+ *
* 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 FILEREPRESENTATION_H
diff --git a/libs/IO/include/LineReader.h b/libs/IO/include/LineReader.h
index 8b8b754..3de64dc 100644
--- a/libs/IO/include/LineReader.h
+++ b/libs/IO/include/LineReader.h
@@ -25,19 +25,17 @@
#ifndef LINEREADER_H
#define LINEREADER_H
-
-class cFileReader;
-class cLineReader
-{
+class cReader;
+class cLineReader {
public:
- cLineReader(cFileReader *FileReader);
+ cLineReader(cReader *Reader);
virtual ~cLineReader();
const char *ReadLine(void);
void Close(void);
private:
- cFileReader *reader;
+ cReader *reader;
int bytesRead;
int off;
int bufSize;
diff --git a/libs/IO/include/Reader.h b/libs/IO/include/Reader.h
new file mode 100644
index 0000000..bc346a6
--- /dev/null
+++ b/libs/IO/include/Reader.h
@@ -0,0 +1,41 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: Reader.h
+ * Created: 30. Juli 2012, 06:44
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libIO: classes for files, filesystem and input/output
+ *
+ * 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 READER_H
+#define READER_H
+
+class cReader {
+public:
+ cReader();
+ virtual ~cReader();
+ virtual int Read(char *buf, int bufSize);
+
+protected:
+ virtual bool Open(void) = 0;
+ virtual void Close(void) = 0;
+ int fd;
+ };
+
+#endif /* READER_H */
+
diff --git a/libs/IO/nbproject/Makefile-Debug.mk b/libs/IO/nbproject/Makefile-Debug.mk
index 0fa73d7..36615b9 100644
--- a/libs/IO/nbproject/Makefile-Debug.mk
+++ b/libs/IO/nbproject/Makefile-Debug.mk
@@ -35,9 +35,11 @@ OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
# Object Files
OBJECTFILES= \
+ ${OBJECTDIR}/src/CommandReader.o \
${OBJECTDIR}/src/FileRepresentation.o \
${OBJECTDIR}/src/LineReader.o \
${OBJECTDIR}/src/File.o \
+ ${OBJECTDIR}/src/Reader.o \
${OBJECTDIR}/src/ConfigReader.o \
${OBJECTDIR}/src/FileReader.o \
${OBJECTDIR}/src/FileSystem.o
@@ -69,6 +71,11 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libio.a: ${OBJECTFILES}
${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libio.a ${OBJECTFILES}
$(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libio.a
+${OBJECTDIR}/src/CommandReader.o: src/CommandReader.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/CommandReader.o src/CommandReader.cc
+
${OBJECTDIR}/src/FileRepresentation.o: src/FileRepresentation.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
@@ -84,6 +91,11 @@ ${OBJECTDIR}/src/File.o: src/File.cc
${RM} $@.d
$(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/File.o src/File.cc
+${OBJECTDIR}/src/Reader.o: src/Reader.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -g -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iinclude -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Reader.o src/Reader.cc
+
${OBJECTDIR}/src/ConfigReader.o: src/ConfigReader.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
diff --git a/libs/IO/nbproject/Makefile-Release.mk b/libs/IO/nbproject/Makefile-Release.mk
index 853a053..29ba2ae 100644
--- a/libs/IO/nbproject/Makefile-Release.mk
+++ b/libs/IO/nbproject/Makefile-Release.mk
@@ -35,9 +35,11 @@ OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
# Object Files
OBJECTFILES= \
+ ${OBJECTDIR}/src/CommandReader.o \
${OBJECTDIR}/src/FileRepresentation.o \
${OBJECTDIR}/src/LineReader.o \
${OBJECTDIR}/src/File.o \
+ ${OBJECTDIR}/src/Reader.o \
${OBJECTDIR}/src/ConfigReader.o \
${OBJECTDIR}/src/FileReader.o \
${OBJECTDIR}/src/FileSystem.o
@@ -69,6 +71,11 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libio.a: ${OBJECTFILES}
${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libio.a ${OBJECTFILES}
$(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libio.a
+${OBJECTDIR}/src/CommandReader.o: src/CommandReader.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/CommandReader.o src/CommandReader.cc
+
${OBJECTDIR}/src/FileRepresentation.o: src/FileRepresentation.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
@@ -84,6 +91,11 @@ ${OBJECTDIR}/src/File.o: src/File.cc
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/File.o src/File.cc
+${OBJECTDIR}/src/Reader.o: src/Reader.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Reader.o src/Reader.cc
+
${OBJECTDIR}/src/ConfigReader.o: src/ConfigReader.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
diff --git a/libs/IO/nbproject/configurations.xml b/libs/IO/nbproject/configurations.xml
index 7cc1823..ebf4175 100644
--- a/libs/IO/nbproject/configurations.xml
+++ b/libs/IO/nbproject/configurations.xml
@@ -4,12 +4,14 @@
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
+ <itemPath>include/CommandReader.h</itemPath>
<itemPath>include/ConfigReader.h</itemPath>
<itemPath>include/File.h</itemPath>
<itemPath>include/FileReader.h</itemPath>
<itemPath>include/FileRepresentation.h</itemPath>
<itemPath>include/FileSystem.h</itemPath>
<itemPath>include/LineReader.h</itemPath>
+ <itemPath>include/Reader.h</itemPath>
</logicalFolder>
<logicalFolder name="ResourceFiles"
displayName="Resource Files"
@@ -18,12 +20,14 @@
<logicalFolder name="SourceFiles"
displayName="Source Files"
projectFiles="true">
+ <itemPath>src/CommandReader.cc</itemPath>
<itemPath>src/ConfigReader.cc</itemPath>
<itemPath>src/File.cc</itemPath>
<itemPath>src/FileReader.cc</itemPath>
<itemPath>src/FileRepresentation.cc</itemPath>
<itemPath>src/FileSystem.cc</itemPath>
<itemPath>src/LineReader.cc</itemPath>
+ <itemPath>src/Reader.cc</itemPath>
</logicalFolder>
<logicalFolder name="TestFiles"
displayName="Test Files"
diff --git a/libs/IO/src/CommandReader.cc b/libs/IO/src/CommandReader.cc
new file mode 100644
index 0000000..6b67511
--- /dev/null
+++ b/libs/IO/src/CommandReader.cc
@@ -0,0 +1,120 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: CommandReader.cc
+ * Created: 30. Juli 2012, 06:42
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libIO: classes for files, filesystem and input/output
+ *
+ * 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 <CommandReader.h>
+#include <Logging.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <wait.h>
+
+cCommandReader::cCommandReader(const char *cmd)
+ : pid(-1)
+{
+ args.push_back(cmd);
+}
+
+cCommandReader::~cCommandReader()
+{
+ Close();
+}
+
+void cCommandReader::AddCommandParameter(const char* Param)
+{
+ args.push_back(Param);
+}
+
+void cCommandReader::Close(void)
+{
+ int status;
+
+ if (pid != waitpid(pid, &status, 0)) {
+ esyslog("ERROR: failed to wait for child #%d - error #%d", pid, errno);
+ }
+ else {
+ isyslog("child exit status: %d", WEXITSTATUS(status));
+ }
+ pid = fd = -1;
+}
+
+bool cCommandReader::Open(void)
+{
+ enum { FDRead, FDWrite };
+ int parent2Child[2];
+ int child2Parent[2];
+
+ if (pipe(parent2Child)) {
+ esyslog("ERROR: failed to create parent2Child-pipe #%d", errno);
+ return false;
+ }
+ if (pipe(child2Parent)) {
+ esyslog("ERROR: failed to create child2Parent-pipe #%d", errno);
+ return false;
+ }
+ switch ((pid = fork())) {
+ case -1:
+ esyslog("fork failed");
+ return false;
+
+ case 0: { /* child */
+ const char *cmdArgs[args.size() + 1];
+
+ for (size_t i=0; i < args.size(); ++i) {
+ cmdArgs[i] = args[i].c_str();
+ }
+ cmdArgs[args.size()] = 0;
+ if (dup2(parent2Child[FDRead], STDIN_FILENO) < 0) {
+ esyslog("ERROR: failed to create parents stdin #%d", errno);
+ exit(-1);
+ }
+ if (dup2(child2Parent[FDWrite], STDOUT_FILENO) < 0) {
+ esyslog("ERROR: failed to create childs stdout #%d", errno);
+ exit(-1);
+ }
+ if (dup2(child2Parent[FDWrite], STDERR_FILENO) < 0) {
+ esyslog("ERROR: failed to create childs stderr #%d", errno);
+ exit(-1);
+ }
+ if (close(parent2Child[FDWrite])) {
+ esyslog("ERROR: failed to close parents write-end of the pipe #%d", errno);
+ exit(-1);
+ }
+ if (close(child2Parent[FDRead])) {
+ esyslog("ERROR: failed to close childs read-end of the pipe #%d", errno);
+ exit(-1);
+ }
+ execv(args[0].c_str(), (char *const*) cmdArgs);
+
+ esyslog("should never be reached!");
+ exit(-1);
+ } break;
+
+ default: { /* parent */
+ isyslog("child process #%d started ...", pid);
+ fd = child2Parent[FDRead];
+
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/libs/IO/src/File.cc b/libs/IO/src/File.cc
index 9b92b55..910d24d 100644
--- a/libs/IO/src/File.cc
+++ b/libs/IO/src/File.cc
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: File.cc
* Created: 21. Juli 2012, 12
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libIO: classes for files, filesystem and input/output
- *
+ *
* 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 <File.h>
diff --git a/libs/IO/src/FileReader.cc b/libs/IO/src/FileReader.cc
index 519c749..fd692ca 100644
--- a/libs/IO/src/FileReader.cc
+++ b/libs/IO/src/FileReader.cc
@@ -29,13 +29,18 @@
#include <unistd.h>
cFileReader::cFileReader(cFile *Input)
- : fd(-1)
- , file(Input)
+ : file(Input)
+{
+ Open();
+}
+
+bool cFileReader::Open()
{
if (file && file->Exists() && file->CanRead()) {
fd = open(file->AbsolutePath(), O_RDONLY);
if (fd < 0) esyslog("ERROR: could not open %s", file->AbsolutePath());
}
+ return fd > 0;
}
cFileReader::~cFileReader()
@@ -45,7 +50,7 @@ cFileReader::~cFileReader()
void cFileReader::Close()
{
- if (fd >= 0) {
+ if (fd > 0) {
close(fd);
fd = -1;
}
@@ -54,10 +59,3 @@ void cFileReader::Close()
file = NULL;
}
}
-
-int cFileReader::Read(char* buf, int bufSize)
-{
- if (fd >= 0) return read(fd, buf, bufSize);
- esyslog("ERROR: not an open file! %s", file->AbsolutePath());
- return 0;
-}
diff --git a/libs/IO/src/FileRepresentation.cc b/libs/IO/src/FileRepresentation.cc
index 3366157..f74d2c8 100644
--- a/libs/IO/src/FileRepresentation.cc
+++ b/libs/IO/src/FileRepresentation.cc
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: FileRepresentation.cc
* Created: 21. Juli 2012, 12
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libIO: classes for files, filesystem and input/output
- *
+ *
* 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 <FileRepresentation.h>
diff --git a/libs/IO/src/LineReader.cc b/libs/IO/src/LineReader.cc
index bf4bcc2..0d06628 100644
--- a/libs/IO/src/LineReader.cc
+++ b/libs/IO/src/LineReader.cc
@@ -23,14 +23,14 @@
* --------------------------------------------------------------
*/
#include <LineReader.h>
-#include <FileReader.h>
+#include <Reader.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
-cLineReader::cLineReader(cFileReader *FileReader)
+cLineReader::cLineReader(cReader *FileReader)
: reader(FileReader)
, bytesRead(0)
, off(0)
diff --git a/libs/IO/src/Reader.cc b/libs/IO/src/Reader.cc
new file mode 100644
index 0000000..cbead31
--- /dev/null
+++ b/libs/IO/src/Reader.cc
@@ -0,0 +1,44 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: Reader.cc
+ * Created: 30. Juli 2012, 08:11
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libIO: classes for files, filesystem and input/output
+ *
+ * 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 <Reader.h>
+#include <Logging.h>
+#include <unistd.h>
+
+cReader::cReader()
+ : fd(-1)
+{
+}
+
+cReader::~cReader()
+{
+}
+
+int cReader::Read(char* buf, int bufSize)
+{
+ if (fd < 0) Open();
+ if (fd > 0) return read(fd, buf, bufSize);
+ esyslog("ERROR: no valid filehandle to read from!");
+ return 0;
+}
diff --git a/libs/fsScan/mediaScan.cbp b/libs/fsScan/mediaScan.cbp
new file mode 100644
index 0000000..6d4d7ec
--- /dev/null
+++ b/libs/fsScan/mediaScan.cbp
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="6" />
+ <Project>
+ <Option title="CMP.libs.mediaScan" />
+ <Option pch_mode="2" />
+ <Option compiler="gcc" />
+ <Build>
+ <Target title="Debug">
+ <Option output="mediaScan" prefix_auto="1" extension_auto="1" />
+ <Option working_dir="" />
+ <Option object_output="obj/Debug/" />
+ <Option type="2" />
+ <Option compiler="gcc" />
+ <Option createDefFile="1" />
+ <Compiler>
+ <Add option="-Wall" />
+ <Add option="-g" />
+ </Compiler>
+ </Target>
+ <Target title="Release">
+ <Option output="mediaScan" prefix_auto="1" extension_auto="1" />
+ <Option working_dir="" />
+ <Option object_output="obj/Release/" />
+ <Option type="2" />
+ <Option compiler="gcc" />
+ <Option createDefFile="1" />
+ <Compiler>
+ <Add option="-Wall" />
+ <Add option="-O2" />
+ </Compiler>
+ <Linker>
+ <Add option="-s" />
+ </Linker>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add option="-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" />
+ <Add option="-D_REENTRANT" />
+ <Add option="-D_GNU_SOURCE=1" />
+ <Add directory="../vdr/include" />
+ <Add directory="../util/include" />
+ <Add directory="../IO/include" />
+ <Add directory="../networking/include" />
+ <Add directory="include" />
+ </Compiler>
+ <Unit filename="include/AbstractMedia.h" />
+ <Unit filename="include/AbstractMultiFileMovie.h" />
+ <Unit filename="include/Audio.h" />
+ <Unit filename="include/DVDImage.h" />
+ <Unit filename="include/FSMediaScanner.h" />
+ <Unit filename="include/LegacyVdrRecording.h" />
+ <Unit filename="include/MediaFactory.h" />
+ <Unit filename="include/Movie.h" />
+ <Unit filename="include/Picture.h" />
+ <Unit filename="include/VdrRecording.h" />
+ <Unit filename="src/AbstractMedia.cc" />
+ <Unit filename="src/AbstractMultiFileMovie.cc" />
+ <Unit filename="src/Audio.cc" />
+ <Unit filename="src/DVDImage.cc" />
+ <Unit filename="src/FSMediaScanner.cc" />
+ <Unit filename="src/LegacyVdrRecording.cc" />
+ <Unit filename="src/MediaFactory.cc" />
+ <Unit filename="src/Movie.cc" />
+ <Unit filename="src/Picture.cc" />
+ <Unit filename="src/VdrRecording.cc" />
+ <Extensions>
+ <code_completion />
+ <envvars />
+ <lib_finder disable_auto="1" />
+ <debugger />
+ </Extensions>
+ </Project>
+</CodeBlocks_project_file>
diff --git a/libs/fsScan/mediaScan.depend b/libs/fsScan/mediaScan.depend
new file mode 100644
index 0000000..c4ac310
--- /dev/null
+++ b/libs/fsScan/mediaScan.depend
@@ -0,0 +1 @@
+# depslib dependency file v1.0
diff --git a/libs/fsScan/mediaScan.layout b/libs/fsScan/mediaScan.layout
new file mode 100644
index 0000000..4398ab3
--- /dev/null
+++ b/libs/fsScan/mediaScan.layout
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_layout_file>
+ <ActiveTarget name="Debug" />
+ <File name="src/VdrRecording.cc" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1404" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/LegacyVdrRecording.cc" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1450" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/AbstractMedia.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1453" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="include/MediaFactory.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1670" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/MediaFactory.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1317" topLine="18" />
+ </Cursor>
+ </File>
+ <File name="include/AbstractMedia.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1008" topLine="0" />
+ </Cursor>
+ </File>
+</CodeBlocks_layout_file>
diff --git a/libs/fsScan/summary.txt b/libs/fsScan/summary.txt
index 0247690..e4c3847 100644
--- a/libs/fsScan/summary.txt
+++ b/libs/fsScan/summary.txt
@@ -1 +1 @@
-libfsScan: mediatypes and filesystem scanning
+libMediaScan: mediatypes and media scanning
diff --git a/libs/networking/include/ServerConfig.h b/libs/networking/include/ServerConfig.h
index 88789cb..98f96d7 100644
--- a/libs/networking/include/ServerConfig.h
+++ b/libs/networking/include/ServerConfig.h
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: ServerConfig.h
* Created: 8. Juli 2012, 06
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libnetworking: classes for tcp/ip sockets and http-protocol handling
- *
+ *
* 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 SERVERCONFIG_H
diff --git a/libs/networking/networking.layout b/libs/networking/networking.layout
index 8ed81c4..9cd0301 100644
--- a/libs/networking/networking.layout
+++ b/libs/networking/networking.layout
@@ -1,32 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="src/ServerConfig.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/HTTPMessage.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1670" topLine="0" />
+ <Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="src/HTTPMessage.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/HTTPFileResponse.cc" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="include/HTTPResponse.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/ConnectionHandler.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="include/ConnectionHandler.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/ServerConfig.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="0" topLine="0" />
+ <Cursor1 position="1684" topLine="0" />
</Cursor>
</File>
- <File name="src/ConnectionPoint.cc" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/HTTPMessage.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="include/HTTPMessage.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/ConnectionPoint.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
@@ -36,19 +36,19 @@
<Cursor1 position="1551" topLine="0" />
</Cursor>
</File>
- <File name="include/ConnectionPoint.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/HTTPResponse.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="src/HTTPFileResponse.cc" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/ServerConfig.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="0" topLine="0" />
+ <Cursor1 position="1670" topLine="0" />
</Cursor>
</File>
- <File name="include/ServerConfig.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/ConnectionPoint.cc" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1684" topLine="0" />
+ <Cursor1 position="0" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>
diff --git a/libs/networking/src/ServerConfig.cc b/libs/networking/src/ServerConfig.cc
index 0b29d8a..fec6107 100644
--- a/libs/networking/src/ServerConfig.cc
+++ b/libs/networking/src/ServerConfig.cc
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: ServerConfig.cc
* Created: 8. Juli 2012, 06
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libnetworking: classes for tcp/ip sockets and http-protocol handling
- *
+ *
* 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 <ServerConfig.h>
diff --git a/libs/util/include/util.h b/libs/util/include/util.h
index daa9b8f..e0855db 100644
--- a/libs/util/include/util.h
+++ b/libs/util/include/util.h
@@ -26,9 +26,13 @@
#define UTIL_H
#include <stdlib.h>
-#define FREE(m) { void *_tmp_ = m; m = NULL; free(_tmp_); }
-#define TO_STRING(s) #s
-#define EVER ;;
+#define FREE(m) { void *_tmp_ = m; m = NULL; free(_tmp_); }
+#define TO_STRING(s) #s
+#define EVER ;;
+
+#define ASSERT_IS(rv, x) if (x != rv) { fprintf(stderr, "assertation failed at %s #%d\n",__FILE__,__LINE__); exit(-1); }
+#define ASSERT_NOT(rv, x) if (x == rv) { fprintf(stderr, "assertation failed at %s #%d\n",__FILE__,__LINE__); exit(-1); }
+#define FAIL(s) { fprintf(stderr, s); exit(-1); }
extern const char * skipWhitespace(const char *Buffer);
extern const char *getWord(char *buf, int bufSize, const char *src);
diff --git a/libs/util/util.layout b/libs/util/util.layout
index 7fa0f25..c12bb95 100644
--- a/libs/util/util.layout
+++ b/libs/util/util.layout
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="src/JSonWriter.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/ManagedMap.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1655" topLine="3" />
+ <Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="include/ManagedMap.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -11,44 +11,44 @@
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="src/Codec.cc" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/StringBuilder.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1327" topLine="0" />
+ <Cursor1 position="1953" topLine="59" />
</Cursor>
</File>
- <File name="include/ManagedVector.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/Codec.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="0" topLine="0" />
+ <Cursor1 position="1385" topLine="0" />
</Cursor>
</File>
- <File name="include/StringBuilder.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/Codec.cc" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1959" topLine="0" />
+ <Cursor1 position="1327" topLine="0" />
</Cursor>
</File>
- <File name="src/StringBuilder.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/JSonWriter.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1953" topLine="59" />
+ <Cursor1 position="1532" topLine="0" />
</Cursor>
</File>
- <File name="include/JSonWriter.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/AbstractListAssembler.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1532" topLine="0" />
+ <Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="src/ManagedMap.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/ManagedVector.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="include/Codec.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/StringBuilder.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1385" topLine="0" />
+ <Cursor1 position="1959" topLine="0" />
</Cursor>
</File>
- <File name="src/AbstractListAssembler.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/JSonWriter.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="0" topLine="0" />
+ <Cursor1 position="1655" topLine="3" />
</Cursor>
</File>
</CodeBlocks_layout_file>
diff --git a/libs/vdr/vdr.layout b/libs/vdr/vdr.layout
index 1c3d5a2..3827c1a 100644
--- a/libs/vdr/vdr.layout
+++ b/libs/vdr/vdr.layout
@@ -1,19 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="include/CharsetConv.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/Thread.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="5244" topLine="0" />
+ <Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="include/Logging.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/i18n.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1690" topLine="0" />
+ <Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="src/Thread.cc" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/Logging.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="0" topLine="0" />
+ <Cursor1 position="1283" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="include/CharsetConv.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="5244" topLine="0" />
</Cursor>
</File>
<File name="src/CharsetConv.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -21,9 +26,9 @@
<Cursor1 position="3680" topLine="57" />
</Cursor>
</File>
- <File name="src/Logging.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="include/Logging.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1283" topLine="0" />
+ <Cursor1 position="1690" topLine="0" />
</Cursor>
</File>
<File name="src/TimeMs.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -31,12 +36,7 @@
<Cursor1 position="2160" topLine="0" />
</Cursor>
</File>
- <File name="include/Thread.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor>
- <Cursor1 position="0" topLine="0" />
- </Cursor>
- </File>
- <File name="src/i18n.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/Thread.cc" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
diff --git a/tests/FilesystemTest/FilesystemTest.layout b/tests/FilesystemTest/FilesystemTest.layout
index 6d88bc4..d39418a 100644
--- a/tests/FilesystemTest/FilesystemTest.layout
+++ b/tests/FilesystemTest/FilesystemTest.layout
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="main.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="407" topLine="0" />
+ <Cursor1 position="438" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>
diff --git a/tests/MetaScanTest/MetaScanTest.layout b/tests/MetaScanTest/MetaScanTest.layout
index c9eeb3d..d189d61 100644
--- a/tests/MetaScanTest/MetaScanTest.layout
+++ b/tests/MetaScanTest/MetaScanTest.layout
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="main.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1602" topLine="0" />
+ <Cursor1 position="1575" topLine="9" />
</Cursor>
</File>
</CodeBlocks_layout_file>
diff --git a/tests/MetaScanTest/main.cpp b/tests/MetaScanTest/main.cpp
index 62c1bda..751186e 100644
--- a/tests/MetaScanTest/main.cpp
+++ b/tests/MetaScanTest/main.cpp
@@ -1,10 +1,14 @@
/*
- * test case for scanning of meta data
+ * File: MetaScanTest.cc
+ * Author: django
+ *
+ * Created on 27.07.2012, 10:03
*/
#include <File.h>
#include <FileReader.h>
#include <LineReader.h>
#include <ConfigReader.h>
+#include <CommandReader.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
@@ -14,15 +18,10 @@
#include <unistd.h>
#include <wait.h>
#include <tr1/tuple>
+#include <util.h>
-//static const char *mediaInfo = NULL;
-//static const char *ffmpeg = NULL;
static void testPipe(const char *chk = NULL);
-#define ASSERT_IS(rv, x) if (x != rv) { fprintf(stderr, "assertation failed at %s #%d\n",__FILE__,__LINE__); exit(-1); }
-#define ASSERT_NOT(rv, x) if (x == rv) { fprintf(stderr, "assertation failed at %s #%d\n",__FILE__,__LINE__); exit(-1); }
-#define FAIL(s) fprintf(stderr, s);
-
static void parseConfig(const char *FileName)
{
cConfigReader *cr = new cConfigReader(new cLineReader(new cFileReader(new cFile(FileName))));
@@ -55,6 +54,21 @@ enum PipeFileDescriptors {
WRITE_FD = 1
};
+static void testCommandReader()
+{
+ cCommandReader *cr = new cCommandReader("/bin/ls");
+ cLineReader *lr = new cLineReader(cr);
+ const char *line;
+
+ cr->AddCommandParameter("-al");
+ cr->AddCommandParameter("--color");
+
+ while ((line = lr->ReadLine())) {
+ std::cout << "from command: " << line << std::endl;
+ }
+ delete lr;
+};
+
static void testPipe(const char *chk)
{
int parent2Child[2];
@@ -137,10 +151,10 @@ int main()
parseConfig("srserver.conf");
std::cout << std::endl << "===========================================" << std::endl << std::endl;
- testPipe();
+ testCommandReader();
- std::cout << std::endl << "===========================================" << std::endl << std::endl;
- testMediaFiles("testMedia.files");
+// std::cout << std::endl << "===========================================" << std::endl << std::endl;
+// testMediaFiles("testMedia.files");
cFile::Cleanup();
return 0;