Ticket #8011: mythtv.grouptotals.patch
File mythtv.grouptotals.patch, 6.8 KB (added by , 14 years ago) |
---|
-
programs/mythfrontend/playbackbox.cpp
667 667 infoMap["description"] = desc; 668 668 infoMap["rec_count"] = QString("%1").arg(countInGroup); 669 669 670 // H O O K: Include the total time and filesize for the group 671 672 int totalsecs = 0; 673 uint64_t totalsize = 0ULL; 674 675 ProgramList::iterator totalit = m_progLists[groupname].begin(); 676 while (totalit != m_progLists[groupname].end()) 677 { 678 totalsecs += (*totalit)->startts.secsTo((*totalit)->endts); 679 totalsize += (*totalit)->filesize; 680 ++totalit; 681 } 682 683 684 int minutes = totalsecs / 60; 685 int totalh = minutes / 60; 686 int totalm = minutes % 60; 687 QString tmpSize; 688 689 tmpSize.sprintf("%0.2f ", totalsize * (1.0 / (1024.0 * 1024.0 * 1024.0))); 690 tmpSize += QObject::tr("GB", "GigaBytes"); 691 infoMap["filesize_str"] = tmpSize; 692 infoMap["filesize"] = QString::number(totalsize); 693 694 695 infoMap["lenmins"] = tr("%n minute(s)", "", minutes); 696 697 if(totalh > 0 && totalm > 0) { 698 infoMap["lentime"] = QString("%1 %2") 699 .arg(QObject::tr("%n hour(s)", "", totalh)) 700 .arg(QObject::tr("%n minute(s)", "", totalm)); 701 } else if(totalh > 0) { 702 infoMap["lentime"] = QObject::tr("%n hour(s)", "", totalh); 703 } else { 704 infoMap["lentime"] = QObject::tr("%n minute(s)", "", totalm); 705 } 706 // HOOK... Done. 707 670 708 ResetMap(m_currentMap); 671 709 SetTextFromMap(infoMap); 672 710 m_currentMap = infoMap; … … 1526 1564 1527 1565 if ((m_viewMask & VIEW_WATCHLIST) && (p->recgroup != "LiveTV")) 1528 1566 { 1567 VERBOSE(VB_FILE, QString("watchlist: Testing: %1 (%2) %3") 1568 .arg(p->title).arg(p->startts.toString(m_formatShortDate)).arg(p->recordid)); 1529 1569 if (m_watchListAutoExpire && !(p->programflags & FL_AUTOEXP)) 1530 1570 { 1531 1571 p->recpriority2 = wlExpireOff; 1532 VERBOSE(VB_FILE, QString(" Auto-expire off: %1")1572 VERBOSE(VB_FILE, QString("watchlist: Auto-expire off: %1") 1533 1573 .arg(p->title)); 1534 1574 } 1535 1575 else if (p->programflags & FL_WATCHED) 1536 1576 { 1537 1577 p->recpriority2 = wlWatched; 1538 VERBOSE(VB_FILE, QString(" Marked as 'watched': %1")1578 VERBOSE(VB_FILE, QString("watchlist: Marked as 'watched': %1") 1539 1579 .arg(p->title)); 1540 1580 } 1541 1581 else 1542 1582 { 1543 if (p->recordid > 0) 1544 recidEpisodes[p->recordid] += 1; 1545 if (recidEpisodes[p->recordid] == 1 || 1546 p->recordid == 0 ) 1547 { 1548 m_progLists[m_watchGroupLabel].push_front(p); 1549 m_progLists[m_watchGroupLabel].setAutoDelete(false); 1550 } 1551 else 1552 { 1553 p->recpriority2 = wlEarlier; 1554 VERBOSE(VB_FILE, QString("Not the earliest: %1") 1555 .arg(p->title)); 1556 } 1583 if (p->recordid > 0) { 1584 recidEpisodes[p->recordid] += 1; 1585 // H O O K: Track the old iterator, so we can delete the newer items next time we see this record 1586 if (recidEpisodes[p->recordid] > 1) { 1587 ProgramList::iterator pit = m_progLists[m_watchGroupLabel].begin(); 1588 while (pit != m_progLists[m_watchGroupLabel].end()) 1589 { 1590 if((*pit)->recordid == p->recordid) { 1591 m_progLists[m_watchGroupLabel].erase(pit); 1592 VERBOSE(VB_FILE, QString("watchlist: Overrides last one ")); 1593 break; 1594 } 1595 1596 ++pit; 1597 } 1598 } 1599 } 1600 1601 m_progLists[m_watchGroupLabel].push_front(p); 1602 m_progLists[m_watchGroupLabel].setAutoDelete(false); 1603 // HOOK... Done. 1604 1557 1605 } 1558 1606 } 1559 1607 } … … 1710 1758 if (delHours[recid] < m_watchListBlackOut * 4) 1711 1759 { 1712 1760 (*pit)->recpriority2 = wlDeleted; 1713 VERBOSE(VB_FILE, QString(" Recently deleted daily: %1")1761 VERBOSE(VB_FILE, QString("watchlist: Recently deleted daily: %1") 1714 1762 .arg((*pit)->title)); 1715 1763 pit = m_progLists[m_watchGroupLabel].erase(pit); 1716 1764 continue; 1717 1765 } 1718 1766 else 1719 1767 { 1720 VERBOSE(VB_FILE, QString(" Daily interval: %1")1768 VERBOSE(VB_FILE, QString("watchlist: Daily interval: %1") 1721 1769 .arg((*pit)->title)); 1722 1770 1723 1771 if (maxEpisodes[recid] > 0) … … 1735 1783 if (delHours[recid] < (m_watchListBlackOut * 24) - 4) 1736 1784 { 1737 1785 (*pit)->recpriority2 = wlDeleted; 1738 VERBOSE(VB_FILE, QString(" Recently deleted weekly: %1")1786 VERBOSE(VB_FILE, QString("watchlist: Recently deleted weekly: %1") 1739 1787 .arg((*pit)->title)); 1740 1788 pit = m_progLists[m_watchGroupLabel].erase(pit); 1741 1789 continue; 1742 1790 } 1743 1791 else 1744 1792 { 1745 VERBOSE(VB_FILE, QString(" Weekly interval: %1")1793 VERBOSE(VB_FILE, QString("watchlist: Weekly interval: %1") 1746 1794 .arg((*pit)->title)); 1747 1795 1748 1796 if (maxEpisodes[recid] > 0) … … 1794 1842 else if (avgd > 100) 1795 1843 (*pit)->recpriority2 = (*pit)->recpriority2 * 100 / delaypct; 1796 1844 1797 VERBOSE(VB_FILE, QString(" %1 %2 %3")1845 VERBOSE(VB_FILE, QString("watchlist: %1 %2 %3") 1798 1846 .arg((*pit)->startts.toString(m_formatShortDate)) 1799 1847 .arg((*pit)->recpriority2).arg((*pit)->title)); 1800 1848