From d5f8f6a0134bde359ad6d9ef4400f7e78b9e5f77 Mon Sep 17 00:00:00 2001 From: Joergi <1439809+joergi@users.noreply.github.com> Date: Fri, 17 Jul 2020 23:10:05 +0200 Subject: [PATCH 01/11] Create special-editions.txt --- special-editions.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 special-editions.txt diff --git a/special-editions.txt b/special-editions.txt new file mode 100644 index 0000000..92b0a3d --- /dev/null +++ b/special-editions.txt @@ -0,0 +1,5 @@ +# Code the Classics – Volume 1 +https://wireframe.raspberrypi.org/books/code-the-classics1/pdf + +# Build Your Own First-Person Shooter in Unity +https://wireframe.raspberrypi.org/books/unity-fps/pdf From 9f3cc3f7a55e24658ca63cdaf606a8e2376fc76c Mon Sep 17 00:00:00 2001 From: joergi <1439809+joergi@users.noreply.github.com> Date: Sat, 18 Jul 2020 00:22:58 +0200 Subject: [PATCH 02/11] add pdfs to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c741b1a..50dd1f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.idea -issues \ No newline at end of file +**.pdf +issues From e1ac28fad1aedd53d2859571cbc6a9e5eb25e3d7 Mon Sep 17 00:00:00 2001 From: joergi <1439809+joergi@users.noreply.github.com> Date: Sat, 18 Jul 2020 00:25:51 +0200 Subject: [PATCH 03/11] adding special editions downloader, downloads from extra file --- books-downloader.sh | 15 +++++++++++++++ wireframe-books-downloader.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 books-downloader.sh create mode 100644 wireframe-books-downloader.sh diff --git a/books-downloader.sh b/books-downloader.sh new file mode 100644 index 0000000..e05cd73 --- /dev/null +++ b/books-downloader.sh @@ -0,0 +1,15 @@ + +OUTDIR=issues + +if [ ! -d "$OUTDIR" ]; then + mkdir "$OUTDIR" +fi + + +file="special-editions.txt" +while IFS= read -r line +do + bash <(curl https://raw.githubusercontent.com/joergi/downloader/master/linux_mac/downloader.sh) $line +done < "$file" + +exit 0 diff --git a/wireframe-books-downloader.sh b/wireframe-books-downloader.sh new file mode 100644 index 0000000..211b477 --- /dev/null +++ b/wireframe-books-downloader.sh @@ -0,0 +1,26 @@ + #!/bin/bash +# ------------------------------------------------------------------ +# [Author] joergi - https://github.com/joergi/WireframeDownloader +# downloader for all Wireframe magzine issues and books +# based on Magpi Downloader: https://github.com/joergi/MagpiDownloader +# they are downloadable for free under https://wireframe.raspberrypi.org/issues +# or you can buy the paper issues under: https://store.rpipress.cc/collections/wireframe +# this script is under GNU GENERAL PUBLIC LICENSE 3 +# ------------------------------------------------------------------ + +# VERSION=0.2.0 +# USAGE="Usage: bash wireframe-books-downloader.sh [-f firstissue] [-l lastissue]" + +OUTDIR=issues + +if [ ! -d "$OUTDIR" ]; then + mkdir "$OUTDIR" +fi + +file="special-editions.txt" +while IFS= read -r line +do + bash <(curl https://raw.githubusercontent.com/joergi/downloader/master/linux_mac/downloader.sh) $line +done < "$file" + +exit 0 From 751bedfd71cf5ffda169dbce310e5f13506138a5 Mon Sep 17 00:00:00 2001 From: Joergi <1439809+joergi@users.noreply.github.com> Date: Sat, 18 Jul 2020 00:26:44 +0200 Subject: [PATCH 04/11] Delete books-downloader.sh --- books-downloader.sh | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 books-downloader.sh diff --git a/books-downloader.sh b/books-downloader.sh deleted file mode 100644 index e05cd73..0000000 --- a/books-downloader.sh +++ /dev/null @@ -1,15 +0,0 @@ - -OUTDIR=issues - -if [ ! -d "$OUTDIR" ]; then - mkdir "$OUTDIR" -fi - - -file="special-editions.txt" -while IFS= read -r line -do - bash <(curl https://raw.githubusercontent.com/joergi/downloader/master/linux_mac/downloader.sh) $line -done < "$file" - -exit 0 From f2c3d49a2cba043aff447415010c9e21d2f2c1fa Mon Sep 17 00:00:00 2001 From: Joergi <1439809+joergi@users.noreply.github.com> Date: Sat, 18 Jul 2020 00:28:21 +0200 Subject: [PATCH 05/11] add test for books --- .github/workflows/testing.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index bf16354..83bf836 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -36,6 +36,9 @@ jobs: - name: Download Issues with start and end limit id: normalIssuesWithRange run: bash ./wireframe-downloader.sh -f 34 -l 35 + - name: Download all special ediations + id: downloadSpecial-Editions + run: bash ./wireframe-books-downloader.sh bash-macos: runs-on: macos-latest steps: @@ -45,4 +48,7 @@ jobs: run: bash ./wireframe-downloader.sh -l 28 - name: Download Issues with start and end limit id: normalIssuesWithRange - run: bash ./wireframe-downloader.sh -f 34 -l 35 \ No newline at end of file + run: bash ./wireframe-downloader.sh -f 34 -l 35 + - name: Download all special ediations + id: downloadSpecial-Editions + run: bash ./wireframe-books-downloader.sh From 6037c9e81fd2c2e034cd8b9e0963880b7828caec Mon Sep 17 00:00:00 2001 From: Joergi <1439809+joergi@users.noreply.github.com> Date: Tue, 28 Jul 2020 00:57:53 +0200 Subject: [PATCH 06/11] removing extra space for linter --- wireframe-books-downloader.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wireframe-books-downloader.sh b/wireframe-books-downloader.sh index 211b477..8e5ad33 100644 --- a/wireframe-books-downloader.sh +++ b/wireframe-books-downloader.sh @@ -1,4 +1,4 @@ - #!/bin/bash +#!/bin/bash # ------------------------------------------------------------------ # [Author] joergi - https://github.com/joergi/WireframeDownloader # downloader for all Wireframe magzine issues and books From f322cc7f0bf7c6ed761071c7a9c4adde8838ebe4 Mon Sep 17 00:00:00 2001 From: Joergi <1439809+joergi@users.noreply.github.com> Date: Tue, 28 Jul 2020 01:08:00 +0200 Subject: [PATCH 07/11] Update testing.yml --- .github/workflows/testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 8faef6e..ad0bb4c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -4,12 +4,12 @@ name: CI # Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch +# events but only for the main branch on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: From 010f06c77e406c3b9e3a883389f118e4e966c6aa Mon Sep 17 00:00:00 2001 From: Joergi <1439809+joergi@users.noreply.github.com> Date: Tue, 28 Jul 2020 01:38:56 +0200 Subject: [PATCH 08/11] Update linters.yml --- .github/workflows/linters.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index aae329c..8446c76 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -3,12 +3,12 @@ name: LINTERS # Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch +# events but only for the main branch on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: From 9a2591a15cedc693fed9f0f9ba9e822b36d0ea46 Mon Sep 17 00:00:00 2001 From: joergi <1439809+joergi@users.noreply.github.com> Date: Wed, 29 Jul 2020 01:25:03 +0200 Subject: [PATCH 09/11] check also for special editions --- .github/workflows/testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index ad0bb4c..d0171b3 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -55,7 +55,7 @@ jobs: id: check_files uses: andstor/file-existence-action@v1 with: - files: "issues/WF_02_Digital_Edition_v3.pdf, issues/Wireframe40.pdf" + files: "issues/WF_02_Digital_Edition_v3.pdf, issues/Wireframe40.pdf, special-issues/Code_the_Classics-book.pdf, special-issues/Wireframe_BYOFPS" allow_failure: false - name: lslah run: ls -lah issues/ @@ -79,7 +79,7 @@ jobs: id: check_files uses: andstor/file-existence-action@v1 with: - files: "issues/WF_02_Digital_Edition_v3.pdf, issues/Wireframe40.pdf" + files: "issues/WF_02_Digital_Edition_v3.pdf, issues/Wireframe40.pdf, special-issues/Code_the_Classics-book.pdf, special-issues/Wireframe_BYOFPS" allow_failure: false - name: lslah run: ls -lah issues/ From 05367214ce58c455830223059ece4a052580c83b Mon Sep 17 00:00:00 2001 From: joergi <1439809+joergi@users.noreply.github.com> Date: Wed, 29 Jul 2020 01:28:30 +0200 Subject: [PATCH 10/11] use new downloader (v0.3.0) --- special-editions.txt | 3 --- wireframe-books-downloader.sh | 4 ++-- wireframe-downloader.sh | 34 ++++++++++------------------------ 3 files changed, 12 insertions(+), 29 deletions(-) mode change 100644 => 100755 wireframe-books-downloader.sh diff --git a/special-editions.txt b/special-editions.txt index 92b0a3d..b86d086 100644 --- a/special-editions.txt +++ b/special-editions.txt @@ -1,5 +1,2 @@ -# Code the Classics – Volume 1 https://wireframe.raspberrypi.org/books/code-the-classics1/pdf - -# Build Your Own First-Person Shooter in Unity https://wireframe.raspberrypi.org/books/unity-fps/pdf diff --git a/wireframe-books-downloader.sh b/wireframe-books-downloader.sh old mode 100644 new mode 100755 index 8e5ad33..20dd420 --- a/wireframe-books-downloader.sh +++ b/wireframe-books-downloader.sh @@ -11,7 +11,7 @@ # VERSION=0.2.0 # USAGE="Usage: bash wireframe-books-downloader.sh [-f firstissue] [-l lastissue]" -OUTDIR=issues +OUTDIR=special-issues if [ ! -d "$OUTDIR" ]; then mkdir "$OUTDIR" @@ -20,7 +20,7 @@ fi file="special-editions.txt" while IFS= read -r line do - bash <(curl https://raw.githubusercontent.com/joergi/downloader/master/linux_mac/downloader.sh) $line + bash <(curl https://raw.githubusercontent.com/joergi/downloader/main/linux_mac/downloader.sh) "$line" "$OUTDIR" done < "$file" exit 0 diff --git a/wireframe-downloader.sh b/wireframe-downloader.sh index d34a0c7..afffa66 100644 --- a/wireframe-downloader.sh +++ b/wireframe-downloader.sh @@ -18,29 +18,15 @@ if [ ! -d "$OUTDIR" ]; then mkdir "$OUTDIR" fi -i=1 -file="$BASEDIR/regular-issues.txt"; - -issues=$(cat "$file"); - - while : - do - case "$1" in - -f) shift; i="$1";; - -l) shift; issues="$1";; - --) shift; break;; - -*) usage "bad argument $1";; - *) break;; - esac - shift - done - - while [ "$i" -le "$issues" ] - do - printf -v page_url "https://wireframe.raspberrypi.org/issues/%02d/pdf" "$i" - pdf_url=$(curl -sf "$page_url" | grep \"c-link\" | sed 's/^.*href=\"//' | sed 's/\?.*$//') - wget -N "$pdf_url" -P "$OUTDIR" - i=$(( i+1 )) - done +downloadUrl="https://wireframe.raspberrypi.org/issues/%02d/pdf" + +file="$BASEDIR/sources-for-download/regular-issues.txt"; +recentIssue=$(cat "$file"); + +# workaround for a known limitation in bash 3.x: http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00018.html +# stackoverflow: https://stackoverflow.com/questions/32596123/why-source-command-doesnt-work-with-process-substitution-in-bash-3-2/32596626#32596626 +# shellcheck disable=SC1091 +source /dev/stdin <<<"$(curl -s https://raw.githubusercontent.com/joergi/downloader/main/linux_mac/downloader.sh)" "$downloadUrl" "$OUTDIR" "$recentIssue" "$@" exit 0 + From 6314c7625730c07c4d090d7a0eb439a567044c83 Mon Sep 17 00:00:00 2001 From: joergi <1439809+joergi@users.noreply.github.com> Date: Wed, 29 Jul 2020 01:31:12 +0200 Subject: [PATCH 11/11] fixing test - add missing .pdf --- .github/workflows/testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d0171b3..71c6479 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -55,7 +55,7 @@ jobs: id: check_files uses: andstor/file-existence-action@v1 with: - files: "issues/WF_02_Digital_Edition_v3.pdf, issues/Wireframe40.pdf, special-issues/Code_the_Classics-book.pdf, special-issues/Wireframe_BYOFPS" + files: "issues/WF_02_Digital_Edition_v3.pdf, issues/Wireframe40.pdf, special-issues/Code_the_Classics-book.pdf, special-issues/Wireframe_BYOFPS.pdf" allow_failure: false - name: lslah run: ls -lah issues/ @@ -79,7 +79,7 @@ jobs: id: check_files uses: andstor/file-existence-action@v1 with: - files: "issues/WF_02_Digital_Edition_v3.pdf, issues/Wireframe40.pdf, special-issues/Code_the_Classics-book.pdf, special-issues/Wireframe_BYOFPS" + files: "issues/WF_02_Digital_Edition_v3.pdf, issues/Wireframe40.pdf, special-issues/Code_the_Classics-book.pdf, special-issues/Wireframe_BYOFPS.pdf" allow_failure: false - name: lslah run: ls -lah issues/