QUOTE
''' vim: ts=8 sw=4 noexpandtab
By: aNtiBiOteK ver: 0.1
Original Script by Rune Hammersland ver: 0.3
This script is for those of you who love to turn on your xbox and watch music
vidoes in the morning. It will take a playlist or a music video directory,
randomize all the videos, and play them. Be sure to modify your autoexec.py
to start it up!
'''
import xbmc
import os
# ---------------------------------------- #
# "Configuration"
# ---------------------------------------- #
# Change this to your playlist(s).
# Written like this: ['path\\to\\plist1', 'to\\plist2', 'plist\\3']
playlist_files= ['E:\\Media\\Music\\playlist.m3u', 'F:\\all.m3u']
# Dirs(s) to traverse if playlist does not exist. NB: No trailing slash.
# Written like this: ['path\\to\\dir1', 'to\\dir2', 'dir\\3']
musicvideos_dirs = ['E:\\Media\\MusicVideos', 'F:\\Media\\MusicVideos']
# Shuffle playlist if this var equals 1.
shuffle_files = 1
# ---------------------------------------- #
# Code
# ---------------------------------------- #
# Function for adding files to playlist
def add_files(pl, dirname, names):
for filename in names:
if (os.path.isfile(dirname + "\\" + filename)):
add = 0
# Check extension of file.
if (filename[-4:] == ".avi"): add = 1
if (filename[-4:] == ".mpg"): add = 1
if (filename[-4:] == ".wmv"): add = 1
if (filename[-4:] == ".asf"): add = 1
if (filename[-4:] == ".m2v"): add = 1
# If file is to be added, do it.
if (add == 1): pl.add(dirname + "\\" + filename)
elif (os.path.isdir(dirname + "\\" + filename)):
os.path.walk(dirname + "\\" + filename, add_files, pl)
# Get music playlist from XBMC
plist = xbmc.PlayList(0)
plist.clear()
# Load playlist if it exists
for playlist_file in playlist_files:
if (os.path.isfile(playlist_file)):
plist.load(playlist_file)
# Else, find all available music videos
else:
for musicvideos_dir in musicvideos_dirs:
os.path.walk(musicvideos_dir, add_files, plist)
# Do the shuffle!
if (shuffle_files == 1): plist.shuffle()
xbmc.Player().play(plist)
This is the startup video directory script. i added xbmc.executebuiltin('XBMC.ActivateWindow(home)') at the end so that it plays in the background on start up, the only problem is that when it swtches videos it comes back in foreground which is quite annoying. If anyone knows python maybe they can help... meanwhile if any body knows I can get the background to be more transparent in MC360?