diff options
author | geronimo <geronimo013@gmx.de> | 2012-07-13 04:26:40 +0200 |
---|---|---|
committer | geronimo <geronimo013@gmx.de> | 2012-07-13 04:26:40 +0200 |
commit | 2d48ae784ea6828e8626c32c848f64232d8f35c0 (patch) | |
tree | fab114b03e91125783a778b835dd1913b039cebe /cmps/serverlib/include | |
download | cmp-2d48ae784ea6828e8626c32c848f64232d8f35c0.tar.gz cmp-2d48ae784ea6828e8626c32c848f64232d8f35c0.tar.bz2 |
initial import
Diffstat (limited to 'cmps/serverlib/include')
-rw-r--r-- | cmps/serverlib/include/AbstractMediaRequestHandler.h | 42 | ||||
-rw-r--r-- | cmps/serverlib/include/CommandHandler.h | 45 | ||||
-rw-r--r-- | cmps/serverlib/include/HTMLListAssembler.h | 54 | ||||
-rw-r--r-- | cmps/serverlib/include/HTTPMediaResponse.h | 43 | ||||
-rw-r--r-- | cmps/serverlib/include/JSonListAssembler.h | 46 | ||||
-rw-r--r-- | cmps/serverlib/include/MediaFileHandler.h | 43 | ||||
-rw-r--r-- | cmps/serverlib/include/MediaListHandler.h | 58 |
7 files changed, 331 insertions, 0 deletions
diff --git a/cmps/serverlib/include/AbstractMediaRequestHandler.h b/cmps/serverlib/include/AbstractMediaRequestHandler.h new file mode 100644 index 0000000..ff57e33 --- /dev/null +++ b/cmps/serverlib/include/AbstractMediaRequestHandler.h @@ -0,0 +1,42 @@ +/** + * ======================== legal notice ====================== + * + * File: AbstractMediaRequestHandler.h + * Created: 5. Juli 2012, 07:58 + * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> + * Project: cmps - the backend (server) part of compound media player + * + * CMP - compound media player + * + * is a client/server mediaplayer intended to play any media from any workstation + * without the need to export or mount shares. cmps is an easy to use backend + * with a (ready to use) HTML-interface. Additionally the backend supports + * authentication via HTTP-digest authorization. + * cmpc is a client with vdr-like osd-menues. + * + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! + * published under Creative Commons by-sa + * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * + * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * + * -------------------------------------------------------------- + */ +#ifndef ABSTRACTMEDIAREQUESTHANDLER_H +#define ABSTRACTMEDIAREQUESTHANDLER_H + +#include <HTTPRequestHandler.h> + +class cFilesystemScanner; +class cAbstractMediaRequestHandler : public cHTTPRequestHandler { +public: + virtual ~cAbstractMediaRequestHandler(); + static void SetFilesystemScanner(cFilesystemScanner *Scanner); + +protected: + cAbstractMediaRequestHandler(); + cFilesystemScanner *FileSystemScanner(void); + }; + +#endif /* ABSTRACTMEDIAREQUESTHANDLER_H */ + diff --git a/cmps/serverlib/include/CommandHandler.h b/cmps/serverlib/include/CommandHandler.h new file mode 100644 index 0000000..42436da --- /dev/null +++ b/cmps/serverlib/include/CommandHandler.h @@ -0,0 +1,45 @@ +/** + * ======================== legal notice ====================== + * + * File: CommandHandler.h + * Created: 5. Juli 2012, 16:06 + * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> + * Project: cmps - the backend (server) part of compound media player + * + * CMP - compound media player + * + * is a client/server mediaplayer intended to play any media from any workstation + * without the need to export or mount shares. cmps is an easy to use backend + * with a (ready to use) HTML-interface. Additionally the backend supports + * authentication via HTTP-digest authorization. + * cmpc is a client with vdr-like osd-menues. + * + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! + * published under Creative Commons by-sa + * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * + * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * + * -------------------------------------------------------------- + */ +#ifndef COMMANDHANDLER_H +#define COMMANDHANDLER_H + +#include <AbstractMediaRequestHandler.h> + +typedef int (*CommandCallback)(void *, cHTTPRequest &); + +class cCommandHandler : public cAbstractMediaRequestHandler { +public: + cCommandHandler(); + virtual ~cCommandHandler(); + + virtual cHTTPResponse *ProcessRequest(cHTTPRequest &Request); + virtual void Usage(cStringBuilder &sb); + + static void RegisterCallback(const char *CommandID, CommandCallback cb, void *opaque); + static void Cleanup(void); + }; + +#endif /* COMMANDHANDLER_H */ + diff --git a/cmps/serverlib/include/HTMLListAssembler.h b/cmps/serverlib/include/HTMLListAssembler.h new file mode 100644 index 0000000..d53d861 --- /dev/null +++ b/cmps/serverlib/include/HTMLListAssembler.h @@ -0,0 +1,54 @@ +/** + * ======================== legal notice ====================== + * + * File: HTMLListAssembler.h + * Created: 6. Juli 2012, 09:55 + * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> + * Project: cmps - the backend (server) part of compound media player + * + * CMP - compound media player + * + * is a client/server mediaplayer intended to play any media from any workstation + * without the need to export or mount shares. cmps is an easy to use backend + * with a (ready to use) HTML-interface. Additionally the backend supports + * authentication via HTTP-digest authorization. + * cmpc is a client with vdr-like osd-menues. + * + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! + * published under Creative Commons by-sa + * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * + * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * + * -------------------------------------------------------------- + */ +#ifndef HTMLLISTASSEMBLER_H +#define HTMLLISTASSEMBLER_H + +#include <AbstractListAssembler.h> +#include <map> + +class cStringBuilder; +class cHTMLListAssembler : public cAbstractListAssembler { +public: + cHTMLListAssembler(); + virtual ~cHTMLListAssembler(); + + virtual const char *MediaType(void) const; + +protected: + bool OpenList(cStringBuilder &sb, std::map<int, size_t> &Categories, size_t total, size_t start = 0, uint delta = 40); + bool AddElement(cStringBuilder &sb, void *ListElement, bool odd); + bool CloseList(cStringBuilder &sb, size_t total, size_t start = 0, uint delta = 40); + +private: + cStringBuilder &genHTMLPrefix(cStringBuilder &sb, const char *Title); + cStringBuilder &genDelim(cStringBuilder &sb); + cStringBuilder &genMediaLink(cStringBuilder &sb, void *ListElement, bool odd); + cStringBuilder &genNextLink(cStringBuilder &sb, int n); + cStringBuilder &genPreviousLink(cStringBuilder &sb, int n); + cStringBuilder &genTypeMenu(cStringBuilder &sb, std::map<int, size_t> &Categories); +}; + +#endif /* HTMLLISTASSEMBLER_H */ + diff --git a/cmps/serverlib/include/HTTPMediaResponse.h b/cmps/serverlib/include/HTTPMediaResponse.h new file mode 100644 index 0000000..1c7827e --- /dev/null +++ b/cmps/serverlib/include/HTTPMediaResponse.h @@ -0,0 +1,43 @@ +/** + * ======================== legal notice ====================== + * + * File: HTTPMediaResponse.h + * Created: 6. Juli 2012, 07:44 + * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> + * Project: cmps - the backend (server) part of compound media player + * + * CMP - compound media player + * + * is a client/server mediaplayer intended to play any media from any workstation + * without the need to export or mount shares. cmps is an easy to use backend + * with a (ready to use) HTML-interface. Additionally the backend supports + * authentication via HTTP-digest authorization. + * cmpc is a client with vdr-like osd-menues. + * + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! + * published under Creative Commons by-sa + * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * + * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * + * -------------------------------------------------------------- + */ +#ifndef HTTPMEDIARESPONSE_H +#define HTTPMEDIARESPONSE_H + +#include <HTTPFileResponse.h> +#include <AbstractMedia.h> + +class cHTTPMediaResponse : public cHTTPFileResponse { +public: + cHTTPMediaResponse(cAbstractMedia *Media); + virtual ~cHTTPMediaResponse(); + + virtual size_t ReadContentChunk(char *Buf, size_t bufSize); + +private: + cAbstractMedia *media; +}; + +#endif /* HTTPMEDIARESPONSE_H */ + diff --git a/cmps/serverlib/include/JSonListAssembler.h b/cmps/serverlib/include/JSonListAssembler.h new file mode 100644 index 0000000..bfc68ed --- /dev/null +++ b/cmps/serverlib/include/JSonListAssembler.h @@ -0,0 +1,46 @@ +/** + * ======================== legal notice ====================== + * + * File: JSonListAssembler.h + * Created: 6. Juli 2012, 09:53 + * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> + * Project: cmps - the backend (server) part of compound media player + * + * CMP - compound media player + * + * is a client/server mediaplayer intended to play any media from any workstation + * without the need to export or mount shares. cmps is an easy to use backend + * with a (ready to use) HTML-interface. Additionally the backend supports + * authentication via HTTP-digest authorization. + * cmpc is a client with vdr-like osd-menues. + * + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! + * published under Creative Commons by-sa + * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * + * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * + * -------------------------------------------------------------- + */ +#ifndef JSONLISTASSEMBLER_H +#define JSONLISTASSEMBLER_H + +#include <AbstractListAssembler.h> +#include <map> + +class cStringBuilder; +class cJSonListAssembler : public cAbstractListAssembler { +public: + cJSonListAssembler(); + virtual ~cJSonListAssembler(); + + virtual const char *MediaType(void) const; + +protected: + virtual bool OpenList(cStringBuilder &sb, std::map<int, size_t> &Categories, size_t total, size_t start = 0, uint delta = 40); + virtual bool AddElement(cStringBuilder &sb, void *ListElement, bool odd); + virtual bool CloseList(cStringBuilder &sb, size_t total, size_t start = 0, uint delta = 40); +}; + +#endif /* JSONLISTASSEMBLER_H */ + diff --git a/cmps/serverlib/include/MediaFileHandler.h b/cmps/serverlib/include/MediaFileHandler.h new file mode 100644 index 0000000..01c7b83 --- /dev/null +++ b/cmps/serverlib/include/MediaFileHandler.h @@ -0,0 +1,43 @@ +/** + * ======================== legal notice ====================== + * + * File: MediaFileHandler.h + * Created: 5. Juli 2012, 08:06 + * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> + * Project: cmps - the backend (server) part of compound media player + * + * CMP - compound media player + * + * is a client/server mediaplayer intended to play any media from any workstation + * without the need to export or mount shares. cmps is an easy to use backend + * with a (ready to use) HTML-interface. Additionally the backend supports + * authentication via HTTP-digest authorization. + * cmpc is a client with vdr-like osd-menues. + * + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! + * published under Creative Commons by-sa + * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * + * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * + * -------------------------------------------------------------- + */ +#ifndef MEDIAFILEHANDLER_H +#define MEDIAFILEHANDLER_H + +#include <AbstractMediaRequestHandler.h> + +class cHTTPRequest; +class cHTTPResponse; +class cStringBuilder; +class cMediaFileHandler : public cAbstractMediaRequestHandler { +public: + cMediaFileHandler(); + virtual ~cMediaFileHandler(); + + virtual cHTTPResponse *ProcessRequest(cHTTPRequest &Request); + virtual void Usage(cStringBuilder &sb); + }; + +#endif /* MEDIAFILEHANDLER_H */ + diff --git a/cmps/serverlib/include/MediaListHandler.h b/cmps/serverlib/include/MediaListHandler.h new file mode 100644 index 0000000..cc3127c --- /dev/null +++ b/cmps/serverlib/include/MediaListHandler.h @@ -0,0 +1,58 @@ +/** + * ======================== legal notice ====================== + * + * File: MediaListHandler.h + * Created: 5. Juli 2012, 08:06 + * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> + * Project: cmps - the backend (server) part of compound media player + * + * CMP - compound media player + * + * is a client/server mediaplayer intended to play any media from any workstation + * without the need to export or mount shares. cmps is an easy to use backend + * with a (ready to use) HTML-interface. Additionally the backend supports + * authentication via HTTP-digest authorization. + * cmpc is a client with vdr-like osd-menues. + * + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! + * published under Creative Commons by-sa + * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * + * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * + * -------------------------------------------------------------- + */ +#ifndef MEDIALISTHANDLER_H +#define MEDIALISTHANDLER_H + +#include <AbstractMediaRequestHandler.h> +#include <string> +#include <tr1/unordered_map> + +class cHTTPRequest; +class cHTTPResponse; +class cAbstractListAssembler; +class cStringBuilder; +class cMediaListHandler : public cAbstractMediaRequestHandler { +public: + typedef std::tr1::unordered_map<std::string, cAbstractListAssembler *> AssemblerList; + + cMediaListHandler(); + virtual ~cMediaListHandler(); + + virtual cHTTPResponse *ProcessRequest(cHTTPRequest &Request); + virtual void Usage(cStringBuilder &sb); + + void SetListAssembler(const char *ID, cAbstractListAssembler *assembler); + void SetDefaultListAssembler(cAbstractListAssembler *assembler); + +protected: + cAbstractListAssembler *ListAssembler(const char *ID = NULL); + +private: + AssemblerList listAssemblers; + cAbstractListAssembler *defaultListAssembler; + }; + +#endif /* MEDIALISTHANDLER_H */ + |