Kodi Community Forum

Full Version: Trigger Kodi Notification from Apple Script - Possible?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I am running an Apple Script to mount / unmount my NAS Drive.

I wonder if it is somehow possible to trigger Kodi Notifications from within this Apple Script to show certain information uppon mounting / unmounting.

Thanks
Stefan
Another question related to notifications:

As an alternative I wonder if I can make Kodi show OSX System Notification to show while in Fullscreen?

My Script triggers notifications using "display notification", but while in FullScreen, these notifications are shown below the Kodi FullScreen Window....

Is there an add on, that converts osx system notification into Kodi Notifications?
I am a step further.

If defined different keys to show Kodi Notification upon keypress in keymap.xml

Unfortunately it seems, that Kodi freezes while executing the apple script. So the Keys are pressed after the complete script is executed.

That shows the messages after the script is finished.

Is there any way to keep Kodi alive while apple script is executed or do I need to use another method to unmount / mount my NAS?

Here is the Applescript

tell application "System Events"
tell application "Kodi.app" to display notification "Drive Mounter wird gestoppt..." with title "Remounting NAS"
# tell application "System Events" to key code 6
if exists application process "Drive Mounter" then
tell application "Drive Mounter" to quit
end if
end tell


tell application "Finder"
tell application "Kodi.app" to display notification "Prepare." with title "Remounting NAS" subtitle "Laufwerke auswerfen..."
# tell application "System Events" to key code 7
if (disk "movie" exists) then
tell application "Kodi.app" to display notification "Eject movie" with title "Remounting NAS" subtitle "Laufwerke auswerfen..."
eject disk "movie"
end if

if (disk "shows" exists) then
tell application "Kodi.app" to display notification "Eject shows" with title "Remounting NAS" subtitle "Laufwerke auswerfen..."
eject disk "shows"
end if

if (disk "video" exists) then
tell application "Kodi.app" to display notification "Eject video" with title "Remounting NAS" subtitle "Laufwerke auswerfen..."
eject disk "video"
end if

if (disk "data" exists) then
tell application "Kodi.app" to display notification "Eject data" with title "Remounting NAS" subtitle "Laufwerke auswerfen..."
eject disk "data"
end if

end tell

delay 1

tell application "Finder"
tell application "Kodi.app" to display notification "Prepare." with title "Remounting NAS" subtitle "Laufwerke einbinden..."
# tell application "System Events" to key code 8
if not (disk "movie" exists) then
tell application "Kodi.app" to display notification "Mounting movie" with title "Remounting NAS" subtitle "Laufwerke einbinden..."
mount volume "afp://192.168.178.29/movie"
end if

if not (disk "shows" exists) then
tell application "Kodi.app" to display notification "Mounting shows" with title "Remounting NAS" subtitle "Laufwerke einbinden..."
mount volume "afp://192.168.178.29/shows"
end if

if not (disk "video" exists) then
tell application "Kodi.app" to display notification "Mounting video" with title "Remounting NAS" subtitle "Laufwerke einbinden..."
mount volume "afp://192.168.178.29/video"
end if

if not (disk "data" exists) then
tell application "Kodi.app" to display notification "Mounting data" with title "Remounting NAS" subtitle "Laufwerke einbinden..."
mount volume "afp://192.168.178.29/data"
end if

end tell


tell application "System Events"
tell application "Kodi.app" to display notification "Drive Mounter starten..." with title "Remounting NAS"
# tell application "System Events" to key code 9
if not (exists application process "Drive Mounter") then
tell application "Drive Mounter" to run
end if
end tell

tell application "System Events" to key code 11

Perhaps it is possible via a python script ?

As I am not used to Python, perhaps someone might be so kind to translate the above to Python?