Adapt startup video script to play random video?
#1
heres a script that plays the video named in the script when xbmc starts up:

http://xbmcscripts.co.uk/index.p....emid=30

so could anyone show me what needs to be added to get it to play random videos from a specified folder? i want random music videos to play when xbmc starts up.

heres the video.py

import xbmc

# by golfi
# version 1.0

file = 'q:\\scripts\\startupvideo\\greenday.mpg'
xbmc.player().play(file)
xbmc.executebuiltin('xbmc.activatewindow(0)')

and heres the autoexec.py

# auto execute scripts when xbmc starts, place this file in xbmchome\scripts\
#
# note: - do not execute more than one script at a time which asks for user input!

# import xbmc

# xbmc.executescript('q:\\scripts\\medusa\\start_medusa.py')
xbmc.executescript('q:\\scripts\\startupvideo\\video.py')

thanks!
Reply
#2
not 100% if this will work but

import random
import xbmc

folder = "path to folder"

for each file in folder
array() = file

x = random.choice(array())
xbmc.player.play(array(x))


i dont think thats the right syntax (im still pretty new to python and xbmc programming) but you get the idea..

basically the idea is to feed an array with your list of files then use a random generator to pick a song for you.
Reply

Logout Mark Read Team Forum Stats Members Help
Adapt startup video script to play random video?0