Esempio n. 1
0
 public static bool IsPartialTitleMatch(redux_items redux, pips_programmes pips)
 {
     if (redux == null || pips == null)
     {
         return false;
     }
     string reduxtitle = GetCompleteTitle(redux);
     if (PartialMatch.IsPartialMatch(reduxtitle, pips.display_title))
     {
         return true;
     }
     return false;
 }
Esempio n. 2
0
 public static bool IsPartialTitleMatchWithDescription(redux_items redux, pips_programmes pips)
 {
     if (redux == null || pips == null)
     {
         return false;
     }
     string reduxtitle = GetCompleteTitle(redux);
     if (PartialMatch.IsPartialMatch(reduxtitle, pips.display_title))
     {
         return true;
     }
     if (PartialMatch.IsPartialMatch(reduxtitle, pips.display_subtitle))
     {
         return true;
     }
     string reduxdesc = redux.short_description;
     if (reduxdesc.Contains("] Followed by "))
     {
         reduxdesc = reduxdesc.Substring(0, reduxdesc.IndexOf("] Followed by "));
     }
     if (reduxdesc.Contains("] Then "))
     {
         reduxdesc = reduxdesc.Substring(0, reduxdesc.IndexOf("] Then "));
     }
     return PartialMatch.IsPartialMatch(redux.programme_name + " " + reduxdesc, pips.display_title + " " + pips.display_subtitle + " " + pips.description);
 }
Esempio n. 3
0
 public static double GetSimpleWeighting(redux_items redux, pips_programmes pips)
 {
     if (IsGoodTitleMatch(redux, pips))
     {
         return 100.0;
     }
     if (IsPartialTitleMatch(redux, pips))
     {
         return 10.0;
     }
     if (IsPartialTitleMatchWithDescription(redux, pips))
     {
         return 1.0;
     }
     return 0.0;
 }
Esempio n. 4
0
 public static bool IsGoodTitleMatch(redux_items redux, pips_programmes pips)
 {
     if (redux == null || pips == null)
     {
         return false;
     }
     string reduxtitle = NormaliseTitle(GetCompleteTitle(redux));
     string pipstitle = NormaliseTitle(pips.display_title);
     if (reduxtitle == pipstitle)
     {
         return true;
     }
     if (reduxtitle == NormaliseTitle(pips.display_subtitle))
     {
         return true;
     }
     return false;
 }
Esempio n. 5
0
        public static ScheduleMatchData GetScheduleWeighting(redux_items redux, pips_programmes pips)
        {
            ScheduleMatchData data = new ScheduleMatchData();
            data.StartDistance = Math.Abs((redux.aired - pips.start_gmt).TotalSeconds);
            data.DurationDelta = Math.Abs(redux.duration - (pips.end_gmt - pips.start_gmt).TotalSeconds);
            DateTime maxstart = pips.start_gmt;
            if (redux.aired > pips.start_gmt)
            {
                maxstart = redux.aired;
            }

            DateTime minend = pips.end_gmt;
            if (redux.aired.AddSeconds(redux.duration) < minend)
            {
                minend = redux.aired.AddSeconds(redux.duration);
            }

            var overlap = minend - maxstart;
            if (overlap.TotalSeconds < 0)
            {
                data.OverlapWeight = 0.0;
            }
            else
            {
                data.OverlapWeight = 100.0 * (overlap.TotalSeconds / (double)redux.duration) + 100.0 * (overlap.TotalSeconds / (pips.end_gmt - pips.start_gmt).TotalSeconds);
            }
            return data;
        }
Esempio n. 6
0
 public static double GetMatchWeighting(redux_items redux, pips_programmes pips)
 {
     var titlematch = Match(redux.programme_name, pips.display_title);
     var partialmatch = Match(pips.display_title + " " + pips.display_subtitle + " " + pips.description, redux.programme_name + " " + redux.short_description);
     double weight = 1;
     if (titlematch.PercentFirstInSecond > 0)
     {
         weight = weight * titlematch.PercentFirstInSecond * 2;
     }
     if (titlematch.PercentSecondInFirst > 0)
     {
         weight = weight * titlematch.PercentSecondInFirst * 2;
     }
     if (partialmatch.PercentFirstInSecond > 0)
     {
         weight = weight * partialmatch.PercentFirstInSecond;
     }
     if (partialmatch.PercentSecondInFirst > 0)
     {
         weight = weight * partialmatch.PercentSecondInFirst;
     }
     return weight;
 }
Esempio n. 7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the pips_programmes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTopips_programmes(pips_programmes pips_programmes)
 {
     base.AddObject("pips_programmes", pips_programmes);
 }
Esempio n. 8
0
 /// <summary>
 /// Create a new pips_programmes object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="start_time">Initial value of the start_time property.</param>
 /// <param name="end_time">Initial value of the end_time property.</param>
 /// <param name="duration">Initial value of the duration property.</param>
 /// <param name="service_id">Initial value of the service_id property.</param>
 /// <param name="matched">Initial value of the matched property.</param>
 /// <param name="start_gmt">Initial value of the start_gmt property.</param>
 /// <param name="end_gmt">Initial value of the end_gmt property.</param>
 public static pips_programmes Createpips_programmes(global::System.Int32 id, global::System.DateTime start_time, global::System.DateTime end_time, global::System.Int32 duration, global::System.Int32 service_id, global::System.Int32 matched, global::System.DateTime start_gmt, global::System.DateTime end_gmt)
 {
     pips_programmes pips_programmes = new pips_programmes();
     pips_programmes.id = id;
     pips_programmes.start_time = start_time;
     pips_programmes.end_time = end_time;
     pips_programmes.duration = duration;
     pips_programmes.service_id = service_id;
     pips_programmes.matched = matched;
     pips_programmes.start_gmt = start_gmt;
     pips_programmes.end_gmt = end_gmt;
     return pips_programmes;
 }
Esempio n. 9
0
 /// <summary>
 /// Create a new pips_programmes object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 public static pips_programmes Createpips_programmes(global::System.Int32 id)
 {
     pips_programmes pips_programmes = new pips_programmes();
     pips_programmes.id = id;
     return pips_programmes;
 }