Ticket #8127: mythtv-8127-fix_programid_uniqueness.patch

File mythtv-8127-fix_programid_uniqueness.patch, 1.7 KB (added by sphery, 14 years ago)

Fixes programid generation to create unique IDs

  • programs/mythfilldatabase/xmltvparser.cpp

    old new  
    538538
    539539        if (!episode.isEmpty() && !season.isEmpty())
    540540        {
    541             programid.append(episode);
    542             programid.append(season);
    543             if (pginfo->partnumber && pginfo->parttotal)
     541            /* Append unpadded episode and season number to the seriesid (to
     542               maintain consistency with historical encoding), but limit the
     543               season number representation to a single base-36 character to
     544               ensure unique programid generation. */
     545            int season_int = season.toInt();
     546            if (season_int > 35)
    544547            {
    545                 programid += QString::number(pginfo->partnumber);
    546                 programid += QString::number(pginfo->parttotal);
     548                // Can not represent season as a single base-36 character, so
     549                // remove the programid and fall back to normal dup matching.
     550                if (kCategoryMovie != pginfo->categoryType)
     551                    programid.clear();
     552            }
     553            else
     554            {
     555                programid.append(episode);
     556                programid.append(QString::number(season_int, 36));
     557                if (pginfo->partnumber && pginfo->parttotal)
     558                {
     559                    programid += QString::number(pginfo->partnumber);
     560                    programid += QString::number(pginfo->parttotal);
     561                }
    547562            }
    548563        }
    549564        else