Last active
August 29, 2015 14:12
-
-
Save tchen/3eb9f58041d3765cb9df to your computer and use it in GitHub Desktop.
XBMC autostart.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To automatically do something at start up of OpenElec, place a shell script at /storage/.config/autostart.sh. | |
For example, to start playing a playlist at start up, you can place the following in autostart.sh, which will launch a different script in the background (and release, so XBMC will start): | |
#!/bin/sh | |
play_videos.sh | |
This is the content of play_videos.sh, which checks to see if xbmc is running first, and then release. Waits about 20 seconds to ensure XBMC started up completely, then play the video playlist: | |
#!/bin/sh | |
MATCH=`ps -elf | grep xbmc | grep standalone | wc -l` | |
# Wait for XBMC to start | |
while [[ $MATCH -eq 0 ]]; do | |
sleep 5; | |
MATCH=`ps -elf | grep xbmc | grep standalone | wc -l` | |
done | |
echo "Short Wait" | |
sleep 20 | |
xbmc-send --action "PlayMedia(/storage/.xbmc/userdata/playlists/video/od.pls)" | |
xbmc-send --action "PlayerControl(Repeat)" | |
Note the extra bonus second command in making it play in an infinite loop. :-) | |
Refer to http://kodi.wiki/view/List_of_built-in_functions for a list of commands that can be sent using: | |
xbmc-send --action "<command>" | |
Also bonus, .pls play list format: | |
[playlist] | |
NumberOfEntries=1 | |
Title1=Video Title | |
File1=/storage/videos/od/some_video.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment