From bcc9e8c93864588848c86cbccb412aa79324c99b Mon Sep 17 00:00:00 2001 From: David Blain Date: Tue, 14 Feb 2012 15:08:31 -0500 Subject: [PATCH 01/15] Minor compatibility changes for VS2010. --- mythtv/libs/libmythbase/compat.h | 2 +- mythtv/libs/libmythtv/subtitlescreen.cpp | 10 +++++----- mythtv/libs/libmythtv/subtitlescreen.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mythtv/libs/libmythbase/compat.h b/mythtv/libs/libmythbase/compat.h index 9d30411f77f..9f23c25ee27 100644 --- a/mythtv/libs/libmythbase/compat.h +++ b/mythtv/libs/libmythbase/compat.h @@ -350,7 +350,7 @@ static inline struct tm *localtime_r(const time_t *timep, struct tm *result) #endif #include /* for FILENAME_MAX */ -#if defined(USING_MINGW) && defined(FILENAME_MAX) +#if defined(USING_MINGW) && defined(FILENAME_MAX) && defined( HAS_DIR ) #include #include #include diff --git a/mythtv/libs/libmythtv/subtitlescreen.cpp b/mythtv/libs/libmythtv/subtitlescreen.cpp index 0ead5165601..e93430f1c84 100644 --- a/mythtv/libs/libmythtv/subtitlescreen.cpp +++ b/mythtv/libs/libmythtv/subtitlescreen.cpp @@ -861,7 +861,7 @@ void FormattedTextSubtitle::InitFromCC608(vector &buffers) int y = (int)(((float)orig_y / (float)yscale) * (float)m_safeArea.height()); FormattedTextLine line(x, y, orig_x, orig_y); - for (int chunk = 0; text != QString::null; chunk++) + while (!text.isNull()) { QString captionText = extract_cc608(text, cc->teletextmode, @@ -1304,11 +1304,11 @@ QStringList FormattedTextSubtitle::ToSRT(void) const return result; } -void SubtitleScreen::SetFontSizes(int small, int medium, int large) +void SubtitleScreen::SetFontSizes(int nSmall, int nMedium, int nLarge) { - m_708fontSizes[k708AttrSizeSmall] = small; - m_708fontSizes[k708AttrSizeStandard] = medium; - m_708fontSizes[k708AttrSizeLarge] = large; + m_708fontSizes[k708AttrSizeSmall] = nSmall; + m_708fontSizes[k708AttrSizeStandard] = nMedium; + m_708fontSizes[k708AttrSizeLarge] = nLarge; } QSize SubtitleScreen::CalcTextSize(const QString &text, diff --git a/mythtv/libs/libmythtv/subtitlescreen.h b/mythtv/libs/libmythtv/subtitlescreen.h index ab40bd04728..0c299def0e5 100644 --- a/mythtv/libs/libmythtv/subtitlescreen.h +++ b/mythtv/libs/libmythtv/subtitlescreen.h @@ -67,7 +67,7 @@ class SubtitleScreen : public MythScreenType void AddScaledImage(QImage &img, QRect &pos); void Clear708Cache(int num); MythFontProperties* Get708Font(CC708CharacterAttribute attr) const; - void SetFontSizes(int small, int medium, int large); + void SetFontSizes(int nSmall, int nMedium, int nLarge); MythPlayer *m_player; SubtitleReader *m_subreader; From f853a5b27a31aa90914dff6472bbaa85fccda757 Mon Sep 17 00:00:00 2001 From: David Blain Date: Tue, 14 Feb 2012 16:09:08 -0500 Subject: [PATCH 02/15] Fix mingw build. --- mythtv/libs/libmythbase/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythtv/libs/libmythbase/compat.h b/mythtv/libs/libmythbase/compat.h index 9f23c25ee27..ff2890f29ed 100644 --- a/mythtv/libs/libmythbase/compat.h +++ b/mythtv/libs/libmythbase/compat.h @@ -350,7 +350,7 @@ static inline struct tm *localtime_r(const time_t *timep, struct tm *result) #endif #include /* for FILENAME_MAX */ -#if defined(USING_MINGW) && defined(FILENAME_MAX) && defined( HAS_DIR ) +#if defined(USING_MINGW) && defined(FILENAME_MAX) && !defined( _MSC_VER ) #include #include #include From 567278cfbec3ca94c9e8fadc51f5ced410ae036e Mon Sep 17 00:00:00 2001 From: Raymond Wagner Date: Tue, 14 Feb 2012 18:03:04 -0500 Subject: [PATCH 03/15] Correct automatic selection of address in GetBackendServerIP. This updates the address selection when connecting to a non-master backend, preferring an IPv4 address if the set IPv6 address is localhost. --- mythtv/libs/libmythbase/mythcorecontext.cpp | 56 ++++++++++++++++----- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp index 919a5f14cfe..9ccc4151db8 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.cpp +++ b/mythtv/libs/libmythbase/mythcorecontext.cpp @@ -714,7 +714,8 @@ void MythCoreContext::ConfigureHostAddress(void) .arg(it->toString())); d->m_IPv6.append(*it); } - LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping link-local " + else + LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping link-local " "address during IPv6 autoselection: %1") .arg(it->toString())); } @@ -964,6 +965,25 @@ double MythCoreContext::GetFloatSettingOnHost(const QString &key, return d->m_database->GetFloatSettingOnHost(key, host, defaultval); } +#if 0 +QString MythCoreContext::GetMasterServerIP(void) +{ + QString saddr = GetSetting("MasterServerIP"); + QHostAddress addr(saddr); + + if (!d->m_IPv6.empty() && + (addr.protocol() == QAbstractSocket::IPv6Protocol)) + // we have IPv6 addresses, assume we can connect to them + return saddr; + else if (!d->m_IPv4.empty() && + (addr.protocol() == QAbstractSocket::IPv4Protocol)) + // we have IPv4 addresses, assume we can connect to them + return saddr; + else + return GetBackendServerIP(GetMasterHostName()); +} +#endif + QString MythCoreContext::GetBackendServerIP(void) { return GetBackendServerIP(d->m_localHostname); @@ -971,23 +991,33 @@ QString MythCoreContext::GetBackendServerIP(void) QString MythCoreContext::GetBackendServerIP(const QString &host) { + QString addr4, addr6; #if !defined(QT_NO_IPV6) - // prefer IPv6 address if optional if (!d->m_IPv6.empty()) - { // we have IPv6 addresses, assume we can connect to them - QString address = GetSettingOnHost("BackendServerIP6", host, ""); - if (!address.isEmpty()) - return address; - } + QString addr6 = GetSettingOnHost("BackendServerIP6", host, ""); #endif - // fall back to IPv4 address - QString address = GetSettingOnHost("BackendServerIP", host, ""); - if (!address.isEmpty()) - return address; + if (!d->m_IPv4.empty()) + QString addr4 = GetSettingOnHost("BackendServerIP", host, ""); + + if (addr6.isEmpty()) + { + if (addr4.isEmpty()) + { + LOG(VB_GENERAL, LOG_ERR, "No address defined for host: "+host); + return ""; + } - LOG(VB_GENERAL, LOG_WARNING, "No address defined for host: "+host); - return ""; + // IPv6 is empty, so return this regardless + return addr4; + } + else if ((QHostAddress(addr6) == QHostAddress::LocalHostIPv6) && + !addr4.isEmpty() && + (QHostAddress(addr4) != QHostAddress::LocalHost)) + // IPv6 set to localhost, but IPv4 address if network accessible + return addr4; + else + return addr6; } void MythCoreContext::SetSetting(const QString &key, const QString &newValue) From 7c1b73704a1022be3f32dcc52801e8498bd9e8f2 Mon Sep 17 00:00:00 2001 From: Gavin Hurlbut Date: Tue, 14 Feb 2012 22:30:51 -0800 Subject: [PATCH 04/15] Fix GetBackendServerIP The variables addr6 and addr4 were only being set locally within the scope of the if (simple typo). Also changed empty() to isEmpty() to match the style of the rest of the code. --- mythtv/libs/libmythbase/mythcorecontext.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp index 9ccc4151db8..979adce9067 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.cpp +++ b/mythtv/libs/libmythbase/mythcorecontext.cpp @@ -993,18 +993,20 @@ QString MythCoreContext::GetBackendServerIP(const QString &host) { QString addr4, addr6; #if !defined(QT_NO_IPV6) - if (!d->m_IPv6.empty()) + if (!d->m_IPv6.isEmpty()) // we have IPv6 addresses, assume we can connect to them - QString addr6 = GetSettingOnHost("BackendServerIP6", host, ""); + addr6 = GetSettingOnHost("BackendServerIP6", host, ""); #endif - if (!d->m_IPv4.empty()) - QString addr4 = GetSettingOnHost("BackendServerIP", host, ""); + if (!d->m_IPv4.isEmpty()) + addr4 = GetSettingOnHost("BackendServerIP", host, ""); if (addr6.isEmpty()) { if (addr4.isEmpty()) { LOG(VB_GENERAL, LOG_ERR, "No address defined for host: "+host); +sleep(2); +abort(); return ""; } From 97a9a1703575a1f10b55972928bf085fa9ac7a96 Mon Sep 17 00:00:00 2001 From: Gavin Hurlbut Date: Tue, 14 Feb 2012 22:42:09 -0800 Subject: [PATCH 05/15] Remove debugging abort. Sorry --- mythtv/libs/libmythbase/mythcorecontext.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp index 979adce9067..1b82082cfa0 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.cpp +++ b/mythtv/libs/libmythbase/mythcorecontext.cpp @@ -1005,8 +1005,6 @@ QString MythCoreContext::GetBackendServerIP(const QString &host) if (addr4.isEmpty()) { LOG(VB_GENERAL, LOG_ERR, "No address defined for host: "+host); -sleep(2); -abort(); return ""; } From c5c73bffa2c7629c792a83cc99a22c22aabc9b8f Mon Sep 17 00:00:00 2001 From: Gavin Hurlbut Date: Tue, 14 Feb 2012 23:36:50 -0800 Subject: [PATCH 06/15] Fix perl bindings to accomodate IPv6 Also added two module requirements to the configure for the perl bindings: - IO::Socket::INET6 - DBD::mysql --- mythtv/bindings/perl/IO/Socket/INET/MythTV.pm | 6 +++--- mythtv/configure | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mythtv/bindings/perl/IO/Socket/INET/MythTV.pm b/mythtv/bindings/perl/IO/Socket/INET/MythTV.pm index 31be7d7f587..b7ac1b75a74 100644 --- a/mythtv/bindings/perl/IO/Socket/INET/MythTV.pm +++ b/mythtv/bindings/perl/IO/Socket/INET/MythTV.pm @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# A MythTV Socket class that extends IO::Socket::INET to include some +# A MythTV Socket class that extends IO::Socket::INET6 to include some # MythTV-specific data queries # # @url $URL$ @@ -11,9 +11,9 @@ # package IO::Socket::INET::MythTV; - use base 'IO::Socket::INET'; + use base 'IO::Socket::INET6'; -# Basically, just inherit the constructor from IO::Socket::INET +# Basically, just inherit the constructor from IO::Socket::INET6 sub new { my $class = shift; return $class->SUPER::new(@_); diff --git a/mythtv/configure b/mythtv/configure index 31d11647096..effa4cab105 100755 --- a/mythtv/configure +++ b/mythtv/configure @@ -4304,12 +4304,15 @@ if enabled bindings_perl; then check_pl_lib "Sys::Hostname" || disable_bindings_perl "Sys::Hostname" # Modules not distributed in Perl core check_pl_lib DBI || disable_bindings_perl DBI + check_pl_lib "DBD::mysql" || disable_bindings_perl "DBD::mysql" check_pl_lib "HTTP::Request" || disable_bindings_perl "HTTP::Request" check_pl_lib "LWP::UserAgent" || disable_bindings_perl "LWP::UserAgent" check_pl_lib "Net::UPnP::QueryResponse" || disable_bindings_perl "Net::UPnP::QueryResponse" check_pl_lib "Net::UPnP::ControlPoint" || disable_bindings_perl "Net::UPnP::ControlPoint" + check_pl_lib "IO::Socket::INET6" || + disable_bindings_perl "IO::Socket::INET6" fi # Check for php dependencies From 94d27c67f274440154de9f3265345863d5f659b6 Mon Sep 17 00:00:00 2001 From: Jim Stichnoth Date: Tue, 14 Feb 2012 23:19:13 -0800 Subject: [PATCH 07/15] Fix the DeleteMap tracker for in-progress recordings. When a cutlist is created, the DeleteMap tracker was simulating an artificial cut region starting from the current last frame. For in-progress recordings, this resulted in playback prematurely exiting when that frame was reached. The tracker is now tracks only true cut regions and avoids the premature exit. --- mythtv/libs/libmythtv/deletemap.cpp | 23 +++++++++++++++++------ mythtv/libs/libmythtv/deletemap.h | 8 ++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/mythtv/libs/libmythtv/deletemap.cpp b/mythtv/libs/libmythtv/deletemap.cpp index 4f75d13f7e1..d5659307292 100644 --- a/mythtv/libs/libmythtv/deletemap.cpp +++ b/mythtv/libs/libmythtv/deletemap.cpp @@ -549,13 +549,18 @@ bool DeleteMap::IsTemporaryMark(uint64_t frame) const } /** - * \brief Returns the next or previous mark. If these do not exist, returns - * either zero (the first frame) or total (the last frame). + * \brief Returns the next or previous mark. If these do not exist, + * returns either zero (the first frame) or total (the last + * frame). If hasMark is non-NULL, it is set to true if the + * next/previous mark exists, and false otherwise. */ uint64_t DeleteMap::GetNearestMark( - uint64_t frame, uint64_t total, bool right) const + uint64_t frame, uint64_t total, bool right, + bool *hasMark) const { uint64_t result; + if (hasMark) + *hasMark = true; frm_dir_map_t::const_iterator it = m_deleteMap.begin(); if (right) { @@ -574,6 +579,8 @@ uint64_t DeleteMap::GetNearestMark( result = it.key(); } } + if (hasMark) + *hasMark = false; return result; } @@ -740,6 +747,7 @@ void DeleteMap::SaveMap(uint64_t total, bool isAutoSave) void DeleteMap::TrackerReset(uint64_t frame, uint64_t total) { m_nextCutStart = 0; + m_nextCutStartIsValid = false; if (IsEmpty()) return; @@ -748,16 +756,19 @@ void DeleteMap::TrackerReset(uint64_t frame, uint64_t total) { if (cutpoint.value() == MARK_CUT_START) { + m_nextCutStartIsValid = true; m_nextCutStart = cutpoint.key(); } else { ++cutpoint; - m_nextCutStart = cutpoint != m_deleteMap.end() ? cutpoint.key() : total; + m_nextCutStartIsValid = (cutpoint != m_deleteMap.end()); + m_nextCutStart = m_nextCutStartIsValid ? cutpoint.key() : total; } } else - m_nextCutStart = GetNearestMark(frame, total, !IsInDelete(frame)); + m_nextCutStart = GetNearestMark(frame, total, !IsInDelete(frame), + &m_nextCutStartIsValid); LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Tracker next CUT_START: %1") .arg(m_nextCutStart)); } @@ -768,7 +779,7 @@ void DeleteMap::TrackerReset(uint64_t frame, uint64_t total) */ bool DeleteMap::TrackerWantsToJump(uint64_t frame, uint64_t total, uint64_t &to) { - if (IsEmpty() || frame < m_nextCutStart) + if (IsEmpty() || !m_nextCutStartIsValid || frame < m_nextCutStart) return false; to = GetNearestMark(m_nextCutStart, total, true); diff --git a/mythtv/libs/libmythtv/deletemap.h b/mythtv/libs/libmythtv/deletemap.h index cbc0623bc87..f111ca3b57d 100644 --- a/mythtv/libs/libmythtv/deletemap.h +++ b/mythtv/libs/libmythtv/deletemap.h @@ -19,7 +19,9 @@ typedef struct DeleteMapUndoEntry class MTV_PUBLIC DeleteMap { public: - DeleteMap(): m_editing(false), m_nextCutStart(0), m_changed(true), + DeleteMap(): m_editing(false), + m_nextCutStartIsValid(false), + m_nextCutStart(0), m_changed(true), m_seekamountpos(4), m_seekamount(30), m_ctx(0), m_undoStackPointer(-1) { Push(""); } @@ -56,7 +58,8 @@ class MTV_PUBLIC DeleteMap void Move(uint64_t frame, uint64_t to, uint64_t total); bool IsInDelete(uint64_t frame) const; - uint64_t GetNearestMark(uint64_t frame, uint64_t total, bool right) const; + uint64_t GetNearestMark(uint64_t frame, uint64_t total, bool right, + bool *hasMark = 0) const; bool IsTemporaryMark(uint64_t frame) const; bool HasTemporaryMark(void) const; uint64_t GetLastFrame(uint64_t total) const; @@ -79,6 +82,7 @@ class MTV_PUBLIC DeleteMap void Push(QString undoMessage); bool m_editing; + bool m_nextCutStartIsValid; uint64_t m_nextCutStart; frm_dir_map_t m_deleteMap; QString m_seekText; From e354a6dd70bb3f2291828923f184587da42db98f Mon Sep 17 00:00:00 2001 From: Jim Stichnoth Date: Wed, 15 Feb 2012 06:40:04 -0800 Subject: [PATCH 08/15] Silence cppcheck warnings in subtitlescreen.h. --- mythtv/libs/libmythtv/subtitlescreen.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/mythtv/libs/libmythtv/subtitlescreen.h b/mythtv/libs/libmythtv/subtitlescreen.h index 0c299def0e5..9266301bb4f 100644 --- a/mythtv/libs/libmythtv/subtitlescreen.h +++ b/mythtv/libs/libmythtv/subtitlescreen.h @@ -110,7 +110,7 @@ class FormattedTextChunk : text(t), format(formatting), parent(p) { } - FormattedTextChunk(void) {} + FormattedTextChunk(void) : parent(0) {} QSize CalcSize(void) const { @@ -155,9 +155,23 @@ class FormattedTextSubtitle FormattedTextSubtitle(const QRect &safearea, bool useBackground, SubtitleScreen *p) : m_safeArea(safearea), m_useBackground(useBackground), - parent(p) {} + parent(p) + { + // make cppcheck happy + m_xAnchorPoint = 0; + m_yAnchorPoint = 0; + m_xAnchor = 0; + m_yAnchor = 0; + } FormattedTextSubtitle(void) - : m_safeArea(QRect()), m_useBackground(false), parent(0) {} + : m_safeArea(QRect()), m_useBackground(false), parent(0) + { + // make cppcheck happy + m_xAnchorPoint = 0; + m_yAnchorPoint = 0; + m_xAnchor = 0; + m_yAnchor = 0; + } void InitFromCC608(vector &buffers); void InitFromCC708(const CC708Window &win, int num, const vector &list, From f47181728797ff0efc05389b2262b2c2374d6626 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 15 Feb 2012 16:47:14 +0000 Subject: [PATCH 09/15] Fix metadata lookups for generic episodes, with thanks to dekarl on IRC for reporting and testing the fix --- mythtv/libs/libmythmetadata/metadatafactory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mythtv/libs/libmythmetadata/metadatafactory.cpp b/mythtv/libs/libmythmetadata/metadatafactory.cpp index 27603c5867e..8a0779195b8 100644 --- a/mythtv/libs/libmythmetadata/metadatafactory.cpp +++ b/mythtv/libs/libmythmetadata/metadatafactory.cpp @@ -630,7 +630,8 @@ LookupType GuessLookupType(ProgramInfo *pginfo) // subtitle, it's *probably* a movie. If it's some // weird combination of both, we've got to try everything. RecordingRule *rule = new RecordingRule(); - rule->LoadByProgram(pginfo); + rule->m_recordID = pginfo->GetRecordingRuleID(); + rule->Load(); int ruleepisode = rule->m_episode; delete rule; From ef3fc49804701d4aa7a35a60704df0a68b422976 Mon Sep 17 00:00:00 2001 From: Jim Stichnoth Date: Wed, 15 Feb 2012 10:11:51 -0800 Subject: [PATCH 10/15] Comply with coding conventions by using NULL instead of 0. --- mythtv/libs/libmythtv/subtitlescreen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mythtv/libs/libmythtv/subtitlescreen.h b/mythtv/libs/libmythtv/subtitlescreen.h index 9266301bb4f..76c9f861b28 100644 --- a/mythtv/libs/libmythtv/subtitlescreen.h +++ b/mythtv/libs/libmythtv/subtitlescreen.h @@ -110,7 +110,7 @@ class FormattedTextChunk : text(t), format(formatting), parent(p) { } - FormattedTextChunk(void) : parent(0) {} + FormattedTextChunk(void) : parent(NULL) {} QSize CalcSize(void) const { @@ -164,7 +164,7 @@ class FormattedTextSubtitle m_yAnchor = 0; } FormattedTextSubtitle(void) - : m_safeArea(QRect()), m_useBackground(false), parent(0) + : m_safeArea(QRect()), m_useBackground(false), parent(NULL) { // make cppcheck happy m_xAnchorPoint = 0; From c60f33147e9a556dbc8392c791eaa339f3b3a2f5 Mon Sep 17 00:00:00 2001 From: Robert McNamara Date: Wed, 15 Feb 2012 14:26:12 -0800 Subject: [PATCH 11/15] Do not copy inetrefs from rule -> recording when the rule is a search. Thanks to Karl Deitz for the report and suggested solution. It appears to work fine from limited testing. If you find that the problem is still present for you, please reopen the ticket. Fixes #10338. --- mythtv/programs/mythmetadatalookup/lookup.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mythtv/programs/mythmetadatalookup/lookup.cpp b/mythtv/programs/mythmetadatalookup/lookup.cpp index d0a5dc0d9ff..0e01b6404ba 100644 --- a/mythtv/programs/mythmetadatalookup/lookup.cpp +++ b/mythtv/programs/mythmetadatalookup/lookup.cpp @@ -342,8 +342,11 @@ void LookerUpper::customEvent(QEvent *levent) if (rule) { rule->LoadByProgram(pginfo); - if (rule->m_inetref.isEmpty()) + if (rule->m_inetref.isEmpty() && + (rule->m_searchType == kNoSearch)) + { rule->m_inetref = lookup->GetInetref(); + } rule->m_season = lookup->GetSeason(); rule->m_episode = lookup->GetEpisode(); rule->Save(); From 2cb7fc6cfb0ca5556b97ceaafcace67bf5f43fe3 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 15 Feb 2012 14:16:03 +0000 Subject: [PATCH 12/15] Expose the media type as a statetype to the OSD, states are recording, video, dvd, bluraydisc, httpstream and rtspstream --- mythtv/libs/libmyth/programinfo.cpp | 41 ++++++++++++++++++++++++++--- mythtv/libs/libmythtv/osd.cpp | 6 +++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index e0d667325f9..61cf8091989 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -1578,6 +1578,41 @@ void ProgramInfo::ToMap(InfoMap &progMap, progMap["originalairdate"] = MythDateToString(originalAirDate, kDateFull); progMap["shortoriginalairdate"] = MythDateToString(originalAirDate, kDateShort); } + + // 'mediatype' for a statetype, so untranslated + // 'mediatypestring' for textarea, so translated + // TODO Move to a dedicated ToState() method? + QString mediaType; + QString mediaTypeString; + switch (GetProgramInfoType()) + { + case kProgramInfoTypeVideoFile : + mediaType = "video"; + mediaTypeString = QObject::tr("Video"); + break; + case kProgramInfoTypeVideoDVD : + mediaType = "dvd"; + mediaTypeString = QObject::tr("DVD"); + break; + case kProgramInfoTypeVideoStreamingHTML : + mediaType = "httpstream"; + mediaTypeString = QObject::tr("HTTP Streaming"); + break; + case kProgramInfoTypeVideoStreamingRTSP : + mediaType = "rtspstream"; + mediaTypeString = QObject::tr("RTSP Streaming"); + break; + case kProgramInfoTypeVideoBD : + mediaType = "bluraydisc"; + mediaTypeString = QObject::tr("Blu-Ray Disc"); + break; + case kProgramInfoTypeRecording : // Fall through + default : + mediaType = "recording"; + mediaTypeString = tr("Recording", "Recorded file, object not action"); + } + progMap["mediatype"] = mediaType; + progMap["mediatypestring"] = mediaTypeString; } /// \brief Returns length of program/recording in seconds. @@ -1951,7 +1986,7 @@ bool ProgramInfo::IsSameTimeslot(const ProgramInfo& other) const return false; if (startts == other.startts && (chanid == other.chanid || - (!chansign.isEmpty() && + (!chansign.isEmpty() && chansign.compare(other.chansign, Qt::CaseInsensitive) == 0))) return true; @@ -1969,7 +2004,7 @@ bool ProgramInfo::IsSameProgramTimeslot(const ProgramInfo &other) const if (title.compare(other.title, Qt::CaseInsensitive) != 0) return false; if ((chanid == other.chanid || - (!chansign.isEmpty() && + (!chansign.isEmpty() && chansign.compare(other.chansign, Qt::CaseInsensitive) == 0)) && startts < other.endts && endts > other.startts) @@ -2003,7 +2038,7 @@ void ProgramInfo::CheckProgramIDAuthorities(void) } int numAuths = authMap.count(); - LOG(VB_GENERAL, LOG_INFO, + LOG(VB_GENERAL, LOG_INFO, QString("Found %1 distinct programid authorities").arg(numAuths)); usingProgIDAuth = (numAuths > 1); diff --git a/mythtv/libs/libmythtv/osd.cpp b/mythtv/libs/libmythtv/osd.cpp index 07d562f1c01..88686c4f465 100644 --- a/mythtv/libs/libmythtv/osd.cpp +++ b/mythtv/libs/libmythtv/osd.cpp @@ -463,6 +463,12 @@ void OSD::SetText(const QString &window, QHash &map, if (state) state->DisplayState(map["nightmode"]); } + if (map.contains("mediatype")) + { + MythUIStateType *state = dynamic_cast (win->GetChild("mediatype")); + if (state) + state->DisplayState(map["mediatype"]); + } MythUIProgressBar *bar = dynamic_cast(win->GetChild("elapsedpercent")); From 75b86831e19be55e13d15286f90f31d5aa4f18e6 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 15 Feb 2012 14:16:17 +0000 Subject: [PATCH 13/15] Expose category type as a statetype in PBB. Valid states are movie, series, tvshow and sports (not especially useful in it's current form) --- mythtv/programs/mythfrontend/playbackbox.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp index 5de32255960..74a4a674888 100644 --- a/mythtv/programs/mythfrontend/playbackbox.cpp +++ b/mythtv/programs/mythfrontend/playbackbox.cpp @@ -1144,6 +1144,13 @@ void PlaybackBox::updateIcons(const ProgramInfo *pginfo) if (iconState && !haveIcon) iconState->Reset(); + + iconState = dynamic_cast(GetChild("categorytype")); + if (iconState) + { + if (!(pginfo && iconState->DisplayState(pginfo->GetCategoryType()))) + iconState->Reset(); + } } bool PlaybackBox::IsUsageUIVisible(void) const @@ -1374,6 +1381,8 @@ void PlaybackBox::updateRecList(MythUIButtonListItem *sel_item) if ((*it)->GetSubtitleType() & sit.key()) item->DisplayState(sit.value(), "subtitletypes"); } + + item->DisplayState((*it)->GetCategoryType(), "categorytype"); } if (m_noRecordingsText) From 0ac55656acbcf97544f57eb6961e892d07419173 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 15 Feb 2012 14:16:26 +0000 Subject: [PATCH 14/15] Expose recording rule last/next recorded and deleted dates in the UI. --- mythtv/libs/libmythtv/recordingrule.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mythtv/libs/libmythtv/recordingrule.cpp b/mythtv/libs/libmythtv/recordingrule.cpp index fa052094fac..fcc8fc3041a 100644 --- a/mythtv/libs/libmythtv/recordingrule.cpp +++ b/mythtv/libs/libmythtv/recordingrule.cpp @@ -488,6 +488,17 @@ void RecordingRule::ToMap(InfoMap &infoMap) const infoMap["searchtype"] = SearchTypeToString(m_searchType); if (m_searchType != kNoSearch) infoMap["searchforwhat"] = m_description; + + + if (m_nextRecording.isValid()) + infoMap["nextrecording"] = MythDateTimeToString(m_nextRecording, + kDateFull | kAddYear); + if (m_lastRecorded.isValid()) + infoMap["lastrecorded"] = MythDateTimeToString(m_lastRecorded, + kDateFull | kAddYear); + if (m_lastDeleted.isValid()) + infoMap["lastdeleted"] = MythDateTimeToString(m_lastDeleted, + kDateFull | kAddYear); } void RecordingRule::UseTempTable(bool usetemp, QString table) From 2a7431378f769d7d5906a1abe0d9edd5bec2766c Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 15 Feb 2012 14:16:40 +0000 Subject: [PATCH 15/15] Add a long-form description string for recording status to the ProgramInfo map. This meant a minor modification to toDescription() so that we returned something sensible for programmes which weren't scheduled to record. --- mythtv/libs/libmyth/programinfo.cpp | 6 ++- mythtv/libs/libmyth/programtypes.cpp | 6 ++- mythtv/libs/libmyth/programtypes.h | 7 +-- .../programs/mythfrontend/schedulecommon.cpp | 52 ++++++++++--------- .../mythfrontend/viewschedulediff.cpp | 5 +- 5 files changed, 44 insertions(+), 32 deletions(-) diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index 61cf8091989..e902929eddb 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -1528,6 +1528,9 @@ void ProgramInfo::ToMap(InfoMap &progMap, progMap["recstatus"] = ::toString(GetRecordingStatus(), GetRecordingRuleType()); + progMap["recstatuslong"] = ::toDescription(GetRecordingStatus(), + GetRecordingRuleType(), + GetRecordingStartTime()); if (IsRepeat()) { @@ -1609,7 +1612,8 @@ void ProgramInfo::ToMap(InfoMap &progMap, case kProgramInfoTypeRecording : // Fall through default : mediaType = "recording"; - mediaTypeString = tr("Recording", "Recorded file, object not action"); + mediaTypeString = QObject::tr("Recording", + "Recorded file, object not action"); } progMap["mediatype"] = mediaType; progMap["mediatypestring"] = mediaTypeString; diff --git a/mythtv/libs/libmyth/programtypes.cpp b/mythtv/libs/libmyth/programtypes.cpp index 0060b0e8b07..0349297658e 100644 --- a/mythtv/libs/libmyth/programtypes.cpp +++ b/mythtv/libs/libmyth/programtypes.cpp @@ -215,8 +215,12 @@ QString toString(RecStatusType recstatus, RecordingType rectype) } /// \brief Converts "recstatus" into a long human readable description. -QString toDescription(RecStatusType recstatus, const QDateTime &recstartts) +QString toDescription(RecStatusType recstatus, RecordingType rectype, + const QDateTime &recstartts) { + if (rectype == kNotRecording) + return QObject::tr("This showing is not scheduled to record"); + QString message; QDateTime now = QDateTime::currentDateTime(); diff --git a/mythtv/libs/libmyth/programtypes.h b/mythtv/libs/libmyth/programtypes.h index 9bcccc38aa5..6864e8119ef 100644 --- a/mythtv/libs/libmyth/programtypes.h +++ b/mythtv/libs/libmyth/programtypes.h @@ -99,7 +99,7 @@ typedef enum SkipTypes { * are just too many false positives from non-commercial cut scenes. */ COMM_DETECT_2_ALL = (COMM_DETECT_2_LOGO | COMM_DETECT_2_BLANK), - COMM_DETECT_PREPOSTROLL = 0x00000200, + COMM_DETECT_PREPOSTROLL = 0x00000200, COMM_DETECT_PREPOSTROLL_ALL = (COMM_DETECT_PREPOSTROLL | COMM_DETECT_BLANKS | COMM_DETECT_SCENE) @@ -144,7 +144,7 @@ typedef enum FlagMask { } ProgramFlag; typedef enum ProgramInfoType { - kProgramInfoTypeRecording = 0, + kProgramInfoTypeRecording = 0, kProgramInfoTypeVideoFile, kProgramInfoTypeVideoDVD, kProgramInfoTypeVideoStreamingHTML, @@ -227,7 +227,8 @@ typedef enum RecStatusTypes { MPUBLIC QString toUIState(RecStatusType); MPUBLIC QString toString(RecStatusType, uint id); MPUBLIC QString toString(RecStatusType, RecordingType); -MPUBLIC QString toDescription(RecStatusType, const QDateTime &recstartts); +MPUBLIC QString toDescription(RecStatusType, RecordingType, + const QDateTime &recstartts); typedef enum AvailableStatusTypes { asAvailable = 0, diff --git a/mythtv/programs/mythfrontend/schedulecommon.cpp b/mythtv/programs/mythfrontend/schedulecommon.cpp index d7644802b30..5305d57a0c8 100644 --- a/mythtv/programs/mythfrontend/schedulecommon.cpp +++ b/mythtv/programs/mythfrontend/schedulecommon.cpp @@ -9,7 +9,7 @@ #include "programinfo.h" #include "remoteutil.h" -// libmythtv +// libmythtv #include "recordinginfo.h" #include "tvremoteutil.h" @@ -31,23 +31,23 @@ void ScheduleCommon::ShowDetails(ProgramInfo *pginfo) const { if (!pginfo) return; - + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); ProgDetails *details_dialog = new ProgDetails(mainStack, pginfo); - + if (!details_dialog->Create()) { delete details_dialog; return; } - + mainStack->AddScreen(details_dialog); } /** * \brief Show the upcoming recordings for this title */ -void ScheduleCommon::ShowUpcoming(const QString &title, +void ScheduleCommon::ShowUpcoming(const QString &title, const QString &seriesid) const { if (title.isEmpty()) @@ -106,7 +106,7 @@ void ScheduleCommon::EditRecording(ProgramInfo *pginfo) { if (!pginfo) return; - + RecordingInfo ri(*pginfo); if (!ri.GetRecordingRuleID()) @@ -124,7 +124,7 @@ void ScheduleCommon::EditScheduled(ProgramInfo *pginfo) { if (!pginfo) return; - + RecordingInfo ri(*pginfo); EditScheduled(&ri); } @@ -167,10 +167,10 @@ void ScheduleCommon::MakeOverride(RecordingInfo *recinfo, bool startActive) return; RecordingRule *recrule = new RecordingRule(); - + if (!recrule->LoadByProgram(static_cast(recinfo))) LOG(VB_GENERAL, LOG_ERR, "Failed to load by program info"); - + if (!recrule->MakeOverride()) { LOG(VB_GENERAL, LOG_ERR, "Failed to make Override"); @@ -195,21 +195,22 @@ void ScheduleCommon::MakeOverride(RecordingInfo *recinfo, bool startActive) void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo) { QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - "); - + message += "\n\n"; - message += toDescription( - recinfo.GetRecordingStatus(), recinfo.GetRecordingStartTime()); - + message += toDescription(recinfo.GetRecordingStatus(), + recinfo.GetRecordingRuleType(), + recinfo.GetRecordingStartTime()); + MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox(message, popupStack, "recOptionPopup", true); - + if (menuPopup->Create()) { menuPopup->SetReturnEvent(this, "schedulerecording"); QDateTime now = QDateTime::currentDateTime(); - + if (recinfo.GetRecordingStartTime() < now && recinfo.GetRecordingEndTime() > now) { @@ -257,7 +258,7 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo) qVariantFromValue(recinfo)); } } - + if (recinfo.GetRecordingRuleType() != kOverrideRecord && recinfo.GetRecordingRuleType() != kDontRecord) { @@ -270,7 +271,7 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo) { menuPopup->AddButton(tr("Edit Options"), qVariantFromValue(recinfo)); - + if (recinfo.GetRecordingRuleType() != kSingleRecord && recinfo.GetRecordingRuleType() != kFindOneRecord) { @@ -279,7 +280,7 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo) } } } - + if (recinfo.GetRecordingRuleType() == kOverrideRecord || recinfo.GetRecordingRuleType() == kDontRecord) { @@ -296,8 +297,8 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo) qVariantFromValue(recinfo)); } } - } - + } + popupStack->AddScreen(menuPopup); } else @@ -315,8 +316,9 @@ void ScheduleCommon::ShowNotRecordingDialog(const RecordingInfo& recinfo) QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - "); message += "\n\n"; - message += toDescription( - recinfo.GetRecordingStatus(), recinfo.GetRecordingStartTime()); + message += toDescription(recinfo.GetRecordingStatus(), + recinfo.GetRecordingRuleType(), + recinfo.GetRecordingStartTime()); if (recinfo.GetRecordingStatus() == rsConflict || recinfo.GetRecordingStatus() == rsLaterShowing) @@ -454,7 +456,7 @@ void ScheduleCommon::ShowNotRecordingDialog(const RecordingInfo& recinfo) qVariantFromValue(recinfo)); } } - + popupStack->AddScreen(menuPopup); } else @@ -513,10 +515,10 @@ void ScheduleCommon::customEvent(QEvent *event) { if (!qVariantCanConvert(dce->GetData())) return; - + RecordingInfo recInfo = qVariantValue (dce->GetData()); - + if (resulttext == tr("Reactivate")) recInfo.ReactivateRecording(); else if (resulttext == tr("Stop recording")) diff --git a/mythtv/programs/mythfrontend/viewschedulediff.cpp b/mythtv/programs/mythfrontend/viewschedulediff.cpp index 04a51e2a419..367d1f2cf4f 100644 --- a/mythtv/programs/mythfrontend/viewschedulediff.cpp +++ b/mythtv/programs/mythfrontend/viewschedulediff.cpp @@ -102,8 +102,9 @@ void ViewScheduleDiff::showStatus(MythUIButtonListItem *item) QString message = pi->toString(ProgramInfo::kTitleSubtitle, " - "); message += "\n\n"; - message += toDescription( - pi->GetRecordingStatus(), pi->GetRecordingStartTime()); + message += toDescription(pi->GetRecordingStatus(), + pi->GetRecordingRuleType(), + pi->GetRecordingStartTime()); if (pi->GetRecordingStatus() == rsConflict || pi->GetRecordingStatus() == rsLaterShowing)