summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_ir.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2014-12-11 14:37:33 (GMT)
committerBritney Fransen <brfransen@gmail.com>2014-12-11 14:37:33 (GMT)
commitd81970c8e5113b800595a5b73c213f493efa6fcf (patch)
treeab584d837938da55f85469d9fde0c25aa7253328 /abs/core/LinHES-config/mv_ir.py
parent144f4122fcbc233e6e102f9886085b0fa58df32f (diff)
downloadlinhes_pkgbuild-d81970c8e5113b800595a5b73c213f493efa6fcf.zip
linhes_pkgbuild-d81970c8e5113b800595a5b73c213f493efa6fcf.tar.gz
linhes_pkgbuild-d81970c8e5113b800595a5b73c213f493efa6fcf.tar.bz2
LinHES-config: mv_ir.py: add Lircmap.xml support for PlexHT. refs #981
Diffstat (limited to 'abs/core/LinHES-config/mv_ir.py')
-rwxr-xr-xabs/core/LinHES-config/mv_ir.py83
1 files changed, 46 insertions, 37 deletions
diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py
index c4386cc..b3b8b59 100755
--- a/abs/core/LinHES-config/mv_ir.py
+++ b/abs/core/LinHES-config/mv_ir.py
@@ -127,7 +127,7 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
continue
include_file("/etc/lircrc",filename)
- #if remote has a special run file use it.
+ #if remote has a special run file use it.
files = remote_path + "/remote.run*"
logging.debug(" Using %s",files)
for filename in glob.glob(files):
@@ -138,46 +138,55 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
cmd = "cp %s /etc/remote.run" %filename
mv_common.runcmd(cmd)
- #if remote has a special xbmc file, use it.
- xbmcfile= remote_path + "/xbmc.xml"
- userxmbcfile = mythhome+"/.xbmc/userdata/Lircmap.xml"
-
- if os.path.exists(xbmcfile):
- logging.debug(" XBMC lirc file present")
- logging.info(" Setting up lirc for xbmc")
- if not os.path.exists(mythhome+"/.xbmc/userdata"):
- logging.debug(" Creating %s/.xbmc",mythhome)
- try:
- os.mkdir(mythhome+"/.xbmc")
- except:
- logging.debug(" Couldn't create .xbmc/ ")
+ #if remote has a Lircmap.xml file, use it for xbmc and plexht.
+ xbmcfile= remote_path + "/Lircmap.xml"
+
+ for app in ['XBMC', 'PlexHT']:
+ if app == 'XBMC':
+ userLircmap = mythhome+"/.xbmc/userdata/Lircmap.xml"
+ userdirname = ".xbmc"
+ elif app == 'PlexHT':
+ userLircmap = mythhome+"/.plexht/userdata/Lircmap.xml"
+ userdirname = ".plexht"
+
+ if os.path.exists(xbmcfile):
+ logging.debug(" %s lirc file present at %s", app, xbmcfile)
+ logging.info(" Setting up lirc for %s",app)
+ if not os.path.exists(mythhome+"/"+userdirname+"/userdata"):
+ logging.debug(" Creating %s/%s", mythhome, userdirname)
+ try:
+ os.mkdir(mythhome+"/"+userdirname)
+ except:
+ logging.debug(" Couldn't create %s/ ",userdirname)
+ try:
+ os.mkdir(mythhome+"/"+userdirname+"/userdata/")
+ except:
+ logging.debug(" Couldn't create %s/userdata",userdirname)
+
+ try:
+ cmd = ''' chown -R mythtv %s/%s''' %(mythhome,userdirname)
+ mv_common.runcmd(cmd)
+ cmd = ''' chgrp -R mythtv %s/%s/userdata''' %(mythhome,userdirname)
+ mv_common.runcmd(cmd)
+ except:
+ logging.debug(" Couldn't change permissions for %s",userdirname)
+ pass
try:
- os.mkdir(mythhome+"/.xbmc/userdata/")
+ cmd = ''' rm -f %s''' %(userLircmap)
+ mv_common.runcmd(cmd)
+ logging.debug(" Creating symlink for %s Lircmap.xml",app)
+ os.symlink(xbmcfile, mythhome+"/"+userdirname+"/userdata/Lircmap.xml")
except:
- logging.debug(" Couldn't create .xbmc/userdata ")
-
- try:
- cmd = ''' chown -R mythtv %s/.xbmc''' %mythhome
- mv_common.runcmd(cmd)
- cmd = ''' chgrp -R mythtv %s/.xbmc/userdata''' %mythhome
- mv_common.runcmd(cmd)
- except:
- logging.debug(" Couldn't change permissions for .xbmc")
pass
- try:
- cmd = ''' rm -f %s''' %(userxmbcfile)
+ else:
+ logging.debug(" %s Lircmap file %s not present", userdirname, xbmcfile)
+ logging.debug(" Checking if %s is a symlink", userLircmap)
+ if os.path.islink(userLircmap):
+ logging.info(" Removing symlink %s", userLircmap)
+ cmd = ''' rm -f %s''' %(userLircmap)
mv_common.runcmd(cmd)
- logging.debug(" Creating symlink for xmbc lircrc")
- os.symlink(xbmcfile, mythhome+"/.xbmc/userdata/Lircmap.xml")
- except:
- pass
- else:
- logging.debug(" XBMC lirc file %s not present" %xbmcfile)
-
-
-
-
-
+ else:
+ logging.debug(" Not a symlink %s", userLircmap)
#remote has it's own modprobe.d/conf filename