Ticket #12296: 0001-Watchlist-Group-by-title-rather-than-recording-rule.patch

File 0001-Watchlist-Group-by-title-rather-than-recording-rule.patch, 3.3 KB (added by Roger Siddons <dizygotheca@…>, 6 years ago)
  • mythtv/programs/mythfrontend/playbackbox.cpp

    From 773392b25789ccb50da1e48a1351fa6077b83620 Mon Sep 17 00:00:00 2001
    From: Roger Siddons <dizygotheca@ntlworld.com>
    Date: Thu, 2 Oct 2014 23:23:17 +0100
    Subject: [PATCH 1/6] Watchlist: Group by title rather than recording rule
    
    
    diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp
    index b9b299d..8abc2ea 100644
    a b static bool extract_one_del( 
    367367    return chanid && recstartts.isValid();
    368368}
    369369
     370static QString extract_watchlist_title(ProgramInfo &pginfo)
     371{
     372    // ignore punctuation & whitespace
     373    QRegExp watchtitleChaff("\\W");
     374    return pginfo.GetTitle().remove(watchtitleChaff);
     375}
     376
    370377void * PlaybackBox::RunPlaybackBox(void * player, bool showTV)
    371378{
    372379    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    bool PlaybackBox::UpdateUILists(void) 
    16321639
    16331640    QMap<QString, QString> sortedList;
    16341641    QMap<int, QString> searchRule;
    1635     QMap<int, int> recidEpisodes;
     1642    QMap<QString, int> watchlistCount;
    16361643
    16371644    m_programInfoCache.Refresh();
    16381645
    bool PlaybackBox::UpdateUILists(void) 
    17791786                    }
    17801787                    else
    17811788                    {
    1782                         if (p->GetRecordingRuleID())
    1783                             recidEpisodes[p->GetRecordingRuleID()] += 1;
    1784                         if (recidEpisodes[p->GetRecordingRuleID()] == 1 ||
    1785                             !p->GetRecordingRuleID())
     1789                        QString title = extract_watchlist_title(*p);
     1790                        ++watchlistCount[title];
     1791                        if (watchlistCount[title] == 1)
    17861792                        {
    17871793                            m_progLists[m_watchGroupLabel].push_front(p);
    17881794                            m_progLists[m_watchGroupLabel].setAutoDelete(false);
    bool PlaybackBox::UpdateUILists(void) 
    19411947            else
    19421948            {
    19431949                (*pit)->SetRecordingPriority2(
    1944                     (recidEpisodes[(*pit)->GetRecordingRuleID()] - 1) *
     1950                    (watchlistCount[extract_watchlist_title(**pit)] - 1) *
    19451951                    baseValue);
    19461952            }
    19471953
  • mythtv/programs/mythfrontend/playbackbox.h

    diff --git a/mythtv/programs/mythfrontend/playbackbox.h b/mythtv/programs/mythfrontend/playbackbox.h
    index a88439e..25964bb 100644
    a b class PlaybackBox : public ScheduleCommon 
    359359    bool                m_watchListStart;
    360360    /// exclude recording not marked for auto-expire from the Watch List
    361361    bool                m_watchListAutoExpire;
    362     /// add 1 to the Watch List scord up to this many days
     362    /// add 1 to the Watch List score up to this many days
    363363    int                 m_watchListMaxAge;
    364364    /// adjust exclusion of a title from the Watch List after a delete
    365365    int                 m_watchListBlackOut;
    class PlaybackBox : public ScheduleCommon 
    405405    /// Program[s] currently selected for deletion
    406406    QStringList m_delList;
    407407    /// Group currently selected
    408     QString m_currentGroup;
     408    QString m_currentGroup; // in lower case
    409409
    410410    // Play List support
    411411    QStringList         m_playList;   ///< list of selected items "play list"