From 17084ea9b06f6e521c376c2ddcc352ece8813d22 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 3 Mar 2019 19:25:30 +0000
Subject: mythtv & mythplugins: update to latest -fixes

---
 abs/core/mythtv/stable-30/mythplugins/PKGBUILD     |  4 +-
 ...ncy-by-moving-blocking-code-to-own-thread.patch | 82 ++++++++++++++++++++
 ...Add-interlaced-status-to-OSD-debug-screen.patch | 19 +++++
 abs/core/mythtv/stable-30/mythtv/PKGBUILD          | 12 ++-
 .../mythtv/addHostnameIPtoMachineStatus.patch      | 88 ++++++++++++++++++++++
 .../mythtv/mythfrontend_en_us.ts_Title_Case.patch  | 19 +++--
 6 files changed, 211 insertions(+), 13 deletions(-)
 create mode 100644 abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch
 create mode 100644 abs/core/mythtv/stable-30/mythtv/0227-OSD-Add-interlaced-status-to-OSD-debug-screen.patch
 create mode 100644 abs/core/mythtv/stable-30/mythtv/addHostnameIPtoMachineStatus.patch

diff --git a/abs/core/mythtv/stable-30/mythplugins/PKGBUILD b/abs/core/mythtv/stable-30/mythplugins/PKGBUILD
index b9ed6d5..6308c04 100644
--- a/abs/core/mythtv/stable-30/mythplugins/PKGBUILD
+++ b/abs/core/mythtv/stable-30/mythplugins/PKGBUILD
@@ -9,7 +9,7 @@ pkgname=('mytharchive'
          'mythweather'
          'mythzoneminder')
 pkgver=30.0
-pkgrel=3
+pkgrel=4
 arch=('x86_64')
 url="http://www.mythtv.org"
 license=('GPL')
@@ -18,7 +18,7 @@ makedepends=('cdrkit' 'dcraw' 'dvdauthor' 'dvd+rw-tools' 'ffmpeg' 'flac' 'libexi
              'perl-datetime-format-iso8601' 'perl-date-manip' 'perl-image-size'
              'perl-json' 'perl-libwww' 'perl-soap-lite' 'perl-xml-sax'
              'perl-xml-simple' 'perl-xml-xpath' 'python2-oauth' 'python2-pillow'
-             'python2-pycurl' 'zlib')
+             'python2-pycurl' 'qt5-tools' 'zlib')
 source=('mythburn.py-aspectratio.patch'
         'mythburn.cpp-python2.patch'
         '0317-0336-MythMusic-Fix-Playlist-copyTracks-and-removeAllTrack.patch'
diff --git a/abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch b/abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch
new file mode 100644
index 0000000..4a2c4c3
--- /dev/null
+++ b/abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch
@@ -0,0 +1,82 @@
+diff -Naur mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/ssdp.cpp mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/ssdp.cpp
+--- mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/ssdp.cpp	2019-01-05 12:44:55.383333333 +0100
++++ mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/ssdp.cpp	2019-01-05 12:44:56.990000000 +0100
+@@ -170,21 +170,21 @@
+         // ------------------------------------------------------------------
+ 
+         LOG(VB_UPNP, LOG_INFO,
+-            "SSDP::EnableNotifications() - sending NTS_byebye");
+-        m_pNotifyTask->SetNTS( NTS_byebye );
+-        m_pNotifyTask->Execute( nullptr );
+-
+-        m_bAnnouncementsEnabled = true;
++            "SSDP::EnableNotifications() - sending NTS_byebye2");
++        m_pNotifyTask->SetNTS( NTS_byebye2 );
++    }
++    else
++    {
++        LOG(VB_UPNP, LOG_INFO,
++            "SSDP::EnableNotifications() - sending NTS_alive");
++        m_pNotifyTask->SetNTS( NTS_alive );
+     }
+ 
++    m_bAnnouncementsEnabled = true;
++
+     // ------------------------------------------------------------------
+     // Add Announcement Task to the Queue
+     // ------------------------------------------------------------------
+-
+-    LOG(VB_UPNP, LOG_INFO, "SSDP::EnableNotifications() - sending NTS_alive");
+-
+-    m_pNotifyTask->SetNTS( NTS_alive );
+-
+     TaskQueue::Instance()->AddTask(m_pNotifyTask);
+ 
+     LOG(VB_UPNP, LOG_INFO,
+diff -Naur mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/upnptasknotify.cpp mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/upnptasknotify.cpp
+--- mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/upnptasknotify.cpp	2019-01-05 12:44:55.383333333 +0100
++++ mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/upnptasknotify.cpp	2019-01-05 12:44:56.990000000 +0100
+@@ -127,7 +127,9 @@
+ 
+         pSocket->writeBlock( scPacket, scPacket.length(),
+                              pSocket->address(), pSocket->port() );
+-        std::this_thread::sleep_for(std::chrono::milliseconds(random() % 250));
++        // Only wait if not sending final bybbye.  This speeds up shutdown
++        if (m_eNTS != NTS_byebye)
++            std::this_thread::sleep_for(std::chrono::milliseconds(random() % 250));
+         pSocket->writeBlock( scPacket, scPacket.length(),
+                              pSocket->address(), pSocket->port() );
+     }
+@@ -168,6 +170,11 @@
+ 
+     if (m_eNTS == NTS_alive) 
+         pQueue->AddTask( (m_nMaxAge / 2) * 1000, (Task *)this  );
++    else if (m_eNTS == NTS_byebye2)
++    {
++        m_eNTS = NTS_alive;
++        pQueue->AddTask( this );
++    }
+ 
+     m_mutex.unlock();
+ 
+diff -Naur mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/upnptasknotify.h mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/upnptasknotify.h
+--- mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/upnptasknotify.h	2019-01-05 12:44:55.383333333 +0100
++++ mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/upnptasknotify.h	2019-01-05 12:44:56.990000000 +0100
+@@ -38,7 +38,8 @@
+ typedef enum
+ {
+     NTS_alive   = 0,
+-    NTS_byebye  = 1
++    NTS_byebye  = 1,
++    NTS_byebye2
+ 
+ } UPnpNotifyNTS;
+ 
+@@ -90,6 +91,7 @@
+             {
+                 case NTS_alive : return( "ssdp:alive"  );
+                 case NTS_byebye: return( "ssdp:byebye" );
++                case NTS_byebye2: return( "ssdp:byebye" );
+             }
+             return( "unknown" );
+         }
diff --git a/abs/core/mythtv/stable-30/mythtv/0227-OSD-Add-interlaced-status-to-OSD-debug-screen.patch b/abs/core/mythtv/stable-30/mythtv/0227-OSD-Add-interlaced-status-to-OSD-debug-screen.patch
new file mode 100644
index 0000000..f61693d
--- /dev/null
+++ b/abs/core/mythtv/stable-30/mythtv/0227-OSD-Add-interlaced-status-to-OSD-debug-screen.patch
@@ -0,0 +1,19 @@
+diff -Naur mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythtv/mythplayer.cpp mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythtv/mythplayer.cpp
+--- mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythtv/mythplayer.cpp	2019-01-05 12:45:37.260000000 +0100
++++ mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythtv/mythplayer.cpp	2019-01-05 12:45:38.720000000 +0100
+@@ -5074,13 +5074,13 @@
+     if (decoder)
+         infoMap["videocodecdesc"] = decoder->GetRawEncodingType();
+     infoMap["videowidth"]     = QString::number(width);
+-    infoMap["videoheight"]    = QString::number(height);
++    bool interlaced = is_interlaced(m_scan);
++    infoMap["videoheight"]    = QString::number(height) + (interlaced ? "i" : "");
+     infoMap["videoframerate"] = QString::number(video_frame_rate, 'f', 2);
+ 
+     if (width < 640)
+         return;
+ 
+-    bool interlaced = is_interlaced(m_scan);
+     if (width == 1920 || height == 1080 || height == 1088)
+         infoMap["videodescrip"] = interlaced ? "HD_1080_I" : "HD_1080_P";
+     else if ((width == 1280 || height == 720) && !interlaced)
diff --git a/abs/core/mythtv/stable-30/mythtv/PKGBUILD b/abs/core/mythtv/stable-30/mythtv/PKGBUILD
index 806fdc3..1867511 100644
--- a/abs/core/mythtv/stable-30/mythtv/PKGBUILD
+++ b/abs/core/mythtv/stable-30/mythtv/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=mythtv
 pkgver=30.0
-pkgrel=3
+pkgrel=4
 commit_hash=`cat ../git_src/git_hash`
 pkgdesc="A Homebrew PVR project $commit_hash"
 arch=('x86_64')
@@ -25,6 +25,8 @@ install='mythtv.install'
 
 patches=(
          'myth_settings.patch'
+         '0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch'
+         '0227-OSD-Add-interlaced-status-to-OSD-debug-screen.patch'
          'videoAlwaysUseBookmark.patch'
          'autoskip_reduce_commskip_jumpback.patch'
          'change_msg_types.patch'
@@ -35,7 +37,7 @@ patches=(
          'mythfrontend_en_us.ts_Title_Case.patch'
          'fixTranslations.patch'
          'pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch'
-         '0294-0283-FE-Add-network-status-to-machine-status-dialog.patch'
+         'addHostnameIPtoMachineStatus.patch'
          'revertQTsettingsForMythinstall.patch'
          )
 
@@ -126,15 +128,17 @@ package() {
 }
 
 md5sums=('fb5a87c52a31168a0c8fdde72f27cc45'
+         '8488776c337ec5d1b15d026c5be40b04'
+         'e4ced95f173911eaf735e5975788d51e'
          '41098e898361a5a3cde3eaae358482a8'
          '2f983590a8a3cf81f386cc65b9628e13'
          'f764758832f8e9068ffda1ac0c8aacba'
          '0f674b9cad031ba1e03aaf6b5ee1499f'
          'b0b238320fa78a4928dce2cea7c85071'
          '8e4492d1777234a021f368bd6ee964ee'
-         'cb34243fafbcfefc3818626126684f6a'
+         '208f46d91c5911e9572d300d89381d7b'
          '72404ebfec2f18536ccc10d8e2bc8757'
          'd05eaf66c434a131c8efb4d87e99b402'
-         'abaef221b00690b329f4dca18676bcd6'
+         'b3ae1cc55f40c6953121415e08c166f4'
          '73ad2f3bec8745f7a3bbf2169ee34db3'
          '633cd853a89aeee5388daaad21ccec28')
diff --git a/abs/core/mythtv/stable-30/mythtv/addHostnameIPtoMachineStatus.patch b/abs/core/mythtv/stable-30/mythtv/addHostnameIPtoMachineStatus.patch
new file mode 100644
index 0000000..2fd8b88
--- /dev/null
+++ b/abs/core/mythtv/stable-30/mythtv/addHostnameIPtoMachineStatus.patch
@@ -0,0 +1,88 @@
+diff --git a/mythtv/programs/mythfrontend/statusbox.cpp b/mythtv/programs/mythfrontend/statusbox.cpp
+index e45016af50..73e7792a61 100644
+--- a/mythtv/programs/mythfrontend/statusbox.cpp
++++ b/mythtv/programs/mythfrontend/statusbox.cpp
+@@ -5,6 +5,7 @@ using namespace std;
+ 
+ #include <QRegExp>
+ #include <QHostAddress>
++    #include <QNetworkInterface>
+ 
+ #include "mythcorecontext.h"
+ #include "filesysteminfo.h"
+@@ -1271,9 +1272,10 @@ void StatusBox::doMachineStatus()
+         m_iconState->DisplayState("machine");
+     m_logList->Reset();
+     QString machineStr = tr("Machine Status shows some operating system "
+-                            "statistics of this machine");
++                            "statistics of this machine.");
+     if (!m_isBackendActive)
+-        machineStr.append(" " + tr("and the MythTV server"));
++        machineStr = tr("Machine Status shows some operating system "
++                        "statistics of this machine and the MythTV server.");
+ 
+     if (m_helpText)
+         m_helpText->SetText(machineStr);
+@@ -1291,13 +1293,41 @@ void StatusBox::doMachineStatus()
+         line = tr("This machine:");
+     AddLogLine(line, machineStr);
+ 
++    // Hostname & IP
++    line = "   " + tr("Hostname") + ": " + gCoreContext->GetHostName();
++    line.append("      " + tr("IP") + ": ");
++    QString sep = " ";
++    foreach(QNetworkInterface iface, QNetworkInterface::allInterfaces())
++    {
++        QNetworkInterface::InterfaceFlags f = iface.flags();
++        if (!(f & QNetworkInterface::IsUp))
++            continue;
++        if (!(f & QNetworkInterface::IsRunning))
++            continue;
++        if (f & QNetworkInterface::IsLoopBack)
++            continue;
++
++        sep = ", ";
++        QString sep2 = "";
++        foreach(QNetworkAddressEntry addr, iface.addressEntries())
++        {
++            if (addr.ip().protocol() == QAbstractSocket::IPv4Protocol || addr.ip().protocol() == QAbstractSocket::IPv6Protocol)
++            {
++                line += sep2 + addr.ip().toString();
++                sep2 = ", ";
++            }
++        }
++        line += "";
++    }
++    AddLogLine(line, machineStr);
++
+     // uptime
+     if (!getUptime(uptime))
+         uptime = 0;
+     line = uptimeStr(uptime);
+ 
+     // weighted average loads
+-    line.append(".   " + tr("Load") + ": ");
++    line.append("      " + tr("Load") + ": ");
+ 
+ #if defined(_WIN32) || defined(Q_OS_ANDROID)
+     line.append(tr("unknown") + " - getloadavg() " + tr("failed"));
+@@ -1339,13 +1369,18 @@ void StatusBox::doMachineStatus()
+         line = tr("MythTV server") + ':';
+         AddLogLine(line, machineStr);
+ 
++        // Hostname & IP
++        line = "   " + tr("Hostname") + ": " + gCoreContext->GetSetting("MasterServerName");
++        line.append("      " + tr("IP") + ": " + gCoreContext->GetSetting("MasterServerIP"));
++        AddLogLine(line, machineStr);
++
+         // uptime
+         if (!RemoteGetUptime(uptime))
+             uptime = 0;
+         line = uptimeStr(uptime);
+ 
+         // weighted average loads
+-        line.append(".   " + tr("Load") + ": ");
++        line.append("      " + tr("Load") + ": ");
+         float floads[3];
+         if (RemoteGetLoad(floads))
+         {
diff --git a/abs/core/mythtv/stable-30/mythtv/mythfrontend_en_us.ts_Title_Case.patch b/abs/core/mythtv/stable-30/mythtv/mythfrontend_en_us.ts_Title_Case.patch
index 09088ec..2669566 100644
--- a/abs/core/mythtv/stable-30/mythtv/mythfrontend_en_us.ts_Title_Case.patch
+++ b/abs/core/mythtv/stable-30/mythtv/mythfrontend_en_us.ts_Title_Case.patch
@@ -1,5 +1,5 @@
 --- src/mythtv/i18n/mythfrontend_en_us.ts.orig	2019-02-25 01:33:22.413248950 +0000
-+++ src/mythtv/i18n/mythfrontend_en_us.ts	2019-02-27 01:32:37.679194737 +0000
++++ src/mythtv/i18n/mythfrontend_en_us.ts	2019-03-01 22:16:23.173068477 +0000
 @@ -4,21 +4,21 @@
  <context>
      <name>(Categories)</name>
@@ -24713,20 +24713,22 @@
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="514"/>
 +        <location filename="../programs/mythfrontend/statusbox.cpp" line="513"/>
          <source>Listings Status shows the latest status information from mythfilldatabase</source>
-         <translation>Listings Status shows the latest status information from mythfilldatabase</translation>
+-        <translation>Listings Status shows the latest status information from mythfilldatabase</translation>
++        <translation>Listings Status shows the latest status information from mythfilldatabase.</translation>
      </message>
      <message>
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="546"/>
 +        <location filename="../programs/mythfrontend/statusbox.cpp" line="545"/>
          <source>Mythfrontend version: %1 (%2)</source>
 -        <translation>Mythfrontend version: %1 (%2)</translation>
-+        <translation>MythFrontend version: %1 (%2)</translation>
++        <translation>MythFrontend Version: %1 (%2)</translation>
      </message>
      <message>
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="548"/>
 +        <location filename="../programs/mythfrontend/statusbox.cpp" line="547"/>
          <source>Last mythfilldatabase guide update:</source>
-         <translation>Last mythfilldatabase guide update:</translation>
+-        <translation>Last mythfilldatabase guide update:</translation>
++        <translation>Last mythfilldatabase Guide Update:</translation>
      </message>
      <message>
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="549"/>
@@ -24933,7 +24935,8 @@
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="1057"/>
 +        <location filename="../programs/mythfrontend/statusbox.cpp" line="1127"/>
          <source>%1 total, %2 used, %3 (or %4%) free.</source>
-         <translation>%1 total, %2 used, %3 (or %4%) free.</translation>
+-        <translation>%1 total, %2 used, %3 (or %4%) free.</translation>
++        <translation>%1 total, %2 used, %3 (or %4%) free</translation>
      </message>
      <message>
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="1074"/>
@@ -25066,7 +25069,8 @@
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="1203"/>
 +        <location filename="../programs/mythfrontend/statusbox.cpp" line="1273"/>
          <source>Machine Status shows some operating system statistics of this machine</source>
-         <translation>Machine Status shows some operating system statistics of this machine</translation>
+-        <translation>Machine Status shows some operating system statistics of this machine</translation>
++        <translation>Machine Status shows some operating system statistics of this machine.</translation>
      </message>
      <message>
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="1206"/>
@@ -25084,7 +25088,8 @@
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="1221"/>
 +        <location filename="../programs/mythfrontend/statusbox.cpp" line="1291"/>
          <source>This machine:</source>
-         <translation>This machine:</translation>
+-        <translation>This machine:</translation>
++        <translation>This Machine:</translation>
      </message>
      <message>
 -        <location filename="../programs/mythfrontend/statusbox.cpp" line="1230"/>
-- 
cgit v0.12