summaryrefslogtreecommitdiff
path: root/libs/mediaScan
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-07-30 15:51:05 (GMT)
committergeronimo <geronimo013@gmx.de>2012-07-30 15:51:05 (GMT)
commitad667186c0c45cfca9d3f153faec7ce35545b238 (patch)
treedb5ab8a2bb22c418bc8a233db3c4955ed16957c5 /libs/mediaScan
parent41922cdaf9c8db57c6b51f090eefe95b0008a0fb (diff)
downloadcmp-ad667186c0c45cfca9d3f153faec7ce35545b238.tar.gz
cmp-ad667186c0c45cfca9d3f153faec7ce35545b238.tar.bz2
created more readers
Diffstat (limited to 'libs/mediaScan')
-rw-r--r--libs/mediaScan/include/MediainfoReader.h34
-rw-r--r--libs/mediaScan/mediaScan.cbp2
-rw-r--r--libs/mediaScan/mediaScan.layout28
-rw-r--r--libs/mediaScan/nbproject/Makefile-Debug.mk18
-rw-r--r--libs/mediaScan/nbproject/Makefile-Release.mk18
-rw-r--r--libs/mediaScan/nbproject/Makefile-impl.mk2
-rw-r--r--libs/mediaScan/nbproject/Makefile-variables.mk16
-rw-r--r--libs/mediaScan/nbproject/Package-Debug.bash12
-rw-r--r--libs/mediaScan/nbproject/Package-Release.bash12
-rw-r--r--libs/mediaScan/nbproject/configurations.xml2
-rw-r--r--libs/mediaScan/nbproject/project.xml2
-rw-r--r--libs/mediaScan/src/MediainfoReader.cc69
12 files changed, 172 insertions, 43 deletions
diff --git a/libs/mediaScan/include/MediainfoReader.h b/libs/mediaScan/include/MediainfoReader.h
new file mode 100644
index 0000000..f45b5e7
--- /dev/null
+++ b/libs/mediaScan/include/MediainfoReader.h
@@ -0,0 +1,34 @@
+/*
+ * File: MediainfoReader.h
+ * Author: django
+ *
+ * Created on 30. Juli 2012, 15:03
+ */
+
+#ifndef MEDIAINFOREADER_H
+#define MEDIAINFOREADER_H
+
+#include <tuple>
+#include <string>
+#include <vector>
+
+class cLineReader;
+class cMediainfoReader {
+public:
+ typedef std::tuple <std::string, std::string> InfoEntry;
+
+ cMediainfoReader(cLineReader *LineReader);
+ virtual ~cMediainfoReader();
+
+ void AddValuableKey(const char *Key);
+ void Close(void);
+ bool IsValuable(std::string &key);
+ InfoEntry *ReadEntry(void);
+
+private:
+ cLineReader *reader;
+ std::vector<std::string> valuableKeys;
+ };
+
+#endif /* MEDIAINFOREADER_H */
+
diff --git a/libs/mediaScan/mediaScan.cbp b/libs/mediaScan/mediaScan.cbp
index 6d4d7ec..3ee2b08 100644
--- a/libs/mediaScan/mediaScan.cbp
+++ b/libs/mediaScan/mediaScan.cbp
@@ -51,6 +51,7 @@
<Unit filename="include/FSMediaScanner.h" />
<Unit filename="include/LegacyVdrRecording.h" />
<Unit filename="include/MediaFactory.h" />
+ <Unit filename="include/MediainfoReader.h" />
<Unit filename="include/Movie.h" />
<Unit filename="include/Picture.h" />
<Unit filename="include/VdrRecording.h" />
@@ -61,6 +62,7 @@
<Unit filename="src/FSMediaScanner.cc" />
<Unit filename="src/LegacyVdrRecording.cc" />
<Unit filename="src/MediaFactory.cc" />
+ <Unit filename="src/MediainfoReader.cc" />
<Unit filename="src/Movie.cc" />
<Unit filename="src/Picture.cc" />
<Unit filename="src/VdrRecording.cc" />
diff --git a/libs/mediaScan/mediaScan.layout b/libs/mediaScan/mediaScan.layout
index 4398ab3..e7fed61 100644
--- a/libs/mediaScan/mediaScan.layout
+++ b/libs/mediaScan/mediaScan.layout
@@ -1,9 +1,19 @@
<?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">
+ <File name="include/MediainfoReader.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
- <Cursor1 position="1404" topLine="0" />
+ <Cursor1 position="459" topLine="0" />
+ </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>
+ <File name="src/MediainfoReader.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1061" 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">
@@ -11,14 +21,19 @@
<Cursor1 position="1450" 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/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">
+ <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="1670" topLine="0" />
+ <Cursor1 position="1404" 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">
@@ -26,9 +41,4 @@
<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/mediaScan/nbproject/Makefile-Debug.mk b/libs/mediaScan/nbproject/Makefile-Debug.mk
index 1e0062b..57923a8 100644
--- a/libs/mediaScan/nbproject/Makefile-Debug.mk
+++ b/libs/mediaScan/nbproject/Makefile-Debug.mk
@@ -41,6 +41,7 @@ OBJECTFILES= \
${OBJECTDIR}/src/VdrRecording.o \
${OBJECTDIR}/src/MediaFactory.o \
${OBJECTDIR}/src/LegacyVdrRecording.o \
+ ${OBJECTDIR}/src/MediainfoReader.o \
${OBJECTDIR}/src/FSMediaScanner.o \
${OBJECTDIR}/src/AbstractMultiFileMovie.o \
${OBJECTDIR}/src/AbstractMedia.o \
@@ -65,13 +66,13 @@ LDLIBSOPTIONS=
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
- "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
+ "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
-${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a: ${OBJECTFILES}
+${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a: ${OBJECTFILES}
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
- ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
- ${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a ${OBJECTFILES}
- $(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
+ ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
+ ${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a ${OBJECTFILES}
+ $(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
${OBJECTDIR}/src/Picture.o: src/Picture.cc
${MKDIR} -p ${OBJECTDIR}/src
@@ -103,6 +104,11 @@ ${OBJECTDIR}/src/LegacyVdrRecording.o: src/LegacyVdrRecording.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../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/LegacyVdrRecording.o src/LegacyVdrRecording.cc
+${OBJECTDIR}/src/MediainfoReader.o: src/MediainfoReader.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../networking/include -I../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediainfoReader.o src/MediainfoReader.cc
+
${OBJECTDIR}/src/FSMediaScanner.o: src/FSMediaScanner.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
@@ -133,7 +139,7 @@ ${OBJECTDIR}/src/Movie.o: src/Movie.cc
# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
${RM} -r ${CND_BUILDDIR}/${CND_CONF}
- ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
+ ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
# Subprojects
.clean-subprojects:
diff --git a/libs/mediaScan/nbproject/Makefile-Release.mk b/libs/mediaScan/nbproject/Makefile-Release.mk
index bc8c6a9..2b0a333 100644
--- a/libs/mediaScan/nbproject/Makefile-Release.mk
+++ b/libs/mediaScan/nbproject/Makefile-Release.mk
@@ -41,6 +41,7 @@ OBJECTFILES= \
${OBJECTDIR}/src/VdrRecording.o \
${OBJECTDIR}/src/MediaFactory.o \
${OBJECTDIR}/src/LegacyVdrRecording.o \
+ ${OBJECTDIR}/src/MediainfoReader.o \
${OBJECTDIR}/src/FSMediaScanner.o \
${OBJECTDIR}/src/AbstractMultiFileMovie.o \
${OBJECTDIR}/src/AbstractMedia.o \
@@ -65,13 +66,13 @@ LDLIBSOPTIONS=
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
- "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
+ "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
-${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a: ${OBJECTFILES}
+${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a: ${OBJECTFILES}
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
- ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
- ${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a ${OBJECTFILES}
- $(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
+ ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
+ ${AR} -rv ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a ${OBJECTFILES}
+ $(RANLIB) ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
${OBJECTDIR}/src/Picture.o: src/Picture.cc
${MKDIR} -p ${OBJECTDIR}/src
@@ -103,6 +104,11 @@ ${OBJECTDIR}/src/LegacyVdrRecording.o: src/LegacyVdrRecording.cc
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/LegacyVdrRecording.o src/LegacyVdrRecording.cc
+${OBJECTDIR}/src/MediainfoReader.o: src/MediainfoReader.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediainfoReader.o src/MediainfoReader.cc
+
${OBJECTDIR}/src/FSMediaScanner.o: src/FSMediaScanner.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
@@ -129,7 +135,7 @@ ${OBJECTDIR}/src/Movie.o: src/Movie.cc
# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
${RM} -r ${CND_BUILDDIR}/${CND_CONF}
- ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
+ ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
# Subprojects
.clean-subprojects:
diff --git a/libs/mediaScan/nbproject/Makefile-impl.mk b/libs/mediaScan/nbproject/Makefile-impl.mk
index 1d398f7..84fe472 100644
--- a/libs/mediaScan/nbproject/Makefile-impl.mk
+++ b/libs/mediaScan/nbproject/Makefile-impl.mk
@@ -24,7 +24,7 @@ CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
# Project Name
-PROJECTNAME=fsScan
+PROJECTNAME=mediaScan
# Active Configuration
DEFAULTCONF=Debug
diff --git a/libs/mediaScan/nbproject/Makefile-variables.mk b/libs/mediaScan/nbproject/Makefile-variables.mk
index e22487e..0b0bf57 100644
--- a/libs/mediaScan/nbproject/Makefile-variables.mk
+++ b/libs/mediaScan/nbproject/Makefile-variables.mk
@@ -9,19 +9,19 @@ CND_DISTDIR=dist
# Debug configuration
CND_PLATFORM_Debug=GNU-Linux-x86
CND_ARTIFACT_DIR_Debug=dist/Debug/GNU-Linux-x86
-CND_ARTIFACT_NAME_Debug=libfsscan.a
-CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux-x86/libfsscan.a
+CND_ARTIFACT_NAME_Debug=libmediascan.a
+CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux-x86/libmediascan.a
CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux-x86/package
-CND_PACKAGE_NAME_Debug=fsScan.tar
-CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux-x86/package/fsScan.tar
+CND_PACKAGE_NAME_Debug=mediaScan.tar
+CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux-x86/package/mediaScan.tar
# Release configuration
CND_PLATFORM_Release=GNU-Linux-x86
CND_ARTIFACT_DIR_Release=dist/Release/GNU-Linux-x86
-CND_ARTIFACT_NAME_Release=libfsscan.a
-CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux-x86/libfsscan.a
+CND_ARTIFACT_NAME_Release=libmediascan.a
+CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux-x86/libmediascan.a
CND_PACKAGE_DIR_Release=dist/Release/GNU-Linux-x86/package
-CND_PACKAGE_NAME_Release=fsScan.tar
-CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux-x86/package/fsScan.tar
+CND_PACKAGE_NAME_Release=mediaScan.tar
+CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux-x86/package/mediaScan.tar
#
# include compiler specific variables
#
diff --git a/libs/mediaScan/nbproject/Package-Debug.bash b/libs/mediaScan/nbproject/Package-Debug.bash
index 2a9c453..a76f06a 100644
--- a/libs/mediaScan/nbproject/Package-Debug.bash
+++ b/libs/mediaScan/nbproject/Package-Debug.bash
@@ -12,9 +12,9 @@ CND_DISTDIR=dist
CND_BUILDDIR=build
NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
TMPDIRNAME=tmp-packaging
-OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
-OUTPUT_BASENAME=libfsscan.a
-PACKAGE_TOP_DIR=fsScan/
+OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
+OUTPUT_BASENAME=libmediascan.a
+PACKAGE_TOP_DIR=mediaScan/
# Functions
function checkReturnCode
@@ -59,15 +59,15 @@ mkdir -p ${NBTMPDIR}
# Copy files and create directories and links
cd "${TOP}"
-makeDirectory "${NBTMPDIR}/fsScan/lib"
+makeDirectory "${NBTMPDIR}/mediaScan/lib"
copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
# Generate tar file
cd "${TOP}"
-rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/fsScan.tar
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/mediaScan.tar
cd ${NBTMPDIR}
-tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/fsScan.tar *
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/mediaScan.tar *
checkReturnCode
# Cleanup
diff --git a/libs/mediaScan/nbproject/Package-Release.bash b/libs/mediaScan/nbproject/Package-Release.bash
index d996196..bcbe0fc 100644
--- a/libs/mediaScan/nbproject/Package-Release.bash
+++ b/libs/mediaScan/nbproject/Package-Release.bash
@@ -12,9 +12,9 @@ CND_DISTDIR=dist
CND_BUILDDIR=build
NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
TMPDIRNAME=tmp-packaging
-OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a
-OUTPUT_BASENAME=libfsscan.a
-PACKAGE_TOP_DIR=fsScan/
+OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libmediascan.a
+OUTPUT_BASENAME=libmediascan.a
+PACKAGE_TOP_DIR=mediaScan/
# Functions
function checkReturnCode
@@ -59,15 +59,15 @@ mkdir -p ${NBTMPDIR}
# Copy files and create directories and links
cd "${TOP}"
-makeDirectory "${NBTMPDIR}/fsScan/lib"
+makeDirectory "${NBTMPDIR}/mediaScan/lib"
copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
# Generate tar file
cd "${TOP}"
-rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/fsScan.tar
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/mediaScan.tar
cd ${NBTMPDIR}
-tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/fsScan.tar *
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/mediaScan.tar *
checkReturnCode
# Cleanup
diff --git a/libs/mediaScan/nbproject/configurations.xml b/libs/mediaScan/nbproject/configurations.xml
index 9984a4c..733c5d2 100644
--- a/libs/mediaScan/nbproject/configurations.xml
+++ b/libs/mediaScan/nbproject/configurations.xml
@@ -11,6 +11,7 @@
<itemPath>include/FSMediaScanner.h</itemPath>
<itemPath>include/LegacyVdrRecording.h</itemPath>
<itemPath>include/MediaFactory.h</itemPath>
+ <itemPath>include/MediainfoReader.h</itemPath>
<itemPath>include/Movie.h</itemPath>
<itemPath>include/Picture.h</itemPath>
<itemPath>include/VdrRecording.h</itemPath>
@@ -29,6 +30,7 @@
<itemPath>src/FSMediaScanner.cc</itemPath>
<itemPath>src/LegacyVdrRecording.cc</itemPath>
<itemPath>src/MediaFactory.cc</itemPath>
+ <itemPath>src/MediainfoReader.cc</itemPath>
<itemPath>src/Movie.cc</itemPath>
<itemPath>src/Picture.cc</itemPath>
<itemPath>src/VdrRecording.cc</itemPath>
diff --git a/libs/mediaScan/nbproject/project.xml b/libs/mediaScan/nbproject/project.xml
index f749866..f0742a0 100644
--- a/libs/mediaScan/nbproject/project.xml
+++ b/libs/mediaScan/nbproject/project.xml
@@ -3,7 +3,7 @@
<type>org.netbeans.modules.cnd.makeproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
- <name>fsScan</name>
+ <name>mediaScan</name>
<c-extensions/>
<cpp-extensions>cc</cpp-extensions>
<header-extensions>h</header-extensions>
diff --git a/libs/mediaScan/src/MediainfoReader.cc b/libs/mediaScan/src/MediainfoReader.cc
new file mode 100644
index 0000000..cd1f3f6
--- /dev/null
+++ b/libs/mediaScan/src/MediainfoReader.cc
@@ -0,0 +1,69 @@
+/*
+ * File: MediainfoReader.cc
+ * Author: django
+ *
+ * Created on 30. Juli 2012, 15:03
+ */
+#include <MediainfoReader.h>
+#include <LineReader.h>
+#include <stddef.h>
+#include <pcrecpp.h>
+#include <vector>
+
+cMediainfoReader::cMediainfoReader(cLineReader *LineReader)
+ : reader(LineReader)
+{
+}
+
+cMediainfoReader::~cMediainfoReader()
+{
+ Close();
+}
+
+void cMediainfoReader::AddValuableKey(const char* Key)
+{
+ valuableKeys.push_back(Key);
+}
+
+void cMediainfoReader::Close(void)
+{
+ if (reader) {
+ delete reader;
+ reader = NULL;
+ }
+}
+
+bool cMediainfoReader::IsValuable(std::string &key)
+{
+ for (size_t i=0; i < valuableKeys.size(); ++i) {
+ if (!strcmp(key.c_str(), valuableKeys[i].c_str()))
+ return true;
+ }
+ return false;
+}
+
+cMediainfoReader::InfoEntry *cMediainfoReader::ReadEntry()
+{
+ if (!reader) return NULL;
+ const char *line = reader->ReadLine();
+ static pcrecpp::RE comment("^\\s*#.*$");
+ static pcrecpp::RE emptyLine("^\\s*$");
+ static pcrecpp::RE entry("^\\s*(.+?)\\s*:\\s*(.+?)\\s*$");
+ std::string name, value;
+ InfoEntry *rv = NULL;
+
+ while (line && (comment.FullMatch(line) || emptyLine.FullMatch(line)))
+ line = reader->ReadLine();
+ while (line && !entry.FullMatch(line, &name, &value))
+ line = reader->ReadLine();
+ while (line && entry.FullMatch(line, &name, &value)) {
+ if (!IsValuable(name)) {
+ line = reader->ReadLine();
+ continue;
+ }
+ rv = new InfoEntry(name, value);
+ break;
+ }
+ return rv;
+}
+