Giter Club home page Giter Club logo

rpipress-downloader's Introduction

rpipress-downloader

Get it from the Snap Store

Download Raspberry Pi Press issues.

Freely available magazines are:

HackSpace, HelloWorld and MagPi

Remember that you can find these resources for free only thanks to people around the world supporting them. You too can support their work either by buying physical copies or by making a contribution of any size.

By default rpipress-downloader downloads only the latest issue of each magazine. However you can download all issues, all books for all or some magazines.

Issues and books are saved respectively in

  • ~/rpipress/{magazine}
  • ~/rpipress/{magazine}/Books

or, using the snap, in

  • ~/snap/rpipress-downloader/current/rpipress/{magazine},
  • ~/snap/rpipress-downloader/current/rpipress/{magazine}/Books.

Installation

From source

git clone https://github.com/artivis/rpipress-downloader.git
cd rpipress-downloader
python3 -m pip install -U .

Snap

sudo snap install rpipress-downloader

Use

By default, invoking rpipress-downloader will download only the latest issue for each magazine if they are not already available locally.

You can:

  • download issues only for one (or several) magazine(s),

    rpipress-downloader --magazines magpi hackspace
  • download all issue of each magazine,

    rpipress-downloader --all
  • download all books,

    rpipress-downloader --books
  • download to a specific base path,

    rpipress-downloader --path /home/ubuntu/Documents
  • combine options,

    rpipress-downloader -a -m magpi -b -p /home/ubuntu/Documents

will download all MagPi issues and books in /home/ubuntu/Documents/rpipress/MagPi.

Options

$ rpipress-downloader -h
usage: rpipress-downloader [-h] [-a] [-b] [-m {hackspace,helloworld,magpi} [{hackspace,helloworld,magpi} ...]] [-p PATH] [-q]

Download Raspberry Pi Press issues.

Freely available magazines are: HackSpace, HelloWorld, MagPi.

By default `rpipress-downloader` downloads only the latest issue of each
magazine. However you can download all issues, all books for all or some magazines.

By default, issues and books are saved respectively in
- `~/rpipress/{magazine}`
- `~/rpipress/{magazine}/Books`

or, using the snap, in
- `~/snap/rpipress-downloader/current/rpipress/{magazine}`,
- `~/snap/rpipress-downloader/current/rpipress/{magazine}/Books`.

optional arguments:
  -h, --help            show this help message and exit
  -a, --all             Download all issues
  -b, --books           Download the magazine books
  -m {hackspace,helloworld,magpi} [{hackspace,helloworld,magpi} ...], --magazines {hackspace,helloworld,magpi} [{hackspace,helloworld,magpi} ...]
                        Choose which magazine(s) to download. Defaults to all.
  -p PATH, --path PATH  Set the download path. Defaults to ~/rpipress or ~/snap/rpipress-downloader/current/rpipress.
  -q, --quiet           No prints

rpipress-downloader's People

Contributors

artivis avatar tripplehelix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rpipress-downloader's Issues

Hello World has updated their magazine page which breaks script

First issue, helloworld magazine no longer uses a "c-latest-issue" class on its webpage.

Latest HackSpace issue is N°71
Traceback (most recent call last):
  File "/home/tom/.local/bin/rpipress-downloader", line 132, in <module>
    last_issue = soup.find('section', class_="c-latest-issue").findChild("a")['href'].split('/')[-1]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'findChild'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tom/.local/bin/rpipress-downloader", line 134, in <module>
    raise Exception('Could not find latest ' + magazine.name + ' issue number')
Exception: Could not find latest HelloWorld issue number

Second issue, the error above. Guessing both are related as "raise exception" needs an issue number.

Had a quick look for an alternative to see if I could easily fix the issue but can't see anything that answers all three magazines.

'You are up to date' Never prints

if not download and not download_error:
    print(
        colors.OK 
        + 'You are up to date.\n' 
        + colors.ENDC
    )

It is never printed for some reason, it's also printed at the end. It should print after each check only if the latest magazine is already downloaded, for example currently we get (using my latest PR, also tested with master):

Latest HackSpace issue is N°79
You may need to wait for the free download.

Latest HelloWorld issue is N°23
Latest MagPi issue is N°142
You may need to wait for the free download.

Latest MagPi book is 'Retro Gaming with Raspberry Pi 3rd edition'
You may need to wait for the free download.

Latest MagPi book is 'The Official Raspberry Pi Handbook 2024'
You may need to wait for the free download.

Your favorite magazines are waiting for you in file:///home/tom/Magazines/

We should get:

Latest HackSpace issue is N°79
You may need to wait for the free download.

Latest HelloWorld issue is N°23
You are up to date.

Latest MagPi issue is N°142
You may need to wait for the free download.

Latest MagPi book is 'Retro Gaming with Raspberry Pi 3rd edition'
You may need to wait for the free download.

Latest MagPi book is 'The Official Raspberry Pi Handbook 2024'
You may need to wait for the free download.

Your favorite magazines are waiting for you in file:///home/tom/Magazines/

Errors due to delayed free pdf

The script currently throws errors as the magazine was released, but it's behind a timer.

Would it be possible to grab the date of release of the current issue then calculate the time till release and display that instead of the error? I think they are released for free 2-3 weeks after print release.

Error when running `rpipress-downloader -b`

ERROR: There was an error downloading MagPi book Retro Gaming with Raspberry Pi 3rd edition
ERROR: There was an error downloading MagPi book The Official Raspberry Pi Handbook 2024

Also noticing many of the available books don't download.

Constant Error's

Do you think it would be a good idea to remove the 'error couldn't download' from the output? It's not really an error if the latest book's PDF isn't available yet. I'm thinking, cut that line entirely.

Then when it prints 'Latest x is' under it print Latest x already downloaded

Gives the user a much clearer view of what's going on, rather than them thinking there's been a malfunction.

With this change and my PR, we could move the spacing to below this message, rather than above the 'LATEST X is X' line. This would clean things up quite a bit. I may add a PR for this later this weekend.

Issue number no longer shown in download error

~► rpipress-downloader
Latest HackSpace issue is N°77
ERROR: Couldn't download HackSpace N°{:02d}
You may need to wait for the free download

Latest HelloWorld issue is N°23
Latest MagPi issue is N°140
ERROR: Couldn't download MagPi N°{:02d}
You may need to wait for the free download

The issue numbers are showing {:02d} instead of the actual nunmbers.

There's also a spacing issue, where once it lists the magazine that's already downloaded and has no error there's no gap to the next magazine. e.g.

~► rpipress-downloader
Latest HackSpace issue is N°77
ERROR: Couldn't download HackSpace N°77
You may need to wait for the free download

Latest HelloWorld issue is N°23

Latest MagPi issue is N°140
ERROR: Couldn't download MagPi N°140
You may need to wait for the free download

Should be displayed

Wireframe has moved?

14:52:46 ▶ rpipress-downloader -a
Latest CustomPC issue is N°234
Latest HackSpace issue is N°65
Latest HelloWorld issue is N°20
Latest MagPi issue is N°128
Traceback (most recent call last):
  File "/home/tom/.local/bin/rpipress-downloader", line 130, in <module>
    last_issue = soup.find('section', class_="c-latest-issue").findChild("a")['href'].split('/')[-1]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'findChild'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tom/.local/bin/rpipress-downloader", line 132, in <module>
    raise Exception('Could not find latest ' + magazine.name + ' issue number')
Exception: Could not find latest Wireframe issue number

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.