From 5752c2147ae11aa7bf72c54c74d1393543cbcc7b Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 29 Dec 2011 14:09:01 -0600
Subject: supplemental-web: correct count.py to remove live-tv from the stats. 
 Set all blank categories to "Unkown" refs #806

---
 abs/core/supplemental-web/PKGBUILD          |  2 +-
 abs/core/supplemental-web/contents/count.py | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/abs/core/supplemental-web/PKGBUILD b/abs/core/supplemental-web/PKGBUILD
index 8fcd23b..af2f600 100644
--- a/abs/core/supplemental-web/PKGBUILD
+++ b/abs/core/supplemental-web/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=supplemental-web
 pkgver=1.0
-pkgrel=14
+pkgrel=15
 arch=('i686')
 MVDIR=$startdir/pkg/usr/MythVantage
 install=supplemental-web.install
diff --git a/abs/core/supplemental-web/contents/count.py b/abs/core/supplemental-web/contents/count.py
index 6d813c1..d59144a 100644
--- a/abs/core/supplemental-web/contents/count.py
+++ b/abs/core/supplemental-web/contents/count.py
@@ -14,7 +14,7 @@ def main(argv):
     # create a cursor
     cursor = db.cursor()
    # execute SQL statement
-    cursor.execute("SELECT unix_timestamp(starttime),unix_timestamp(endtime),title FROM oldrecorded ORDER by starttime;")
+    cursor.execute("SELECT unix_timestamp(starttime),unix_timestamp(endtime),title FROM oldrecorded where oldrecorded.recstatus = -3  ORDER by starttime;")
     result = cursor.fetchall()
 
     for row in result:
@@ -58,7 +58,7 @@ def main(argv):
     print '<div id="content"> <p></p>'
     print '<table class="sample">'
     print "Top 20 Shows"
-    cursor.execute("select title,count(title),category as numtitle from oldrecorded group by title having (COUNT(title) > 1) order by (COUNT(title)) DESC  limit 20;" )
+    cursor.execute("select title,count(title),category as numtitle from oldrecorded where oldrecorded.recstatus = -3 group by title having (COUNT(title) > 0 ) order by (COUNT(title)) DESC  limit 20;" )
     result = cursor.fetchall()
     for row in result:
         print "	<tr>"
@@ -74,11 +74,14 @@ def main(argv):
     print '<div id="column"></div>'
     print '<table class="sample">'
     print "Top 20 Categories"
-    cursor.execute("select category,count(category) as numtitle from oldrecorded group by category having (COUNT(category) > 1) order by (COUNT(category)) DESC  limit 20; " )
+    cursor.execute("select category,count(category) as numtitle from oldrecorded where oldrecorded.recstatus = -3 group by category having (COUNT(category) > 0 ) order by (COUNT(category)) DESC  limit 20; " )
     result = cursor.fetchall()
     for row in result:
+        category = row[0]
+        if category == "":
+            category = "Unknown"
         print "	<tr>"
-        print "		<td>",row[0],"</td>"
+        print "		<td>",category,"</td>"
         print "		<td>",row[1],"</td>"
         print "	</tr>"
         #print "%16s %16s" %(row[0],row[1])
-- 
cgit v0.12

