This link gives the reason for preferring PID search rather than show search.
https://github.com/get-iplayer/get_iplayer/wiki/faq
I'm new to Bash scripting so don't laugh....
# split comma seperated string into list from PID env variable
IFS=',' read -ra PIDLIST <<< "${PID}"
Then modified your loop to:
# process each show in the list
for index in "${!SHOWLIST[@]}"; do
And added a test to see if PIDs are being used:
if [[ -n "${PID}" ]]; then
echo "[info] Running get_iplayer on PIDs..."
# run get_iplayer for PID, saving to incomplete folder
/usr/bin/get_iplayer --profile-dir /config --pid --nopurge --modes=flashhd,flashvhigh,flashhigh,flashstd,flashnormal,flashlow --file-prefix="${show_name} - <senum> - <episodeshort>" "${PIDLIST[index]}" --pid-recursive --output "/data/get_iplayer/incomplete/${show_name}"
else
# run get_iplayer for show, saving to incomplete folder
echo "[info] Running get_iplayer on shows..."
/usr/bin/get_iplayer --profile-dir /config --get --nopurge --modes=flashhd,flashvhigh,flashhigh,flashstd,flashnormal,flashlow --file-prefix="${show_name} - <senum> - <episodeshort>" "${show_name}" --output "/data/get_iplayer/incomplete/${show_name}"
fi
Basically you use --pid instead of --get. Also make sure --pid-recursive is added.
There are probably cleaner ways to do this, as you can probably get the showname from get_iplayer (c.f. with your <senum> and <episodeshort> parameters), but it was just a test to see if I could get it working.