Kodi Community Forum

Full Version: Random play issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I recently created an autoexec.py file :
import xbmc
xbmc.executebuiltin( "PlayMedia(C:\Users\Pan2\AppData\Roaming\XBMC\userdata\playlists\music\playlist.m3u)" )
xbmc.executebuiltin( "PlayerControl(RandomOn)" )
(Thanks to Artrafael)
This enabled me to create a set of m3u's to randomly play some background music on start-up (a set of m3u's inside playlist.m3u)
It works great but did create one small problem in that when I music played back from a folder (usually an album) in my music library, it now played tracks in random order, not normally desired I would think. Now that was easily stopped by opening the left hand slide open menu and turning off Random Play (This was being turned on at start-up by the .py file), once again not something you want to do every time you play an mp3 or flac folder. I then realised that after start-up there was no need for Random Play, a random m3u was up and running and if I was actually opening the music section, I could turn off Random Play via the Home.xml.
The code addition is:

<item id="3">
<label>Music </label>
<onclick>ActivateWindow(Music)</onclick>
<onclick>XBMC.PlayerControl(Randomoff)</onclick>

I thought I should have been able to create just one onclick line like:

<onclick>ActivateWindow(Music) + XBMC.PlayerControl(Randomoff)</onclick)
but it didn't work, hence the two onclicks

Now all I have to do is work out how to reactivate the start-up feature if I stop watching a movie or stop playing a music folder and return to the home screen Smile