Example scripts
This commit is contained in:
@@ -86,6 +86,9 @@ BEACON_EMAIL = "beacontrialemail@gmail.com"
|
||||
BEACON_PASSWORD = "Micaeah444?"
|
||||
```
|
||||
|
||||
## A word on scripts/*.sh
|
||||
These scripts are examples of scripts you could run on remote and local machines (i.e. seedboxes, home servers) to fully automate the downloading of Beacon.tv episodes, and **they are not required to use autosnatch at all**. I simply generalised the scripts I use in my home infrastructure and chucked them in here as inspiration (plus the annmoying ways in which cron needs `ssh`/`rsync` commands written in order to function).
|
||||
|
||||
## A word on headless server operation
|
||||
This project uses [pyvirtualdisplay](https://github.com/ponty/PyVirtualDisplay), which allows us to open an invisible browser window on an invisible display buffer, for machines that do not _have_ a real display. Ensure you skim over its GitHub above for additional set-up steps or issues documented.
|
||||
|
||||
|
||||
29
scripts/client-fetch.EXAMPLE.sh
Normal file
29
scripts/client-fetch.EXAMPLE.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Put this on the local machine. This will run remote-dl.sh on the remote machine, then download the episodes over rsync to the local machine.
|
||||
|
||||
# DO NOT CHANGE THESE
|
||||
M_ERR=$(printf '\e[1;31mERROR:\e[0m')
|
||||
ISNUMBER='^[0-9]+$'
|
||||
EPISODE=$1
|
||||
# DO NOT CHANGE THESE
|
||||
|
||||
# CHANGE THESE
|
||||
SRC_USER=remoteuser # The remote server user
|
||||
SRC_HOST=server.local # The remote server hostname/IP
|
||||
SRC_DL_DIR=/home/remoteexampleuser/autosnatch/beacon-downloads/ # The remote directory in which autosnatch is set to save its downloads
|
||||
SRC_AUTOSNATCHDIR=/home/remoteexampleuser/autosnatch # The directory in which you put the autosnatch files on the remote machine
|
||||
DEST_DL_DIR=/home/exampleuser/beacon-downloads/ # Where you want the files to download to on your local mahcine
|
||||
PRIVKEY=/home/exampleuser/.ssh/id_ed25519 # Cron needs to know with which private key to connect to the seedbox
|
||||
|
||||
if ! [[ $EPISODE =~ $ISNUMBER ]] ; then
|
||||
if ! [[ $EPISODE = 'latest' ]] ; then
|
||||
echo -e "$M_ERR Missing or invalid episode number" >&2; exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Trigger the remote server to download the latest episodes
|
||||
ssh -i $PRIVKEY $SRC_USER@$SRC_HOST -t $SRC_AUTOSNATCHDIR/scripts/remote-dl.sh critical-cooldown
|
||||
ssh -i $PRIVKEY $SRC_USER@$SRC_HOST -t $SRC_AUTOSNATCHDIR/scripts/remote-dl.sh campaign-4
|
||||
|
||||
# Pull the episodes from the remote server to your local machine
|
||||
rsync -avzhP -e "ssh -i $PRIVKEY" $SRC_USER@$SRC_HOST:$SRC_DL_DIR $DEST_DL_DIR
|
||||
6
scripts/remote-dl.EXAMPLE.sh
Normal file
6
scripts/remote-dl.EXAMPLE.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Put this on the remote machine. This will be run over SSH to download the latest episode automatically.
|
||||
|
||||
cd /home/remoteexampleuser/autosnatch # Replace this with the directory where you put the autosnatch files on the remote machine
|
||||
source venv/bin/activate
|
||||
python -m scripts.dl $1 latest
|
||||
Reference in New Issue
Block a user