summaryrefslogtreecommitdiff
path: root/cmps/serverlib/src/MediaFileHandler.cc
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-07-13 04:26:40 +0200
committergeronimo <geronimo013@gmx.de>2012-07-13 04:26:40 +0200
commit2d48ae784ea6828e8626c32c848f64232d8f35c0 (patch)
treefab114b03e91125783a778b835dd1913b039cebe /cmps/serverlib/src/MediaFileHandler.cc
downloadcmp-2d48ae784ea6828e8626c32c848f64232d8f35c0.tar.gz
cmp-2d48ae784ea6828e8626c32c848f64232d8f35c0.tar.bz2
initial import
Diffstat (limited to 'cmps/serverlib/src/MediaFileHandler.cc')
-rw-r--r--cmps/serverlib/src/MediaFileHandler.cc62
1 files changed, 62 insertions, 0 deletions
diff --git a/cmps/serverlib/src/MediaFileHandler.cc b/cmps/serverlib/src/MediaFileHandler.cc
new file mode 100644
index 0000000..d16a033
--- /dev/null
+++ b/cmps/serverlib/src/MediaFileHandler.cc
@@ -0,0 +1,62 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: MediaFileHandler.cc
+ * 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
+ *
+ * --------------------------------------------------------------
+ */
+#include <MediaFileHandler.h>
+#include <AbstractMedia.h>
+#include <FilesystemScanner.h>
+#include <HTTPRequest.h>
+#include <HTTPMediaResponse.h>
+#include <StringBuilder.h>
+#include <Logging.h>
+
+cMediaFileHandler::cMediaFileHandler()
+{
+}
+
+cMediaFileHandler::~cMediaFileHandler()
+{
+}
+
+cHTTPResponse *cMediaFileHandler::ProcessRequest(cHTTPRequest& Request)
+{
+ cAbstractMedia *media = FileSystemScanner()->FindMedia(Request.Url().Path());
+
+ isyslog("cMediaFileHandler::ProcessRequest ... %0X", media);
+
+ if (!media) return NULL;
+ media->Refresh();
+
+ return new cHTTPMediaResponse(media);
+}
+
+void cMediaFileHandler::Usage(cStringBuilder& sb)
+{
+ isyslog("start of cMediaFileHandler::Usage() ...");
+ sb.Append("<dl><dt><em>");
+ sb.Append("/any/path/to/media/file");
+ sb.Append("</em></dt><dd>");
+ sb.Append("returns the media-file ready to be played by client media-players.");
+ sb.Append("</dd></dl>");
+ isyslog("end of cMediaFileHandler::Usage() ...");
+} \ No newline at end of file