From ceb6d3594fbd672587a1f15618427be552654241 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 21 Sep 2015 13:37:07 +0000
Subject: kodi: fix hdhr uPnP issue. closes #998

---
 abs/extra/kodi/PKGBUILD       |  7 +++++--
 abs/extra/kodi/__changelog    |  1 +
 abs/extra/kodi/hdhr_uPnP.diff | 16 ++++++++++++++++
 3 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 abs/extra/kodi/hdhr_uPnP.diff

diff --git a/abs/extra/kodi/PKGBUILD b/abs/extra/kodi/PKGBUILD
index 961c07a..2898d21 100644
--- a/abs/extra/kodi/PKGBUILD
+++ b/abs/extra/kodi/PKGBUILD
@@ -15,7 +15,7 @@ pkgbase=kodi
 pkgname=('kodi' 'kodi-eventclients')
 pkgver=15.1
 _codename=Isengard
-pkgrel=1
+pkgrel=2
 arch=('i686' 'x86_64')
 url="http://kodi.tv"
 license=('GPL2')
@@ -33,6 +33,7 @@ source=(
   "$pkgname-$pkgver-$_codename.tar.gz::https://github.com/xbmc/xbmc/archive/$pkgver-$_codename.tar.gz"
   'kodi.sh'
   'kodi_lib.conf'
+  'hdhr_uPnP.diff'
 )
 
 prepare() {
@@ -42,6 +43,7 @@ prepare() {
   sed 's|^#!.*python$|#!/usr/bin/python2|' -i tools/depends/native/rpl-native/rpl
 	sed 's/python/python2/' -i tools/Linux/kodi.sh.in
   sed 's/shell python/shell python2/' -i tools/EventClients/Makefile.in
+  patch -Np1 -i ${srcdir}/hdhr_uPnP.diff
 }
 
 build() {
@@ -136,4 +138,5 @@ package_kodi-eventclients() {
 
 md5sums=('d8acb0ef061b3e2fef88146cea1f4443'
          'f6adc8e06d7076143ca2ad118126b158'
-         'f04d1c89f5108c6aba36cf708a74cc95')
+         'f04d1c89f5108c6aba36cf708a74cc95'
+         'c09cc882da2ad0c1f042fb86a5b47d20')
diff --git a/abs/extra/kodi/__changelog b/abs/extra/kodi/__changelog
index 8015995..53d67ec 100644
--- a/abs/extra/kodi/__changelog
+++ b/abs/extra/kodi/__changelog
@@ -2,3 +2,4 @@ PKGBUILD - remove libpulse dep and remove --enable-pulse config option
 PKGBUILD - Add /usr/LH/bin/kodi.sh
 PKGBUILD - Add /etc/gen_lib_xml.d/kodi_lib.conf
 kodi.install - add gen_lib_xml.py to post_install and post_remove
+PKGBUILD - Add hdhr_uPnP.diff
diff --git a/abs/extra/kodi/hdhr_uPnP.diff b/abs/extra/kodi/hdhr_uPnP.diff
new file mode 100644
index 0000000..7ad89e1
--- /dev/null
+++ b/abs/extra/kodi/hdhr_uPnP.diff
@@ -0,0 +1,16 @@
+diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp
+index c308649..25af47e 100644
+--- a/xbmc/filesystem/CurlFile.cpp
++++ b/xbmc/filesystem/CurlFile.cpp
+@@ -1528,8 +1528,9 @@ bool CCurlFile::CReadState::FillBuffer(unsigned int want)
+                   msg->data.result == CURLE_RECV_ERROR)        &&
+                   !m_bFirstLoop)
+               CURLresult = msg->data.result;
+-            else if ( (msg->data.result == CURLE_HTTP_RANGE_ERROR     ||
+-                       httpCode == 416 /* = Requested Range Not Satisfiable */) &&
++            else if ( (msg->data.result == CURLE_HTTP_RANGE_ERROR              ||
++                       httpCode == 416 /* = Requested Range Not Satisfiable */ ||
++                       httpCode == 406 /* = Not Acceptable (fixes issues with non compliant HDHomerun servers */) &&
+                        m_bFirstLoop                                   &&
+                        m_filePos == 0                                 &&
+                        m_sendRange)
-- 
cgit v0.12

