Kodi Community Forum

Full Version: what's wrong with my autoexec.py script?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
libreelec 9.0.1/kodi 18

I have created my autoexec.py file and placed it in...

/storage/.kodi/userdata/

I'm trying to just start a recurring slideshow using the contents of my picture folder in the default location...
Code:
import xbmc
xbmc.executebuiltin( "RecursiveSlideShow(/storage/.kodi/pictures/)" )
xbmc.executebuiltin( "PlayerControl(RepeatAll)" )

I'm assuming I have my pathing wrong, but can't work it out. On restart Kodi does nothing
The script looks fine to me.

Enable debug logging
restart kodi
paste the log somewhere and link to it here
(2019-04-26, 23:04)trogggy Wrote: [ -> ]The script looks fine to me.

Enable debug logging
restart kodi
paste the log somewhere and link to it here
Log is here....

https://hastebin.com/nezamobehu.bash

The only error I can find is a pathing one but not sure why...

Code:
2019-04-26 21:19:24.602 T:139763865540736 ERROR: GetDirectory - Error getting /pictures
@griffindodd try putting the URL in quotes.
From:
xbmc.executebuiltin(RecursiveSlideShow(/storage/.kodi/pictures/))
To:
xbmc.executebuiltin(RecursiveSlideShow("/storage/.kodi/pictures/"))

I have a service add-on that performs a task at boot and had to code it that way.
If snoopyjoe's suggestioin doesn't work I'd try running autoexec.py from a favourite or remote / keyboard key.

So eg add a line to favourites.xml:

<favourite name="Run autoexec" >RunScript(special://masterprofile/autoexec.py)</favourite>
(2019-04-27, 01:45)snoopyjoe Wrote: [ -> ]@griffindodd try putting the URL in quotes.
From:
xbmc.executebuiltin(RecursiveSlideShow(/storage/.kodi/pictures/))
To:
xbmc.executebuiltin(RecursiveSlideShow("/storage/.kodi/pictures/"))

I have a service add-on that performs a task at boot and had to code it that way.

Unfortunately no difference, I get the same error in the log, I wonder if it's because the pictures directory is within the hidden .kodi directory ? I have to be able to use a directory that I can access via SMB as I am using this as a sign where I will be changing the content remotely.
OK I was having a massive 'DERP' moment - editing the script across samba was NOT applying my changes even though it looked like they were sticking when viewing them in a code editor so yeah that happened.

any wayyyyyyyyy, returning to the original script and syntax (it doesn't like adding the quotes around the path - throws a syntax error)...

Code:
import xbmc
xbmc.executebuiltin( "RecursiveSlideShow(/storage/.kodi/pictures/)" )
xbmc.executebuiltin( "PlayerControl(RepeatAll)" )

I don't get any errors in the log, in fact I get confirmation that the script ran successfully without error...

Code:
2019-04-29 17:22:59.858 T:139920404363008 INFO: CPythonInvoker(2, /storage/.kodi/userdata/autoexec.py): script successfully run
2019-04-29 17:22:59.858 T:139920404363008 DEBUG: onExecutionDone(2, /storage/.kodi/userdata/autoexec.py)
2019-04-29 17:22:59.860 T:139920404363008 INFO: Python interpreter stopped
 

and yet, the slideshow still doesn't even run, so now I'm super stumped.
trying a different approach I'm still seeing some weird pathing issues (remember this is a libreelec install)
Code:
# Autoplay videodirectory
import os, xbmc

# set path to dir you want to play
path="/storage/.kodi/pictures/" 

dirList=os.listdir(path)

videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
videoList.clear()

for fname in dirList:
    videoList.add(path + "\\" + fname)

# put playlist on repeat
xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)")

# play playlist
xbmc.Player().play(videoList)

I get a 'no such file or directory error when trying to use any of the following paths to the directory...

/storage/.kodi/pictures/
/storage/kodi/pictures/
/storage/.kodi/pictures
/storage/kodi/pictures
sources://pictures/
I FINALLY worked it out...
Code:
import xbmc
xbmc.executebuiltin( "RecursiveSlideShow(/storage/pictures)" )
xbmc.executebuiltin( "PlayerControl(RepeatAll)" )

no idea why the pathing works like this with the kodi install folder left out, but that was the simple answer
(2019-04-29, 20:05)griffindodd Wrote: [ -> ]I FINALLY worked it out...
Code:
import xbmc
xbmc.executebuiltin( "RecursiveSlideShow(/storage/pictures)" )
xbmc.executebuiltin( "PlayerControl(RepeatAll)" )

no idea why the pathing works like this with the kodi install folder left out, but that was the simple answer 
/storage/.kodi/pictures and /storage/pictures are completely different paths.
One (that works) is a pictures folder in the root of storage.  The other isn't.
(2019-04-29, 20:18)trogggy Wrote: [ -> ]
(2019-04-29, 20:05)griffindodd Wrote: [ -> ]I FINALLY worked it out...
Code:
import xbmc
xbmc.executebuiltin( "RecursiveSlideShow(/storage/pictures)" )
xbmc.executebuiltin( "PlayerControl(RepeatAll)" )

no idea why the pathing works like this with the kodi install folder left out, but that was the simple answer  
/storage/.kodi/pictures and /storage/pictures are completely different paths.
One (that works) is a pictures folder in the root of storage.  The other isn't. 

Aye, I guess the way the samba shares appear is confusing as the pictures directory shows alongside the userdata directory which is inside /.kodi/ but thinking on it, the shares could be at any potential location - ah well you live and learn.
I can see how that could be confusing.  It's a long time since I've used the default shares - job 1 on install for me is usually to edit samba.conf.sample in the .configfiles share.
If it makes it any clearer, this is what my LE Pi has in the storage folder (via ls -al from an ssh terminal session):

Code:
drwxr-xr-x   22 root     root          1024 Apr 26 07:29 .
drwxr-xr-x   13 root     root           202 Feb 21 07:45 ..
-rw-------    1 root     root          2906 Apr 26 07:29 .ash_history
drwxr-xr-x   11 root     root          1024 Jun 22  2018 .cache
drwxr-xr-x   17 root     root          1024 Jun 22  2018 .config
drwxr-xr-x   10 root     root          1024 Mar 14  2017 .kodi
drwxr-xr-x    2 root     root          1024 Mar 30  2016 .smb
drwx------    2 root     root          1024 Dec 26 20:48 .ssh
-rw-r--r--    1 root     root           214 May 21  2017 .swfinfo
drwxr-xr-x    2 root     root          1024 Jan  1  1970 .update
drwxr-xr-x    2 root     root          1024 Apr 25 20:09 .urserver
drwxr-xr-x    4 root     root          1024 Dec 10 09:34 backup
lrwxrwxrwx    1 root     root            59 Aug 23  2015 devupdate
drwxrwxrwx    2 root     root          1024 Apr 24 07:45 downloads
drwxrwxrwx    2 root     root          1024 Aug 15  2015 emulators
drwxrwxrwx    2 root     root          4096 Apr 25 20:15 logfiles
drwx------    2 root     root         12288 Aug  8  2015 lost+found
drwxr-xr-x    2 root     root          1024 Jan  1  1970 music
drwxrwxrwx    4 root     root          1024 Nov 18  2017 picons
drwxr-xr-x    2 root     root          1024 Sep 26  2016 pictures
drwxrwxrwx   25 root     root          4096 Apr  7 15:59 pvr
drwxrwxrwx    2 root     root          1024 Aug 15  2015 recordings
drwxr-xr-x    2 root     root          1024 Sep 20  2016 screenshots
drwxr-xr-x    2 root     root          1024 Jan  1  1970 tvshows
drwxr-xr-x    2 root     root          1024 Jan  1  1970 videos

As you can see, all the media folders (videos, pictures, tvshows, music, emulators) are at the same level as the .kodi folder, and not inside it.

Edited to correct the above statement - wrote userdata (wiki) but meant .kodi
(2019-04-29, 23:10)DarrenHill Wrote: [ -> ]If it makes it any clearer, this is what my LE Pi has in the storage folder (via ls -al from an ssh terminal session):
Code:
drwxr-xr-x 22 root root 1024 Apr 26 07:29 .
drwxr-xr-x 13 root root 202 Feb 21 07:45 ..
-rw------- 1 root root 2906 Apr 26 07:29 .ash_history
drwxr-xr-x 11 root root 1024 Jun 22 2018 .cache
drwxr-xr-x 17 root root 1024 Jun 22 2018 .config
drwxr-xr-x 10 root root 1024 Mar 14 2017 .kodi
drwxr-xr-x 2 root root 1024 Mar 30 2016 .smb
drwx------ 2 root root 1024 Dec 26 20:48 .ssh
-rw-r--r-- 1 root root 214 May 21 2017 .swfinfo
drwxr-xr-x 2 root root 1024 Jan 1 1970 .update
drwxr-xr-x 2 root root 1024 Apr 25 20:09 .urserver
drwxr-xr-x 4 root root 1024 Dec 10 09:34 backup
lrwxrwxrwx 1 root root 59 Aug 23 2015 devupdate
drwxrwxrwx 2 root root 1024 Apr 24 07:45 downloads
drwxrwxrwx 2 root root 1024 Aug 15 2015 emulators
drwxrwxrwx 2 root root 4096 Apr 25 20:15 logfiles
drwx------ 2 root root 12288 Aug 8 2015 lost+found
drwxr-xr-x 2 root root 1024 Jan 1 1970 music
drwxrwxrwx 4 root root 1024 Nov 18 2017 picons
drwxr-xr-x 2 root root 1024 Sep 26 2016 pictures
drwxrwxrwx 25 root root 4096 Apr 7 15:59 pvr
drwxrwxrwx 2 root root 1024 Aug 15 2015 recordings
drwxr-xr-x 2 root root 1024 Sep 20 2016 screenshots
drwxr-xr-x 2 root root 1024 Jan 1 1970 tvshows
drwxr-xr-x 2 root root 1024 Jan 1 1970 videos

As you can see, all the media folders (videos, pictures, tvshows, music, emulators) are at the same level as the userdata (wiki) folder, and not inside it.  

I'm not seeing that.  Huh
Userdata is at /storage/.kodi/userdata.
Media folders are in the root of storage.
@trogggy - the above is the content of the storage folder. The media folders are there, so agrees with that (the "Media folders are in the root of storage." comment).

Editted to add - I see what you mean. You are correct, my last statement is wrong. I will correct it (was written on the fly as I was headed out the door).

The media folders are in the storage folder, at the same level as the .kodi folder (which itself contains the userdata (wiki) one).