Wanted: Python Script to play Random file on smb share
#1
I thought this would of been pretty common. I have a bunch of tv episodes ripped to a server. I play them fine in XBMC over SMB.

What i would like is a python script to play a random file from a network (SMB) share - I just specify the folder (inside the python script itself would be fine).

I've searched and searched but no luck - is this something that should be easy to knock up?

I'd like to be able to have multiple scripts and launch them from the favorite scripts menu on the main screen down the bottom right. So i could say play a random episode of Futurama, or a random episode of the Simpsons etc...
Reply
#2
yes it would be possible, maybe even easy, but why not queue whatever series you want to watch, then hit the random button?

how would what you're wanting be any different from that?
Reply
#3
Isn't the whole point of scripting in general to automate a manual process? Smile

Bit of stuffing around to go and queue a bunch of files and then set it to random and play, as opposed to just clicking a shortcut from the script menu?
Reply
#4
You can add playlists to favourites too

Dont know if that helps but that was my penny...
Reply
#5
Rainbow 
you could create a playlist and save it. Then use random. Pretty much as folks have suggested.

It should be possible to write a plugin I would imagine though, yes. having said that the above method should work just fine. Let us know if you have problems. Wink
Reply
#6
Take a look at this thread:

http://forum.xbmc.org/showthread.php?tid=20445 The script there allows you to randomize all the contents of a playlist, so what you could do is set up a few smart playlists then use this to make sure that the playback is randomized.

OR you could search around the forums some more and find some scripts that can display an entire directory, then combine the two to make your script.
Reply
#7
Thanks guys. The problem with the scripts i've found is none of them will add files from a network share (SMB). Only local paths.

I could create a playlist then just play that random - but if I add new files/episodes to the video dir, i will have to re-create the playlist each time.
Reply
#8
look at the plugin maker script. that uses httpapi's getDirectory() which will handle smb shares.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
Wanted: Python Script to play Random file on smb share0