#!/bin/bash -x

# In your browser, visit
#
#   https://academictorrents.com/browse.php?search=Crossref
#
# and locate latest year for the dataset available

# https://academictorrents.com/details/b5ee0e102689b3e67023dd024694c0f5f124646f
#
# ->
# https://academictorrents.com/download/b5ee0e102689b3e67023dd024694c0f5f124646f.torrent


year=2026
torrent_id=b5ee0e102689b3e67023dd024694c0f5f124646f

# Debug output
# echo "transmission-cli --download-dir crossref-data https://academictorrents.com/download/$torrent_id.torrent"
# exit


# It looks like 'transmission-cli' automatically starts serving up the JSON files for others in the P2P network
# so the process never finished
#
# The CLI tool does however print out progress of how much is downloaded, this can be monitored with:
#
#     egrep "^Processed:" nohup.out
#
# It also prints out a line when the download is completed.  A bit tricker to spot, so have a helper script
# for this:
#
#     ./CHECK-DOWNLOAD-COMPLETE.sh


TERM=dumb nohup transmission-cli --download-dir crossref-data \
    https://academictorrents.com/download/$torrent_id.torrent \
    > nohup-torrent-download-2026.out 2>&1 &


# Unsuccessful attempt to include a marker that helps spot when the download is completed
#    && echo -w "----\nCOMPLETED\n----" \



