Iremote.py is a project mainly written in Python, based on the LGPL-3.0 license.
A Python-compatible interface for the Apple Remote
Install iremoted from http://github.com/swinton/iremoted along with this Python module.
Construct your source code like so:
from iremote import IRemote
def my_iremote_handler(event):
if event == IRemote.NEXT:
# Next button pressed
# ...
iremote = IRemote()
iremote.add_listener(my_iremote_handler)
iremote.start()