From 8200e8eae6a3d97f578f7f958ad9feafd75d9ab5 Mon Sep 17 00:00:00 2001 From: "E.Smith" <31170571+azlm8t@users.noreply.github.com> Date: Fri, 16 Nov 2018 15:05:23 +0000 Subject: [PATCH] dvr: Alter test for season/episode on unique path. If we have an episode number and it differs from the other side then we know it is not a dup. Similarly with a season number. --- src/dvr/dvr_db.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 169d5b940..c1d3da7cd 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -1610,10 +1610,26 @@ static int _dvr_duplicate_unique_match(dvr_entry_t *de1, dvr_entry_t *de2, void de2->de_epnum.s_num && de2->de_epnum.e_num) return de1->de_epnum.s_num == de2->de_epnum.s_num && de1->de_epnum.e_num == de2->de_epnum.e_num ? DUP : NOT_DUP; - /* Only one has season and episode? Then can't be a dup with the - * other one that doesn't have season+episode + /* If we don't have Season & Episode, then we will try matching just + * season and just episode (if available). This is because if OTA + * has just "Ep 1" then we don't know the season (so we would have + * season 0 internally even though it could be S1 or S2), so we + * can't know if it is a DUP with another showing of "Ep 1" (could + * be different season), but we _do_ know that if they differ then + * it's definitely a different episode. + * + * So: + * - Ep1 == Ep1 ==> don't know if it's a dup or not + * - Ep1 != Ep2 ==> definitely not a dup. + * - S1 == S1 ==> don't know if dup or not + * - S1 != S2 ==> definitely not a dup. + * This assumes consistent metadata (so always have Season & Episode + * info, or always only have same partial info of just season or + * just episode). */ - if (de1->de_epnum.e_num || de2->de_epnum.e_num) + if (de1->de_epnum.s_num != de2->de_epnum.s_num) + return NOT_DUP; + if (de1->de_epnum.e_num != de2->de_epnum.e_num) return NOT_DUP; /* Now, near the end, we can check for unequal programme ids. We do -- 2.47.2