diff options
author | geronimo <geronimo013@gmx.de> | 2012-07-29 15:11:47 +0200 |
---|---|---|
committer | geronimo <geronimo013@gmx.de> | 2012-07-29 15:11:47 +0200 |
commit | 85cb3f04252b0228830903b21c08bb64e9919c18 (patch) | |
tree | 5c00dbd8d296861aa56cca598ee2a36e51971822 /libs/fsScan | |
parent | 736033f3d532c4814eeff84db5dbf99f0249df6e (diff) | |
download | cmp-85cb3f04252b0228830903b21c08bb64e9919c18.tar.gz cmp-85cb3f04252b0228830903b21c08bb64e9919c18.tar.bz2 |
changed server setup to config file, little rearrangement of sources
Diffstat (limited to 'libs/fsScan')
33 files changed, 281 insertions, 908 deletions
diff --git a/libs/fsScan/fsScan.cbp b/libs/fsScan/fsScan.cbp index 8f51f56..21a5de4 100644 --- a/libs/fsScan/fsScan.cbp +++ b/libs/fsScan/fsScan.cbp @@ -35,11 +35,12 @@ </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 -ansi" /> + <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> @@ -47,10 +48,7 @@ <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/FSMediaScanner.h" /> <Unit filename="include/LegacyVdrRecording.h" /> <Unit filename="include/MediaFactory.h" /> <Unit filename="include/Movie.h" /> @@ -60,10 +58,7 @@ <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/FSMediaScanner.cc" /> <Unit filename="src/LegacyVdrRecording.cc" /> <Unit filename="src/MediaFactory.cc" /> <Unit filename="src/Movie.cc" /> diff --git a/libs/fsScan/fsScan.layout b/libs/fsScan/fsScan.layout index 2fdf779..2db2bda 100644 --- a/libs/fsScan/fsScan.layout +++ b/libs/fsScan/fsScan.layout @@ -1,39 +1,24 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <CodeBlocks_layout_file> <ActiveTarget name="Debug" /> - <File name="src/FileRepresentation.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="1911" topLine="9" /> - </Cursor> - </File> - <File name="include/File.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="1782" topLine="0" /> - </Cursor> - </File> - <File name="src/FilesystemScanner.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="2177" 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="src/LegacyVdrRecording.cc" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="1450" topLine="0" /> + <Cursor1 position="1317" topLine="18" /> </Cursor> </File> - <File name="src/MediaFactory.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="1709" topLine="9" /> + <Cursor1 position="1450" topLine="0" /> </Cursor> </File> - <File name="include/MediaFactory.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="1119" topLine="0" /> + <Cursor1 position="1670" topLine="0" /> </Cursor> </File> <File name="src/VdrRecording.cc" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> @@ -41,24 +26,9 @@ <Cursor1 position="1404" topLine="0" /> </Cursor> </File> - <File name="include/FileRepresentation.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="1593" topLine="0" /> - </Cursor> - </File> - <File name="include/FileSystem.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="1438" topLine="0" /> - </Cursor> - </File> - <File name="src/File.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="3161" topLine="54" /> - </Cursor> - </File> - <File name="src/FileSystem.cc" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="1476" topLine="9" /> + <Cursor1 position="1008" topLine="0" /> </Cursor> </File> </CodeBlocks_layout_file> diff --git a/libs/fsScan/fsScan.layout.save b/libs/fsScan/fsScan.layout.save index 6134cfb..2db2bda 100644 --- a/libs/fsScan/fsScan.layout.save +++ b/libs/fsScan/fsScan.layout.save @@ -6,29 +6,19 @@ <Cursor1 position="1453" 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/FilesystemScanner.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="2177" topLine="0" /> + <Cursor1 position="1317" topLine="18" /> </Cursor> </File> - <File name="include/MediaFactory.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="1119" topLine="0" /> - </Cursor> - </File> - <File name="include/FileSystem.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="1438" topLine="0" /> + <Cursor1 position="1450" topLine="0" /> </Cursor> </File> - <File name="src/FileSystem.cc" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="1476" topLine="9" /> + <Cursor1 position="1670" topLine="0" /> </Cursor> </File> <File name="src/VdrRecording.cc" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> @@ -36,29 +26,9 @@ <Cursor1 position="1404" topLine="0" /> </Cursor> </File> - <File name="include/File.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="1782" topLine="0" /> - </Cursor> - </File> - <File name="src/File.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="3161" topLine="54" /> - </Cursor> - </File> - <File name="src/MediaFactory.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="1709" topLine="9" /> - </Cursor> - </File> - <File name="src/FileRepresentation.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> - <Cursor> - <Cursor1 position="1911" topLine="9" /> - </Cursor> - </File> - <File name="include/FileRepresentation.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="1593" topLine="0" /> + <Cursor1 position="1008" topLine="0" /> </Cursor> </File> </CodeBlocks_layout_file> diff --git a/libs/fsScan/include/AbstractMedia.h b/libs/fsScan/include/AbstractMedia.h index 750ffde..8c87dd5 100644 --- a/libs/fsScan/include/AbstractMedia.h +++ b/libs/fsScan/include/AbstractMedia.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: AbstractMedia.h * Created: 2. Juli 2012, 14 * 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 ABSTRACTMEDIA_H @@ -56,6 +56,7 @@ public: ulong LastModified(void) const; const char *LogicalPath(void) const { return logicalPath; } virtual const char *Name(void) const; + virtual bool NeedsFurtherScan(void) const; virtual size_t Size(void) const; virtual const char *URI(void) const { return uri; } virtual void Refresh(void); diff --git a/libs/fsScan/include/AbstractMultiFileMovie.h b/libs/fsScan/include/AbstractMultiFileMovie.h index aed75b9..6913a74 100644 --- a/libs/fsScan/include/AbstractMultiFileMovie.h +++ b/libs/fsScan/include/AbstractMultiFileMovie.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: AbstractMultiFileMovie.h * Created: 3. Juli 2012, 07 * 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 ABSTRACTMULTIFILEMOVIE_H diff --git a/libs/fsScan/include/Audio.h b/libs/fsScan/include/Audio.h index 44472ef..42611c2 100644 --- a/libs/fsScan/include/Audio.h +++ b/libs/fsScan/include/Audio.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: Audio.h * Created: 2. Juli 2012, 15 * 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 AUDIO_H @@ -32,6 +32,8 @@ public: cAudio(const cFile &File, const char *Mime); virtual ~cAudio(); + virtual bool NeedsFurtherScan(void) const; + private: static const char *ContentType(const char *Extension); static SupportedExtension knownExtensions[]; diff --git a/libs/fsScan/include/DVDImage.h b/libs/fsScan/include/DVDImage.h index 1a657ff..5845d77 100644 --- a/libs/fsScan/include/DVDImage.h +++ b/libs/fsScan/include/DVDImage.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: DVDImage.h * Created: 3. Juli 2012, 08 * 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 DVDIMAGE_H diff --git a/libs/fsScan/include/FilesystemScanner.h b/libs/fsScan/include/FSMediaScanner.h index 51cd44e..1c85b46 100644 --- a/libs/fsScan/include/FilesystemScanner.h +++ b/libs/fsScan/include/FSMediaScanner.h @@ -1,39 +1,39 @@ /** * ======================== legal notice ====================== - * - * File: FilesystemScanner.h + * + * File: FSMediaScanner.h * 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 - * + * * -------------------------------------------------------------- */ -#ifndef FILESYSTEMSCANNER_H -#define FILESYSTEMSCANNER_H +#ifndef FSMEDIASCANNER_H +#define FSMEDIASCANNER_H #include <ManagedVector.h> #include <MediaFactory.h> #include <map> class cAbstractMedia; -class cFilesystemScanner { +class cFSMediaScanner { public: - cFilesystemScanner(); - virtual ~cFilesystemScanner(); + cFSMediaScanner(); + virtual ~cFSMediaScanner(); cManagedVector &MediaPool(void) { return pool; } std::map<int, size_t> &Categories(void) { return categories; } @@ -48,5 +48,5 @@ private: cMediaFactory *mediaFactory; }; -#endif /* FILESYSTEMSCANNER_H */ +#endif /* FSMEDIASCANNER_H */ diff --git a/libs/fsScan/include/File.h b/libs/fsScan/include/File.h deleted file mode 100644 index 587d99c..0000000 --- a/libs/fsScan/include/File.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * ======================== legal notice ====================== - * - * File: File.h - * Created: 21. Juli 2012, 12 - * 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 <stddef.h> -#include <sys/types.h> - -class cFileSystem; -class cFileRepresentation; -class cStringBuilder; -class cFile { -public: - cFile(const char *Path = NULL); - cFile(const cFile &other); - cFile(const cFile &Parent, const char *RelativePath); - virtual ~cFile(); - - cFile &operator =(const cFile &other); - 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; - void SetVirtualRoot(bool isRoot = true); - const char *AbsolutePath(void) const; ///< returns an allocated string - char *toURI(void) const; ///< returns an allocated string - cFile *Parent(void) const; ///< allocates a new file instance! - void VisitFiles(int (*cb)(void *, cFile *, const char *), void *opaque); - 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 deleted file mode 100644 index 39a3c1e..0000000 --- a/libs/fsScan/include/FileRepresentation.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * ======================== legal notice ====================== - * - * File: FileRepresentation.h - * Created: 21. Juli 2012, 12 - * 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(); - - const char *Path(void) const; - const cFileRepresentation *getParent(void) const { return parent; }; - void SetVirtualRoot(bool isRoot); - -private: - cFileRepresentation(const char *Name); - cFileRepresentation(const cFileRepresentation *Parent, const char *Name); - char *toURI(void) const; - bool exists; - bool isRoot; - bool isVirtualRoot; - mode_t mode; - off64_t size; - ulong lastModified; - char *name; - mutable char *path; - 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 deleted file mode 100644 index 0cf4a2f..0000000 --- a/libs/fsScan/include/FileSystem.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * ======================== legal notice ====================== - * - * File: FileSystem.h - * Created: 21. Juli 2012, 12 - * 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/LegacyVdrRecording.h b/libs/fsScan/include/LegacyVdrRecording.h index d60902a..cc46348 100644 --- a/libs/fsScan/include/LegacyVdrRecording.h +++ b/libs/fsScan/include/LegacyVdrRecording.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: LegacyVdrRecording.h * Created: 3. Juli 2012, 08 * 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 LEGACYVDRRECORDING_H diff --git a/libs/fsScan/include/MediaFactory.h b/libs/fsScan/include/MediaFactory.h index 200335b..2ddcaa5 100644 --- a/libs/fsScan/include/MediaFactory.h +++ b/libs/fsScan/include/MediaFactory.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: MediaFactory.h * Created: 2. Juli 2012, 15 * 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 MEDIAFACTORY_H @@ -32,9 +32,10 @@ class cAbstractMedia; class cFile; class cManagedVector; +class cServerConfig; class cMediaFactory { public: - cMediaFactory(const cFile &BaseDirectory); + cMediaFactory(const cServerConfig &config); virtual ~cMediaFactory(); cAbstractMedia *CreateMedia(const cFile &FileOrDirectory); @@ -43,8 +44,12 @@ public: void SetBaseDirectory(const cFile &dir); private: + void Scan4MetaData(cAbstractMedia *media); + int CreateMedia(const cFile *Parent, const char *Name); static int createMedia(void *opaque, cFile *Parent, const char *Name); + const cServerConfig &config; cFile baseDirectory; + cManagedVector *mediaPool; char *scratch; size_t scratchSize; }; diff --git a/libs/fsScan/include/Movie.h b/libs/fsScan/include/Movie.h index ecb62ec..5a4f60d 100644 --- a/libs/fsScan/include/Movie.h +++ b/libs/fsScan/include/Movie.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: Movie.h * Created: 2. Juli 2012, 15 * 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 MOVIE_H @@ -32,6 +32,8 @@ public: cMovie(const cFile &File, const char *Mime, SupportedMediaType Type = cAbstractMedia::Movie); virtual ~cMovie(); + virtual bool NeedsFurtherScan(void) const; + private: static const char *ContentType(const char *Extension); static SupportedExtension knownExtensions[]; diff --git a/libs/fsScan/include/Picture.h b/libs/fsScan/include/Picture.h index 3e9a079..669509b 100644 --- a/libs/fsScan/include/Picture.h +++ b/libs/fsScan/include/Picture.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: Picture.h * Created: 2. Juli 2012, 15 * 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 PICTURE_H diff --git a/libs/fsScan/include/VdrRecording.h b/libs/fsScan/include/VdrRecording.h index 9b92c61..a8ec292 100644 --- a/libs/fsScan/include/VdrRecording.h +++ b/libs/fsScan/include/VdrRecording.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: VdrRecording.h * Created: 3. Juli 2012, 08 * 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 VDRRECORDING_H diff --git a/libs/fsScan/nbproject/Makefile-Debug.mk b/libs/fsScan/nbproject/Makefile-Debug.mk index 316d5a4..1e0062b 100644 --- a/libs/fsScan/nbproject/Makefile-Debug.mk +++ b/libs/fsScan/nbproject/Makefile-Debug.mk @@ -41,10 +41,7 @@ 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/FSMediaScanner.o \ ${OBJECTDIR}/src/AbstractMultiFileMovie.o \ ${OBJECTDIR}/src/AbstractMedia.o \ ${OBJECTDIR}/src/Movie.o @@ -54,8 +51,8 @@ OBJECTFILES= \ CFLAGS= # CC Compiler Flags -CCFLAGS=-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 -CXXFLAGS=-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 +CCFLAGS=-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 +CXXFLAGS=-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 # Fortran Compiler Flags FFLAGS= @@ -79,70 +76,59 @@ ${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_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 + $(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/Picture.o src/Picture.cc ${OBJECTDIR}/src/Audio.o: src/Audio.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/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../IO/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_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 + $(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/DVDImage.o src/DVDImage.cc ${OBJECTDIR}/src/VdrRecording.o: src/VdrRecording.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/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../IO/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_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 + $(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/MediaFactory.o src/MediaFactory.cc ${OBJECTDIR}/src/LegacyVdrRecording.o: src/LegacyVdrRecording.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/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../IO/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 +${OBJECTDIR}/src/FSMediaScanner.o: src/FSMediaScanner.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_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 + $(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/FSMediaScanner.o src/FSMediaScanner.cc ${OBJECTDIR}/src/AbstractMultiFileMovie.o: src/AbstractMultiFileMovie.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/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../IO/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_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 + $(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/AbstractMedia.o src/AbstractMedia.cc ${OBJECTDIR}/src/Movie.o: src/Movie.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/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../IO/include -I../util/include -I../vdr/include -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/Movie.o src/Movie.cc # Subprojects .build-subprojects: + cd ../vdr && ${MAKE} -f Makefile CONF=Debug + cd ../util && ${MAKE} -f Makefile CONF=Debug + cd ../networking && ${MAKE} -f Makefile CONF=Debug + cd ../IO && ${MAKE} -f Makefile CONF=Debug # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} @@ -151,6 +137,10 @@ ${OBJECTDIR}/src/Movie.o: src/Movie.cc # Subprojects .clean-subprojects: + cd ../vdr && ${MAKE} -f Makefile CONF=Debug clean + cd ../util && ${MAKE} -f Makefile CONF=Debug clean + cd ../networking && ${MAKE} -f Makefile CONF=Debug clean + cd ../IO && ${MAKE} -f Makefile CONF=Debug clean # Enable dependency checking .dep.inc: .depcheck-impl diff --git a/libs/fsScan/nbproject/Makefile-Release.mk b/libs/fsScan/nbproject/Makefile-Release.mk index 072cdf0..bc8c6a9 100644 --- a/libs/fsScan/nbproject/Makefile-Release.mk +++ b/libs/fsScan/nbproject/Makefile-Release.mk @@ -41,10 +41,7 @@ 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/FSMediaScanner.o \ ${OBJECTDIR}/src/AbstractMultiFileMovie.o \ ${OBJECTDIR}/src/AbstractMedia.o \ ${OBJECTDIR}/src/Movie.o @@ -106,25 +103,10 @@ ${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 +${OBJECTDIR}/src/FSMediaScanner.o: src/FSMediaScanner.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 + $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/src/FSMediaScanner.o src/FSMediaScanner.cc ${OBJECTDIR}/src/AbstractMultiFileMovie.o: src/AbstractMultiFileMovie.cc ${MKDIR} -p ${OBJECTDIR}/src diff --git a/libs/fsScan/nbproject/configurations.xml b/libs/fsScan/nbproject/configurations.xml index ca6b34a..9984a4c 100644 --- a/libs/fsScan/nbproject/configurations.xml +++ b/libs/fsScan/nbproject/configurations.xml @@ -8,10 +8,7 @@ <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/FSMediaScanner.h</itemPath> <itemPath>include/LegacyVdrRecording.h</itemPath> <itemPath>include/MediaFactory.h</itemPath> <itemPath>include/Movie.h</itemPath> @@ -29,10 +26,7 @@ <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/FSMediaScanner.cc</itemPath> <itemPath>src/LegacyVdrRecording.cc</itemPath> <itemPath>src/MediaFactory.cc</itemPath> <itemPath>src/Movie.cc</itemPath> @@ -64,10 +58,11 @@ <incDir> <pElem>include</pElem> <pElem>../networking/include</pElem> + <pElem>../IO/include</pElem> <pElem>../util/include</pElem> <pElem>../vdr/include</pElem> </incDir> - <commandLine>-std=gnu++0x -fomit-frame-pointer -fPIC -pthread -Wall -Wno-parentheses -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration -ansi</commandLine> + <commandLine>-std=gnu++0x -fomit-frame-pointer -fPIC -pthread -Wall -Wno-parentheses -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration</commandLine> <preprocessorList> <Elem>_FILE_OFFSET_BITS=64</Elem> <Elem>_GNU_SOURCE=1</Elem> @@ -82,6 +77,48 @@ </ccTool> <archiverTool> </archiverTool> + <requiredProjects> + <makeArtifact PL="../vdr" + CT="3" + CN="Debug" + AC="true" + BL="true" + WD="../vdr" + BC="${MAKE} -f Makefile CONF=Debug" + CC="${MAKE} -f Makefile CONF=Debug clean" + OP="${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libvdr.a"> + </makeArtifact> + <makeArtifact PL="../util" + CT="3" + CN="Debug" + AC="true" + BL="true" + WD="../util" + BC="${MAKE} -f Makefile CONF=Debug" + CC="${MAKE} -f Makefile CONF=Debug clean" + OP="${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libutil.a"> + </makeArtifact> + <makeArtifact PL="../networking" + CT="3" + CN="Debug" + AC="true" + BL="true" + WD="../networking" + BC="${MAKE} -f Makefile CONF=Debug" + CC="${MAKE} -f Makefile CONF=Debug clean" + OP="${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libnetworking.a"> + </makeArtifact> + <makeArtifact PL="../IO" + CT="3" + CN="Debug" + AC="true" + BL="true" + WD="../IO" + BC="${MAKE} -f Makefile CONF=Debug" + CC="${MAKE} -f Makefile CONF=Debug clean" + OP="${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libio.a"> + </makeArtifact> + </requiredProjects> </compileType> </conf> <conf name="Release" type="3"> diff --git a/libs/fsScan/nbproject/project.xml b/libs/fsScan/nbproject/project.xml index a104f65..f749866 100644 --- a/libs/fsScan/nbproject/project.xml +++ b/libs/fsScan/nbproject/project.xml @@ -8,7 +8,12 @@ <cpp-extensions>cc</cpp-extensions> <header-extensions>h</header-extensions> <sourceEncoding>UTF-8</sourceEncoding> - <make-dep-projects/> + <make-dep-projects> + <make-dep-project>../IO</make-dep-project> + <make-dep-project>../vdr</make-dep-project> + <make-dep-project>../util</make-dep-project> + <make-dep-project>../networking</make-dep-project> + </make-dep-projects> <sourceRootList/> <confList> <confElem> diff --git a/libs/fsScan/src/AbstractMedia.cc b/libs/fsScan/src/AbstractMedia.cc index 27ad751..924f01a 100644 --- a/libs/fsScan/src/AbstractMedia.cc +++ b/libs/fsScan/src/AbstractMedia.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: AbstractMedia.cc * Created: 2. Juli 2012, 14 * 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 <AbstractMedia.h> @@ -112,6 +112,11 @@ const char *cAbstractMedia::MediaType2Text(int Type) } } +bool cAbstractMedia::NeedsFurtherScan(void) const +{ + return false; +} + const char *cAbstractMedia::AbsolutePath(void) const { return keyPath.AbsolutePath(); diff --git a/libs/fsScan/src/AbstractMultiFileMovie.cc b/libs/fsScan/src/AbstractMultiFileMovie.cc index d20da87..f679511 100644 --- a/libs/fsScan/src/AbstractMultiFileMovie.cc +++ b/libs/fsScan/src/AbstractMultiFileMovie.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: AbstractMultiFileMovie.cc * Created: 3. Juli 2012, 07 * 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 <AbstractMultiFileMovie.h> diff --git a/libs/fsScan/src/Audio.cc b/libs/fsScan/src/Audio.cc index 8933c36..6c90fbc 100644 --- a/libs/fsScan/src/Audio.cc +++ b/libs/fsScan/src/Audio.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: Audio.cc * Created: 2. Juli 2012, 15 * 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 <Audio.h> @@ -40,7 +40,7 @@ SupportedExtension cAudio::knownExtensions[] = { { "mp3", "audio/mpeg" }, { "mp4", "audio/x-mpeg4" }, { "m4a", "audio/x-m4" }, - { "mpg", "audio/mpeg" }, +// { "mpg", "audio/mpeg" }, { "mpp", "audio/x-musepack" }, { "ram", "audio/x-realaudio" }, { NULL, NULL } @@ -63,3 +63,8 @@ const char *cAudio::ContentType(const char* Extension) return NULL; } +bool cAudio::NeedsFurtherScan(void) const +{ +//TODO: common meta data: artist, title + return true; +} diff --git a/libs/fsScan/src/DVDImage.cc b/libs/fsScan/src/DVDImage.cc index 8c789b4..0d23ae1 100644 --- a/libs/fsScan/src/DVDImage.cc +++ b/libs/fsScan/src/DVDImage.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: DVDImage.cc * Created: 3. Juli 2012, 08 * 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 <DVDImage.h> diff --git a/libs/fsScan/src/FilesystemScanner.cc b/libs/fsScan/src/FSMediaScanner.cc index cbe4b95..f4ac14e 100644 --- a/libs/fsScan/src/FilesystemScanner.cc +++ b/libs/fsScan/src/FSMediaScanner.cc @@ -1,28 +1,28 @@ /** * ======================== legal notice ====================== - * - * File: FilesystemScanner.cc + * + * File: FSMediaScanner.cc * 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> +#include <FSMediaScanner.h> #include <AbstractMedia.h> #include <Logging.h> #include <stddef.h> @@ -40,20 +40,20 @@ void freeMediaCallback(void *elem) delete (cAbstractMedia *)elem; } -cFilesystemScanner::cFilesystemScanner() +cFSMediaScanner::cFSMediaScanner() : fileBufSize(512) , pool(freeMediaCallback) , mediaFactory(NULL) { } -cFilesystemScanner::~cFilesystemScanner() +cFSMediaScanner::~cFSMediaScanner() { pool.clear(); if (mediaFactory) delete mediaFactory; } -void cFilesystemScanner::SetMediaFactory(cMediaFactory* factory) +void cFSMediaScanner::SetMediaFactory(cMediaFactory* factory) { mediaFactory = factory; } @@ -76,7 +76,7 @@ bool defaultMediaSortOrder(void *a, void *b) return rv; } -void cFilesystemScanner::Refresh() +void cFSMediaScanner::Refresh() { if (!mediaFactory) return; pool.clear(); @@ -96,7 +96,7 @@ void cFilesystemScanner::Refresh() } } -cAbstractMedia *cFilesystemScanner::FindMedia(const char *Path) +cAbstractMedia *cFSMediaScanner::FindMedia(const char *Path) { cAbstractMedia *rv = NULL, *tmp; diff --git a/libs/fsScan/src/File.cc b/libs/fsScan/src/File.cc deleted file mode 100644 index 477c5c8..0000000 --- a/libs/fsScan/src/File.cc +++ /dev/null @@ -1,181 +0,0 @@ -/** - * ======================== legal notice ====================== - * - * File: File.cc - * Created: 21. Juli 2012, 12 - * 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(); - if (!Path) { - Path = getcwd(NULL, 0); - rep = fs->representationOfFile(Path); - free((char *) Path); - } - else rep = fs->representationOfFile(Path); -} - -cFile::cFile(const cFile &other) - : rep(other.rep) -{ - if (!fs) fs = new cFileSystem(); -} - -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() -{ -} - -cFile &cFile::operator =(const cFile &other) -{ - rep = other.rep; - return *this; -} - -const char *cFile::AbsolutePath(void) const -{ - if (rep) return rep->Path(); - return NULL; -} - -bool cFile::Exists(void) const -{ - if (rep) return rep->exists; - return false; -} - -bool cFile::IsDirectory(void) const -{ - if (rep) return (rep->mode & S_IFMT) == S_IFDIR; - return false; -} - -bool cFile::IsFile(void) const -{ - if (rep) return (rep->mode & S_IFMT) == S_IFREG; - return false; -} - -bool cFile::IsSymbolic(void) const -{ - if (rep) return (rep->mode & S_IFMT) == S_IFLNK; - return false; -} - -bool cFile::CanRead(void) const -{ - if (rep) return rep->mode & ReadMask; - return false; -} - -bool cFile::CanWrite(void) const -{ - if (rep) return rep->mode & WriteMask; - return false; -} - -bool cFile::CanExecute(void) const -{ - if (rep) return rep->mode & ExecMask; - return false; -} - -off64_t cFile::Size(void) const -{ - if (rep) return rep->size; - return 0; -} - -ulong cFile::LastModified(void) const -{ - if (rep) return rep->lastModified; - return 0; -} - -cFile *cFile::Parent(void) const -{ - if (rep) return new cFile(rep->getParent()); - return NULL; -} - -const char *cFile::Name(void) const -{ - if (rep) return rep->name; - return NULL; -} - -void cFile::Cleanup(void) -{ - if (fs) { - delete fs; - fs = NULL; - } -} - -void cFile::VisitFiles(int (*cb)(void *, cFile *, const char *), void *opaque) -{ - if (!Exists() || !IsDirectory()) return; - struct dirent entryBuffer, *pE; - DIR *dir = opendir(AbsolutePath()); - - while (!readdir_r(dir, &entryBuffer, &pE) && pE) { - if (*(pE->d_name) == '.') continue; // don't bother with hidden stuff - cb(opaque, this, pE->d_name); - } - closedir(dir); -} - -char *cFile::toURI() const -{ - if (rep) return rep->toURI(); - return NULL; -} - -void cFile::SetVirtualRoot(bool isRoot) -{ - if (rep) ((cFileRepresentation *)rep)->SetVirtualRoot(isRoot); -} diff --git a/libs/fsScan/src/FileRepresentation.cc b/libs/fsScan/src/FileRepresentation.cc deleted file mode 100644 index 81599a3..0000000 --- a/libs/fsScan/src/FileRepresentation.cc +++ /dev/null @@ -1,132 +0,0 @@ -/** - * ======================== legal notice ====================== - * - * File: FileRepresentation.cc - * Created: 21. Juli 2012, 12 - * 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 <Url.h> -#include <Codec.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#include <stdlib.h> -#include <iostream> -#include <stack> - -cFileRepresentation::cFileRepresentation(const char *Name) - : exists(false) - , isRoot(true) - , isVirtualRoot(true) - , mode(0) - , size(0) - , lastModified(0) - , name(NULL) - , path(NULL) - , parent(NULL) -{ - struct stat st; - - if (!stat(Name, &st)) { - name = strdup(Name); - exists = true; - mode = st.st_mode; - size = st.st_size; - lastModified = st.st_mtime; - } -} - -cFileRepresentation::cFileRepresentation(const cFileRepresentation *Parent, const char *Name) - : exists(false) - , isRoot(false) - , isVirtualRoot(false) - , mode(0) - , size(0) - , lastModified(0) - , name(strdup(Name)) - , path(NULL) - , parent(Parent) -{ - struct stat st; - - if (!stat(Path(), &st)) { - exists = true; - mode = st.st_mode; - size = st.st_size; - lastModified = st.st_mtime; - } -} - -cFileRepresentation::~cFileRepresentation() -{ - free(name); - free(path); -} - -const char *cFileRepresentation::Path() const -{ - if (!path) { - cStringBuilder sb; - - if (parent) sb.Append(parent->Path()); - sb.Append(cFileSystem::PathSeparator).Append(name); - path = sb.toString(); - } - return path; -} - -void cFileRepresentation::SetVirtualRoot(bool isRoot) -{ - isVirtualRoot = isRoot; -} - -char *cFileRepresentation::toURI() const -{ - cStringBuilder *sb = new cStringBuilder(); - const cFileRepresentation *f = this; - std::stack<const cFileRepresentation *> rev; - cURLEncoder *enc = cUrl::Encoder(); - char *tmp, *chk, *rv; - size_t stackSize; - - while (!f->isVirtualRoot) { - rev.push(f); - stackSize = rev.size(); - f = f->parent; - } - - for (;;) { - f = rev.top(); - rev.pop(); - chk = f->name + strlen(f->name) - 1; - if (*chk != cFileSystem::PathSeparator) sb->Append(cFileSystem::PathSeparator); - tmp = enc->Encode(f->name); - sb->Append(tmp); - free(tmp); - if (rev.empty()) break; - } - rv = sb->toString(); - delete sb; - - return rv; -} diff --git a/libs/fsScan/src/FileSystem.cc b/libs/fsScan/src/FileSystem.cc deleted file mode 100644 index 3891c97..0000000 --- a/libs/fsScan/src/FileSystem.cc +++ /dev/null @@ -1,132 +0,0 @@ -/** - * ======================== legal notice ====================== - * - * File: FileSystem.cc - * Created: 21. Juli 2012, 12 - * 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) -{ - if (fileCache.empty()) return NULL; - 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 = new cStringBuilder(Parent.AbsolutePath()); - 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[RootPath] = tmp; - break; - } - } - 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/LegacyVdrRecording.cc b/libs/fsScan/src/LegacyVdrRecording.cc index 731d0f3..5ee635c 100644 --- a/libs/fsScan/src/LegacyVdrRecording.cc +++ b/libs/fsScan/src/LegacyVdrRecording.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: LegacyVdrRecording.cc * Created: 3. Juli 2012, 08 * 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 <LegacyVdrRecording.h> diff --git a/libs/fsScan/src/MediaFactory.cc b/libs/fsScan/src/MediaFactory.cc index 22b9044..4dec763 100644 --- a/libs/fsScan/src/MediaFactory.cc +++ b/libs/fsScan/src/MediaFactory.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: MediaFactory.cc * Created: 2. Juli 2012, 15 * 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 <MediaFactory.h> @@ -29,6 +29,7 @@ #include <LegacyVdrRecording.h> #include <VdrRecording.h> #include <DVDImage.h> +#include <ServerConfig.h> #include <StringBuilder.h> #include <Logging.h> #include <File.h> @@ -36,8 +37,9 @@ #include <stdlib.h> #include <string.h> -cMediaFactory::cMediaFactory(const cFile &BaseDirectory) - : baseDirectory(BaseDirectory) +cMediaFactory::cMediaFactory(const cServerConfig &sc) + : config(sc) + , baseDirectory(sc.DocumentRoot()) , scratch(NULL) , scratchSize(1024) { @@ -61,7 +63,14 @@ void cMediaFactory::SetBaseDirectory(const cFile &dir) int cMediaFactory::createMedia(void *opaque, cFile *Parent, const char *Name) { if (!opaque) return -1; - cManagedVector *pool = (cManagedVector *) opaque; + cMediaFactory *mf = (cMediaFactory *) opaque; + + return mf->CreateMedia(Parent, Name); +} + +int cMediaFactory::CreateMedia(const cFile *Parent, const char *Name) +{ +// cManagedVector *pool = (cManagedVector *) opaque; cFile *curFile = new cFile(*Parent, Name); const char *mimeType = NULL; cAbstractMedia *rv = NULL; @@ -93,7 +102,7 @@ int cMediaFactory::createMedia(void *opaque, cFile *Parent, const char *Name) } delete tmp; } - if (!rv) curFile->VisitFiles(createMedia, opaque); + if (!rv) curFile->VisitFiles(createMedia, this); } else { const char *extension = strrchr(Name, '.'); @@ -117,7 +126,8 @@ int cMediaFactory::createMedia(void *opaque, cFile *Parent, const char *Name) } delete curFile; if (rv) { - pool->push_back(rv); + if (config.WantExtendedScan() && rv->NeedsFurtherScan()) Scan4MetaData(rv); + mediaPool->push_back(rv); return 0; } return -1; @@ -128,5 +138,11 @@ void cMediaFactory::Scan4Media(cManagedVector& pool) if (!baseDirectory.Exists() || !baseDirectory.IsDirectory()) return; baseDirectory.SetVirtualRoot(); - baseDirectory.VisitFiles(createMedia, &pool); + mediaPool = &pool; + baseDirectory.VisitFiles(createMedia, this); +} + +void cMediaFactory::Scan4MetaData(cAbstractMedia* media) +{ + //TODO: } diff --git a/libs/fsScan/src/Movie.cc b/libs/fsScan/src/Movie.cc index 759ff3d..a63ff19 100644 --- a/libs/fsScan/src/Movie.cc +++ b/libs/fsScan/src/Movie.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: Movie.cc * Created: 2. Juli 2012, 15 * 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 <Movie.h> @@ -37,6 +37,7 @@ SupportedExtension cMovie::knownExtensions[] = { { "ogv", "video/ogg" }, { "mkv", "video/x-matroska" }, { "mov", "video/quicktime" }, + { "mpg", "video/mpeg" }, { "mpeg", "video/mpeg" }, { "swf", "application/x-shockwave-flash" }, { NULL, NULL } @@ -59,3 +60,8 @@ const char *cMovie::ContentType(const char* Extension) return NULL; } +bool cMovie::NeedsFurtherScan(void) const +{ +//TODO: common meta data: width, height, interlaced + return true; +} diff --git a/libs/fsScan/src/Picture.cc b/libs/fsScan/src/Picture.cc index 566c44c..19a02a1 100644 --- a/libs/fsScan/src/Picture.cc +++ b/libs/fsScan/src/Picture.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: Picture.cc * Created: 2. Juli 2012, 15 * 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 <Picture.h> diff --git a/libs/fsScan/src/VdrRecording.cc b/libs/fsScan/src/VdrRecording.cc index 4fb61fa..03abccf 100644 --- a/libs/fsScan/src/VdrRecording.cc +++ b/libs/fsScan/src/VdrRecording.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: VdrRecording.cc * Created: 3. Juli 2012, 08 * 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 <VdrRecording.h> |