Re: quasi-[OT] Adobe Flash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2010-10-23 at 14:28 -0700, suvayu ali wrote:
> On 23 October 2010 11:24, Marko Vojinovic <vvmarko@xxxxxxxxx> wrote:
> > Feel free to test it :-), and tell us the results. I can't myself, don't have
> > flash on this machine, need to wait until I get home.
> >
> > The script should be run while flash is downloading the movie, and it should
> > end on its own once done.
> >
> 
> Works as expected, but there is one catch. Since the plugin is run by
> the browser, it waits for the browser to quit. Which might be rather
> inconvenient. Maybe inotify is the way to go, or maybe the script
> could check whether the file descriptor is still open under the pid of
> the browser.

I tried it using inotifywait(1), but it never terminates, i.e. the flash
file persists even after the video has finished. I suspect it will stay
there till a new video starts or the flash plugin (i.e. the browser
process) dies.

This is my version in case anyone wants to play with it. I changed the
name to avoid clashing with Suvayu and Marko's efforts:

$ cat grab-flash
#!/bin/sh
# Grab Flash video while it's being downloaded
# Adapted from http://lists.fedoraproject.org/pipermail/users/2010-October/385463.html

case $# in
1)	out_file=$1 ;;
*)	echo Usage: grab-flash output
	exit -1 ;;
esac

pid=$(ps -fu `whoami`|egrep 'libflashplayer\.so'|egrep -om 1 -E '\<[0-9]+\>'|head -1);
fid=$(lsof -p $pid |egrep '/tmp/Flash'|egrep -om 1 -E '\<[0-9]+[a-z]\>'|tr -d 'a-z');
in_file=/proc/${pid}/fd/${fid}
tail -f -q --bytes=1G --pid=${pid} $in_file > $out_file &
inotifywait -e delete $in_file 2> /dev/null
sleep 5	# Wait for buffer to flush. Is this necessary?
kill $!

poc


-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux