2006-06-20, 04:12
dude i tried the file u posted and it did the samething.........whenever i change videos it goes back to full screen. am i doing something wrong?
Quote: def onplaybackended(self):
pass
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 time
import os
# ---------------------------------------- #
# "configuration"
# ---------------------------------------- #
# change this to your playlist(s).
# written like this: ['path\\to\\plist1', 'to\\plist2', 'plist\\3']
playlist_files= ['e:\\apps\\xbmc\\userdata\\playlists\\test.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 = ['g:\\video\\musicvidz', 'g:\\video\\musicvids']
# shuffle playlist if this var equals 1.
shuffle_files = 1
player_playing = true
# ---------------------------------------- #
# code
# ---------------------------------------- #
# function for adding files to playlist
class myplayer( xbmc.player ) : # thanks thor918 for this class
def ( self ):
xbmc.player.( self )# initialize xbmc.player as a baseclass of our class
def onplaybackstopped(self):
global player_playing
player_playing = false
def onplaybackended(self):
pass
global player_playing
player_playing = false
def onplaybackstarted(self):
xbmc.executebuiltin('xbmc.activatewindow(home)')
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 (filename[-4:] == ".mp4"): 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()
cplayer = myplayer()
xbmc.player().play(plist)
while player_playing:
time.sleep(.1)
Quote: def onplaybackended(self):
pass
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 time
import os
# ---------------------------------------- #
# "configuration"
# ---------------------------------------- #
# change this to your playlist(s).
# written like this: ['path\\to\\plist1', 'to\\plist2', 'plist\\3']
playlist_files= ['e:\\apps\\xbmc\\userdata\\playlists\\test.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 = ['g:\\video\\musicvidz', 'g:\\video\\musicvids']
# shuffle playlist if this var equals 1.
shuffle_files = 1
player_playing = true
# ---------------------------------------- #
# code
# ---------------------------------------- #
# function for adding files to playlist
class myplayer( xbmc.player ) : # thanks thor918 for this class
def ( self ):
xbmc.player.( self )# initialize xbmc.player as a baseclass of our class
def onplaybackstopped(self):
global player_playing
player_playing = false
def onplaybackended(self):
pass
def onplaybackstarted(self):
xbmc.executebuiltin('xbmc.activatewindow(home)')
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 (filename[-4:] == ".mp4"): 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()
cplayer = myplayer()
xbmc.player().play(plist)
while player_playing:
time.sleep(.1)
Quote:response = xbmc.executehttpapi("sendkey(258)")
''' 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 time
import os
# ---------------------------------------- #
# "configuration"
# ---------------------------------------- #
# change this to your playlist(s).
# written like this: ['path\\to\\plist1', 'to\\plist2', 'plist\\3']
playlist_files= ['e:\\apps\\xbmc\\userdata\\playlists\\test.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 = ['g:\\video\\musicvidz', 'g:\\video\\musicvids']
# shuffle playlist if this var equals 1.
shuffle_files = 1
player_playing = true
# ---------------------------------------- #
# code
# ---------------------------------------- #
# function for adding files to playlist
class myplayer( xbmc.Player ) : # thanks thor918 for this class
def __init__( self ):
xbmc.Player.__init__( self )# initialize xbmc.player as a baseclass of our class
def onplaybackstopped(self):
global player_playing
player_playing = False
def onplaybackended(self):
pass
def onplaybackstarted(self):
xbmc.executebuiltin('xbmc.activatewindow(home)')
def add_files(pl, dirname, names):
for filename in names:
add = 0
if (os.path.isfile(dirname + "\\" + filename)):
# 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 (filename[-4:] == ".mp4"): 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()
cplayer = myplayer()
cplayer.play(plist)
while player_playing:
time.sleep(.1)
''' 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 = ['F:\\Music Videos']
# Shuffle playlist if this var equals 1.
shuffle_files = 1
# ---------------------------------------- #
# Code
# ---------------------------------------- #
# Function for adding files to playlist
class myplayer( xbmc.Player ) : # thanks thor918 for this class
def __init__( self ):
xbmc.Player.__init__( self )# initialize xbmc.player as a baseclass of our class
def onplaybackstopped(self):
global player_playing
player_playing = False
def onplaybackended(self):
pass
def onplaybackstarted(self):
xbmc.executebuiltin('xbmc.activatewindow(home)')
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()
cplayer = myplayer()
cplayer.play(plist)
while player_playing:
time.sleep(.1)