Flash Video Cache Finder

Various Gnome Stuff

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

0
Score 53.3%
Description:

Find cached video while watching and without needing downloader extensions. Type moz at a prompt to find the vid. Tested with Firefox (Icecat), Chromium, Midori, Uzbl, Konqueror, and Arora.

To install, append the downloaded moz() function to your local .bashrc file. It will work at your next login.
Last changelog:

7 years ago

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.

phillipe

7 years ago

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

Report

C

marcaemus

7 years ago

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.

Report

phillipe

7 years ago

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

Report

C

marcaemus

7 years ago

And that would leave $PATH set with /usr/sbin in it which is not what I would want.

Report

phillipe

7 years ago

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

Report

C

marcaemus

7 years ago

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.

Report

C

marcaemus

7 years ago

This was just a 90 second hack very early this morning. It is, like me, ugly but very effective.

Report

phillipe

7 years ago

Ok man!

I just wanted to show you another way to do that without make many validations.

Anyway this is a very useful script.

Report

C

marcaemus

7 years ago

Added the least bit of error checking for a less brain-dead script.

Report

lordix

7 years ago

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

Report

C

marcaemus

7 years ago

(Hit save not edit) Its here:
http://gnome-look.org/content/show.php/Save+cached+video?content=146399

Report

C

marcaemus

7 years ago

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.

Report

C

marcaemus

7 years ago

Also, what was the need to change line 6?

Report

C

marcaemus

7 years ago

Should have searched for lsof instead of hard-coding. Will update in next version.

Report

7 years ago

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.

12345678910
11
product-maker adso Nov 05 2011 9 excellent
product-maker MiShUbuntu Nov 04 2011 3 bad
product-maker Count: 4 Rating: 5.0
File (click to download) Version Description PackagetypeArchitecture Downloads Date Filesize DL OCS-Install MD5SUM
*Needs ocs-url or ocs-store to install things
Pling
Details
license
version
1.1
updated Nov 01 2011
added Oct 28 2011
downloads 24h
0
page views 24h 1