Jump to content

Helmi

Member
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Helmi

  1. Thanks deanishe,

     

    that works great for me. My bash script within the workflow now looks like this:

     

     

    ping -o -t 1 192.168.xx.200

    if [[ $? -gt 0 ]]; then
      python /Users/xxx/scripts/wol.py
      sleep 40
    fi
     
    /Applications/VLC.app/Contents/MacOS/VLC http://192.168.xx.200:3000/channels.m3u --sout-deinterlace-mode=blend

     

    the python script is this one (just in case someone cares) 

     

     

    #!/usr/bin/env python

    # wol.py

     

    import socket

    import struct

     

    def wake_on_lan(macaddress):

        """ Switches on remote computers using WOL. """

     

        # Check macaddress format and try to compensate.

        if len(macaddress) == 12:

            pass

        elif len(macaddress) == 12 + 5:

            sep = macaddress[2]

            macaddress = macaddress.replace(sep, '')

        else:

            raise ValueError('Incorrect MAC address format')

     

        # Pad the synchronization stream.

        data = ''.join(['FFFFFFFFFFFF', macaddress * 20])

        send_data = ''

     

        # Split up the hex values and pack.

        for i in range(0, len(data), 2):

            send_data = ''.join([send_data,

                                 struct.pack('B', int(data[i: i + 2], 16))])

     

        # Broadcast it to the LAN.

        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

        sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)

        sock.sendto(send_data, ('<broadcast>', 7))

     

     

    if __name__ == '__main__':

        # Use macaddresses with any seperators.

        # wake_on_lan('0F:0F:DF:0F:BF:EF')

        # wake_on_lan('0F-0F-DF-0F-BF-EF')

        # or without any seperators.

        wake_on_lan('12-34-56-78-90') # enter MAC-address here

  2. Hi,

     

    i'm quite new to workflows - just have installed some ready made ones but only did a simple one myself. This simple one until now just started VLC video player with a parameter to a special Playlist-URL.

    I now want to extend this workflow and have it send a WOL (wake on lan) packet first, then wait X seconds (still have to test how long to wait ideally) and then start VLC and additionally call a URL in Chrome.

     

    I already have the python script to send the WOL packet and that works. Now i need to find out how to execute my VLC command. Until now i did this via the "Run script" module with /bin/bash selected as language and it looked like this:

    /Applications/VLC.app/Contents/MacOS/VLC http://192.168.88.200:3000/channels.m3u

    most probably there's a better way to do this but anyhow i need to know how to put these commands in a row with a pause in between.

     

    Can anyone tell me?

     

    Thanks!

    Frank

     

  3. Hi,

     

    as a frequent but not very professional alfred user i wonder which is the best way to launch an app via a custom terminal command. In this case it is a Java App that i can perfectly start from the terminal using:

    /usr/libexec/java_home -v 1.6.0 --exec java -Xms4G -Xmx4G -jar FTB_Launcher.jar

    I've already put that in a shell script which works from the terminal but if i launch the script via alfred it just opens it in the editor.

    What is the intended way to do that via alfred?

     

    Thanks

×
×
  • Create New...