public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Walter Dnes" <waltdnes@waltdnes.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Downloading Flash videos
Date: Wed, 27 Jun 2007 21:15:41 -0400	[thread overview]
Message-ID: <20070628011541.GA6828@waltdnes.org> (raw)
In-Reply-To: <200706270027.25841.volker.armin.hemmann@tu-clausthal.de>

On Wed, Jun 27, 2007 at 12:27:25AM +0200, Hemmann, Volker Armin wrote

> open site. Wait until flash starts to load
> ls -lhtr /tmp
> the last file, starting with FLASH is the one.
> Wait for it to be fully loaded, copy it somewhere.

  There's an automated way of doing this.  I've written a bash script
that will find flash video files in the current directory *REGARDLESS OF
THE NAME*, and move them over to a specified directory with sequential
names, i.e. mm000.flv, mm001.flv, mm002.flv, etc.  Here's the setup...

1) mkdir ~/mvflv

2) save the script below as ~/bin/mvflv and make it executable.  This
bash script is released under GPL version 2.  You don't know me, so you
may want to wade through the code to ensure that it doesn't do anything
nasty, especially in the backtick expansions.  (I originally wrote the
decrement(), increment(), and getnextversion() functions for use with my
system backups, so that they would be sequentially numbered).

3) cd to either /tmp or Firefox's Cache directory and execute mvflv
The script lists each file it moves into ~/flvfiles

##################################################################
#!/bin/bash

decrement() {
  echo $(( $1 - 1 ))
}

increment() {
  echo $(( $1 + 1 ))
}

getnextversion() {
  NUMBER=
  DIGITPOINTER=0
  while [ ${DIGITPOINTER} -lt ${1} ]
  do
    NUMBER=${NUMBER}0
    DIGIT[${DIGITPOINTER}]=0
    DIGITPOINTER=`increment ${DIGITPOINTER}`
  done
  while [ -e ${2}${NUMBER}${3} ]
  do
    DIGITPOINTER=`decrement ${1}`
    DIGITPNTLEFT=`decrement ${DIGITPOINTER}`
    DIGIT[${DIGITPOINTER}]=`increment ${DIGIT[${DIGITPOINTER}]}`
    NUMBER=
    while [ ${DIGITPOINTER} -ge 0 ]
    do
      if [ ${DIGIT[${DIGITPOINTER}]} -eq 10 ]
      then
        DIGIT[${DIGITPOINTER}]=0
        if [ ${DIGITPNTLEFT} -gt 0 ]
        then
          DIGIT[${DIGITPNTLEFT}]=`increment ${DIGIT[${DIGITPNTLEFT}]}`
        fi
      fi
      NUMBER=${DIGIT[${DIGITPOINTER}]}${NUMBER}
      DIGITPOINTER=${DIGITPNTLEFT}
      DIGITPNTLEFT=`decrement ${DIGITPNTLEFT}`
    done
  done
  echo ${2}${NUMBER}${3}
}

for filename in *
do
  if echo "`file ${filename}`" | grep "Macromedia Flash Video" ; then
    newfilename=`getnextversion 3 ~/flvfiles/mm .flv`
    mv ${filename} ${newfilename}
    echo ${newfilename}
  fi
done
##################################################################


-- 
Walter Dnes <waltdnes@waltdnes.org> In linux /sbin/init is Job #1
Q. Mr. Ghandi, what do you think of Microsoft security?
A. I think it would be a good idea.
-- 
gentoo-user@gentoo.org mailing list



      parent reply	other threads:[~2007-06-28  1:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-26 20:42 [gentoo-user] Downloading Flash videos Mick
2007-06-26 21:03 ` [gentoo-user] " Ali Polatel
2007-06-26 21:06 ` [gentoo-user] " Hans-Werner Hilse
2007-06-26 21:08 ` Daniel da Veiga
2007-06-27  7:22   ` Roger Luethi
2007-06-26 21:26 ` Daniel Pielmeier
2007-06-26 21:47   ` Mick
2007-06-26 22:00     ` Edward Pasek
2007-06-27  6:40       ` Mick
2007-06-26 22:27 ` Hemmann, Volker Armin
2007-06-27 17:02   ` felix
2007-06-28  1:15   ` Walter Dnes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070628011541.GA6828@waltdnes.org \
    --to=waltdnes@waltdnes.org \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox