Forgot to finish of the episode number checking in series link.

This commit is contained in:
Adam Sutton 2012-06-14 11:42:24 +01:00
parent b8ec3642d1
commit a8b59db732
3 changed files with 24 additions and 3 deletions

View file

@ -65,6 +65,7 @@ static int
autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
{
channel_tag_mapping_t *ctm;
epg_episode_num_t epnum;
if (!e->channel) return 0;
if (!e->episode) return 0;
@ -103,10 +104,12 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
if (!ok) return 0;
}
if(dae->dae_brand)
if (!e->episode->brand || dae->dae_brand != e->episode->brand) return 0;
// Note: we always test season first, though it will only be set
// if configured
if(dae->dae_season)
if (!e->episode->season || dae->dae_season != e->episode->season) return 0;
if(dae->dae_brand)
if (!e->episode->brand || dae->dae_brand != e->episode->brand) return 0;
if(dae->dae_title != NULL && dae->dae_title[0] != '\0') {
if(e->episode->title == NULL ||
@ -125,6 +128,12 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
return 0;
}
// Note: dae_epnum is unset then all values are 0 and this will
// always return 1
epg_episode_number_full(e->episode, &epnum);
if(epg_episode_number_cmp(&dae->dae_epnum, &epnum) < 0)
return 0;
if(dae->dae_weekdays != 0x7f) {
struct tm tm;
localtime_r(&e->start, &tm);

View file

@ -958,7 +958,6 @@ size_t epg_episode_number_format
void epg_episode_number_full ( epg_episode_t *ee, epg_episode_num_t *num )
{
if (!ee || !num) return;
num->e_num = ee->number;
num->p_num = ee->part_number;
num->p_cnt = ee->part_count;
@ -971,6 +970,17 @@ void epg_episode_number_full ( epg_episode_t *ee, epg_episode_num_t *num )
}
}
int epg_episode_number_cmp ( epg_episode_num_t *a, epg_episode_num_t *b )
{
if (a->s_num != b->s_num) {
return a->s_num - b->s_num;
} else if (a->e_num != b->e_num) {
return a->e_num - b->e_num;
} else {
return a->p_num - b->p_num;
}
}
int epg_episode_fuzzy_match
( epg_episode_t *episode, const char *uri, const char *title,
const char *summary, const char *description )

View file

@ -262,6 +262,8 @@ size_t epg_episode_number_format
const char *cfmt );
void epg_episode_number_full
( epg_episode_t *e, epg_episode_num_t *epnum );
int epg_episode_number_cmp
( epg_episode_num_t *a, epg_episode_num_t *b );
/* Matching */
int epg_episode_fuzzy_match