0

I'm trying to make the following script run at 17:00 everyday on Raspbmc using crontab. Cronjob scheduler is activated and running, but the script does not get executed. The crontab I used is:

0 17 * * * python /home/pi/.kodi/userdata/test.py

and my script is:

import xbmc
xbmc.executebuiltin("PlayMedia(/home/pi/.kodi/userdata/playlists/music/test.m3u)")
xbmc.executebuiltin("PlayerControl(Random)")

I could use a service called "XBMC Alarm clock", it works, but I need the songs to be shuffled!

What am I doing wrong?

user1766169
  • 1,932
  • 3
  • 22
  • 44
BMECS
  • 11
  • 3

2 Answers2

1

I figured it out, I had to execute the following through SSH:

1).sudo apt-get install xbmc-eventclients-xbmc-send

2).xbmc-send --action='RunScript("/home/pi/.kodi/userdata/test.py")' (to test if the script works through SSH)

or

3).0 17 * * * xbmc-send --action='RunScript("/home/pi/.kodi/userdata/test.py")' (to set the crontab)

Of course you need to make the script executable (755 permissions) and set the python env, as previously mentioned.

Thanks for the the replies!

BMECS
  • 11
  • 3
0

I've never used Raspbmc but since you are using python:

  1. have you made your test.py executable? (eg: 755 permissions on the file)
  2. set the python env in test.py

I tend to prefer the second option when working with python files and add at the top of my file something like this:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

R.

Martin G
  • 17,357
  • 9
  • 82
  • 98
ralvez
  • 1
  • 1