diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-11-01 22:43:42 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-11-01 22:43:42 +0000 |
commit | 2cfeac1ce467a73e18378f2009a39ee4c6461ae7 (patch) | |
tree | e4aaba93d347ccd403275b9f8c19be9c870af4ad | |
parent | Merge branch 'p2pvr-slicer' (diff) | |
download | p2pvr-2cfeac1ce467a73e18378f2009a39ee4c6461ae7.tar.bz2 p2pvr-2cfeac1ce467a73e18378f2009a39ee4c6461ae7.tar.xz p2pvr-2cfeac1ce467a73e18378f2009a39ee4c6461ae7.zip |
Strip 'New:' from event titles
-rw-r--r-- | p2pvr/daemon/unittests/testMaint.cpp | 14 | ||||
-rw-r--r-- | p2pvr/dvb/siParsers/event.cpp | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/p2pvr/daemon/unittests/testMaint.cpp b/p2pvr/daemon/unittests/testMaint.cpp index 9926c2b..a794e5e 100644 --- a/p2pvr/daemon/unittests/testMaint.cpp +++ b/p2pvr/daemon/unittests/testMaint.cpp @@ -1,6 +1,7 @@ #define BOOST_TEST_MODULE Maintenance #include <boost/test/unit_test.hpp> #include <boost/filesystem/operations.hpp> +#include <boost/algorithm/string/predicate.hpp> #include <testOptionsSource.h> #include <Ice/ObjectAdapter.h> #include <Ice/Service.h> @@ -133,7 +134,7 @@ BOOST_AUTO_TEST_CASE( GetNetworks ) BOOST_AUTO_TEST_CASE( GetDeliveryForService ) { - auto del = s->GetDeliveryForService(serviceId); + auto del = s->GetDeliveryForService(serviceId); BOOST_REQUIRE(del); BOOST_REQUIRE_EQUAL(del->ice_id(), "::DVBSI::TerrestrialDelivery"); BOOST_REQUIRE_EQUAL(del->Frequency, 682000000); @@ -141,7 +142,7 @@ BOOST_AUTO_TEST_CASE( GetDeliveryForService ) BOOST_AUTO_TEST_CASE( GetDeliveryForTransport ) { - auto del = s->GetDeliveryForTransport(transportId); + auto del = s->GetDeliveryForTransport(transportId); BOOST_REQUIRE(del); BOOST_REQUIRE_EQUAL(del->ice_id(), "::DVBSI::TerrestrialDelivery"); BOOST_REQUIRE_EQUAL(del->Frequency, 722000000); @@ -254,5 +255,14 @@ BOOST_AUTO_TEST_CASE( update_events ) BOOST_REQUIRE_EQUAL(keyEvents[1]->Title, keyEventsOnDayTwo[1]->Title); } +BOOST_AUTO_TEST_CASE( test_titleFiltering ) +{ + auto thingsWithNew = s->EventSearch("new", IceUtil::Optional<int>(), + IceUtil::Optional<Common::DateTime>(), IceUtil::Optional<Common::DateTime>()); + BOOST_REQUIRE_EQUAL(0, std::count_if(thingsWithNew.begin(), thingsWithNew.end(), [](auto e) { + return boost::algorithm::starts_with(e->Title, "New:"); + })); +} + BOOST_AUTO_TEST_SUITE_END() diff --git a/p2pvr/dvb/siParsers/event.cpp b/p2pvr/dvb/siParsers/event.cpp index 4c3a572..11c15e2 100644 --- a/p2pvr/dvb/siParsers/event.cpp +++ b/p2pvr/dvb/siParsers/event.cpp @@ -91,6 +91,12 @@ SiEpgParser::parseDescriptor_ShortEvent(DVBSI::EventPtr current, const u_char * subtitle = convert((const char *)evtdesc->data + evtlen + 1, dsclen); } + if (title) { + if (boost::algorithm::starts_with(*title, "New:")) { + *title = boost::algorithm::trim_left_copy_if(title->substr(4), isspace); + } + } + if (subtitle) { Glib::MatchInfo matches; if (yearRegex->match(*subtitle, matches)) { |