
Flash Video Cache Finder
Source (link to git-repo or to original if based on someone elses unmodified work):
Available as/for:
Description:To install, append the downloaded moz() function to your local .bashrc file. It will work at your next login.
Speedup again and this time actually find the correct file descriptor.
Look for lsof instead of hard-coded path and graceful exit if no vid found.
1.0 will now find any number of simultaneous videos. Will only find the first instance of uzbl-tabbed.
1.1 Fixed a rather massive error where references to ~/.adobe/Flash_Player were incorrectly pick up.
Ratings & Comments
14 Comments
Hi man! You can simplify the method to verify if LSOF really exists, here is what you can do: -# Make sure we have lsof -if [ -x /usr/bin/lsof ]; then - LSOF=/usr/bin/lsof -elif [ -x /usr/sbin/lsof ]; then - LSOF=/usr/sbin/lsof -elif [ -x /usr/local/bin/lsof ]; then - LSOF=/usr/local/bin/lsof -else - echo "lsof was not found... exiting" - return 1 -fi +# Make sure we have lsof +if [ -x `which lsof` ]; then + LSOF=`which lsof` +else + echo "lsof was not found... exiting" + return 1 +fi
Fair enough, but I wanted to check explicitly because, for example, /usr/sbin is not in my users' $PATH so 'which' would not work here.
Simple... Just export a custom PATH: # Make sure we have lsof export PATH=$PATH:/usr/sbin if [ -x `which lsof` ]; then LSOF=`which lsof` else echo "lsof was not found... exiting" return 1 fi
And that would leave $PATH set with /usr/sbin in it which is not what I would want.
But it can be only while the function is executed: PATH_ORIG=$PATH export PATH=$PATH:/usr/sbin And on the end of the function: export PATH=$PATH_ORIG
What I've written is the simplest and quickest (in execution) lookup for lsof. So my original function is still the best version of this quick hack.
Ok man! I just wanted to show you another way to do that without make many validations. Anyway this is a very useful script.
This was just a 90 second hack very early this morning. It is, like me, ugly but very effective.
Added the least bit of error checking for a less brain-dead script.
Hello. To operate in archlinux: moz () { ME=`/usr/sbin/lsof | grep Flash | tail -n1 | awk '{ print $2 " " $5}'` VID=`echo $ME | awk '{ print $2 }'` PROCDIR=`echo $ME | awk '{ print $1 }'` echo "Video is at "${VID%?} cd /proc/$PROCDIR && cd fd cp ${VID%?} ~/flv/video-${VID%?} } Edit line 2 Edit line 6 +++ cp ${VID%?} ~/flv/video-${VID%?} Copy flv file in ~/flv
Should have searched for lsof instead of hard-coding. Will update in next version.
Also, what was the need to change line 6?
Written a script (not a function) to copy video to your home directory. Usage "mozz [filename]" will copy the cached video to $HOME/flvs/filename.flv.
(Hit save not edit) Its here: http://gnome-look.org/content/show.php/Save+cached+video?content=146399