Skip to content

Commit

Permalink
Speed up EPG loading
Browse files Browse the repository at this point in the history
With kodi-pvr#269 there are two regex which are evaluated on every function call. In my case loading time was increased from 800msec to 10sec. This PR replaces those regex with static one.
For Leia branch.
  • Loading branch information
vpeter4 committed Sep 22, 2019
1 parent a19d662 commit 23cdcf1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pvr.iptvsimple/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.iptvsimple"
version="3.8.2"
version="3.8.3"
name="PVR IPTV Simple Client"
provider-name="nightik">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.iptvsimple/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v3.8.3
- Speed up EPG loading

v3.8.2
- Update github wiki link in addon.xml

Expand Down
6 changes: 4 additions & 2 deletions src/PVRIptvData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,12 @@ bool PVRIptvData::ParseXmltvNsEpisodeNumberInfo(const std::string& episodeNumber

bool PVRIptvData::ParseOnScreenEpisodeNumberInfo(const std::string& episodeNumberString, PVRIptvEpgEntry& entry)
{
const std::string text = std::regex_replace(episodeNumberString, std::regex("[ \\txX_\\.]"), "");
static const std::regex numRegex("[ \\txX_\\.]");
static const std::regex epRegex("^[sS]([0-9][0-9]*)[eE][pP]?([0-9][0-9]*)$");
const std::string text = std::regex_replace(episodeNumberString, numRegex, "");

std::smatch match;
if (std::regex_match(text, match, std::regex("^[sS]([0-9][0-9]*)[eE][pP]?([0-9][0-9]*)$")))
if (std::regex_match(text, match, epRegex))
{
if (match.size() == 3)
{
Expand Down

0 comments on commit 23cdcf1

Please sign in to comment.