blob: 22fc6352ba3e31ccd48b752980d42176c3f13aea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/usr/bin/env python2
# 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, os
# 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'
try:
os.remove("/home/mythtv/.mythtv/pytmdb3.cache")
print 'tmdb3 cache at /home/mythtv/.mythtv/pytmdb3.cache removed.'
except OSError:
print "tmdb3 cache at /home/mythtv/.mythtv/pytmdb3.cache doesn't exist."
pass
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()
|