This is a pretty simple little script I coded a while back that will play an n amount of randomly picked shows from a collection of shows.
Like, “randomshow.py 5” will play 5 randomly picked episodes back to back. I usually use this to cue up some shows right before going to sleep. It’s better than flipping through channels trying to find something to watch.
By default, it uses a gui-less mplayer in full screen to play the videos. You can edit the playback command to use a different video player or use different settings.
Note: It expects the video player to exit after finishing playback. Mplayer does this by default (without the gui), but VLC, Xine, etc. don’t.
To use, edit the first part of the file with the location(s) of your video files and the commands if needed. Run
python randomshow.py rescan to generate your collection file. Then run
python randomshow.py to play a random show.
This was made and used on linux, but it should also be compatible on Windows, though you might need to edit the commands.
I’ll probably edit this to have better control over collections, a playlist option that’ll just generate a playlist so you can use VLC or other video players. If you have any suggestions, let me know.
I’m also making a movie version, that will also support browsing of the collection (probably just via a web interface), and support multiple CD versions and archives. It’ll be more like MythTV, but allowing less overhead.
Random Show 1.0 – James Wilson
randomshow.py [option] [count]
For 1 random show
For n random shows
Rescan your collection
Use different collection and play 1 show. If collection doesn’t exist, it will use default. latenight.txt can be any collection text file.
Use different collection and play n shows
randomshow.py latenight.txt n
Rescan different collection
randomshow.py rescan latenight.txt
Create new collection
randomshow.py create latenight.txt “/media/tv/”
Example rescan output:
[‘/media/My Book/downloads/tv/’, ‘/media/hdb1/Documents and Settings/User/My Documents/My Videos/tv/Futurama’, ‘/media/hdb1/Documents and Settings/User/My Documents/Fastlane’]
Clearing collection file
Added 113 King of the Ant Hill.avi
Added 110 Keeping Up With Our Joneses.avi
Added 104 Luanne’s Saga.avi
Added Fastlane – 120 – Asslane.avi
Added Fastlane – 121 – Dosed.avi
Added Fastlane – 122 – Iced.avi
Collection built – 696 files
Example collection file:
Random-Show-Collection-1.0;shows.txt;/media/My Book/downloads/tv/,/media/hdb1/Documents and Settings/User/My Documents/My Videos/tv/Futurama,/media/hdb1/Documents and Settings/User/My Documents/Fastlane
/media/My Book/downloads/tv/koth1/113 King of the Ant Hill.avi
/media/My Book/downloads/tv/koth1/110 Keeping Up With Our Joneses.avi
/media/My Book/downloads/tv/koth1/104 Luanne’s Saga.avi
/media/hdb1/Documents and Settings/User/My Documents/Fastlane/Season 1/Fastlane – 120 – Asslane.avi
/media/hdb1/Documents and Settings/User/My Documents/Fastlane/Season 1/Fastlane – 121 – Dosed.avi
/media/hdb1/Documents and Settings/User/My Documents/Fastlane/Season 1/Fastlane – 122 – Iced.avi