summaryrefslogtreecommitdiff
path: root/libs/fsScan
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-07-22 11:38:43 +0200
committergeronimo <geronimo013@gmx.de>2012-07-22 11:38:43 +0200
commitab7186c6c116629983dc506c4b53794026518455 (patch)
treef5508dd32f35509fb45f7cf046a0a8e0bc1c4605 /libs/fsScan
parent04a867b018a8c6761047ef8878a4434692673084 (diff)
downloadcmp-ab7186c6c116629983dc506c4b53794026518455.tar.gz
cmp-ab7186c6c116629983dc506c4b53794026518455.tar.bz2
worked out new file class
Diffstat (limited to 'libs/fsScan')
-rw-r--r--libs/fsScan/fsScan.cbp10
-rw-r--r--libs/fsScan/fsScan.layout35
-rw-r--r--libs/fsScan/fsScan.layout.save35
-rw-r--r--libs/fsScan/include/AbstractMedia.h2
-rw-r--r--libs/fsScan/include/AbstractMultiFileMovie.h2
-rw-r--r--libs/fsScan/include/Audio.h2
-rw-r--r--libs/fsScan/include/DVDImage.h2
-rw-r--r--libs/fsScan/include/File.h65
-rw-r--r--libs/fsScan/include/FileRepresentation.h53
-rw-r--r--libs/fsScan/include/FileSystem.h51
-rw-r--r--libs/fsScan/include/FilesystemScanner.h2
-rw-r--r--libs/fsScan/include/LegacyVdrRecording.h2
-rw-r--r--libs/fsScan/include/MediaFactory.h2
-rw-r--r--libs/fsScan/include/Movie.h2
-rw-r--r--libs/fsScan/include/Picture.h2
-rw-r--r--libs/fsScan/include/VdrRecording.h2
-rw-r--r--libs/fsScan/nbproject/Makefile-Debug.mk38
-rw-r--r--libs/fsScan/nbproject/Makefile-Release.mk18
-rw-r--r--libs/fsScan/nbproject/configurations.xml14
-rw-r--r--libs/fsScan/nbproject/private/configurations.xml2
-rw-r--r--libs/fsScan/nbproject/private/private.xml1
-rw-r--r--libs/fsScan/src/AbstractMedia.cc2
-rw-r--r--libs/fsScan/src/AbstractMultiFileMovie.cc2
-rw-r--r--libs/fsScan/src/Audio.cc2
-rw-r--r--libs/fsScan/src/DVDImage.cc2
-rw-r--r--libs/fsScan/src/File.cc146
-rw-r--r--libs/fsScan/src/FileRepresentation.cc109
-rw-r--r--libs/fsScan/src/FileSystem.cc132
-rw-r--r--libs/fsScan/src/FilesystemScanner.cc14
-rw-r--r--libs/fsScan/src/LegacyVdrRecording.cc2
-rw-r--r--libs/fsScan/src/MediaFactory.cc2
-rw-r--r--libs/fsScan/src/Movie.cc2
-rw-r--r--libs/fsScan/src/Picture.cc2
-rw-r--r--libs/fsScan/src/VdrRecording.cc2
34 files changed, 721 insertions, 40 deletions
diff --git a/libs/fsScan/fsScan.cbp b/libs/fsScan/fsScan.cbp
index bef32fe..8f51f56 100644
--- a/libs/fsScan/fsScan.cbp
+++ b/libs/fsScan/fsScan.cbp
@@ -7,7 +7,7 @@
<Option compiler="gcc" />
<Build>
<Target title="Debug">
- <Option output="libfsScan" prefix_auto="1" extension_auto="1" />
+ <Option output="fsScan" prefix_auto="1" extension_auto="1" />
<Option working_dir="" />
<Option object_output="obj/Debug/" />
<Option type="2" />
@@ -19,7 +19,7 @@
</Compiler>
</Target>
<Target title="Release">
- <Option output="libfsScan" prefix_auto="1" extension_auto="1" />
+ <Option output="fsScan" prefix_auto="1" extension_auto="1" />
<Option working_dir="" />
<Option object_output="obj/Release/" />
<Option type="2" />
@@ -47,6 +47,9 @@
<Unit filename="include/AbstractMultiFileMovie.h" />
<Unit filename="include/Audio.h" />
<Unit filename="include/DVDImage.h" />
+ <Unit filename="include/File.h" />
+ <Unit filename="include/FileRepresentation.h" />
+ <Unit filename="include/FileSystem.h" />
<Unit filename="include/FilesystemScanner.h" />
<Unit filename="include/LegacyVdrRecording.h" />
<Unit filename="include/MediaFactory.h" />
@@ -57,6 +60,9 @@
<Unit filename="src/AbstractMultiFileMovie.cc" />
<Unit filename="src/Audio.cc" />
<Unit filename="src/DVDImage.cc" />
+ <Unit filename="src/File.cc" />
+ <Unit filename="src/FileRepresentation.cc" />
+ <Unit filename="src/FileSystem.cc" />
<Unit filename="src/FilesystemScanner.cc" />
<Unit filename="src/LegacyVdrRecording.cc" />
<Unit filename="src/MediaFactory.cc" />
diff --git a/libs/fsScan/fsScan.layout b/libs/fsScan/fsScan.layout
index f1a8eb2..f2bee52 100644
--- a/libs/fsScan/fsScan.layout
+++ b/libs/fsScan/fsScan.layout
@@ -1,6 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
+ <File name="src/FilesystemScanner.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="include/FileSystem.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="627" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/FileRepresentation.cc" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="127" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="include/FileRepresentation.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="607" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/FileSystem.cc" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="3048" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/File.cc" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="2198" topLine="0" />
+ </Cursor>
+ </File>
+ <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="621" 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="0" topLine="0" />
diff --git a/libs/fsScan/fsScan.layout.save b/libs/fsScan/fsScan.layout.save
index f1a8eb2..22810d1 100644
--- a/libs/fsScan/fsScan.layout.save
+++ b/libs/fsScan/fsScan.layout.save
@@ -1,6 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
+ <File name="src/FilesystemScanner.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="include/FileSystem.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="439" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/FileRepresentation.cc" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="127" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="include/FileRepresentation.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="607" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/FileSystem.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="492" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="src/File.cc" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1130" topLine="0" />
+ </Cursor>
+ </File>
+ <File name="include/File.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="677" 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="0" topLine="0" />
diff --git a/libs/fsScan/include/AbstractMedia.h b/libs/fsScan/include/AbstractMedia.h
index 4b8fedd..6ca9677 100644
--- a/libs/fsScan/include/AbstractMedia.h
+++ b/libs/fsScan/include/AbstractMedia.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: AbstractMedia.h
- * Created: 2. Juli 2012, 14:33
+ * Created: 2. Juli 2012, 14
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/AbstractMultiFileMovie.h b/libs/fsScan/include/AbstractMultiFileMovie.h
index e3bd520..e7bad44 100644
--- a/libs/fsScan/include/AbstractMultiFileMovie.h
+++ b/libs/fsScan/include/AbstractMultiFileMovie.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: AbstractMultiFileMovie.h
- * Created: 3. Juli 2012, 07:39
+ * Created: 3. Juli 2012, 07
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/Audio.h b/libs/fsScan/include/Audio.h
index d1a784a..2b2046d 100644
--- a/libs/fsScan/include/Audio.h
+++ b/libs/fsScan/include/Audio.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: Audio.h
- * Created: 2. Juli 2012, 15:00
+ * Created: 2. Juli 2012, 15
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/DVDImage.h b/libs/fsScan/include/DVDImage.h
index e773e72..4f3af2e 100644
--- a/libs/fsScan/include/DVDImage.h
+++ b/libs/fsScan/include/DVDImage.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: DVDImage.h
- * Created: 3. Juli 2012, 08:34
+ * Created: 3. Juli 2012, 08
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/File.h b/libs/fsScan/include/File.h
new file mode 100644
index 0000000..4883cdd
--- /dev/null
+++ b/libs/fsScan/include/File.h
@@ -0,0 +1,65 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: File.h
+ * Created: 21. Juli 2012, 12:41
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * 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 FILE_H
+#define FILE_H
+
+#include <sys/types.h>
+
+class cFileSystem;
+class cFileRepresentation;
+class cStringBuilder;
+class cFile
+{
+public:
+ cFile(const char *Path);
+ cFile(const cFile &Parent, const char *RelativePath);
+ virtual ~cFile();
+
+ bool CanRead(void) const;
+ bool CanWrite(void) const;
+ bool CanExecute(void) const;
+ bool Exists(void) const;
+ bool IsDirectory(void) const;
+ bool IsFile(void) const;
+ bool IsSymbolic(void) const;
+ off64_t Size(void) const;
+ ulong LastModified(void) const;
+ const char *Name(void) const;
+
+ char *AbsolutePath(void) const;
+ cFile *Parent(void) const;
+ void VisitFiles(int (*cb)(cFile *, const char *));
+
+ static void Cleanup(void);
+
+private:
+ cFile(const cFileRepresentation *);
+ const cFileRepresentation *rep;
+ static cFileSystem *fs;
+ friend class cFileSystem;
+};
+
+#endif /* FILE_H */
+
diff --git a/libs/fsScan/include/FileRepresentation.h b/libs/fsScan/include/FileRepresentation.h
new file mode 100644
index 0000000..2193929
--- /dev/null
+++ b/libs/fsScan/include/FileRepresentation.h
@@ -0,0 +1,53 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: FileRepresentation.h
+ * Created: 21. Juli 2012, 12:41
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * 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
+#define FILEREPRESENTATION_H
+
+#include <sys/types.h>
+
+class cStringBuilder;
+class cFileRepresentation
+{
+public:
+ virtual ~cFileRepresentation();
+
+ cStringBuilder *internalPath(void) const;
+ const cFileRepresentation *getParent(void) const { return parent; };
+
+private:
+ cFileRepresentation(const char *Path);
+ cFileRepresentation(const cFileRepresentation *Parent, const char *Path);
+ bool exists;
+ bool isRoot;
+ mode_t mode;
+ off64_t size;
+ ulong lastModified;
+ char *name;
+ const cFileRepresentation *parent;
+ friend class cFileSystem;
+ friend class cFile;
+};
+
+#endif // FILEREPRESENTATION_H
diff --git a/libs/fsScan/include/FileSystem.h b/libs/fsScan/include/FileSystem.h
new file mode 100644
index 0000000..eb0264e
--- /dev/null
+++ b/libs/fsScan/include/FileSystem.h
@@ -0,0 +1,51 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: FileSystem.h
+ * Created: 21. Juli 2012, 12:44
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * 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 FILESYSTEM_H
+#define FILESYSTEM_H
+
+#include <tr1/unordered_map>
+#include <string>
+
+class cFile;
+class cFileRepresentation;
+class cFileSystem
+{
+public:
+ cFileSystem();
+ virtual ~cFileSystem();
+
+ cFileRepresentation *representationOfFile(const char *Path);
+ cFileRepresentation *representationOfFile(const cFile &Parent, const char *Path);
+
+private:
+ cFileRepresentation *cacheEntry(const char *Path);
+ std::tr1::unordered_map<std::string, cFileRepresentation *> fileCache;
+ static char PathSeparator;
+ static char RootPath[4];
+ friend class cFileRepresentation;
+};
+
+#endif /* FILESYSTEM_H */
+
diff --git a/libs/fsScan/include/FilesystemScanner.h b/libs/fsScan/include/FilesystemScanner.h
index 7a188ce..b90b50d 100644
--- a/libs/fsScan/include/FilesystemScanner.h
+++ b/libs/fsScan/include/FilesystemScanner.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: FilesystemScanner.h
- * Created: 2. Juli 2012, 13:58
+ * Created: 2. Juli 2012, 13
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/LegacyVdrRecording.h b/libs/fsScan/include/LegacyVdrRecording.h
index 147e6fc..9c191be 100644
--- a/libs/fsScan/include/LegacyVdrRecording.h
+++ b/libs/fsScan/include/LegacyVdrRecording.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: LegacyVdrRecording.h
- * Created: 3. Juli 2012, 08:16
+ * Created: 3. Juli 2012, 08
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/MediaFactory.h b/libs/fsScan/include/MediaFactory.h
index b9b5391..a3b1987 100644
--- a/libs/fsScan/include/MediaFactory.h
+++ b/libs/fsScan/include/MediaFactory.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: MediaFactory.h
- * Created: 2. Juli 2012, 15:43
+ * Created: 2. Juli 2012, 15
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/Movie.h b/libs/fsScan/include/Movie.h
index af8b437..63cccc7 100644
--- a/libs/fsScan/include/Movie.h
+++ b/libs/fsScan/include/Movie.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: Movie.h
- * Created: 2. Juli 2012, 15:12
+ * Created: 2. Juli 2012, 15
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/Picture.h b/libs/fsScan/include/Picture.h
index a911a71..a1998e7 100644
--- a/libs/fsScan/include/Picture.h
+++ b/libs/fsScan/include/Picture.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: Picture.h
- * Created: 2. Juli 2012, 15:18
+ * Created: 2. Juli 2012, 15
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/include/VdrRecording.h b/libs/fsScan/include/VdrRecording.h
index 2e3904b..25e5996 100644
--- a/libs/fsScan/include/VdrRecording.h
+++ b/libs/fsScan/include/VdrRecording.h
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: VdrRecording.h
- * Created: 3. Juli 2012, 08:30
+ * Created: 3. Juli 2012, 08
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/nbproject/Makefile-Debug.mk b/libs/fsScan/nbproject/Makefile-Debug.mk
index a13c068..316d5a4 100644
--- a/libs/fsScan/nbproject/Makefile-Debug.mk
+++ b/libs/fsScan/nbproject/Makefile-Debug.mk
@@ -41,7 +41,10 @@ OBJECTFILES= \
${OBJECTDIR}/src/VdrRecording.o \
${OBJECTDIR}/src/MediaFactory.o \
${OBJECTDIR}/src/LegacyVdrRecording.o \
+ ${OBJECTDIR}/src/FileRepresentation.o \
+ ${OBJECTDIR}/src/File.o \
${OBJECTDIR}/src/FilesystemScanner.o \
+ ${OBJECTDIR}/src/FileSystem.o \
${OBJECTDIR}/src/AbstractMultiFileMovie.o \
${OBJECTDIR}/src/AbstractMedia.o \
${OBJECTDIR}/src/Movie.o
@@ -76,52 +79,67 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libfsscan.a: ${OBJECTFILES}
${OBJECTDIR}/src/Picture.o: src/Picture.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Picture.o src/Picture.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Picture.o src/Picture.cc
${OBJECTDIR}/src/Audio.o: src/Audio.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Audio.o src/Audio.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Audio.o src/Audio.cc
${OBJECTDIR}/src/DVDImage.o: src/DVDImage.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/DVDImage.o src/DVDImage.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/DVDImage.o src/DVDImage.cc
${OBJECTDIR}/src/VdrRecording.o: src/VdrRecording.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/VdrRecording.o src/VdrRecording.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/VdrRecording.o src/VdrRecording.cc
${OBJECTDIR}/src/MediaFactory.o: src/MediaFactory.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediaFactory.o src/MediaFactory.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/MediaFactory.o src/MediaFactory.cc
${OBJECTDIR}/src/LegacyVdrRecording.o: src/LegacyVdrRecording.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/LegacyVdrRecording.o src/LegacyVdrRecording.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/LegacyVdrRecording.o src/LegacyVdrRecording.cc
+
+${OBJECTDIR}/src/FileRepresentation.o: src/FileRepresentation.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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FileRepresentation.o src/FileRepresentation.cc
+
+${OBJECTDIR}/src/File.o: src/File.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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/File.o src/File.cc
${OBJECTDIR}/src/FilesystemScanner.o: src/FilesystemScanner.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FilesystemScanner.o src/FilesystemScanner.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FilesystemScanner.o src/FilesystemScanner.cc
+
+${OBJECTDIR}/src/FileSystem.o: src/FileSystem.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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FileSystem.o src/FileSystem.cc
${OBJECTDIR}/src/AbstractMultiFileMovie.o: src/AbstractMultiFileMovie.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMultiFileMovie.o src/AbstractMultiFileMovie.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMultiFileMovie.o src/AbstractMultiFileMovie.cc
${OBJECTDIR}/src/AbstractMedia.o: src/AbstractMedia.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMedia.o src/AbstractMedia.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/AbstractMedia.o src/AbstractMedia.cc
${OBJECTDIR}/src/Movie.o: src/Movie.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
- $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -I../networking/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Movie.o src/Movie.cc
+ $(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../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Movie.o src/Movie.cc
# Subprojects
.build-subprojects:
diff --git a/libs/fsScan/nbproject/Makefile-Release.mk b/libs/fsScan/nbproject/Makefile-Release.mk
index b1821f6..072cdf0 100644
--- a/libs/fsScan/nbproject/Makefile-Release.mk
+++ b/libs/fsScan/nbproject/Makefile-Release.mk
@@ -41,7 +41,10 @@ OBJECTFILES= \
${OBJECTDIR}/src/VdrRecording.o \
${OBJECTDIR}/src/MediaFactory.o \
${OBJECTDIR}/src/LegacyVdrRecording.o \
+ ${OBJECTDIR}/src/FileRepresentation.o \
+ ${OBJECTDIR}/src/File.o \
${OBJECTDIR}/src/FilesystemScanner.o \
+ ${OBJECTDIR}/src/FileSystem.o \
${OBJECTDIR}/src/AbstractMultiFileMovie.o \
${OBJECTDIR}/src/AbstractMedia.o \
${OBJECTDIR}/src/Movie.o
@@ -103,11 +106,26 @@ ${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/FileRepresentation.o: src/FileRepresentation.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FileRepresentation.o src/FileRepresentation.cc
+
+${OBJECTDIR}/src/File.o: src/File.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/File.o src/File.cc
+
${OBJECTDIR}/src/FilesystemScanner.o: src/FilesystemScanner.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FilesystemScanner.o src/FilesystemScanner.cc
+${OBJECTDIR}/src/FileSystem.o: src/FileSystem.cc
+ ${MKDIR} -p ${OBJECTDIR}/src
+ ${RM} $@.d
+ $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FileSystem.o src/FileSystem.cc
+
${OBJECTDIR}/src/AbstractMultiFileMovie.o: src/AbstractMultiFileMovie.cc
${MKDIR} -p ${OBJECTDIR}/src
${RM} $@.d
diff --git a/libs/fsScan/nbproject/configurations.xml b/libs/fsScan/nbproject/configurations.xml
index 8e6973a..ca6b34a 100644
--- a/libs/fsScan/nbproject/configurations.xml
+++ b/libs/fsScan/nbproject/configurations.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<configurationDescriptor version="80">
+<configurationDescriptor version="84">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<logicalFolder name="HeaderFiles"
displayName="Header Files"
@@ -8,6 +8,9 @@
<itemPath>include/AbstractMultiFileMovie.h</itemPath>
<itemPath>include/Audio.h</itemPath>
<itemPath>include/DVDImage.h</itemPath>
+ <itemPath>include/File.h</itemPath>
+ <itemPath>include/FileRepresentation.h</itemPath>
+ <itemPath>include/FileSystem.h</itemPath>
<itemPath>include/FilesystemScanner.h</itemPath>
<itemPath>include/LegacyVdrRecording.h</itemPath>
<itemPath>include/MediaFactory.h</itemPath>
@@ -26,6 +29,9 @@
<itemPath>src/AbstractMultiFileMovie.cc</itemPath>
<itemPath>src/Audio.cc</itemPath>
<itemPath>src/DVDImage.cc</itemPath>
+ <itemPath>src/File.cc</itemPath>
+ <itemPath>src/FileRepresentation.cc</itemPath>
+ <itemPath>src/FileSystem.cc</itemPath>
<itemPath>src/FilesystemScanner.cc</itemPath>
<itemPath>src/LegacyVdrRecording.cc</itemPath>
<itemPath>src/MediaFactory.cc</itemPath>
@@ -63,8 +69,14 @@
</incDir>
<commandLine>-std=gnu++0x -fomit-frame-pointer -fPIC -pthread -Wall -Wno-parentheses -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration -ansi</commandLine>
<preprocessorList>
+ <Elem>_FILE_OFFSET_BITS=64</Elem>
<Elem>_GNU_SOURCE=1</Elem>
+ <Elem>_LARGEFILE64_SOURCE</Elem>
+ <Elem>_LARGEFILE_SOURCE</Elem>
<Elem>_REENTRANT</Elem>
+ <Elem>__STDC_CONSTANT_MACROS</Elem>
+ <Elem>__STDC_FORMAT_MACROS</Elem>
+ <Elem>__STDC_LIMIT_MACROS</Elem>
</preprocessorList>
<warningLevel>2</warningLevel>
</ccTool>
diff --git a/libs/fsScan/nbproject/private/configurations.xml b/libs/fsScan/nbproject/private/configurations.xml
index fa15dc7..616cc91 100644
--- a/libs/fsScan/nbproject/private/configurations.xml
+++ b/libs/fsScan/nbproject/private/configurations.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<configurationDescriptor version="80">
+<configurationDescriptor version="84">
<projectmakefile>Makefile</projectmakefile>
<confs>
<conf name="Debug" type="3">
diff --git a/libs/fsScan/nbproject/private/private.xml b/libs/fsScan/nbproject/private/private.xml
index 5ee2703..dfdcba4 100644
--- a/libs/fsScan/nbproject/private/private.xml
+++ b/libs/fsScan/nbproject/private/private.xml
@@ -5,4 +5,5 @@
<activeConfIndexElem>0</activeConfIndexElem>
</data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+ <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
</project-private>
diff --git a/libs/fsScan/src/AbstractMedia.cc b/libs/fsScan/src/AbstractMedia.cc
index 3a3556b..17cf86c 100644
--- a/libs/fsScan/src/AbstractMedia.cc
+++ b/libs/fsScan/src/AbstractMedia.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: AbstractMedia.cc
- * Created: 2. Juli 2012, 14:33
+ * Created: 2. Juli 2012, 14
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/src/AbstractMultiFileMovie.cc b/libs/fsScan/src/AbstractMultiFileMovie.cc
index bcbd115..823130e 100644
--- a/libs/fsScan/src/AbstractMultiFileMovie.cc
+++ b/libs/fsScan/src/AbstractMultiFileMovie.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: AbstractMultiFileMovie.cc
- * Created: 3. Juli 2012, 07:39
+ * Created: 3. Juli 2012, 07
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/src/Audio.cc b/libs/fsScan/src/Audio.cc
index 25521dc..6d92576 100644
--- a/libs/fsScan/src/Audio.cc
+++ b/libs/fsScan/src/Audio.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: Audio.cc
- * Created: 2. Juli 2012, 15:00
+ * Created: 2. Juli 2012, 15
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/src/DVDImage.cc b/libs/fsScan/src/DVDImage.cc
index 5ffb170..6ce7d30 100644
--- a/libs/fsScan/src/DVDImage.cc
+++ b/libs/fsScan/src/DVDImage.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: DVDImage.cc
- * Created: 3. Juli 2012, 08:34
+ * Created: 3. Juli 2012, 08
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/src/File.cc b/libs/fsScan/src/File.cc
new file mode 100644
index 0000000..c88fd7c
--- /dev/null
+++ b/libs/fsScan/src/File.cc
@@ -0,0 +1,146 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: File.cc
+ * Created: 21. Juli 2012, 12:41
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * 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 <FileSystem.h>
+#include <FileRepresentation.h>
+#include <StringBuilder.h>
+#include <sys/stat.h>
+#include <sys/dir.h>
+
+cFileSystem *cFile::fs = NULL;
+static mode_t ReadMask = S_IRUSR | S_IRGRP | S_IROTH;
+static mode_t WriteMask = S_IWUSR | S_IWGRP | S_IWOTH;
+static mode_t ExecMask = S_IXUSR | S_IXGRP | S_IXOTH;
+
+
+cFile::cFile(const char *Path)
+ : rep(NULL)
+{
+ if (!fs) fs = new cFileSystem();
+ rep = fs->representationOfFile(Path);
+}
+
+cFile::cFile(const cFile& Parent, const char* RelativePath)
+ : rep(NULL)
+{
+ if (!fs) fs = new cFileSystem();
+ rep = fs->representationOfFile(Parent, RelativePath);
+}
+
+cFile::cFile(const cFileRepresentation *fr)
+ : rep(fr)
+{
+ if (!fs) fs = new cFileSystem();
+}
+
+cFile::~cFile()
+{
+}
+
+char *cFile::AbsolutePath(void) const
+{
+ cStringBuilder *sb = rep->internalPath();
+ char *rv = NULL;
+
+ if (sb) {
+ rv = sb->toString();
+ delete sb;
+ }
+ return rv;
+}
+
+bool cFile::Exists(void) const
+{
+ return rep->exists;
+}
+
+bool cFile::IsDirectory(void) const
+{
+ return (rep->mode & S_IFMT) == S_IFDIR;
+}
+
+bool cFile::IsFile(void) const
+{
+ return (rep->mode & S_IFMT) == S_IFREG;
+}
+
+bool cFile::IsSymbolic(void) const
+{
+ return (rep->mode & S_IFMT) == S_IFLNK;
+}
+
+bool cFile::CanRead(void) const
+{
+ return rep->mode & ReadMask;
+}
+
+bool cFile::CanWrite(void) const
+{
+ return rep->mode & WriteMask;
+}
+
+bool cFile::CanExecute(void) const
+{
+ return rep->mode & ExecMask;
+}
+
+off64_t cFile::Size(void) const
+{
+ return rep->size;
+}
+
+ulong cFile::LastModified(void) const
+{
+ return rep->lastModified;
+}
+
+cFile *cFile::Parent(void) const
+{
+ return new cFile(rep->getParent());
+}
+
+const char *cFile::Name(void) const
+{
+ return rep->name;
+}
+
+void cFile::Cleanup(void)
+{
+ if (fs) delete fs;
+}
+
+void cFile::VisitFiles(int (*cb)(cFile *, const char *))
+{
+ struct dirent entryBuffer, *pE;
+ char * path = AbsolutePath();
+ DIR *dir = opendir(path);
+
+ while (!readdir_r(dir, &entryBuffer, &pE) && pE) {
+ if (*(pE->d_name) == '.') continue; // don't bother with hidden stuff
+ cb(this, pE->d_name);
+ }
+ closedir(dir);
+ free(path);
+}
diff --git a/libs/fsScan/src/FileRepresentation.cc b/libs/fsScan/src/FileRepresentation.cc
new file mode 100644
index 0000000..8899e16
--- /dev/null
+++ b/libs/fsScan/src/FileRepresentation.cc
@@ -0,0 +1,109 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: FileRepresentation.cc
+ * Created: 21. Juli 2012, 12:41
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * 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>
+#include <FileSystem.h>
+#include <StringBuilder.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <stdlib.h>
+#include <iostream>
+#include <stack>
+
+cFileRepresentation::cFileRepresentation(const char *Path)
+ : exists(false)
+ , isRoot(true)
+ , mode(0)
+ , size(0)
+ , lastModified(0)
+ , name(NULL)
+ , parent(NULL)
+{
+ struct stat st;
+
+ if (!stat(Path, &st)) {
+ name = strdup(Path);
+ exists = true;
+ mode = st.st_mode;
+ size = st.st_size;
+ lastModified = st.st_mtime;
+ }
+}
+
+cFileRepresentation::cFileRepresentation(const cFileRepresentation *Parent, const char *Path)
+ : exists(false)
+ , isRoot(false)
+ , mode(0)
+ , size(0)
+ , lastModified(0)
+ , name(NULL)
+ , parent(Parent)
+{
+ name = strdup(Path);
+ cStringBuilder *sb = internalPath();
+ char *tmp = sb->toString();
+ struct stat st;
+
+ std::cout << "real path is: " << tmp << std::endl;
+ if (!stat(tmp, &st)) {
+ exists = true;
+ mode = st.st_mode;
+ size = st.st_size;
+ lastModified = st.st_mtime;
+ }
+ free(tmp);
+ delete sb;
+ std::cout << "should create file representation for " << Path << std::endl;
+}
+
+cFileRepresentation::~cFileRepresentation()
+{
+ free(name);
+}
+
+cStringBuilder *cFileRepresentation::internalPath(void) const
+{
+ cStringBuilder *sb = new cStringBuilder();
+ const cFileRepresentation *f = this;
+ std::stack<const cFileRepresentation *> rev;
+ char *chk;
+
+ while (!f->isRoot) {
+ rev.push(f);
+ f = f->parent;
+ }
+
+ for (;;) {
+ sb->Append(f->name);
+ if (rev.empty()) break;
+ chk = f->name + strlen(f->name) - 1;
+ if (*chk != cFileSystem::PathSeparator) sb->Append(cFileSystem::PathSeparator);
+ f = rev.top();
+ rev.pop();
+ }
+
+ return sb;
+}
+
diff --git a/libs/fsScan/src/FileSystem.cc b/libs/fsScan/src/FileSystem.cc
new file mode 100644
index 0000000..9d467c6
--- /dev/null
+++ b/libs/fsScan/src/FileSystem.cc
@@ -0,0 +1,132 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: FileSystem.cc
+ * Created: 21. Juli 2012, 12:44
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libfsScan: mediatypes and filesystem scanning
+ *
+ * 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 <FileSystem.h>
+#include <FileRepresentation.h>
+#include <File.h>
+#include <StringBuilder.h>
+#include <iostream>
+#include <stdlib.h>
+#include <string.h>
+
+char cFileSystem::PathSeparator = '/';
+char cFileSystem::RootPath[4] = { PathSeparator, 0, 0, 0 };
+
+cFileSystem::cFileSystem()
+{
+}
+
+cFileSystem::~cFileSystem()
+{
+ std::tr1::unordered_map<std::string, cFileRepresentation *>::iterator it = fileCache.begin();
+
+ while (it != fileCache.end()) {
+ if (it->second) delete it->second;
+ ++it;
+ }
+}
+
+cFileRepresentation *cFileSystem::cacheEntry(const char* Path)
+{
+ std::tr1::unordered_map<std::string, cFileRepresentation *>::iterator it = fileCache.find(Path);
+
+ if (it != fileCache.end()) return it->second;
+ return NULL;
+}
+
+cFileRepresentation *cFileSystem::representationOfFile(const cFile &Parent, const char* Path)
+{
+ cFileRepresentation *parentRep = (cFileRepresentation *) Parent.rep;
+ cFileRepresentation *tmp = NULL;
+ cStringBuilder *sb = parentRep->internalPath();
+ char *scratch = strdup(Path);
+ char *last = scratch + strlen(Path);
+ char *start = *scratch == PathSeparator ? scratch + 1 : scratch;
+ char *end = strchr(scratch, PathSeparator);
+ char *path;
+
+ while (start < last) {
+ end = strchr(start, PathSeparator);
+ if (!end) end = start + strlen(start);
+ *end = 0;
+ sb->Append(PathSeparator).Append(start);
+ path = sb->toString();
+ tmp = cacheEntry(path);
+ if (!tmp) {
+ tmp = new cFileRepresentation(parentRep, start);
+ fileCache[path] = tmp;
+ }
+ parentRep = tmp;
+ free(path);
+ start = end + 1;
+ }
+ free(scratch);
+ delete sb;
+
+ if (tmp) return tmp;
+ return NULL;
+}
+
+cFileRepresentation *cFileSystem::representationOfFile(const char* Path)
+{
+ cFileRepresentation *rv = cacheEntry(Path);
+
+ if (!rv) {
+ cFileRepresentation *tmp = NULL;
+ char *scratch = strdup(Path);
+ char *p;
+
+ for (p = strrchr(scratch, PathSeparator); !rv && p; p = strrchr(scratch, PathSeparator)) {
+ if (p > scratch) *p = 0;
+ else {
+ if (!(rv = cacheEntry(RootPath))) {
+ *p = 0;
+ tmp = new cFileRepresentation(RootPath);
+ fileCache["/"] = tmp;
+ break;
+ }
+ }
+ std::cout << "check path " << scratch << std::endl;
+ if ((tmp = cacheEntry(scratch))) break;
+ }
+
+ if (tmp) {
+ cFileRepresentation *parent = tmp;
+ size_t poolSize = fileCache.size();
+ const char *last = scratch + strlen(Path);
+
+ for (p = scratch + strlen(scratch) + 1; p < last; p += strlen(p) + 1) {
+ if (!*(p - 1)) *(p - 1) = PathSeparator;
+ tmp = new cFileRepresentation(parent, p);
+ fileCache[scratch] = tmp;
+ poolSize = fileCache.size();
+ parent = tmp;
+ }
+ rv = parent;
+ }
+ free(scratch);
+ }
+ return rv;
+}
+
diff --git a/libs/fsScan/src/FilesystemScanner.cc b/libs/fsScan/src/FilesystemScanner.cc
index 29fabba..2315ee1 100644
--- a/libs/fsScan/src/FilesystemScanner.cc
+++ b/libs/fsScan/src/FilesystemScanner.cc
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: FilesystemScanner.cc
- * Created: 2. Juli 2012, 13:58
+ * Created: 2. Juli 2012, 13
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
- *
+ *
* 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 <FilesystemScanner.h>
diff --git a/libs/fsScan/src/LegacyVdrRecording.cc b/libs/fsScan/src/LegacyVdrRecording.cc
index ea2ed35..29bebe7 100644
--- a/libs/fsScan/src/LegacyVdrRecording.cc
+++ b/libs/fsScan/src/LegacyVdrRecording.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: LegacyVdrRecording.cc
- * Created: 3. Juli 2012, 08:16
+ * Created: 3. Juli 2012, 08
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/src/MediaFactory.cc b/libs/fsScan/src/MediaFactory.cc
index a94fbb1..dfb0142 100644
--- a/libs/fsScan/src/MediaFactory.cc
+++ b/libs/fsScan/src/MediaFactory.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: MediaFactory.cc
- * Created: 2. Juli 2012, 15:43
+ * Created: 2. Juli 2012, 15
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/src/Movie.cc b/libs/fsScan/src/Movie.cc
index a558f81..878beb0 100644
--- a/libs/fsScan/src/Movie.cc
+++ b/libs/fsScan/src/Movie.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: Movie.cc
- * Created: 2. Juli 2012, 15:12
+ * Created: 2. Juli 2012, 15
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/src/Picture.cc b/libs/fsScan/src/Picture.cc
index 3c44ce6..f1e509c 100644
--- a/libs/fsScan/src/Picture.cc
+++ b/libs/fsScan/src/Picture.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: Picture.cc
- * Created: 2. Juli 2012, 15:18
+ * Created: 2. Juli 2012, 15
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*
diff --git a/libs/fsScan/src/VdrRecording.cc b/libs/fsScan/src/VdrRecording.cc
index f706477..cf192ba 100644
--- a/libs/fsScan/src/VdrRecording.cc
+++ b/libs/fsScan/src/VdrRecording.cc
@@ -2,7 +2,7 @@
* ======================== legal notice ======================
*
* File: VdrRecording.cc
- * Created: 3. Juli 2012, 08:30
+ * Created: 3. Juli 2012, 08
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libfsScan: mediatypes and filesystem scanning
*