Ok, I better explain what I would like and what I got so far...
What I would like is to have my MusicVideo Playlist automaticly starting everytime
I start XBMC. It needs to play the musicvideo's in the background of the "Home"screen.
What I got so far is the following script "StartMyVid.py" added to my "Autoexec.py":
CODE
import xbmc
import os
# ---------------------------------------- #
# "Configuration"
# ---------------------------------------- #
# Change this to your playlist(s).
# Written like this: ['path\\to\\plist1', 'to\\plist2', 'plist\\3']
playlist_files= ['F:\\Files\\Albums\\Cache\\Playlists\\Video\\mv.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 = ['']
# 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)
xbmc.executebuiltin('XBMC.ActivateWindow(0)')
It's an existing script which I edited just a bit to point to my musicvideo playlist (mv.m3u).
the last line
CODE
xbmc.executebuiltin('XBMC.ActivateWindow(0)')
makes the first video play in the background of the Home-screen (main window),
which is perfect BUT the next video's are all played in fullscreen.
What I did notice, is when I start the musicvideo playlist manually (from within XBMC) and then switch manually from fullscreen to the background of the Home-screen, it does play ALL the video's in the background, which is exactly what I want.
So the question is: What command is given when you start a video playlist manually AND
what command is given when you switch manually from full screen to background mode?
If I know this the "StartMyVid.py" script could be edited with these commands and the script would probably work perfectly.
This post has been edited by RSkillz: Feb 13 2006, 09:49 AM