Register
It is currently Tue Oct 21, 2014 7:34 pm

ushare / xbox 360 frontend.


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Tue Apr 01, 2008 12:44 pm   

Joined: Tue Apr 01, 2008 12:33 pm
Posts: 2
a simple script i wrote to start/shutdown ushare for when i do or dont want to stream media to my xbox 360.
i am sure this code can be greatly simplified from what i wrote.


Code:

#!/bin/bash

# front end script for sharing media to xbox 360 with ushare by dubux


# variables

# setup directory structure of your media.
ALLMEDIA="/path/to/all/your/media"
US1=movies
US1DIR="/path/to/movies"
US2=music
US2DIR="/path/to/music"
US3=wma
US3DIR="/path/to/wma"

# name the media server and port to listen on.
MEDIASRVR=uShare
MDAPORT=49152


uscmd() {
nohup ushare -n $MEDIASRVR -p $MDAPORT -c "$MEDIADIR" -x >/dev/null 2>&1 &
}

ps aux | grep -v grep | grep -v /bin/bash | grep ushare -n > /tmp/tmp.myparsefile
USPID=`awk '{ print $2}' /tmp/tmp.myparsefile `
USGREP=`ps aux | grep -v grep | grep -c ushare -n `
if [ $USGREP  != 0 ]
then
USSTATUS="running [PID: $USPID]"
rm /tmp/tmp.myparsefile
else
USSTATUS="not running"
rm /tmp/tmp.myparsefile
fi



echo " "
echo "#####################################"
echo "#            ushare menu            #"
echo "#####################################"
echo " "
echo "status: $USSTATUS"
echo " "
echo "[1] start ushare (all media)"
echo "[2] start ushare sharing only $US1"
echo "[3] start ushare sharing only $US2"
echo "[4] start ushare sharing only $US3"
echo "[5] shutdown ushare"
echo "[6] close menu"
echo " "
echo "select number from menu : "
read i;

case $i in

1)
if [ $USGREP != 0 ]
then
echo " "
echo "ushare is already running. [PID: $USPID]"
echo " "
else
MEDIADIR="$ALLMEDIA"
uscmd
echo " "
echo "ushare has been successfully started sharing all media."
echo " "
fi
;;
2)
if [ $USGREP != 0 ]
then
echo " "
echo "ushare is already running. [PID: $USPID]"
echo " "
else
MEDIADIR="$US1DIR"
uscmd
echo " "
echo "ushare has been successfully started sharing $US1."
echo " "
fi
;;
3)
if [ $USGREP != 0 ]
then
echo " "
echo "ushare is already running. [PID: $USPID]"
echo " "
else
MEDIADIR="$US2DIR"
uscmd
echo " "
echo "ushare has been successfully started sharing $US2."
echo " "
fi
;;
4)
if [ $USGREP != 0 ]
then
echo " "
echo "ushare is already running. [PID: $USPID]"
echo " "
else
MEDIADIR="$US3DIR"
uscmd
echo " "
echo "ushare has been successfully started sharing $US3."
echo " "
fi
;;
5)
if [ $USGREP != 0 ]
then
echo " "
echo "attempting to shut down ushare [PID: $USPID].."
echo " "
kill -9 $USPID

#check to see if processes were killed.
sleep 2
if ps aux | grep -v grep | grep -v /bin/bash | grep ushare -n
then
echo "ushare could not be shut down. try shutting down ushare manually."
else
echo "ushare has been shutdown successfully."
echo " "
fi
else
echo " "
echo "ushare is not currently running."
echo " "
fi
;;
6)
exit
esac




Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP