<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc=" http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>briancarper.net (λ) (Tag: Flashgot)</title><link>http://briancarper.net/tag/28/flashgot</link><description>Some guy's blog about programming and Linux and cows.</description><item><title>FlashGot</title><link>http://briancarper.net/blog/flashgot</link><guid>http://briancarper.net/blog/flashgot</guid><pubDate>Mon, 17 Apr 2006 10:29:35 -0700</pubDate><description>&lt;p&gt;I'm likely the last person in the world who heard of &lt;a href=&quot;http://www.flashgot.net/whats&quot;&gt;FlashGot&lt;/a&gt;, but better late than never.  FlashGot is a Firefox plugin that lets you integrate with an external download manager program.  It also lets you download every link on a page via a single menu command, which is either nice or overkill, depending on what you want to do.&lt;/p&gt;

&lt;p&gt;Linux doesn't have many (any?) good download managers.  There's &lt;a href=&quot;http://www.krasu.ru/soft/chuchelo/&quot;&gt;D4X&lt;/a&gt;, but I never cared much for it.  I installed &lt;a href=&quot;http://www.gnome.org/projects/gwget/&quot;&gt;GWGET&lt;/a&gt; but FlashGot didn't auto-recognize it, and I'm not going through any trouble to get it working.&lt;/p&gt;

&lt;p&gt;However I still find FlashGot incredibly useful, for one reason: You can use a custom downloader executable.  FlashGot will then call the executable and pass it the download URL as a command line argument.  You can also pass other arguments (read about them all &lt;a href=&quot;http://www.flashgot.net/features#customdm&quot;&gt;here&lt;/a&gt;) but the URL is all I really need.  &lt;/p&gt;

&lt;p&gt;The downloader I use is a simple Ruby script I wrote myself which calls &lt;a href=&quot;http://www.gnu.org/software/wget/&quot;&gt;wget&lt;/a&gt;.  What's the point of this, you ask?  Well, you can do some neat things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Filter your downloads into directories by filetype, filename, source website, or any criteria at all.&lt;/li&gt;
&lt;li&gt;Spawn massive numbers of parallel downloads with a single click.  (Probably not a good idea to hammer servers too much with this though, it's not nice.)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use all the power of wget, which includes:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;custom timeout duration* download retrying* download resuming* filename timestamping* download speed throttling* FTP suport* (perhaps my favorite) GOOD filename collision resolution, so if you download a file called 1.png and then download a file called 1.png from a different site, wget will save the second one as 1.png.1.  This something I miss from Safari.  Firefox by default tends to ask you if you want to overwrite the old file, which gets very annoying very quickly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You could even conceivably crawl a web page or do recursive downloads.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's say you want every MP3 you download to go into a &quot;music&quot; folder, every PNG you download to go into a &quot;Pictures&quot; folder, and ignore all other files.  You could do something extremely simple like this (which I just wrote in 5 minutes and haven't tested):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/ruby

require 'fileutils'

begin
    ARGV.each do |arg|
        dir = ''
        if arg =~ /mp3/i then
            dir = '/home/chester/music'
        elsif arg =~ /png/i then
            dir = '/home/chester/pictures'
        else
            dir = nil
        end
        if dir then
            FileUtils.mkdir(dir) unless File.directory?(dir)
            Dir.chdir(dir) do
                `wget #{arg}`
            end
        end            
    end
rescue Exception =&amp;gt; e
    # If you want to see the output
    # when the script crashes, you 
    # could log it here.
    raise e
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Point FlashGot to this script and when you &quot;FlashGot All&quot;, all linked PNGs and MP3s on a site will be downloaded and sorted, and all other links will be ignored.  This would be very useful if you want to grab a whole page of wallpapers for example.&lt;/p&gt;</description></item></channel></rss>

