Skip to content

Instantly share code, notes, and snippets.

@fooling
Last active August 29, 2015 14:22
Show Gist options
  • Save fooling/ffd8b3cd517e49a32a3d to your computer and use it in GitHub Desktop.
Save fooling/ffd8b3cd517e49a32a3d to your computer and use it in GitHub Desktop.
Run MPlayerX through command line
#!/bin/bash
ps -A | grep MPlayerX | grep Application | awk {'print $1'} | xargs kill
if [ "$1" == "" ]; then
echo "Positional parameter 1 is empty"
exit 0
fi
if [[ $1 != /* ]];then
path=`pwd`
file=$path"/"$1
else
file=$1
fi
open -a /Applications/MPlayerX.app --args -file "$file"
#!/usr/local/bin/python
#play random movie under current dir
import os
from subprocess import call
import random
ls=os.listdir(os.getcwd())
choice=random.choice(ls)
print choice
call(["mplayer",choice])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment