From d81970c8e5113b800595a5b73c213f493efa6fcf Mon Sep 17 00:00:00 2001 From: Britney Fransen <brfransen@gmail.com> Date: Thu, 11 Dec 2014 14:37:33 +0000 Subject: LinHES-config: mv_ir.py: add Lircmap.xml support for PlexHT. refs #981 --- abs/core/LinHES-config/PKGBUILD | 4 +- abs/core/LinHES-config/mv_ir.py | 83 +++++++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 39 deletions(-) diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index 193cc31..c0b7a65 100755 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=8.3 -pkgrel=1 +pkgrel=2 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config ) pkgdesc="Install and configure your system" depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted' @@ -159,7 +159,7 @@ md5sums=('17d9dd5a097fbbd4dae75dff8e2677ff' 'c0549457750c4f8e8038d904a0f3012a' '21838e6bfc9ece97bf6e22b7bdf8c46f' 'b845de3e05c1734cce4b9ac5e8f1baaf' - '885fcb99a0179d9704385e14aefd7af6' + '00c4aa4e6eedab74c6c3c5c3cb1f128b' '8b7dce4a3a0a281fa6656aa8781a648e' '4b10fff21a0274f950f97f2b61e92463' '824e49d9b01fed295c704ab68908b464' 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 -- cgit v0.12