Skip to content

Instantly share code, notes, and snippets.

@rpcameron
Last active September 1, 2022 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpcameron/3b0f51eae3df36948edbc02a03870b69 to your computer and use it in GitHub Desktop.
Save rpcameron/3b0f51eae3df36948edbc02a03870b69 to your computer and use it in GitHub Desktop.
Manual Channels recording
#!/bin/sh
# This is using GNU date; will not work on macOS/BSD
_DVR=${CHANNELS:-127.0.0.1}
if [ -z $3]; then
echo "Usage: $0 channel start duration [title [description]]"
exit 0
fi
_CH=$1
_START=$(date -d "$2" +%s)
_DUR=$(("$3" * 60))
_TITLE=${4:-"Manual Recording"}
_DESC=$5
create_job() {
cat << EOF
{
"Name": "${_TITLE}",
"Time": ${_START},
"Duration": ${_DUR},
"Channels": ["${_CH}"],
"Airing": {
"Source": "manual",
"Channel": "${_CH}",
"Time": ${_START},
"Duration": ${_DUR},
"Title": "${_TITLE}",
"Summary": "${_DESC}",
"Image": "https://tmsimg.fancybits.co/assets/p9467679_st_h6_aa.jpg",
"SeriesID": "manual/${_CH}",
"ProgramID": "manual/${_TITLE}"
}
}
EOF
}
curl -XPOST --data-binary "$(create_job)" "http://${_DVR}:8089/dvr/jobs/new"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment