Wednesday 8 October 2008

play from rar archive


Another right-click menu entry I've set up in nautilus-actions is a 'play from rar' button. Now, for some irritating reason, i cant get it to pass anything beyond the parameter %M, so i had to put it in a script. It doesn't really need to be a python script, but mine is python anyway because i like messing with python, no matter how trivial the task at hand may be ;)

The other reason it's in python is because it's part of a movie catalogue program im writing, much like a lot of my other scripts.

All this script really does is execute the command:
unrar p -inul ARCHIVE.rar |mplayer -fs -noidx -

I use mplayer, and i like it to come up fullscreen, hence the -fs flag. -noidx is needed because the file is essentially being streamed from the rar archive. Xine and VLC should probably work just as well with the right setting flags.

#! /usr/bin/python

import sys, os

video = sys.argv[1]
os.system("unrar p -inul " + video + "|mplayer -fs -noidx -")

No comments:

Post a Comment