From 270178d0278fe2d1ceddf98186feb744fe174489 Mon Sep 17 00:00:00 2001 From: Jeff Moe Date: Fri, 10 Jun 2022 21:17:08 -0600 Subject: [PATCH] Add script to download Internet Archive torrents --- README.md | 8 ++++++++ wut-ia-torrents | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 wut-ia-torrents diff --git a/README.md b/README.md index 4da0803..5187cd1 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ The following scripts are in the repo. * `wut-files` --- Tells you about what files you have in `downloads/` and `data/`. * `wut-files-data` --- Tells you about what files you have in `data/`. * `wut-ia` --- Download SatNOGS data from the Internet Archive at `archive.org`. +* `wut-ia-torrents` --- Download SatNOGS torrents from the Internet Archive at `archive.org`. * `wut-img-ck.py` --- Validate image files are not corrupt with PIL. * `wut-ml` --- Main machine learning Python script using Tensorflow and Keras. * `wut-ml-auto` --- Machine learning Python script using Tensorflow and Keras, auto. @@ -249,6 +250,13 @@ Get an account at archive.org, then run this to set up your account locally: ia configure ``` +To download all the SatNOGS collections `.torrent` files from the +Internet Archive, run: + +``` +wut-ia-torrents +``` + # Caveats This is the first artificial intelligence script I've done, diff --git a/wut-ia-torrents b/wut-ia-torrents new file mode 100755 index 0000000..9cf61c2 --- /dev/null +++ b/wut-ia-torrents @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# +# wut-ia-torrents --- Download SatNOGS torrents from the Internet Archive. +# +# https://archive.org/details/satnogs + +from internetarchive import get_item +from internetarchive import get_session +from internetarchive import download +from internetarchive import search_items + +# Download dir +obs_dl='/srv/dl' + +s = get_session() +s.mount_http_adapter() +search_results = s.search_items('satnogs-observations') +for i in search_items('identifier:satnogs-observations-*'): + obs_id=(i['identifier']) + print('Collection', obs_id) + download(obs_id, verbose=True, glob_pattern='*.torrent', + checksum=True, destdir=obs_dl, + retries=4, ignore_errors=True) +