1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FIXED duration prefix back please

Discussion in 'Bug Reports' started by iiidefconiii, 4 September 2016.

  1. iiidefconiii

    iiidefconiii Member

    Messages:
    86
    Hardware:
    32/64bit, +Arduino
    i recently have read that the duration prefix has been cancelled out of hyperion? Why?
    I used this for clear state effect. hereby my scripts

    autoxec.py in/home/.kodi/userdata

    Code:
    import xbmc,xbmcgui
    import subprocess,os
    import time
    
    class MyPlayer(xbmc.Player) :
    
            def __init__ (self):
                xbmc.Player.__init__(self)
    
            def onPlayBackStarted(self):
                if xbmc.Player().isPlayingVideo():
                    os.system("/home/iiidefconiii/HarmonyHubControl/HarmonyHubControl thomasvdalen@gmail.com  192.168.1.11 issue_device_command 13630846 L03")
                    os.system('/usr/share/hyperion/bin/hyperion-remote --clear')
    
            def onPlayBackEnded(self):
                if (VIDEO == 1):
                    os.system("/home/iiidefconiii/HarmonyHubControl/HarmonyHubControl thomasvdalen@gmail.com  192.168.1.11 issue_device_command 13630846 L04")
                    os.system('/usr/share/hyperion/bin/hyperion-remote --priority 100 --duration 86400 --effect "Blue mood blobs"')
    
            def onPlayBackStopped(self):
                if (VIDEO == 1):
                    os.system("/home/iiidefconiii/HarmonyHubControl/HarmonyHubControl thomasvdalen@gmail.com  192.168.1.11 issue_device_command 13630846 L04")
                    os.system('/usr/share/hyperion/bin/hyperion-remote --priority 100 --duration 86400 --effect "Blue mood blobs"')
                   
            def onPlayBackPaused(self):
                if xbmc.Player().isPlayingVideo():
                    os.system("/home/iiidefconiii/HarmonyHubControl/HarmonyHubControl thomasvdalen@gmail.com  192.168.1.11 issue_device_command 13630846 L04")
    
            def onPlayBackResumed(self):
                if xbmc.Player().isPlayingVideo():
                    os.system("/home/iiidefconiii/HarmonyHubControl/HarmonyHubControl thomasvdalen@gmail.com  192.168.1.11 issue_device_command 13630846 L03")
                    os.system('/usr/share/hyperion/bin/hyperion-remote --clear')
    
    player=MyPlayer()
    
    subprocess.call('/usr/share/hyperion/bin/hyperiond /etc/hyperion.config.json </dev/null >/dev/null 2>&1 &', shell=True,)
    time.sleep(3)
    subprocess.call('/usr/share/hyperion/bin/hyperion-remote --effect "Blue mood blobs"', shell=True,)
    
    while(1):
        if xbmc.Player().isPlayingVideo():
            VIDEO = 1
    
        else:
            VIDEO = 0
    
        xbmc.sleep(3000)
    cause of duration the effect would keep playing 24 hours after watching a movie a affect would called up, but with this new hyperion the effect only stays on for a couple minutes and then goes to clear state, i have read about replacing the bootsequance to initaleffectin here: https://github.com/hyperion-project/hyperion.ng/pull/30

    but this didn't work for me, i also read that its only compatible with hyperion.ng or something, don't know what it is.

    could the devs please put --duration back, or give us the possibility to add an static effect, not color when no content is played?

    Thank You!
     
  2. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    672
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino
    Last edited: 6 September 2016
  3. iiidefconiii

    iiidefconiii Member

    Messages:
    86
    Hardware:
    32/64bit, +Arduino
    the background feature is awesome so im not using this in autoxec.py anymore
    but i got an script that loads a custom effect, these should be able to run 24 hours with the --duration tag. Now these times when i open that script by a button, the only stays on for a maybe an minute, max 2 and then automaticly falls back to the background initialEffect.

    EDIT: mm strange, till now the effect is already up for 5 min

    Code:
    import json
    import subprocess
    
    colors = ['Snake',
              'Strobe',
              'Rainbow swirl fast',
              'mood-blobs',
              'red',
              'purple',
              ]
    
    defaultData = {"color":"purple",
                   "effect":"Blue\\ mood\\ blobs"
                   }
    
    effects = ['Blue\\ mood\\ blobs',
              'Cold\\ mood\\ blobs',
              'Full\\ color\\ mood\\ blobs',
              'Green\\ mood\\ blobs',
              'Red\\ mood\\ blobs',
              'Warm\\ mood\\ blobs',
              'Rainbow\\ swirl',
              ]
          
    def read_current():
        try:
            with open('/usr/share/hyperion/scripts/currenteffect.json', 'r') as f:
                data = json.load(f)
            f.close()
            if data == '':
                return defaultData
            else:
                return data
        except (IOError, ValueError):
            return defaultData
    
    def write_current(data):
        try:
            with open('/usr/share/hyperion/scripts/currenteffect.json', 'w') as f:
                json.dump(data, f)
            f.close()
        except IOError:
            pass
    
    def parse_current_effect():
        pass
    
    def set_current_effect():
        pass
    
    def set_effect(effect):
        subprocess.Popen('/usr/share/hyperion/bin/hyperion-remote --priority 100 --effect ' + effect, shell=True)
    
    def main():
        current_data = read_current()
        for i,effect in enumerate(effects):
            if effect == current_data['effect']:
                if i == len(effects) - 1:
                    current_data['effect'] = effects[0]
                    break
                else:
                    current_data['effect'] = effects[i + 1]
                    break
        
        write_current(current_data)
        set_effect(current_data['effect'])
    
    main()
     
    Last edited: 6 September 2016
  4. iiidefconiii

    iiidefconiii Member

    Messages:
    86
    Hardware:
    32/64bit, +Arduino
    strange i didn't changed anything, but when i now press a button, the effect keeps going on, so that's good
     
  5. Brindosch

    Brindosch Administrator Administrator

    Messages:
    607
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    As there where no change, it should work as always.
     
  6. iiidefconiii

    iiidefconiii Member

    Messages:
    86
    Hardware:
    32/64bit, +Arduino
    its strange tough cause i had it earlier that the effect would go off within an minute. multiple times. but ok :)