From 415889576cfd85f52b9d3c5aa7f47c31225dc1b8 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 28 Apr 2016 22:05:05 +0000
Subject: mythtv, mythplugins, mythweb: update to latest fixes

mythtv: update recordings script and patch Program.pm to seperate category types.
---
 abs/core/mythtv/stable-0.28/git_src/git_hash       |  2 +-
 abs/core/mythtv/stable-0.28/git_src/git_hash_web   |  2 +-
 abs/core/mythtv/stable-0.28/mythplugins/PKGBUILD   |  2 +-
 abs/core/mythtv/stable-0.28/mythtv/PKGBUILD        |  6 ++-
 .../mythtv/add_categorytype_Program.pm.patch       | 10 +++++
 abs/core/mythtv/stable-0.28/mythtv/recordings      | 50 ++++++++++++++++------
 abs/core/mythtv/stable-0.28/mythweb/PKGBUILD       |  2 +-
 7 files changed, 54 insertions(+), 20 deletions(-)
 create mode 100644 abs/core/mythtv/stable-0.28/mythtv/add_categorytype_Program.pm.patch

diff --git a/abs/core/mythtv/stable-0.28/git_src/git_hash b/abs/core/mythtv/stable-0.28/git_src/git_hash
index 5342cf5..cc8108c 100644
--- a/abs/core/mythtv/stable-0.28/git_src/git_hash
+++ b/abs/core/mythtv/stable-0.28/git_src/git_hash
@@ -1 +1 @@
-6956ff00feb1e8a1ce137ccbbf6d32354714018b
+1bec90bcf03e9dfd60514c95e1e3872d4ee643bf
diff --git a/abs/core/mythtv/stable-0.28/git_src/git_hash_web b/abs/core/mythtv/stable-0.28/git_src/git_hash_web
index 5a116a2..542ef2e 100644
--- a/abs/core/mythtv/stable-0.28/git_src/git_hash_web
+++ b/abs/core/mythtv/stable-0.28/git_src/git_hash_web
@@ -1 +1 @@
-f1cb29b0b20586c959c5c2d33ed2b3853dab3f12
+a1f2cdf03978427eaa9e35fa18162a0ba6be829d
diff --git a/abs/core/mythtv/stable-0.28/mythplugins/PKGBUILD b/abs/core/mythtv/stable-0.28/mythplugins/PKGBUILD
index e4386ae..b0a2e7f 100644
--- a/abs/core/mythtv/stable-0.28/mythplugins/PKGBUILD
+++ b/abs/core/mythtv/stable-0.28/mythplugins/PKGBUILD
@@ -9,7 +9,7 @@ pkgname=('mytharchive'
          'mythweather'
          'mythzoneminder')
 pkgver=0.28
-pkgrel=10
+pkgrel=11
 arch=('i686' 'x86_64')
 url="http://www.mythtv.org"
 license=('GPL')
diff --git a/abs/core/mythtv/stable-0.28/mythtv/PKGBUILD b/abs/core/mythtv/stable-0.28/mythtv/PKGBUILD
index 750a89a..e00b6c8 100644
--- a/abs/core/mythtv/stable-0.28/mythtv/PKGBUILD
+++ b/abs/core/mythtv/stable-0.28/mythtv/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=mythtv
 pkgver=0.28
-pkgrel=10
+pkgrel=11
 commit_hash=`cat ../git_src/git_hash`
 pkgdesc="A Homebrew PVR project $commit_hash"
 arch=('i686' 'x86_64')
@@ -29,6 +29,7 @@ patches=(
          'change_msg_types.patch'
          'disable_mythnotification_tuner_failure.patch'
          'tv.cpp_fix_caps.patch'
+         'add_categorytype_Program.pm.patch'
          )
 
 optdepends=()
@@ -112,4 +113,5 @@ md5sums=('e30b482dcd5f3e71c6419fd753bab2b1'
          'f8a56ac814722b110dc9859169b9bda9'
          '1cd668136deea20efb79cf3e6310effc'
          '62c42b1043ebf65959fa9eced9ca3ed8'
-         '928de4b070d9f3b784d55c0db415eaf3')
+         'a38f26576662afdc02d11c7096839321'
+         'cc9e81a297f82e9df4ad72428c4f37c6')
diff --git a/abs/core/mythtv/stable-0.28/mythtv/add_categorytype_Program.pm.patch b/abs/core/mythtv/stable-0.28/mythtv/add_categorytype_Program.pm.patch
new file mode 100644
index 0000000..0bff554
--- /dev/null
+++ b/abs/core/mythtv/stable-0.28/mythtv/add_categorytype_Program.pm.patch
@@ -0,0 +1,10 @@
+--- src/mythtv/bindings/perl/MythTV/Program.pm.orig	2016-04-28 20:31:49.230576243 +0000
++++ src/mythtv/bindings/perl/MythTV/Program.pm	2016-04-28 20:28:29.779523866 +0000
+@@ -346,6 +346,7 @@
+         ($fields{'S'} = ($self->{'subtitle'}    or '')) =~ s/%/%%/g;
+         ($fields{'R'} = ($self->{'description'} or '')) =~ s/%/%%/g;
+         ($fields{'C'} = ($self->{'category'}    or '')) =~ s/%/%%/g;
++        ($fields{'Ct'} = ($self->{'categorytype'}    or '')) =~ s/%/%%/g;
+         ($fields{'U'} = ($self->{'recgroup'}    or '')) =~ s/%/%%/g;
+     # Misc
+         ($fields{'hn'} = ($self->{'hostname'}    or '')) =~ s/%/%%/g;
diff --git a/abs/core/mythtv/stable-0.28/mythtv/recordings b/abs/core/mythtv/stable-0.28/mythtv/recordings
index 984fea9..c1fe28a 100644
--- a/abs/core/mythtv/stable-0.28/mythtv/recordings
+++ b/abs/core/mythtv/stable-0.28/mythtv/recordings
@@ -25,49 +25,71 @@ then
     recdir="/data/storage/disk0/media/recordings"
     tmprecdir="/data/storage/disk0/media/tmp/recordings"
     rm -r $tmprecdir
-    su - mythtv -c "perl /usr/share/mythtv/contrib/user_jobs/mythlink.pl --format '%U/%T/%T %- S%ssE%ep %- %oY-%om-%od = %S' --link '$tmprecdir'"
+    su - mythtv -c "perl /usr/share/mythtv/contrib/user_jobs/mythlink.pl --format '%Ct/%U/%T/%T %- S%ssE%ep %- %oY-%om-%od = %S' --link '$tmprecdir'"
 
-    #delete Deleted recgroup and move files out of other dirs
-    if [ -d "$tmprecdir/Deleted" ]
-    then
-        rm -r "$tmprecdir/Deleted"
-    fi
-    #move all links in recgroup dirs out to tmprecdir
-    for recgroup in $tmprecdir/*
+    # rename category_types (%Ct) from numbers to names
+    for cattype in $tmprecdir/*
+    do
+        if [ $cattype == "$tmprecdir/1" ]
+        then
+            rsync -a "$cattype/" "$tmprecdir/Movies"
+            rm -r "$cattype"
+        elif [[ $cattype == "$tmprecdir/2" ]] || [[ $cattype == "$tmprecdir/4" ]]
+        then
+            rsync -a "$cattype/" "$tmprecdir/TV Shows"
+            rm -r "$cattype"
+        elif [ $cattype == "$tmprecdir/3" ]
+        then
+            rsync -a "$cattype/" "$tmprecdir/Sports"
+            rm -r "$cattype"
+        fi
+    done
+
+    #delete Deleted recgroup
+    for link in $tmprecdir/**/Deleted
+    do
+        rm -r "$link"
+    done
+
+    #move all links in recgroup dirs out to parent dir
+    for recgroup in $tmprecdir/**/*
     do
         if [ -d "$recgroup" ]
         then
-            rsync -a "$recgroup/" "$tmprecdir"
+            cd "$recgroup"
+            rsync -a "$recgroup/" ..
+            cd "$tmprecdir"
             rm -r "$recgroup"
         fi
     done
+
     #replace SE if no season/episode is in myth
-    for link in $tmprecdir/**/*\ -\ SE\ -\ *
+    for link in $tmprecdir/**/**/*\ -\ SE\ -\ *
     do
         newlink=`echo "$link" | sed 's/ - SE - / - /'`
         mv "$link" "$newlink"
     done
     #replace SEyy if no season is in myth
-    for link in $tmprecdir/**/*\ -\ SE[0-9][0-9]\ -\ *
+    for link in $tmprecdir/**/**/*\ -\ SE[0-9][0-9]\ -\ *
     do
         newlink=`echo "$link" | sed 's/ - SE/ - S00E/'`
         mv "$link" "$newlink"
     done
     #replace SyyE if no episode is in myth
-    for link in $tmprecdir/**/*\ -\ S[0-9][0-9]E\ -\ *
+    for link in $tmprecdir/**/**/*\ -\ S[0-9][0-9]E\ -\ *
     do
         newlink=`echo "$link" | sed 's/E - /E00 - /'`
         mv "$link" "$newlink"
     done
     #replace blank original date
-    for link in $tmprecdir/**/*\ -\ 0000-00-00\ -\ *
+    for link in $tmprecdir/**/**/*\ -\ 0000-00-00\ -\ *
     do
         newlink=`echo "$link" | sed 's/ - 0000-00-00 - / - /'`
         mv "$link" "$newlink"
     done
     #add dash pt suffix if filename before the subtitle is the same
     #so that plex will scan and include in library
-    uniqs="$(ls $tmprecdir/**/* | sed 's/ = .*//' | sort | uniq -d)"
+    uniqs="$(ls $tmprecdir/**/**/* | sed 's/ = .*//' | sort | uniq -d)"
     SAVEIFS=$IFS
     IFS=$'\n'
     for link in $uniqs
diff --git a/abs/core/mythtv/stable-0.28/mythweb/PKGBUILD b/abs/core/mythtv/stable-0.28/mythweb/PKGBUILD
index 23b3735..035a03a 100644
--- a/abs/core/mythtv/stable-0.28/mythweb/PKGBUILD
+++ b/abs/core/mythtv/stable-0.28/mythweb/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=mythweb
 pkgver=0.28
-pkgrel=4
+pkgrel=5
 commit_hash=`cat ../git_src/git_hash_web`
 pkgdesc="Web interface for MythTV's backend, $commit_hash"
 arch=('i686' 'x86_64')
-- 
cgit v0.12

