Thread: [Commits] : Tuxbox-GIT: apps branch master updated. CVS-Final-42-g4456795
Tuxbox Sources
Brought to you by:
dbt1
|
From: Thilo G. <tux...@ne...> - 2013-02-22 20:00:02
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 4456795a825fc66ee9189ac4a6e655ce1f20aec9 (commit)
from 2fcf2277e39144a5bf1683f736b085ed7347af37 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4456795a825fc66ee9189ac4a6e655ce1f20aec9
Author: [CST] Focus <foc...@gm...>
Date: Thu Feb 21 21:27:05 2013 +0100
sectionsd: add operators, simplify event compare code
Signed-off-by: Christian Schuett <Gau...@ho...>
diff --git a/tuxbox/neutrino/daemons/sectionsd/SIevents.hpp b/tuxbox/neutrino/daemons/sectionsd/SIevents.hpp
index 00654d5..f1d16d1 100644
--- a/tuxbox/neutrino/daemons/sectionsd/SIevents.hpp
+++ b/tuxbox/neutrino/daemons/sectionsd/SIevents.hpp
@@ -133,6 +133,22 @@ public:
return name < l.name;
}
+ bool operator==(const SIlinkage& l) const {
+ return (linkageType == l.linkageType) &&
+ (transportStreamId == l.transportStreamId) &&
+ (originalNetworkId == l.originalNetworkId) &&
+ (serviceId == l.serviceId) &&
+ (name == l.name);
+ }
+
+ bool operator!=(const SIlinkage& l) const {
+ return (linkageType != l.linkageType) ||
+ (transportStreamId != l.transportStreamId) ||
+ (originalNetworkId != l.originalNetworkId) ||
+ (serviceId != l.serviceId) ||
+ (name != l.name);
+ }
+
void dump(void) const {
printf("Linakge Type: 0x%02hhx\n", linkageType);
if (name.length())
@@ -205,6 +221,18 @@ class SIcomponent {
return streamContent < c.streamContent;
// return component < c.component;
}
+ bool operator==(const SIcomponent& c) const {
+ return (componentType == c.componentType) &&
+ (componentTag == c.componentTag) &&
+ (streamContent == c.streamContent) &&
+ (component == c.component);
+ }
+ bool operator!=(const SIcomponent& c) const {
+ return (componentType != c.componentType) ||
+ (componentTag != c.componentTag) ||
+ (streamContent != c.streamContent) ||
+ (component != c.component);
+ }
void dump(void) const {
if(component.length())
printf("Component: %s\n", component.c_str());
@@ -257,8 +285,16 @@ class SIparentalRating {
countryCode=r.countryCode;
}
// Der Operator zum sortieren
- bool operator < (const SIparentalRating& c) const {
- return countryCode < c.countryCode;
+ bool operator < (const SIparentalRating& r) const {
+ return countryCode < r.countryCode;
+ }
+ bool operator==(const SIparentalRating& r) const {
+ return (rating == r.rating) &&
+ (countryCode == r.countryCode);
+ }
+ bool operator!=(const SIparentalRating& r) const {
+ return (rating != r.rating) ||
+ (countryCode != r.countryCode);
}
void dump(void) const {
printf("Rating: %s %hhu (+3)\n", countryCode.c_str(), rating);
@@ -304,6 +340,14 @@ class SItime {
bool operator < (const SItime& t) const {
return startzeit < t.startzeit;
}
+ bool operator==(const SItime& t) const {
+ return (dauer == t.dauer) &&
+ (startzeit == t.startzeit);
+ }
+ bool operator!=(const SItime& t) const {
+ return (dauer != t.dauer) ||
+ (startzeit != t.startzeit);
+ }
void dump(void) const {
printf("Startzeit: %s", ctime(&startzeit));
printf("Dauer: %02u:%02u:%02u (%umin, %us)\n", dauer/3600, (dauer%3600)/60, dauer%60, dauer/60, dauer);
diff --git a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
index 327bf83..bfb7124 100644
--- a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
+++ b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
@@ -780,82 +780,14 @@ static void addEvent(const SIevent &evt, const time_t zeit, bool cn = false)
them with the old ones, because the same event can be complete
on one German Sky channel and incomplete on another one. So we
make sure to keep the complete event, if applicable. */
-
- if ((already_exists) && !evt.components.empty()) {
- if (si->second->components.size() != evt.components.size())
- already_exists = false;
- else {
- SIcomponents::const_iterator c1 = si->second->components.begin();
- SIcomponents::const_iterator c2 = evt.components.begin();
- while ((c1 != si->second->components.end()) && (c2 != evt.components.end())) {
- if ((c1->componentType != c2->componentType) ||
- (c1->componentTag != c2->componentTag) ||
- (c1->streamContent != c2->streamContent) ||
- (strcmp(c1->component.c_str(),c2->component.c_str()) != 0)) {
- already_exists = false;
- break;
- }
- c1++;
- c2++;
- }
- }
- }
-
- if ((already_exists) && !evt.linkage_descs.empty()) {
- if (si->second->linkage_descs.size() != evt.linkage_descs.size())
- already_exists = false;
- else {
- for (unsigned int i = 0; i < si->second->linkage_descs.size(); i++) {
- if ((si->second->linkage_descs[i].linkageType !=
- evt.linkage_descs[i].linkageType) ||
- (si->second->linkage_descs[i].originalNetworkId !=
- evt.linkage_descs[i].originalNetworkId) ||
- (si->second->linkage_descs[i].transportStreamId !=
- evt.linkage_descs[i].transportStreamId) ||
- (strcmp(si->second->linkage_descs[i].name.c_str(),
- evt.linkage_descs[i].name.c_str()) != 0)) {
- already_exists = false;
- break;
- }
- }
- }
- }
-
- if ((already_exists) && !evt.ratings.empty()) {
- if (si->second->ratings.size() != evt.ratings.size())
- already_exists = false;
- else {
- SIparentalRatings::const_iterator p1 = si->second->ratings.begin();
- SIparentalRatings::const_iterator p2 = evt.ratings.begin();
- while ((p1 != si->second->ratings.end()) && (p2 != evt.ratings.end())) {
- if ((p1->rating != p2->rating) ||
- (strcmp(p1->countryCode.c_str(),p2->countryCode.c_str()) != 0)) {
- already_exists = false;
- break;
- }
- p1++;
- p2++;
- }
- }
- }
-
- if (already_exists) {
- if (si->second->times.size() != evt.times.size())
- already_exists = false;
- else {
- SItimes::iterator t1 = si->second->times.begin();
- SItimes::iterator t2 = evt.times.begin();
- while ((t1 != si->second->times.end()) && (t2 != evt.times.end())) {
- if ((t1->startzeit != t2->startzeit) ||
- (t1->dauer != t2->dauer)) {
- already_exists = false;
- break;
- }
- t1++;
- t2++;
- }
- }
- }
+ if (already_exists && !evt.components.empty() && (evt.components != si->second->components))
+ already_exists = false;
+ if (already_exists && !evt.linkage_descs.empty() && (evt.linkage_descs != si->second->linkage_descs))
+ already_exists = false;
+ if (already_exists && !evt.ratings.empty() && (evt.ratings != si->second->ratings))
+ already_exists = false;
+ if (already_exists && (evt.times != si->second->times))
+ already_exists = false;
if ((already_exists) && (SIlanguage::getMode() == CSectionsdClient::LANGUAGE_MODE_OFF)) {
si->second->contentClassification = evt.contentClassification;
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/daemons/sectionsd/SIevents.hpp | 48 ++++++++++++-
tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp | 84 ++--------------------
2 files changed, 54 insertions(+), 78 deletions(-)
--
Tuxbox-GIT: apps
|