From ad667186c0c45cfca9d3f153faec7ce35545b238 Mon Sep 17 00:00:00 2001 From: geronimo Date: Mon, 30 Jul 2012 17:51:05 +0200 Subject: created more readers --- tests/MetaScanTest/MetaScanTest.cbp | 4 +- tests/MetaScanTest/MetaScanTest.depend | 27 ++++++++++-- tests/MetaScanTest/MetaScanTest.layout | 2 +- tests/MetaScanTest/main.cpp | 76 ++++++++++++++++++++++++++++------ 4 files changed, 90 insertions(+), 19 deletions(-) (limited to 'tests/MetaScanTest') diff --git a/tests/MetaScanTest/MetaScanTest.cbp b/tests/MetaScanTest/MetaScanTest.cbp index 832ce4a..31b7674 100644 --- a/tests/MetaScanTest/MetaScanTest.cbp +++ b/tests/MetaScanTest/MetaScanTest.cbp @@ -39,14 +39,14 @@ - + - + diff --git a/tests/MetaScanTest/MetaScanTest.depend b/tests/MetaScanTest/MetaScanTest.depend index aa86b49..4a9fb68 100644 --- a/tests/MetaScanTest/MetaScanTest.depend +++ b/tests/MetaScanTest/MetaScanTest.depend @@ -1,9 +1,11 @@ # depslib dependency file v1.0 -1343547065 source:/d/linux/CMP/tests/MetaScanTest/main.cpp +1343662973 source:/d/linux/CMP/tests/MetaScanTest/main.cpp + + @@ -13,16 +15,33 @@ + 1343485153 /d/linux/CMP/libs/IO/include/File.h -1343485153 /d/linux/CMP/libs/IO/include/FileReader.h +1343628880 /d/linux/CMP/libs/IO/include/FileReader.h + -1343485153 /d/linux/CMP/libs/IO/include/LineReader.h +1343629066 /d/linux/CMP/libs/IO/include/LineReader.h -1343538490 /d/linux/CMP/libs/IO/include/ConfigReader.h +1343653800 /d/linux/CMP/libs/IO/include/ConfigReader.h +1343628826 /d/linux/CMP/libs/IO/include/Reader.h + +1343629103 /d/linux/CMP/libs/IO/include/CommandReader.h + + + + +1343655505 /d/linux/CMP/libs/mediaScan/include/MediainfoReader.h + + + + +1343622277 /d/linux/CMP/libs/util/include/util.h + + diff --git a/tests/MetaScanTest/MetaScanTest.layout b/tests/MetaScanTest/MetaScanTest.layout index d189d61..0daa8b2 100644 --- a/tests/MetaScanTest/MetaScanTest.layout +++ b/tests/MetaScanTest/MetaScanTest.layout @@ -3,7 +3,7 @@ - + diff --git a/tests/MetaScanTest/main.cpp b/tests/MetaScanTest/main.cpp index 751186e..dcca444 100644 --- a/tests/MetaScanTest/main.cpp +++ b/tests/MetaScanTest/main.cpp @@ -1,14 +1,33 @@ -/* - * File: MetaScanTest.cc - * Author: django +/** + * ======================== legal notice ====================== * - * Created on 27.07.2012, 10:03 + * File: MetaScanTest.cc + * Created: 27.07.2012, 10:03 + * Author: Geronimo + * 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 #include #include #include #include +#include #include #include #include @@ -20,14 +39,14 @@ #include #include -static void testPipe(const char *chk = NULL); +void testPipe(const char *chk = NULL); static void parseConfig(const char *FileName) { cConfigReader *cr = new cConfigReader(new cLineReader(new cFileReader(new cFile(FileName)))); cConfigReader::ConfigEntry *ce; - while ((ce = cr->ReadValue())) { + while ((ce = cr->ReadEntry())) { std::cout << "config entry [" << std::get<0>(*ce) << "] => " << std::get<1>(*ce) << std::endl; delete ce; } @@ -35,14 +54,47 @@ static void parseConfig(const char *FileName) delete cr; } -static void testMediaFiles(const char *FileName) +static void setupMediainfoReader(cMediainfoReader *mir) +{ + mir->AddValuableKey("Format"); + //Audio + mir->AddValuableKey("Duration"); + mir->AddValuableKey("Album"); + mir->AddValuableKey("Track name"); + mir->AddValuableKey("Performer"); + mir->AddValuableKey("Bit rate"); + //Image + mir->AddValuableKey("Width"); + mir->AddValuableKey("Height"); + //Video + mir->AddValuableKey("Display aspect ratio"); + mir->AddValuableKey("Scan type"); +} + +static void testMediaInfo(const char *FileName) +{ + cCommandReader *cr = new cCommandReader("/usr/bin/mediainfo"); + cMediainfoReader *mir = new cMediainfoReader(new cLineReader(cr)); + cMediainfoReader::InfoEntry *ie; + + cr->AddCommandParameter(FileName); + setupMediainfoReader(mir); + while ((ie = mir->ReadEntry())) { + std::cout << "media info - [" << std::get<0>(*ie) << "] ==> " << std::get<1>(*ie) << std::endl; +// delete ie; + } + mir->Close(); + delete mir; +} + +void testMediaFiles(const char *FileName) { cLineReader *lr = new cLineReader(new cFileReader(new cFile(FileName))); const char *line; while ((line = lr->ReadLine())) { - std::cout << "media-test-file: " << line << std::endl; - testPipe(line); + std::cout << std::endl << "media-test-file: " << line << std::endl; + testMediaInfo(line); } lr->Close(); delete lr; @@ -69,7 +121,7 @@ static void testCommandReader() delete lr; }; -static void testPipe(const char *chk) +void testPipe(const char *chk) { int parent2Child[2]; int child2Parent[2]; @@ -153,8 +205,8 @@ int main() std::cout << std::endl << "===========================================" << std::endl << std::endl; testCommandReader(); -// std::cout << std::endl << "===========================================" << std::endl << std::endl; -// testMediaFiles("testMedia.files"); + std::cout << std::endl << "===========================================" << std::endl << std::endl; + testMediaFiles("testMedia.files"); cFile::Cleanup(); return 0; -- cgit v1.2.3