summaryrefslogtreecommitdiff
path: root/cmps/serverlib
diff options
context:
space:
mode:
Diffstat (limited to 'cmps/serverlib')
-rw-r--r--cmps/serverlib/include/HTMLListAssembler.h14
-rw-r--r--cmps/serverlib/include/HTTPMediaResponse.h14
-rw-r--r--cmps/serverlib/serverlib.layout4
-rw-r--r--cmps/serverlib/serverlib.layout.save10
-rw-r--r--cmps/serverlib/src/HTMLListAssembler.cc50
-rw-r--r--cmps/serverlib/src/JSonListAssembler.cc31
-rw-r--r--cmps/serverlib/src/MediaFileHandler.cc14
7 files changed, 69 insertions, 68 deletions
diff --git a/cmps/serverlib/include/HTMLListAssembler.h b/cmps/serverlib/include/HTMLListAssembler.h
index 8450130..2b8fa65 100644
--- a/cmps/serverlib/include/HTMLListAssembler.h
+++ b/cmps/serverlib/include/HTMLListAssembler.h
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: HTMLListAssembler.h
* Created: 6. Juli 2012, 09
* 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
@@ -48,7 +48,7 @@ private:
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
index b1ac4ca..298f43c 100644
--- a/cmps/serverlib/include/HTTPMediaResponse.h
+++ b/cmps/serverlib/include/HTTPMediaResponse.h
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: HTTPMediaResponse.h
* Created: 6. Juli 2012, 07
* 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
@@ -37,7 +37,7 @@ public:
private:
cAbstractMedia *media;
-};
+ };
#endif /* HTTPMEDIARESPONSE_H */
diff --git a/cmps/serverlib/serverlib.layout b/cmps/serverlib/serverlib.layout
index cff8ff9..10f38d5 100644
--- a/cmps/serverlib/serverlib.layout
+++ b/cmps/serverlib/serverlib.layout
@@ -11,12 +11,12 @@
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="src/MediaListHandler.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/HTMLListAssembler.cc" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
- <File name="src/HTMLListAssembler.cc" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <File name="src/MediaListHandler.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
diff --git a/cmps/serverlib/serverlib.layout.save b/cmps/serverlib/serverlib.layout.save
index cff8ff9..c8e0376 100644
--- a/cmps/serverlib/serverlib.layout.save
+++ b/cmps/serverlib/serverlib.layout.save
@@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="src/JSonListAssembler.cc" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor>
- <Cursor1 position="1183" topLine="0" />
- </Cursor>
- </File>
<File name="src/AbstractMediaRequestHandler.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
@@ -21,4 +16,9 @@
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
+ <File name="src/JSonListAssembler.cc" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+ <Cursor>
+ <Cursor1 position="1183" topLine="0" />
+ </Cursor>
+ </File>
</CodeBlocks_layout_file>
diff --git a/cmps/serverlib/src/HTMLListAssembler.cc b/cmps/serverlib/src/HTMLListAssembler.cc
index c455fc1..bf190fe 100644
--- a/cmps/serverlib/src/HTMLListAssembler.cc
+++ b/cmps/serverlib/src/HTMLListAssembler.cc
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: HTMLListAssembler.cc
* Created: 6. Juli 2012, 09
* 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 <HTMLListAssembler.h>
@@ -98,27 +98,25 @@ cStringBuilder &cHTMLListAssembler::genDelim(cStringBuilder &sb)
cStringBuilder &cHTMLListAssembler::genMediaLink(cStringBuilder &sb, void *Element, bool odd)
{
cAbstractMedia *m = (cAbstractMedia *)Element;
- cUrl *uri = new cUrl(m->LogicalPath());
- char *lp = uri->ToString();
-
- sb.Append("<a class=\"");
- sb.Append(odd ? "odd" : "even");
- sb.Append("\" href=\"");
- sb.Append(lp);
- free(lp);
- sb.Append("\">");
- switch (m->MediaType()) {
- case cAbstractMedia::Audio: sb.Append("[A] "); break;
- case cAbstractMedia::Movie: sb.Append("[M] "); break;
- case cAbstractMedia::DVDImage: sb.Append("[D] "); break;
- case cAbstractMedia::LegacyVdrRecording: sb.Append("[L] "); break;
- case cAbstractMedia::VdrRecording: sb.Append("[V] "); break;
- case cAbstractMedia::Picture: sb.Append("[P] "); break;
- default: ;
- }
- sb.Append(m->Name());
- sb.Append("</a>");
+ if (m) {
+ sb.Append("<a class=\"");
+ sb.Append(odd ? "odd" : "even");
+ sb.Append("\" href=\"");
+ sb.Append(m->URI());
+ sb.Append("\">");
+ switch (m->MediaType()) {
+ case cAbstractMedia::Audio: sb.Append("[A] "); break;
+ case cAbstractMedia::Movie: sb.Append("[M] "); break;
+ case cAbstractMedia::DVDImage: sb.Append("[D] "); break;
+ case cAbstractMedia::LegacyVdrRecording: sb.Append("[L] "); break;
+ case cAbstractMedia::VdrRecording: sb.Append("[V] "); break;
+ case cAbstractMedia::Picture: sb.Append("[P] "); break;
+ default: ;
+ }
+ sb.Append(m->Name());
+ sb.Append("</a>");
+ }
return sb;
}
diff --git a/cmps/serverlib/src/JSonListAssembler.cc b/cmps/serverlib/src/JSonListAssembler.cc
index f49b8ec..05ff5cc 100644
--- a/cmps/serverlib/src/JSonListAssembler.cc
+++ b/cmps/serverlib/src/JSonListAssembler.cc
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: JSonListAssembler.cc
* Created: 6. Juli 2012, 09
* 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 <JSonListAssembler.h>
@@ -28,6 +28,7 @@
#include <Url.h>
cJSonListAssembler::cJSonListAssembler()
+ : writer(NULL)
{
}
@@ -58,17 +59,17 @@ bool cJSonListAssembler::OpenList(cStringBuilder &sb, std::map<int, size_t> &Cat
bool cJSonListAssembler::AddElement(cStringBuilder &sb, void *ListElement, bool odd)
{
cAbstractMedia *m = (cAbstractMedia *)ListElement;
- cUrl *uri = new cUrl(m->LogicalPath());
- char *lp = uri->ToString();
- writer->Object();
- writer->Key("name").Value(m->Name());
- writer->Key("type").Value(m->MediaType());
- writer->Key("path").Value(lp);
- free(lp);
- writer->EndObject();
+ if (m) {
+ writer->Object();
+ writer->Key("name").Value(m->Name());
+ writer->Key("type").Value(m->MediaType());
+ writer->Key("path").Value(m->URI());
+ writer->EndObject();
- return true;
+ return true;
+ }
+ return false;
}
bool cJSonListAssembler::CloseList(cStringBuilder &sb, size_t total, size_t start, uint delta)
diff --git a/cmps/serverlib/src/MediaFileHandler.cc b/cmps/serverlib/src/MediaFileHandler.cc
index b2e97a3..200c933 100644
--- a/cmps/serverlib/src/MediaFileHandler.cc
+++ b/cmps/serverlib/src/MediaFileHandler.cc
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: MediaFileHandler.cc
* Created: 5. Juli 2012, 08
* 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>
@@ -40,6 +40,8 @@ cMediaFileHandler::~cMediaFileHandler()
cHTTPResponse *cMediaFileHandler::ProcessRequest(cHTTPRequest& Request)
{
+ isyslog("have to find requested media: >%s<", Request.Url().Path());
+
cAbstractMedia *media = FileSystemScanner()->FindMedia(Request.Url().Path());
isyslog("cMediaFileHandler::ProcessRequest ... %0X", media);