From 85cb3f04252b0228830903b21c08bb64e9919c18 Mon Sep 17 00:00:00 2001 From: geronimo Date: Sun, 29 Jul 2012 15:11:47 +0200 Subject: changed server setup to config file, little rearrangement of sources --- libs/fsScan/include/AbstractMedia.h | 13 +++--- libs/fsScan/include/AbstractMultiFileMovie.h | 12 ++--- libs/fsScan/include/Audio.h | 14 +++--- libs/fsScan/include/DVDImage.h | 12 ++--- libs/fsScan/include/FSMediaScanner.h | 52 +++++++++++++++++++++ libs/fsScan/include/File.h | 67 ---------------------------- libs/fsScan/include/FileRepresentation.h | 56 ----------------------- libs/fsScan/include/FileSystem.h | 50 --------------------- libs/fsScan/include/FilesystemScanner.h | 52 --------------------- libs/fsScan/include/LegacyVdrRecording.h | 12 ++--- libs/fsScan/include/MediaFactory.h | 19 +++++--- libs/fsScan/include/Movie.h | 14 +++--- libs/fsScan/include/Picture.h | 12 ++--- libs/fsScan/include/VdrRecording.h | 12 ++--- 14 files changed, 117 insertions(+), 280 deletions(-) create mode 100644 libs/fsScan/include/FSMediaScanner.h delete mode 100644 libs/fsScan/include/File.h delete mode 100644 libs/fsScan/include/FileRepresentation.h delete mode 100644 libs/fsScan/include/FileSystem.h delete mode 100644 libs/fsScan/include/FilesystemScanner.h (limited to 'libs/fsScan/include') 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: Geronimo * 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: Geronimo * 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: Geronimo * 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: Geronimo * 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/FSMediaScanner.h b/libs/fsScan/include/FSMediaScanner.h new file mode 100644 index 0000000..1c85b46 --- /dev/null +++ b/libs/fsScan/include/FSMediaScanner.h @@ -0,0 +1,52 @@ +/** + * ======================== legal notice ====================== + * + * File: FSMediaScanner.h + * Created: 2. Juli 2012, 13 + * Author: Geronimo + * 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 FSMEDIASCANNER_H +#define FSMEDIASCANNER_H + +#include +#include +#include + +class cAbstractMedia; +class cFSMediaScanner { +public: + cFSMediaScanner(); + virtual ~cFSMediaScanner(); + + cManagedVector &MediaPool(void) { return pool; } + std::map &Categories(void) { return categories; } + cAbstractMedia *FindMedia(const char *LogicalPath); + void Refresh(void); + void SetMediaFactory(cMediaFactory *factory); + +private: + size_t fileBufSize; + cManagedVector pool; + std::map categories; + cMediaFactory *mediaFactory; + }; + +#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: Geronimo - * 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 -#include - -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: Geronimo - * 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 - -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: Geronimo - * 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 -#include - -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 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 deleted file mode 100644 index 51cd44e..0000000 --- a/libs/fsScan/include/FilesystemScanner.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * ======================== legal notice ====================== - * - * File: FilesystemScanner.h - * Created: 2. Juli 2012, 13 - * Author: Geronimo - * 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 - -#include -#include -#include - -class cAbstractMedia; -class cFilesystemScanner { -public: - cFilesystemScanner(); - virtual ~cFilesystemScanner(); - - cManagedVector &MediaPool(void) { return pool; } - std::map &Categories(void) { return categories; } - cAbstractMedia *FindMedia(const char *LogicalPath); - void Refresh(void); - void SetMediaFactory(cMediaFactory *factory); - -private: - size_t fileBufSize; - cManagedVector pool; - std::map categories; - cMediaFactory *mediaFactory; - }; - -#endif /* FILESYSTEMSCANNER_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: Geronimo * 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: Geronimo * 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: Geronimo * 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: Geronimo * 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: Geronimo * 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 -- cgit v1.2.3