diff options
Diffstat (limited to 'cmps')
31 files changed, 209 insertions, 60 deletions
diff --git a/cmps/main.cc b/cmps/main.cc index c918ada..86e14b7 100644 --- a/cmps/main.cc +++ b/cmps/main.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: main.cc - * Created: 2. Juli 2012, 16:51 + * Created: 2. Juli 2012, 16 * 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 <HTTPServer.h> diff --git a/cmps/nbproject/Makefile-Debug.mk b/cmps/nbproject/Makefile-Debug.mk index a3a76de..183ac43 100644 --- a/cmps/nbproject/Makefile-Debug.mk +++ b/cmps/nbproject/Makefile-Debug.mk @@ -44,6 +44,7 @@ TESTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tests TESTFILES= \ ${TESTDIR}/TestFiles/f1 \ ${TESTDIR}/TestFiles/f3 \ + ${TESTDIR}/TestFiles/f5 \ ${TESTDIR}/TestFiles/f2 \ ${TESTDIR}/TestFiles/f4 @@ -104,6 +105,10 @@ ${TESTDIR}/TestFiles/f3: ${TESTDIR}/tests/ConnectionHandlerTest.o ${OBJECTFILES: ${MKDIR} -p ${TESTDIR}/TestFiles ${LINK.cc} -o ${TESTDIR}/TestFiles/f3 $^ ${LDLIBSOPTIONS} +${TESTDIR}/TestFiles/f5: ${TESTDIR}/tests/FileSystemTest.o ${OBJECTFILES:%.o=%_nomain.o} + ${MKDIR} -p ${TESTDIR}/TestFiles + ${LINK.cc} -o ${TESTDIR}/TestFiles/f5 $^ ${LDLIBSOPTIONS} + ${TESTDIR}/TestFiles/f2: ${TESTDIR}/tests/FScanTest.o ${OBJECTFILES:%.o=%_nomain.o} ${MKDIR} -p ${TESTDIR}/TestFiles ${LINK.cc} -o ${TESTDIR}/TestFiles/f2 $^ ${LDLIBSOPTIONS} @@ -125,6 +130,12 @@ ${TESTDIR}/tests/ConnectionHandlerTest.o: tests/ConnectionHandlerTest.cc $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/fsScan/include -I../libs/networking/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/ConnectionHandlerTest.o tests/ConnectionHandlerTest.cc +${TESTDIR}/tests/FileSystemTest.o: tests/FileSystemTest.cc + ${MKDIR} -p ${TESTDIR}/tests + ${RM} $@.d + $(COMPILE.cc) -g -Wall -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude -Iserverlib/include -I../libs/fsScan/include -I../libs/networking/include -I../libs/util/include -I../libs/vdr/include -I. -MMD -MP -MF $@.d -o ${TESTDIR}/tests/FileSystemTest.o tests/FileSystemTest.cc + + ${TESTDIR}/tests/FScanTest.o: tests/FScanTest.cc ${MKDIR} -p ${TESTDIR}/tests ${RM} $@.d @@ -156,6 +167,7 @@ ${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc then \ ${TESTDIR}/TestFiles/f1 || true; \ ${TESTDIR}/TestFiles/f3 || true; \ + ${TESTDIR}/TestFiles/f5 || true; \ ${TESTDIR}/TestFiles/f2 || true; \ ${TESTDIR}/TestFiles/f4 || true; \ else \ diff --git a/cmps/nbproject/Makefile-Release.mk b/cmps/nbproject/Makefile-Release.mk index 65f3816..29abff0 100644 --- a/cmps/nbproject/Makefile-Release.mk +++ b/cmps/nbproject/Makefile-Release.mk @@ -45,6 +45,7 @@ TESTFILES= \ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps \ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps \ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps \ + ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps \ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps # C Compiler Flags @@ -89,6 +90,10 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${TESTDIR}/tests/ConnectionHand ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps $^ ${LDLIBSOPTIONS} +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${TESTDIR}/tests/FileSystemTest.o ${OBJECTFILES:%.o=%_nomain.o} + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} + ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps $^ ${LDLIBSOPTIONS} + ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps: ${TESTDIR}/tests/FScanTest.o ${OBJECTFILES:%.o=%_nomain.o} ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps $^ ${LDLIBSOPTIONS} @@ -110,6 +115,12 @@ ${TESTDIR}/tests/ConnectionHandlerTest.o: tests/ConnectionHandlerTest.cc $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${TESTDIR}/tests/ConnectionHandlerTest.o tests/ConnectionHandlerTest.cc +${TESTDIR}/tests/FileSystemTest.o: tests/FileSystemTest.cc + ${MKDIR} -p ${TESTDIR}/tests + ${RM} $@.d + $(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${TESTDIR}/tests/FileSystemTest.o tests/FileSystemTest.cc + + ${TESTDIR}/tests/FScanTest.o: tests/FScanTest.cc ${MKDIR} -p ${TESTDIR}/tests ${RM} $@.d @@ -143,6 +154,7 @@ ${OBJECTDIR}/main_nomain.o: ${OBJECTDIR}/main.o main.cc ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps || true; \ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps || true; \ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps || true; \ + ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cmps || true; \ else \ ./${TEST} || true; \ fi diff --git a/cmps/nbproject/configurations.xml b/cmps/nbproject/configurations.xml index 2138f97..e30f086 100644 --- a/cmps/nbproject/configurations.xml +++ b/cmps/nbproject/configurations.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<configurationDescriptor version="80"> +<configurationDescriptor version="84"> <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT"> <logicalFolder name="HeaderFiles" displayName="Header Files" @@ -30,6 +30,12 @@ kind="TEST"> <itemPath>tests/ConnectionHandlerTest.cc</itemPath> </logicalFolder> + <logicalFolder name="f5" + displayName="FileSystemTest" + projectFiles="true" + kind="TEST"> + <itemPath>tests/FileSystemTest.cc</itemPath> + </logicalFolder> <logicalFolder name="f2" displayName="FScanTest" projectFiles="true" @@ -202,6 +208,21 @@ <output>${TESTDIR}/TestFiles/f4</output> </linkerTool> </folder> + <folder path="TestFiles/f5"> + <cTool> + <incDir> + <pElem>.</pElem> + </incDir> + </cTool> + <ccTool> + <incDir> + <pElem>.</pElem> + </incDir> + </ccTool> + <linkerTool> + <output>${TESTDIR}/TestFiles/f5</output> + </linkerTool> + </folder> </conf> <conf name="Release" type="1"> <toolsSet> diff --git a/cmps/nbproject/private/configurations.xml b/cmps/nbproject/private/configurations.xml index 10e0756..8cc427d 100644 --- a/cmps/nbproject/private/configurations.xml +++ b/cmps/nbproject/private/configurations.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<configurationDescriptor version="80"> +<configurationDescriptor version="84"> <projectmakefile>Makefile</projectmakefile> <confs> <conf name="Debug" type="1"> diff --git a/cmps/nbproject/private/private.xml b/cmps/nbproject/private/private.xml index a38cae6..6b4ef19 100644 --- a/cmps/nbproject/private/private.xml +++ b/cmps/nbproject/private/private.xml @@ -5,4 +5,5 @@ <activeConfIndexElem>0</activeConfIndexElem> </data> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/> + <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> </project-private> diff --git a/cmps/serverlib/include/AbstractMediaRequestHandler.h b/cmps/serverlib/include/AbstractMediaRequestHandler.h index ff57e33..f92e87c 100644 --- a/cmps/serverlib/include/AbstractMediaRequestHandler.h +++ b/cmps/serverlib/include/AbstractMediaRequestHandler.h @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: AbstractMediaRequestHandler.h - * Created: 5. Juli 2012, 07:58 + * Created: 5. Juli 2012, 07 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/include/CommandHandler.h b/cmps/serverlib/include/CommandHandler.h index 42436da..ee4ddbb 100644 --- a/cmps/serverlib/include/CommandHandler.h +++ b/cmps/serverlib/include/CommandHandler.h @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: CommandHandler.h - * Created: 5. Juli 2012, 16:06 + * Created: 5. Juli 2012, 16 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/include/HTMLListAssembler.h b/cmps/serverlib/include/HTMLListAssembler.h index d53d861..8450130 100644 --- a/cmps/serverlib/include/HTMLListAssembler.h +++ b/cmps/serverlib/include/HTMLListAssembler.h @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: HTMLListAssembler.h - * Created: 6. Juli 2012, 09:55 + * Created: 6. Juli 2012, 09 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/include/HTTPMediaResponse.h b/cmps/serverlib/include/HTTPMediaResponse.h index 1c7827e..b1ac4ca 100644 --- a/cmps/serverlib/include/HTTPMediaResponse.h +++ b/cmps/serverlib/include/HTTPMediaResponse.h @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: HTTPMediaResponse.h - * Created: 6. Juli 2012, 07:44 + * Created: 6. Juli 2012, 07 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/include/JSonListAssembler.h b/cmps/serverlib/include/JSonListAssembler.h index 6185508..463c391 100644 --- a/cmps/serverlib/include/JSonListAssembler.h +++ b/cmps/serverlib/include/JSonListAssembler.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: JSonListAssembler.h - * Created: 6. Juli 2012, 09:53 + * 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 JSONLISTASSEMBLER_H diff --git a/cmps/serverlib/include/MediaFileHandler.h b/cmps/serverlib/include/MediaFileHandler.h index 01c7b83..81836d0 100644 --- a/cmps/serverlib/include/MediaFileHandler.h +++ b/cmps/serverlib/include/MediaFileHandler.h @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: MediaFileHandler.h - * Created: 5. Juli 2012, 08:06 + * Created: 5. Juli 2012, 08 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/include/MediaListHandler.h b/cmps/serverlib/include/MediaListHandler.h index cc3127c..1662cc8 100644 --- a/cmps/serverlib/include/MediaListHandler.h +++ b/cmps/serverlib/include/MediaListHandler.h @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: MediaListHandler.h - * Created: 5. Juli 2012, 08:06 + * Created: 5. Juli 2012, 08 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/serverlib.layout b/cmps/serverlib/serverlib.layout index d8fea17..cff8ff9 100644 --- a/cmps/serverlib/serverlib.layout +++ b/cmps/serverlib/serverlib.layout @@ -1,24 +1,24 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <CodeBlocks_layout_file> <ActiveTarget name="Debug" /> - <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/JSonListAssembler.cc" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <Cursor> - <Cursor1 position="0" topLine="0" /> + <Cursor1 position="1183" 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/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" /> </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"> + <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> </File> - <File name="src/JSonListAssembler.cc" open="1" top="1" tabpos="7" 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="1183" topLine="0" /> + <Cursor1 position="0" topLine="0" /> </Cursor> </File> </CodeBlocks_layout_file> diff --git a/cmps/serverlib/serverlib.layout.save b/cmps/serverlib/serverlib.layout.save index 6d13f5b..cff8ff9 100644 --- a/cmps/serverlib/serverlib.layout.save +++ b/cmps/serverlib/serverlib.layout.save @@ -1,22 +1,22 @@ <?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="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <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="1138" topLine="0" /> + <Cursor1 position="1183" 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/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" /> </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> </File> - <File name="src/AbstractMediaRequestHandler.cc" open="0" top="0" tabpos="2" 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> diff --git a/cmps/serverlib/src/AbstractMediaRequestHandler.cc b/cmps/serverlib/src/AbstractMediaRequestHandler.cc index b65ad13..ad845b6 100644 --- a/cmps/serverlib/src/AbstractMediaRequestHandler.cc +++ b/cmps/serverlib/src/AbstractMediaRequestHandler.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: AbstractMediaRequestHandler.cc - * Created: 5. Juli 2012, 07:58 + * Created: 5. Juli 2012, 07 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/src/CommandHandler.cc b/cmps/serverlib/src/CommandHandler.cc index b1a17b8..5449d25 100644 --- a/cmps/serverlib/src/CommandHandler.cc +++ b/cmps/serverlib/src/CommandHandler.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: CommandHandler.cc - * Created: 5. Juli 2012, 16:06 + * Created: 5. Juli 2012, 16 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/src/HTMLListAssembler.cc b/cmps/serverlib/src/HTMLListAssembler.cc index 8ef3261..c455fc1 100644 --- a/cmps/serverlib/src/HTMLListAssembler.cc +++ b/cmps/serverlib/src/HTMLListAssembler.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: HTMLListAssembler.cc - * Created: 6. Juli 2012, 09:55 + * Created: 6. Juli 2012, 09 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * @@ -25,6 +25,7 @@ #include <HTMLListAssembler.h> #include <AbstractMedia.h> #include <StringBuilder.h> +#include <Url.h> #include <tools.h> cHTMLListAssembler::cHTMLListAssembler() @@ -97,11 +98,14 @@ 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(m->LogicalPath()); + sb.Append(lp); + free(lp); sb.Append("\">"); switch (m->MediaType()) { case cAbstractMedia::Audio: sb.Append("[A] "); break; diff --git a/cmps/serverlib/src/HTTPMediaResponse.cc b/cmps/serverlib/src/HTTPMediaResponse.cc index 667d114..ca08576 100644 --- a/cmps/serverlib/src/HTTPMediaResponse.cc +++ b/cmps/serverlib/src/HTTPMediaResponse.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: HTTPMediaResponse.cc - * Created: 6. Juli 2012, 07:44 + * Created: 6. Juli 2012, 07 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/src/JSonListAssembler.cc b/cmps/serverlib/src/JSonListAssembler.cc index 8660953..f49b8ec 100644 --- a/cmps/serverlib/src/JSonListAssembler.cc +++ b/cmps/serverlib/src/JSonListAssembler.cc @@ -1,30 +1,31 @@ /** * ======================== legal notice ====================== - * + * * File: JSonListAssembler.cc - * Created: 6. Juli 2012, 09:53 + * 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> #include <AbstractMedia.h> #include <JSonWriter.h> +#include <Url.h> cJSonListAssembler::cJSonListAssembler() { @@ -57,11 +58,14 @@ 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(m->LogicalPath()); + writer->Key("path").Value(lp); + free(lp); writer->EndObject(); return true; diff --git a/cmps/serverlib/src/MediaFileHandler.cc b/cmps/serverlib/src/MediaFileHandler.cc index d16a033..b2e97a3 100644 --- a/cmps/serverlib/src/MediaFileHandler.cc +++ b/cmps/serverlib/src/MediaFileHandler.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: MediaFileHandler.cc - * Created: 5. Juli 2012, 08:06 + * Created: 5. Juli 2012, 08 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/serverlib/src/MediaListHandler.cc b/cmps/serverlib/src/MediaListHandler.cc index 029c137..cdb2b21 100644 --- a/cmps/serverlib/src/MediaListHandler.cc +++ b/cmps/serverlib/src/MediaListHandler.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: MediaListHandler.cc - * Created: 5. Juli 2012, 08:06 + * Created: 5. Juli 2012, 08 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/tests/CodecTest.cc b/cmps/tests/CodecTest.cc index 071ff7b..3403810 100644 --- a/cmps/tests/CodecTest.cc +++ b/cmps/tests/CodecTest.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: CodecTest.cc - * Created: 09.07.2012, 05:44:50 + * Created: 09.07.2012, 05 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * @@ -35,6 +35,10 @@ static const char *TT[] = { , "http://localhost:12345/test/Mukke/36%20%20%20130%20-%20R.I.O.%20ft%20Jerry%20Ropero%20vs.%20Mendonca%20-%20Do%20Rio-De%20Janeiro%20Berinbau%20(Bootleg%20Edit).mp3" , "http://localhost:12345/import/Das_Verm%C3%A4chtnis_der_Tempelritter/2012-07-02.22.10.36-0.rec" , NULL +, "file:///media/audio/Collection/Rock/XIII. Století/Vampire Songs: Tajemství gothických archivů/(1 - 05) Smutné časy.mp3" +, "file:///media/audio/Collection/Rock/XIII. Století/Vampire Songs: Tajemství gothických archivů/(1 - 06) Starý hrabě.mp3" +, "file:///media/audio/Collection/Rock/XIII. Století/Nosferatu/(1 - 03) Nevěsta temnot.mp3" +, NULL }; void test1() @@ -54,6 +58,20 @@ void test1() void test2() { std::cout << "CodecTest test 2" << std::endl; + cURLEncoder *ue = new cURLEncoder(); + const char **p; + char *newText; + + for (p = TT + 8; p && *p; ++p) { + newText = ue->Encode(*p); + std::cout << "original: " << *p << std::endl; + std::cout << "encoded.: " << newText << std::endl << std::endl; + } +} + +void test3() +{ + std::cout << "CodecTest test 3" << std::endl; std::cout << "%TEST_FAILED% time=0 testname=test2 (CodecTest) message=error message sample" << std::endl; } @@ -66,9 +84,9 @@ int main(int argc, char** argv) test1(); std::cout << "%TEST_FINISHED% time=0 test1 (CodecTest)" << std::endl; -// std::cout << "%TEST_STARTED% test2 (CodecTest)\n" << std::endl; -// test2(); -// std::cout << "%TEST_FINISHED% time=0 test2 (CodecTest)" << std::endl; + std::cout << "%TEST_STARTED% test2 (CodecTest)\n" << std::endl; + test2(); + std::cout << "%TEST_FINISHED% time=0 test2 (CodecTest)" << std::endl; std::cout << "%SUITE_FINISHED% time=0" << std::endl; diff --git a/cmps/tests/ConnectionHandlerTest.cc b/cmps/tests/ConnectionHandlerTest.cc index e32fbb3..6e0257b 100644 --- a/cmps/tests/ConnectionHandlerTest.cc +++ b/cmps/tests/ConnectionHandlerTest.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: ConnectionHandlerTest.cc - * Created: 10.07.2012, 05:48:23 + * Created: 10.07.2012, 05 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/tests/DirTest.cc b/cmps/tests/DirTest.cc index 4a1f1a7..b6270a9 100644 --- a/cmps/tests/DirTest.cc +++ b/cmps/tests/DirTest.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: DirTest.cc - * Created: 02.07.2012, 18:07:18 + * Created: 02.07.2012, 18 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/tests/FScanTest.cc b/cmps/tests/FScanTest.cc index 86f0895..2684557 100644 --- a/cmps/tests/FScanTest.cc +++ b/cmps/tests/FScanTest.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: FScanTest.cc - * Created: 02.07.2012, 16:57:48 + * Created: 02.07.2012, 16 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * @@ -77,7 +77,7 @@ void FScanTest::test4() cAbstractMedia *media; std::cout << "FScanTest test 4" << std::endl; - scanner.SetMediaFactory(new cMediaFactory("/media")); + scanner.SetMediaFactory(new cMediaFactory("/media/video")); uint64_t start = cTimeMs::Now(); scanner.Refresh(); diff --git a/cmps/tests/FileSystemTest.cc b/cmps/tests/FileSystemTest.cc new file mode 100644 index 0000000..99a76d0 --- /dev/null +++ b/cmps/tests/FileSystemTest.cc @@ -0,0 +1,77 @@ +/** + * ======================== legal notice ====================== + * + * File: FileSystemTest.cc + * Created: 21.07.2012, 12:40:48 + * 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 <stdlib.h> +#include <iostream> +#include <FileSystem.h> +#include <File.h> + +/* + * Simple C++ Test Suite + */ + +void test1() +{ + std::cout << "FileSystemTest test 1" << std::endl; + cFile *f = new cFile("/media/xchange/"); + + std::cout << "got file: " << f->AbsolutePath() << std::endl; + + cFile *other = f->Parent(); + + std::cout << "parent is file: " << other->AbsolutePath() << std::endl; + + cFile *newOne = new cFile(*other, "/video/test/blah"); + + std::cout << "assembled file: " << newOne->AbsolutePath() << std::endl; + + delete newOne; + delete other; + delete f; +} + +void test2() +{ + std::cout << "FileSystemTest test 2" << std::endl; + std::cout << "%TEST_FAILED% time=0 testname=test2 (FileSystemTest) message=error message sample" << std::endl; +} + +int main(int argc, char** argv) +{ + std::cout << "%SUITE_STARTING% FileSystemTest" << std::endl; + std::cout << "%SUITE_STARTED%" << std::endl; + + std::cout << "%TEST_STARTED% test1 (FileSystemTest)" << std::endl; + test1(); + std::cout << "%TEST_FINISHED% time=0 test1 (FileSystemTest)" << std::endl; + + std::cout << "%TEST_STARTED% test2 (FileSystemTest)\n" << std::endl; + test2(); + std::cout << "%TEST_FINISHED% time=0 test2 (FileSystemTest)" << std::endl; + + std::cout << "%SUITE_FINISHED% time=0" << std::endl; + + return (EXIT_SUCCESS); +} + diff --git a/cmps/tests/JSonTest.cc b/cmps/tests/JSonTest.cc index 21fc394..422a845 100644 --- a/cmps/tests/JSonTest.cc +++ b/cmps/tests/JSonTest.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: JSonTest.cc - * Created: 12.07.2012, 07:31:46 + * Created: 12.07.2012, 07 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/tests/StringBuilderTest.cc b/cmps/tests/StringBuilderTest.cc index 4a0443b..bb07d2e 100644 --- a/cmps/tests/StringBuilderTest.cc +++ b/cmps/tests/StringBuilderTest.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: StringBuilderTest.cc - * Created: 06.07.2012, 18:28:08 + * Created: 06.07.2012, 18 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/tests/URLTest.cc b/cmps/tests/URLTest.cc index 9dc69c3..5f13ca0 100644 --- a/cmps/tests/URLTest.cc +++ b/cmps/tests/URLTest.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: URLTest.cc - * Created: 04.07.2012, 09:25:57 + * Created: 04.07.2012, 09 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * diff --git a/cmps/tests/UTF8Test.cc b/cmps/tests/UTF8Test.cc index 70c7cc1..fa417b8 100644 --- a/cmps/tests/UTF8Test.cc +++ b/cmps/tests/UTF8Test.cc @@ -2,7 +2,7 @@ * ======================== legal notice ====================== * * File: UTF8Test.cc - * Created: 05.07.2012, 15:19:07 + * Created: 05.07.2012, 15 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: cmps - the backend (server) part of compound media player * |