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
Conversation
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); |
There was a problem hiding this comment.
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.
|
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)*/ | |||
There was a problem hiding this comment.
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;
|
Done. Sorry for the NULL-terminating array, but I was thinking about dynamic structures. |
scraping season/episode numbers for sky-it
Extended the already present hack to extract such numbers from episode descriptions in Sky IT EPG data.