techne/internet-archive.org
2024-09-20 21:17:26 -05:00

35 lines
1.1 KiB
Org Mode

#+title: Internet Archive
#+setupfile: ../org-templates/page.org
** Install Python command line client
#+BEGIN_SRC bash
pipx install internetarchive
#+END_SRC
** Use Python client to download torrent files from given collection
Ensure "Automatically add torrents from" > Monitored Folder is set to ~/mnt/torrent_files~ and the Override save path is Default save path.
*** Get itemlist from collection
#+BEGIN_SRC bash
ia search --itemlist "collection:bbsmagazine" | tee bbsmagazine.txt
#+END_SRC
*** Download torrent files from each item using parallel
#+BEGIN_SRC bash
cat bbsmagazine.txt | parallel 'ia download --format "Archive BitTorrent" --destdir=/mnt/torrent_files {}'
#+END_SRC
*** Move .torrent files from their directories to ~/mnt/torrent_files~
#+BEGIN_SRC bash
find /mnt/torrent_files -type f -name "*.torrent" -exec mv {} /mnt/torrent_files \;
#+END_SRC
#+BEGIN_QUOTE
Note: .torrent files will be removed from ~/mnt/torrent_files~ by qBittorrent once they are added to the instance.
#+END_QUOTE
*** Remove empty directories
#+BEGIN_SRC bash
find /mnt/torrent_files -maxdepth 1 -mindepth 1 -type d -delete
#+END_SRC