Apr
15
2012

Looking to download a run of issues? There’s a script for that…

Google+ user Kevin Lynch has made a quick script (updated by David Mawdsley) to download multiple issues:

—-

 

#!/bin/bash
echo -n "What is the issue number of the first Full Circle Magazine to
download? "
read firstissue

echo ""
echo -n "What is the issue number of the last Full Circle Magazine to
download? ( > or = the previous number) "
read lastissue

cd ~/Desktop  # ~ brings you to the home directory of the user and from
there I wanted to use my folder 'Desktop'

for a in `seq $firstissue $lastissue`
    do
        wget -U Mozilla "http://dl.fullcirclemagazine.org/issue"$a"_en.pdf"
    done

echo ""
echo "Complete!"


Share it now!

About the Author: Ronnie Tucker

I'm the founder, and editor, of Full Circle magazine. Also, a self taught artist, official Ubuntu member and I've been using Linux exclusively (in one form or another) for over five years now.

9 Comments + Add Comment

  • Great ! thanks.

  • The only thing I’d love to see added is a way of downloading all of the “Special” editions also. I know they’re VM01, SC01, PY01 – PY04, SE01, and UU01, but I’m not sure how they could be incorporated into the script. Unless you did something like a question about whether the user wants them, and then have the for loop cycle through AA to ZZ and 01 to 10 or something like that. Or just have them hardcoded into the script (although that won’t work in the future).

    Have a great day:)
    Patrick.

  • i suggest to add “-c” option to wget. if issue is ollready downloaded in current folder it will not download it twice

  • I just made a small script to download the latest version of the issues (including the special editions).
    What you need is to create a folder structure like this (the folder names can be variable) and keep each different kind of issues on its own folder:

    .
    ./Special-Editions
    ./Special-Editions/Scribus
    ./Special-Editions/Programming-Series
    ./Special-Editions/Programming-Series/Python
    ./Special-Editions/Virtualization-Series

    Put the script in “.” folder and in each subfolder download manually at least the first issue of the normal or special issues your are interested on.

    Then run the script and it will iterate until reaching the latest uploaded issues.

    #!/bin/bash

    function download_issue {
    mydir=$1

    pushd $mydir > /dev/null
    Prefix=$(ls issue* | cut -d”_” -f 1 | sed ‘s/issue//g’ | sed ‘s/[0-9]*//g’ | tail -1)
    Latest=$( ls issue$Prefix* | cut -d”_” -f 1 | sed ‘s/issue’$Prefix’//g’ | sort -n | tail -1)
    echo Latest local issue found: $Latest
    let “Latest += 1″
    if [ "$Prefix" == "" ]; then
    FileToDownload=issue”$Latest”_en.pdf
    else
    FileToDownload=issue”$Prefix”$(printf “%02d” $Latest)_en.pdf
    fi
    echo Will try to download $FileToDownload
    wget -U Mozilla “http://dl.fullcirclemagazine.org/$FileToDownload” 2> /dev/null
    exit_status=$?
    popd > /dev/null

    return $exit_status
    }

    for dir in `find . -type d`; do
    filesexist=$(ls -l $dir | grep -v ^d | grep -v “^total [[:digit:]]” | wc -l)
    if [ $filesexist -gt 0 ]; then
    echo “”
    echo “Trying to fetch latest issues in $dir”
    exit_status=0
    while [ $exit_status -eq 0 ]; do
    download_issue $dir
    exit_status=$?
    if [ $exit_status -eq 0 ]; then
    echo “Issue $FileToDownload downloaded successfully”
    else
    echo “Issue $FileToDownload does not yet exist. Please check again later.”
    fi
    done
    echo “”
    fi
    done

  • Segue um em português do Brasil!!!
    “In portuguese from Brazil”!!!

    #!/bin/bash
    #
    # Criado por Google+ user Kevin Lynch has made a quick script (updated by David Mawdsley) to download multiple issues
    #
    # Modificado por Marcio C. Bravim – marciocbravim@yahoo.com.br
    # ICQ 76209707 – @marciocbravim – RJ – BRAZIL
    #
    ### versão 0.0.1-BR – 2012-04-25
    #
    #
    #URL JPG => http://dl.fullcirclemagazine.org/cover/58/en.jpg
    #URL edição => http://fullcirclemagazine.org/issue-58/
    #
    #********========
    # Edição atual
    cd /tmp
    echo ” Verificando quantas edições da revista existem atualmente. Aguarde …”
    wget -q http://fullcirclemagazine.org/downloads/
    TOTAL=`grep “issue” index.html | fmt | grep jpg | cut -d\” -f2 | wc -l`
    echo ” Atualmente existem $TOTAL edições da Full Circle magazine”
    rm -f index.html
    cd –
    echo “”

    #
    #********========
    echo -n “Qual o diretório de download? ”
    read downloadir

    if [ ! -d $downloadir ]; then
    echo “Diretório não existe. Criando”
    mkdir $downloadir
    fi
    echo “”

    cd $downloadir

    echo -ne “Deseja baixar todas as edições? [S] ou [N]: [ ]” ’33[3D’
    read -n 1 RESP
    echo “”

    if [ "$RESP" = "s" -o "$RESP" = "S" ] ; then

    for a in `seq 0 $TOTAL`; do
    wget -c http://dl.fullcirclemagazine.org/issue“$a”_en.pdf
    done

    elif [ "$RESP" = "n" -o "$RESP" = "N" ] ; then
    echo -n “Qual o número da primeira edição da Full Circle Magazine para download? ”
    read -n 1 firstissue
    echo “”

    echo -n “Qual o número da última edição da Full Circle Magazine para download? ”
    read -n 1 lastissue
    echo “”

    fi

    for b in `seq $firstissue $lastissue`
    do
    wget -c http://dl.fullcirclemagazine.org/issue“$b”_en.pdf
    done

    echo “”
    echo “Download Completo!”
    # FIM

  • Where should this script be saved to and how do you run it? I’m a complete newb to scripting and such. Thanks!!

  • got it! i’m slowly learning but still a newb. not i just need to decode that script to see what each thing means.

  • Is there a way to set this up for EPUB yet? Do those have consistent naming?

  • How about:

    wget http://dl.fullcirclemagazine,org/issue{1..61}_en.pdf

Read Full Circle at:


You can also read Full Circle online at: http://issuu.com/fullcirclemagazine


You can also read Full Circle online via Google Play/Books

Go on Flattr us

All donations go to buying you folks some awesome competition prizes.

Subscribe

You can subscribe to get an email update every time a new issue of the magazine comes out.

Name:

E-mail:


About

Full Circle is a free, independent, monthly magazine dedicated to the Ubuntu family of Linux operating systems. Each month, it contains helpful how-to articles and reader submitted stories.

Full Circle also features a companion podcast, the Full Circle Podcast, which covers the magazine along with other news of interest.