What to do with .flv files?
Simon
simon80-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Nov 30 18:15:11 UTC 2006
Like I said, gmail likes to mangle text, so I attached it as well.
The reason for the fallthrough is to keep the script non-interactive,
while for people with more than one directory in their firefox
directory, they can manually cd to the proper one and use it. I
forgot that doing */Cache would handle everything properly - the best
thing would be for dir in */Cache; do <rest of script>. Either way,
the fallthrough is safe, the script doesn't do anything in the
directory it falls into, it only outputs to the working directory. I
didn't know I needed a script like this, but it's a pretty convenient
and foolproof way to grab flv files, once it's fully automated -
thanks for the great idea, Walter, this is going into my ~/bin.
On 11/30/06, D. Hugh Redelmeier <hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org> wrote:
> | From: Simon <simon80-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
>
> | # change to cache dir by assuming that there's only one directory in the
> | # firefox
> | # dir, but we don't know what it is, so cd to the first directory we can find
> | # and hope it has a Cache folder in it
> | for file in ~/.mozilla/firefox/*; do
> | if [ -d $file ]; then
> | cd $file/Cache || { echo "I screwed up, change to your Cache
> | directory and run this again for better results. Press ctrl-c to kill
> | the script
> | now unless you're aready in the desired directory." && sleep
> | 5; }
> | break;
> | fi;
> | done
>
> The line breaks in the echo and sleep commands are accidental, I
> assume. So I'm reading them out. It is often best to fold long lines
> oneself.
>
> I don't understand the && before the sleep. It should not be
> necessary when { } is used.
>
> The "if all else fails, fall through" seems scary. Perhaps a check
> that `pwd matches` ~/.mozilla/*/*/Cache would be a good idea.
>
> Error messages should go to standard error and should be clearly
> marked as errors. They should make it clear what is reporting the
> error.
>
> This seems simpler [UNTESTED]:
>
> # change into the first firefox Cache directory
> cd ~/.mozilla/firefox/*/Cache/. \
> || {
> echo "Error: $0 didn't find a firefox Cache directory" >&2
> exit 1;
> }
>
> If there are multiple firefox subdirectories with with Cache
> subdirectories, this will choose the first (cd seems to ignore
> arguments after the first -- yuck).
>
> If you wish to better handle this case, the right thing might be to
> make this a for loop and have the rest of the script in the for body:
> scavange files from all Caches.
> --
> The Toronto Linux Users Group. Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list