summaryrefslogtreecommitdiffstats
path: root/abs/core/mythtv/stable-0.25/mythtv/tmdb3_db_update.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2013-10-01 18:08:08 (GMT)
committerBritney Fransen <brfransen@gmail.com>2013-10-01 18:08:08 (GMT)
commit9567c7d747cd41b035eef2367836f8d41803d550 (patch)
tree909d392752e69dd32b61ec4666c6e2c50fe98c5e /abs/core/mythtv/stable-0.25/mythtv/tmdb3_db_update.py
parent745f038168bd69352eecad08f267bfc4f57dc52a (diff)
downloadlinhes_pkgbuild-9567c7d747cd41b035eef2367836f8d41803d550.zip
linhes_pkgbuild-9567c7d747cd41b035eef2367836f8d41803d550.tar.gz
linhes_pkgbuild-9567c7d747cd41b035eef2367836f8d41803d550.tar.bz2
mythtv: tmdb3_db_update.py: use systemconfig method do update db depending on system type.
remove old tmdb.py
Diffstat (limited to 'abs/core/mythtv/stable-0.25/mythtv/tmdb3_db_update.py')
-rwxr-xr-xabs/core/mythtv/stable-0.25/mythtv/tmdb3_db_update.py37
1 files changed, 35 insertions, 2 deletions
diff --git a/abs/core/mythtv/stable-0.25/mythtv/tmdb3_db_update.py b/abs/core/mythtv/stable-0.25/mythtv/tmdb3_db_update.py
index 35f1b29..4f31364 100755
--- a/abs/core/mythtv/stable-0.25/mythtv/tmdb3_db_update.py
+++ b/abs/core/mythtv/stable-0.25/mythtv/tmdb3_db_update.py
@@ -1,8 +1,41 @@
#!/usr/bin/env python2
-# This script will update the myth db to use tmdb3.py.
+# This script will configure the myth db to use tmdb3.py
+from socket import gethostname
from MythTV import MythDB
mythdb = MythDB()
+localhostname = gethostname()
+import sys
-mythdb.settings.NULL.MovieGrabber = u'metadata/Movie/tmdb3.py'
+# Function to set db setting. This setting is set in mythtv-setup.
+def dbSettingChange():
+ if mythdb.settings.NULL.MovieGrabber == u'metadata/Movie/tmdb3.py':
+ print 'The MythTV database setting MovieGrabber is already set to tmdb3.py.'
+ else:
+ mythdb.settings.NULL.MovieGrabber = u'metadata/Movie/tmdb3.py'
+ print 'The MythTV database setting MovieGrabber has been updated to tmdb3.py'
+ return
+
+#taken from systemconfig.py
+#this is how you populate the dict
+systemconfig = {}
+file_name = "/etc/systemconfig"
+try:
+ config_file = open(file_name)
+except:
+ print file_name + ' could not be opened'
+ sys.exit(1)
+
+for line in config_file:
+ line = line.strip()
+ if line and line[0] is not "#" and line[-1] is not "=":
+ var, val = line.rsplit("=", 1)
+ val = val.strip('"')
+ systemconfig[var.strip()] = val.strip()
+
+#this is how you reference a value from mv_hostype.py
+if (systemconfig.get("SystemType") == "Standalone"):
+ dbSettingChange()
+elif systemconfig.get("SystemType") == "Master_backend":
+ dbSettingChange()