diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..91f5417 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +docker/.env +docker/output +docker/urls.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..37c0b4e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.8-slim as requirements +COPY requirements.txt . +RUN pip install -r requirements.txt + +FROM requirements +COPY archive-org-downloader.py . +ENTRYPOINT ["/usr/local/bin/python", "archive-org-downloader.py"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..4e9a227 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,33 @@ +### Install Docker Desktop + +See [here](https://www.docker.com/products/docker-desktop/) + + +### Configure Downloader + +```shell +cd ./docker +``` + +Put your desired book URLs in a `./urls.txt` file: + +```shell +echo 'https://archive.org/details/XXXX' >> ./urls.txt +``` + +Place the following contents in a `./.env` file: + +```shell +AD_EMAIL='ARCHIVE.ORG_EMAIL' +AD_PASSWORD='ARCHIVE.ORG_PASSWORD' +AD_RESOLUTION='0' +``` + + +### Run the Downloader + +```shell +docker-compose run archive_downloader +``` + +You can find the downloaded PDFs at `./output/*.pdf` diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..38d52fd --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,20 @@ +version: "3.9" +services: + archive_downloader: + build: + context: .. + dockerfile: Dockerfile + volumes: + - ./output:/ad_output:rw + - ./urls.txt:/ad_urls.txt:ro + command: + - "-e" + - "$AD_EMAIL" + - "-p" + - "$AD_PASSWORD" + - "-r" + - "$AD_RESOLUTION" + - "-d" + - "/ad_output" + - "-f" + - "/ad_urls.txt"