Example #1
0
void CMediaMonitor::FilterDuplicates(MOVIELIST& movies)
{
  MOVIELISTITERATOR current = movies.begin();
  MOVIELISTITERATOR previous = current;

  while (current != movies.end())
  {
    if (previous != current)
    {
      // ensure at least less than 75% similar compared to the previous selection
      if (parse_Similar( (*current).strFilepath, (*previous).strFilepath, 75))
      {
        // items are similar, find out which one is more likely to be CD1
        long valueA = parse_AggregateValue((*current).strFilepath);
        long valueB = parse_AggregateValue((*previous).strFilepath);

        if (valueA < valueB)
        {
          *previous = *current;
        }

        current = movies.erase(current);
        continue;
      }
    }

    previous = current;
    current++;
  }
}