Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scraping season/episode numbers for sky-it #478

Merged
merged 4 commits into from Sep 13, 2014
Merged

scraping season/episode numbers for sky-it #478

merged 4 commits into from Sep 13, 2014

Conversation

mario-tux
Copy link
Contributor

Extended the already present hack to extract such numbers from episode descriptions in Sky IT EPG data.

sync with main repository
Extended the already present hack to extract such numbers from episode descriptions in Sky IT EPG data.
en.e_num = atoi(ev.summary + match[2].rm_so);
save |= epg_episode_set_epnum(ee, &en, src);
for (i=0; patterns[i]; i++) {
regcomp(&preg, patterns[i], REG_ICASE | REG_EXTENDED);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move regcomp() to opentv_init() and regfree() to opentv_done() to save CPU ticks.. The patterns and precompiled regexes might be defined as global variables.

As suggested by perex, moved patterns and regexs as global variables and their management in opentv_init/opentv_done.
@mario-tux
Copy link
Contributor Author

perexg, does it fit your recommendations?

@@ -815,12 +825,19 @@ void opentv_init ( void )
if ((m = hts_settings_load("epggrab/opentv/prov")))
_opentv_prov_load(m);
tvhlog(LOG_DEBUG, "opentv", "providers loaded");

/* Compile some recurring regular-expressions */
for (i = 0; _opentv_se_num_patterns[i]; i++) ; /* count the available patterns (NULL-terminated array)*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to use ARRAY_SIZE() to avoid this loop. Don't forget to remove the last NULL from _opentv_se_num_patterns[].

- make use of ARRAY_SIZE macro;
- missing static keyword for global variables;
- better patterns for sky-it with possibility to support a description without season specification;
- debug messages;
@mario-tux
Copy link
Contributor Author

Done. Sorry for the NULL-terminating array, but I was thinking about dynamic structures.

perexg added a commit that referenced this pull request Sep 13, 2014
scraping season/episode numbers for sky-it
@perexg perexg merged commit e6ee82c into tvheadend:master Sep 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants