diff options
-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)) { |