[MAC] Volume Level Control
#16
(2014-04-30, 12:27)Gigantur Wrote: Here is a simple Volume-up keymap for Apple Remote HOLD CENTRE that I used successfully before switching to fixed max volume (due to HDMI output) .. took me ages to get to work - syntax on runscript should be exactly as below.

(see Winestock for his excellent Applescript - I used a modified earlier version to quickly jump vol in larger increments )

keyboard.xml

<keymap>
<FullscreenVideo>
<joystick name="AppleRemote">
<button id="1">VolumeUp</button>
<button id="2">VolumeDown</button>
<button id="3">StepBack</button>
<button id="4">StepForward</button>
<button id="5">Pause</button>
<button id="6">Stop</button>
<button id="7">runscript(/Users/chris/Library/Application Support/XBMC/scripts/VolumeUp.applescript)</button>
<button id="8">OSD</button>
<button id="9">Rewind</button>
<button id="10">FastForward</button>
</joystick>
</FullscreenVideo>
</keymap>

I am surprised the runscript command even works for you because runscript command is for running python scripts not applescripts (http://wiki.xbmc.org/index.php?title=Lis..._functions ):
Quote:RunScript(script[,args]*) Runs the python script. You must specify the full path to the script. If the script is an add-on, you can also execute it using its add-on id. As of 2007/02/24, all extra parameters are passed to the script as arguments and can be accessed by python using sys.argv

RunAppleScript(script[,args]*) Run the specified AppleScript command

By the way, you could change /Users/chris/Library/Application Support/XBMC/scripts/VolumeUp.applescript to special://home/scripts/VolumeUp.applescript. Makes the paths more portable if you ever decide to move the userdata folder to another user.

(2014-04-30, 13:20)bigbadrabbit Wrote: Aren't you guys experiencing small freezes when playing a video and executing an applescript? Every time i press the volume keys, the video is stopped while the script is being executed.

I'm using this applescript to control the volume of my Marantz-AVR:
Code:
set telnet to "(echo MVUP; sleep 0.1) | telnet 192.168.0.74 23 > /dev/null 2>&1 &"

do shell script telnet
delay 0.1
do shell script telnet
delay 0.1
do shell script telnet
delay 0.1
do shell script telnet


Also - why are you using keyboard.xml instead of joystick.AppleRemote.xml?

Yes, I see a small pause in the video while the script is executing. I have always used keyboard.xml instead of joystick.AppleRemote.xml.
Kodi 17, Transparency Skin
PogoPlug v4 running Arm Linux 4.4.63 as MySQL (mariadb) server.
Mac OS 10.12.5
2015 27" iMac 3.3 GHz Quad, 16GB RAM, 1TB SSD
2015 13" Macbook Pro, 8GB RAM, 256GB SSD
AppleTV 4 TV OS 10
Reply
#17
(2014-04-30, 13:00)Ecklund Wrote: Thanks for your assistance! I'm still unable to get it to work. Do I have to have the py files and the applescript files in the keymap directory or do they still go into a scripts directory? Do i need to customize anything in those py files to my filenames or anything? I'm very unfamiliar with scripting, etc. Currently I have the xml, py, and applescript files all together in the keymap directory but I tried them in a sep directory first. Only thing that happens in XBMC when i attempt to adjust volume is it just changes the in app volume still. Does it matter that I am using an older white apple remote instead of the newer aluminum one?

Thanks again for all of your help!

You can place the .py and .applescript anywhere you like. However, you will need to change the path in keyboard.xml to reflect that. So in the case where you place the .py and .applescript in your scripts folder, keyboard.xml:
Code:
<keymap>
    <Home>
        <joystick name="AppleRemote">
            <!-- hold menu  -->     <button id="8">ActivateWindow(shutdownmenu)</button>
        </joystick>
    </Home>
    <FullscreenVideo>
        <joystick name="AppleRemote">
            <!-- plus       -->     <button id="1">RunAppleScript(special://home/scripts/VolumeUp.applescript)</button>
            <!-- minus      -->     <button id="2">RunAppleScript(special://home/scripts/VolumeDown.applescript)</button>
            <!-- left       -->     <button id="3">BigStepBack</button>
            <!-- right      -->     <button id="4">BigStepForward</button>
            <!-- play       -->     <button id="5">Pause</button>
            <!-- menu       -->     <button id="6">Stop</button>
            <!-- hold play  -->     <button id="7">OSD</button>
            <!-- hold menu  -->     <button id="8">ShowVideoMenu</button>
            <!-- hold left  -->     <button id="9">Rewind</button>
            <!-- hold right -->     <button id="10">FastForward</button>
            <!-- hold left  -->     <button id="11">Rewind</button>
        </joystick>
    </FullscreenVideo>
    <VideoMenu>
        <joystick name="AppleRemote">
            <!-- play      -->      <button id="5">Select</button>
            <!-- menu      -->      <button id="6">Stop</button>
            <!-- hold play -->      <button id="7">OSD</button>
            <!-- hold menu -->      <button id="8">ShowVideoMenu</button>
        </joystick>
    </VideoMenu>
    <MyVideoLibrary>
        <joystick name="AppleRemote">
            <!-- hold play -->      <button id="7">Info</button>
            <!-- hold menu -->      <button id="8">Stop</button>
        </joystick>
    </MyVideoLibrary>
</keymap>

It will be simpler if you skip using the VolumeUp.py and VolumeDown.py and just use the applecsripts instead. I am going to change back to using applescripts instead of python for this use.
Kodi 17, Transparency Skin
PogoPlug v4 running Arm Linux 4.4.63 as MySQL (mariadb) server.
Mac OS 10.12.5
2015 27" iMac 3.3 GHz Quad, 16GB RAM, 1TB SSD
2015 13" Macbook Pro, 8GB RAM, 256GB SSD
AppleTV 4 TV OS 10
Reply
#18
Thank you so much guys! I got it to work!
Reply
#19
Thanks Winestock - appreciate the tips. Was not ever prettied up and was only a quick hack in frustration that audio mixer is unusable on mac with apple-remote (menu fails to exit). Then I switched to HDMI which fixes sys vol at max so don't need it.
Reply
#20
<deleted>
Kodi 17, Transparency Skin
PogoPlug v4 running Arm Linux 4.4.63 as MySQL (mariadb) server.
Mac OS 10.12.5
2015 27" iMac 3.3 GHz Quad, 16GB RAM, 1TB SSD
2015 13" Macbook Pro, 8GB RAM, 256GB SSD
AppleTV 4 TV OS 10
Reply

Logout Mark Read Team Forum Stats Members Help
[MAC] Volume Level Control0