1 |
On Wed, Jun 27, 2007 at 12:27:25AM +0200, Hemmann, Volker Armin wrote |
2 |
|
3 |
> open site. Wait until flash starts to load |
4 |
> ls -lhtr /tmp |
5 |
> the last file, starting with FLASH is the one. |
6 |
> Wait for it to be fully loaded, copy it somewhere. |
7 |
|
8 |
There's an automated way of doing this. I've written a bash script |
9 |
that will find flash video files in the current directory *REGARDLESS OF |
10 |
THE NAME*, and move them over to a specified directory with sequential |
11 |
names, i.e. mm000.flv, mm001.flv, mm002.flv, etc. Here's the setup... |
12 |
|
13 |
1) mkdir ~/mvflv |
14 |
|
15 |
2) save the script below as ~/bin/mvflv and make it executable. This |
16 |
bash script is released under GPL version 2. You don't know me, so you |
17 |
may want to wade through the code to ensure that it doesn't do anything |
18 |
nasty, especially in the backtick expansions. (I originally wrote the |
19 |
decrement(), increment(), and getnextversion() functions for use with my |
20 |
system backups, so that they would be sequentially numbered). |
21 |
|
22 |
3) cd to either /tmp or Firefox's Cache directory and execute mvflv |
23 |
The script lists each file it moves into ~/flvfiles |
24 |
|
25 |
################################################################## |
26 |
#!/bin/bash |
27 |
|
28 |
decrement() { |
29 |
echo $(( $1 - 1 )) |
30 |
} |
31 |
|
32 |
increment() { |
33 |
echo $(( $1 + 1 )) |
34 |
} |
35 |
|
36 |
getnextversion() { |
37 |
NUMBER= |
38 |
DIGITPOINTER=0 |
39 |
while [ ${DIGITPOINTER} -lt ${1} ] |
40 |
do |
41 |
NUMBER=${NUMBER}0 |
42 |
DIGIT[${DIGITPOINTER}]=0 |
43 |
DIGITPOINTER=`increment ${DIGITPOINTER}` |
44 |
done |
45 |
while [ -e ${2}${NUMBER}${3} ] |
46 |
do |
47 |
DIGITPOINTER=`decrement ${1}` |
48 |
DIGITPNTLEFT=`decrement ${DIGITPOINTER}` |
49 |
DIGIT[${DIGITPOINTER}]=`increment ${DIGIT[${DIGITPOINTER}]}` |
50 |
NUMBER= |
51 |
while [ ${DIGITPOINTER} -ge 0 ] |
52 |
do |
53 |
if [ ${DIGIT[${DIGITPOINTER}]} -eq 10 ] |
54 |
then |
55 |
DIGIT[${DIGITPOINTER}]=0 |
56 |
if [ ${DIGITPNTLEFT} -gt 0 ] |
57 |
then |
58 |
DIGIT[${DIGITPNTLEFT}]=`increment ${DIGIT[${DIGITPNTLEFT}]}` |
59 |
fi |
60 |
fi |
61 |
NUMBER=${DIGIT[${DIGITPOINTER}]}${NUMBER} |
62 |
DIGITPOINTER=${DIGITPNTLEFT} |
63 |
DIGITPNTLEFT=`decrement ${DIGITPNTLEFT}` |
64 |
done |
65 |
done |
66 |
echo ${2}${NUMBER}${3} |
67 |
} |
68 |
|
69 |
for filename in * |
70 |
do |
71 |
if echo "`file ${filename}`" | grep "Macromedia Flash Video" ; then |
72 |
newfilename=`getnextversion 3 ~/flvfiles/mm .flv` |
73 |
mv ${filename} ${newfilename} |
74 |
echo ${newfilename} |
75 |
fi |
76 |
done |
77 |
################################################################## |
78 |
|
79 |
|
80 |
-- |
81 |
Walter Dnes <waltdnes@××××××××.org> In linux /sbin/init is Job #1 |
82 |
Q. Mr. Ghandi, what do you think of Microsoft security? |
83 |
A. I think it would be a good idea. |
84 |
-- |
85 |
gentoo-user@g.o mailing list |