summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2009-08-28 21:55:38 (GMT)
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2009-08-28 21:55:38 (GMT)
commitd7cde805f380cfd188585eba080f58a1cb1648c8 (patch)
treeb016a3289813140168ea1ee92e36e2ab9776ba4a
parent5cd60f99e54d0d2a0f0abf0d1d3170bea74ecdc2 (diff)
downloadvdr-plugin-live-d7cde805f380cfd188585eba080f58a1cb1648c8.tar.gz
vdr-plugin-live-d7cde805f380cfd188585eba080f58a1cb1648c8.tar.bz2
Added a fix suggested by user gda in vdr-portal.de for the epg imagescvs-commit-364
problem reported in (german) http://www.vdr-portal.de/board/thread.php?threadid=88589 The fix tries first to find a image with correct image-Id. If no images are found, then it tries the old method. This will lead to less false positives if images are available, but will still lead to a wrong image list if no images should be available for that epg id but become available with the workaround of the bug in tvm2vdr.pl.
-rw-r--r--epg_events.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/epg_events.cpp b/epg_events.cpp
index b95443d..f4547f4 100644
--- a/epg_events.cpp
+++ b/epg_events.cpp
@@ -280,10 +280,11 @@ namespace vdrlive
string domId(idOverride ? idOverride : EncodeDomId(chan->GetChannelID(), event->EventID()));
return EpgInfoPtr(new EpgEvent(domId, event, chan->Name()));
}
- else if (LiveSetup().GetShowChannelsWithoutEPG()) {
+ if (LiveSetup().GetShowChannelsWithoutEPG()) {
string domId(idOverride ? idOverride : EncodeDomId(chan->GetChannelID(), 0));
return EpgInfoPtr(new EmptyEvent(domId, chan->GetChannelID(), chan->Name()));
}
+ return EpgInfoPtr();
}
EpgInfoPtr CreateEpgInfo(string const &recid, cRecording const *recording, char const *caption)
@@ -296,14 +297,10 @@ namespace vdrlive
return EpgInfoPtr(new EpgString(id, caption, info));
}
- list<string> EpgImages(string const &epgid)
- {
- list<string> images;
-
- size_t delimPos = epgid.find_last_of('_');
- string imageId = epgid.substr(delimPos+1);
- imageId = imageId.substr(0, imageId.size()-1); // tvm2vdr seems always to use one digit less
+ bool ScanForEpgImages(string const & imageId, list<string> & images)
+ {
+ bool found = false;
const string filemask(LiveSetup().GetEpgImageDir() + "/" + imageId + "*.*");
glob_t globbuf;
globbuf.gl_offs = 0;
@@ -312,9 +309,33 @@ namespace vdrlive
const string imagefile(globbuf.gl_pathv[i]);
size_t delimPos = imagefile.find_last_of('/');
images.push_back(imagefile.substr(delimPos+1));
+ found = true;
}
globfree(&globbuf);
}
+ return found;
+ }
+
+ list<string> EpgImages(string const &epgid)
+ {
+ size_t delimPos = epgid.find_last_of('_');
+ string imageId = epgid.substr(delimPos+1);
+
+ list<string> images;
+ if (! ScanForEpgImages(imageId, images))
+ {
+ // if we didn't get images try to work arround a bug
+ // in tvm2vdr. tvm2vdr seems always to use one digit
+ // less, which leads in some rare cases to the bug in
+ // LIVE, that unrelated and to many images are
+ // displayed. But without this 'fix' no images would
+ // be visible at all. The bug should be fixed in
+ // tvm2vdr.pl (Perl version of tvm2vdr). There exists
+ // a plugin - also called tvm2vdr - which might not
+ // have that bug.
+ imageId = imageId.substr(0, imageId.size()-1);
+ ScanForEpgImages(imageId, images);
+ }
return images;
}