View Single Post
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#3
I have this script that I call yta (YouTube Audio)

Code:
#!/bin/sh

# version 1.3

# set this to the directory where videos will be downloaded
VIDEO_DOWNLOAD_DIR="/media/mmc1/Videos"
VIDEO_SAVE_DIR="/media/mmc1/Favorites"

# REQUIRED:
# /usr/bin/youtube-dl-x -- http://rg3.github.com/youtube-dl/
# xclip -- http://asui.garage.maemo.org/_download/xclip
# apt-get install libxmu6

# USAGE:
# yt [URL]      -- download and play video in clipboard
# yt get [URL]  -- download video in clipboard
# yt kill       -- kill all downloads and playback
# yt clean      -- remove all downloaded videos
# yt save [URL] -- move already downloaded video in clipboard to saved video directory

#################################

if [ "$1" = "get" -o "$1" = "kill" -o "$1" = "clean" -o "$1" = "save" ]; then
	VIDEO=$2
else
	VIDEO=$1
fi
[ "$VIDEO" = "" ] && VIDEO=`xclip -out`
[ "$VIDEO" = "" -a "$1" != "kill" -a "$1" != "clean" ] && echo "Copy a youtube URL to clipboard or specify one on the command line" && exit

if [ "$1" = "kill" ]; then
	killall mplayer
	kill `ps aux|grep "/bin/sh $0"|grep -vE "(grep|kill|clean)"|awk '{print $1}'`
	kill `ps aux|grep "python /usr/bin/youtube-dl-x"|grep -v grep|awk '{print $1}'`
elif [ "$1" = "get" ]; then
	cd "$VIDEO_DOWNLOAD_DIR"
	echo "Downloading $VIDEO..."
	/usr/bin/youtube-dl-x --no-part -f 18 -o "%(stitle)s.%(ext)s" "$VIDEO"
elif [ "$1" = "save" ]; then
	cd "$VIDEO_DOWNLOAD_DIR"
	echo "Saving $VIDEO..."
	FILE=`youtube-dl-x --no-part -c -f 18 -o "%(stitle)s.%(ext)s" --get-filename "$VIDEO"`
	mv "$FILE" "$VIDEO_SAVE_DIR"/
elif [ "$1" = "clean" ]; then
	$0 kill
	rm -f "$VIDEO_DOWNLOAD_DIR"/*
else
	cd "$VIDEO_DOWNLOAD_DIR"
	echo "Downloading $VIDEO..."
	youtube-dl-x --no-part -c -f 18 -o "%(stitle)s.%(ext)s" "$VIDEO" &
	FILE=`youtube-dl-x --no-part -f 18 -o "%(stitle)s.%(ext)s" --get-filename "$VIDEO"`
	while [ ! -f "$FILE" ]; do sleep 5 ; done
	while [ "`/bin/ls -s "$FILE"|awk '{print $1}'`" -lt "4" ]; do sleep 5 ; done
	sleep 30
	mplayer "$FILE"
fi
It will grab the best audio quality of a Youtube video.

This is really great if you're into audio books and music such as this guy's channel.
http://m.youtube.com/user/osirisligh...ient=mv-google

Don't forget to check out Tarek's daily builds of SCUMM.

James Woodcock just released a musically enhanced version for the 7th Guest a day ago. His work is always amazing. <3

One other thing to quickly note is that you can use WinAmp skins with Xmms.

I'll think of some more junk later.
 

The Following 2 Users Say Thank You to Addison For This Useful Post: