Kodi Community Forum

Full Version: [ATV2] WakeOnLan at XBMC startup?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So yeah, I searched everywhere and just want to start my server via WOL at the XBMC startup from my ATV2.

I have the WOL Addon installed, but for that to work I have to manually start that up, what I want is that it starts automatically at startup

I've read about the autoexec.py but I can't find it on the ATV2 version of XBMC, so is there anything else I can do?

If anyone could help me, that would be great.
As far as I know it's not there by default, just create it (e.g. copy one of the available Wake-on-Lan scripts and rename it to autoexec.py) in the userdata directory.
Tried that, also used this script and renamed it autoexec.py with my mac address changed. Didn't work either. Any more tips?

Code:
# Wake-On-LAN
#
# Copyright (C) 2002 by Micro Systems Marc Balmer
# Written by Marc Balmer, [email protected], http://www.msys.ch/
# This code is free software under the GPL

import struct, socket

def WakeOnLan(ethernet_address):

  # Construct a six-byte hardware address

  addr_byte = ethernet_address.split(':')
  hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16),
    int(addr_byte[1], 16),
    int(addr_byte[2], 16),
    int(addr_byte[3], 16),
    int(addr_byte[4], 16),
    int(addr_byte[5], 16))

  # Build the Wake-On-LAN "Magic Packet"...

  msg = '\xff' * 6 + hw_addr * 16

  # ...and send it to the broadcast address using UDP

  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
  s.sendto(msg, ('<broadcast>', 7))
  s.close()

# Example use
WakeOnLan('00:00:00:00:00:00')
im no expert on python nor am i on appletv2, but i think you will need to install python on your appletv first for this to run