#!/bin/bash

# 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

if ! command -v transmission-cli >/dev/null 2>&1 ; then
    echo "----" 1>&2
    echo "Error: Failed to find 'transmission-cli'" 1>&2
    echo "=> Please 'sudo' installed" 1>&2
    echo "=> Or refer to dev/GET-DEV-TOOLS.sh" 1>&2
    echo "----" 1>&2
    exit 1
fi

TERM=dumb nohup transmission-cli --download-dir crossref-data \
    -f "$PWD/_STOP-TRANSMISSION-CLI.sh" \
    https://academictorrents.com/download/$torrent_id.torrent \
    > nohup-torrent-download-2026.out 2>&1 &

echo "----"
echo "Nohup 'transmission-cli' logging to:"
echo "  $PWD/nohup-torrent-download-2026.out"
echo "----"

echo ""
echo "To monitor progress run:"
echo "  ./01-DOWNLOAD-DATASET-CHECK-PROGRESS.sh"
echo ""





