#!/bin/bash
#
# Rip from flash files in /tmp (such as YouTube videos or something).  Useful
# if you want to create a VCD or very low-quality DVD of clips or something.
#
# This works with YouTube and a few other sites that cache files in /tmp.
# However, media player software written in Flash is always subject to change,
# so this script may stop working at some point in the future.
#
# Copyright (c) 2007, 2008 Michael B. Trausch <mike@trausch.us>.  Permission
# of modification, redistribution, and usage rights are under the terms of the
# GNU GPL v3, available on the Free Software Foundation's Web site.
#

for i in `ls /tmp/Flash*`; do
    printf "Found %s: Rip? (y or n)  " "$i"
    read yorn
    if [ "$yorn" = "y" ]; then
	printf "Specify output file name (Without extension):  "
	read outputfile
	ffmpeg2theora -o "$outputfile".ogg "$i"
	printf "Done converting, would you like to listen to the file?  (y or n)  "
	read yorn
	if [ "$yorn" = "y" ]; then
	    ogg123 "$outputfile".ogg
	fi
	printf "Done!\n\n"
    fi
done