OliveTin for Channels: An Interface for Misc Channels DVR Scripts & Tricks

Thank you sir!

Latest list of OliveTin-for-Channels features posted here:

Also, I'm thinking about adding an action button to reboot HDHomeRun tuners from a dropdown list. Does that have appeal?

For the "Ping Channels DVR Server" Action, I think I'm going to change it from a ping of the host to a curl of the main Channels DVR webpage.

This seems preferable as it confirms Channels DVR itself is running, rather than simply that the host computer is responding. So unless there's anyone that has a specific use-case for the ping approach, we'll go from a core test of this:

pingDVR=$(ping -q -c 1 -W 2 $channelsHost)

to this:

curlDVR=$(curl --fail --output /dev/null --max-time 5 http://$dvr)

As before, multiple DVRs are supported, as is Tailscale. Same healthchecks.io tie-in, so you'll know immediately (based on your test interval) if the curl fails via e-mail or whatever other integrations you've configured.

1 Like

@bnhf I've been using olive tin for awhile and have not had issues. But now I cannot get generate Twit data or fix thumbnails to work. I tried stopping with an interval 0. Then I try to start with an interval and a healthchecks URL. I get the "success" notification and stdout says exit code zero but the icon never turns green and it seems to not be running. Any ideas?

First thing I'd suggest is to pull the most recent version of :latest -- which I pushed 4 days ago. Make sure you allow yamls and scripts to update (UPDATE_YAMLS=true and UPDATE_SCRIPTS=true)

I just tried TWiT.tv myself, and it's working here. The resulting TWiT.tv guide data file now goes into a folder named host-port_data, now that multiple DVRs are supported.

I forgot to mention I have been pulling "latest" and I do have UPDATE_YAMLS=true and UPDATE_SCRIPTS=true.

Can you post the output from stderr after you try to run the Action? That should give me an idea of what's going on.

Here is stderr:

+ dvr=ical_2_xmltv
++ echo ical_2_xmltv
++ awk -F: '{print $1}'
+ channelsHost=ical_2_xmltv
++ awk -F: '{print $2}'
++ echo ical_2_xmltv
+ channelsPort=
+ backgroundScript=1h
+ firstChar=1
+ runInterval=https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b
+ healthchecksIO=
+ [[ '' == \h\t\t\p\s\:\/\/\h\c\-\p\i\n\g\.\c\o\m\/\y\o\u\r\_\c\u\s\t\o\m\_\u\u\i\d ]]
++ awk '{print $2}'
++ grep '[1]h.* ical_2_xmltv'
++ ps -ef
+ runningScriptPID=
+ [[ -n '' ]]
+ backgroundArguments='ical_2_xmltv https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b '
+ greenIcon='"icons/channels.png"'
+ purpleIcon='"https://community-assets.getchannels.com/original/2X/5/55232547f7e8f243069080b6aec0c71872f0f537.png"'
+ logFile=/config/ical_2_xmltv-_1h_latest.log
+ trap finish EXIT
+ main
+ scriptRun
+ case "$runInterval" in
+ [[ -n '' ]]
+ echo 'Background script initiated, with https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b between runs for ical_2_xmltv'
+ grep -q '(.*) #1h' /config/config.yaml
+ nohup /config/1h.sh ical_2_xmltv https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b
+ [[ 1 == \1 ]]
++ date +%d%b%y_%H:%M
+ sed -i '/#1h title/s/#/(18Nov23_05:25) #/' /config/config.yaml
+ sed -i '/#1h icon/s|img src = .* width|img src = "icons/channels.png" width|' /config/config.yaml
+ sed -i '/#1h interval default/s/default: .* #/default: https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b #/' /config/config.yaml
sed: -e expression #1, char 55: unknown option to `s'
+ [[ -n '' ]]
+ echo 'ical_2_xmltv 1h https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b '
+ runningScripts
+ servers=($CHANNELS_DVR $CHANNELS_DVR_ALTERNATES)
+ for server in "${servers[@]}"
++ echo cjynas:8089
++ awk -F: '{print $1}'
+ serverHost=cjynas
++ echo cjynas:8089
++ awk -F: '{print $2}'
+ serverPort=8089
++ ps -ef
++ grep '[1]h.* cjynas:8089'
++ awk '{print $2}'
+ activeProcess=
+ [[ -n '' ]]
+ exit 0
+ finish
+ echo -e 'foreground.sh is exiting for 1h with exit code 0'
+ cp /config/config.yaml /config/temp.yaml
+ cp /config/temp.yaml /config/config.yaml
+ sleep 1
+ '[' -f /config/ical_2_xmltv-_1h_latest.log ']'
+ cat /config/ical_2_xmltv-_1h_latest.log

Looks like I didn't push the latest scripts I'm using through to the repo. I'll fix that now and let you know when you can try it again. Shouldn't be long...

Give it a try now if you would please... :latest and :test have both been updated, and are the same currently.

EDIT: Hold tight there's still an issue. Not sure how this happened. :frowning:

1 Like

@cyoungers

Could you give it a go now please?

The Delete Recording Log Files Action needs some documentation (it uses the same launch script as the two scripts we've been addressing), specifically on how to set up the volume mounts for multiple DVRs -- but otherwise I think we should be back on track.

1 Like

Well it appears that both twit and fix thumbs are running. I see the icon go green and I see that healthchecks got a ping. However at least with fix thumbnails, it appears that it is not running as my video filenames still have filenames with [] and (). It is not easy for me to figure out if Twit guide data got updated.

Could you post stdout and stderr for both please?

For fix thumbs:

Background script initiated, with 30m between runs for cjynas:8089
Using healthcheck.io pings to https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140 to confirm functionality
Background fix_thumbnails process running for cjynas:8089
foreground.sh is exiting for fix_thumbnails with exit code 0
+ dvr=cjynas:8089
++ echo cjynas:8089
++ awk -F: '{print $1}'
+ channelsHost=cjynas
++ echo cjynas:8089
++ awk -F: '{print $2}'
+ channelsPort=8089
+ backgroundScript=fix_thumbnails
+ firstChar=f
+ runInterval=30m
+ healthchecksIO=https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140
+ [[ https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140 == \h\t\t\p\s\:\/\/\h\c\-\p\i\n\g\.\c\o\m\/\y\o\u\r\_\c\u\s\t\o\m\_\u\u\i\d ]]
++ ps -ef
++ grep '[f]ix_thumbnails.* cjynas:8089'
++ awk '{print $2}'
+ runningScriptPID=
+ [[ -n '' ]]
+ backgroundArguments='cjynas:8089 30m https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140'
+ greenIcon='"icons/channels.png"'
+ purpleIcon='"https://community-assets.getchannels.com/original/2X/5/55232547f7e8f243069080b6aec0c71872f0f537.png"'
+ logFile=/config/cjynas-8089_fix_thumbnails_latest.log
+ trap finish EXIT
+ main
+ scriptRun
+ case "$runInterval" in
+ [[ -n '' ]]
+ echo 'Background script initiated, with 30m between runs for cjynas:8089'
+ grep -q '(.*) #fix_thumbnails' /config/config.yaml
+ nohup /config/fix_thumbnails.sh cjynas:8089 30m https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140
+ [[ 1 == \1 ]]
++ date +%d%b%y_%H:%M
+ sed -i '/#fix_thumbnails title/s/#/(18Nov23_08:20) #/' /config/config.yaml
+ sed -i '/#fix_thumbnails icon/s|img src = .* width|img src = "icons/channels.png" width|' /config/config.yaml
+ sed -i '/#fix_thumbnails interval default/s/default: .* #/default: 30m #/' /config/config.yaml
+ [[ -n https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140 ]]
+ echo 'Using healthcheck.io pings to https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140 to confirm functionality'
+ sed -i '/#fix_thumbnails healthchecks default/s|default: .* #|default: https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140 #|' /config/config.yaml
+ echo 'cjynas:8089 fix_thumbnails 30m https://hc-ping.com/33f47a5b-d148-4819-b391-044712cc6140'
+ runningScripts
+ servers=($CHANNELS_DVR $CHANNELS_DVR_ALTERNATES)
+ for server in "${servers[@]}"
++ awk -F: '{print $1}'
++ echo cjynas:8089
+ serverHost=cjynas
++ echo cjynas:8089
++ awk -F: '{print $2}'
+ serverPort=8089
++ ps -ef
++ grep '[f]ix_thumbnails.* cjynas:8089'
++ awk '{print $2}'
+ activeProcess=829
+ [[ -n 829 ]]
+ echo 'Background fix_thumbnails process running for cjynas:8089'
+ exit 0
+ finish
+ echo -e 'foreground.sh is exiting for fix_thumbnails with exit code 0'
+ cp /config/config.yaml /config/temp.yaml
+ cp /config/temp.yaml /config/config.yaml
+ sleep 1
+ '[' -f /config/cjynas-8089_fix_thumbnails_latest.log ']'
+ cat /config/cjynas-8089_fix_thumbnails_latest.log

For Twit:

Background script initiated, with 2h between runs for cjynas:8089
Using healthcheck.io pings to https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b to confirm functionality
Downloading latest iCal data for cjynas:8089...
Background ical_2_xmltv process running for cjynas:8089
foreground.sh is exiting for ical_2_xmltv with exit code 0
++ echo cjynas:8089
++ awk -F: '{print $1}'
+ channelsHost=cjynas
++ echo cjynas:8089
++ awk -F: '{print $2}'
+ channelsPort=8089
+ backgroundScript=ical_2_xmltv
+ firstChar=i
+ runInterval=2h
+ healthchecksIO=https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b
+ [[ https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b == \h\t\t\p\s\:\/\/\h\c\-\p\i\n\g\.\c\o\m\/\y\o\u\r\_\c\u\s\t\o\m\_\u\u\i\d ]]
++ ps -ef
++ grep '[i]cal_2_xmltv.* cjynas:8089'
++ awk '{print $2}'
+ runningScriptPID=
+ [[ -n '' ]]
+ backgroundArguments='cjynas:8089 2h https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b'
+ greenIcon='"icons/channels.png"'
+ purpleIcon='"https://community-assets.getchannels.com/original/2X/5/55232547f7e8f243069080b6aec0c71872f0f537.png"'
+ logFile=/config/cjynas-8089_ical_2_xmltv_latest.log
+ trap finish EXIT
+ main
+ scriptRun
+ case "$runInterval" in
+ [[ -n '' ]]
+ echo 'Background script initiated, with 2h between runs for cjynas:8089'
+ grep -q '(.*) #ical_2_xmltv' /config/config.yaml
+ nohup /config/ical_2_xmltv.sh cjynas:8089 2h https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b
+ [[ 1 == \1 ]]
++ date +%d%b%y_%H:%M
+ sed -i '/#ical_2_xmltv title/s/#/(18Nov23_08:20) #/' /config/config.yaml
+ sed -i '/#ical_2_xmltv icon/s|img src = .* width|img src = "icons/channels.png" width|' /config/config.yaml
+ sed -i '/#ical_2_xmltv interval default/s/default: .* #/default: 2h #/' /config/config.yaml
+ [[ -n https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b ]]
+ echo 'Using healthcheck.io pings to https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b to confirm functionality'
+ sed -i '/#ical_2_xmltv healthchecks default/s|default: .* #|default: https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b #|' /config/config.yaml
+ echo 'cjynas:8089 ical_2_xmltv 2h https://hc-ping.com/af4d7b89-7446-46dc-9d56-52e653f6c34b'
+ runningScripts
+ servers=($CHANNELS_DVR $CHANNELS_DVR_ALTERNATES)
+ for server in "${servers[@]}"
++ echo cjynas:8089
++ awk -F: '{print $1}'
+ serverHost=cjynas
++ awk -F: '{print $2}'
++ echo cjynas:8089
+ serverPort=8089
++ ps -ef
++ grep '[i]cal_2_xmltv.* cjynas:8089'
++ awk '{print $2}'
+ activeProcess=776
+ [[ -n 776 ]]
+ echo 'Background ical_2_xmltv process running for cjynas:8089'
+ exit 0
+ finish
+ echo -e 'foreground.sh is exiting for ical_2_xmltv with exit code 0'
+ cp /config/config.yaml /config/temp.yaml
+ cp /config/temp.yaml /config/config.yaml
+ sleep 1
+ '[' -f /config/cjynas-8089_ical_2_xmltv_latest.log ']'
+ cat /config/cjynas-8089_ical_2_xmltv_latest.log

@cyoungers

Could you exec into the OliveTin container and ping cjynas please? Just want to be sure it resolves.

Yup, the ping to cjynas did not resolve. While I was having issues with the periodic tasks I tried the tailscale magic dns and set my server to cjynas. I should have not changed configuration while trying to fix the initial problem. I changed back to using the ip number directly and now the fix thumbs is working! Thanks for the help. I'll have to investigate why tailscale is not working for me in olivetin.

I'm using Tailscale with MagicDNS myself, and at minimum you'll want to change your domain name in the docker compose to your tailnet.

There are a couple of other possible tweaks, depending on how you're running Tailscale on the Docker host.

1 Like

I'm running tailscale on my Synology NAS installed from Package Center. I am setting the TAILNET env variable to tail6d9e.ts.net which I got from the tailscale DNS configuration page. Then I set CHANNELS_DVR = cjynas:8089 in env variables. For whatever reason that did not work. I'm happy with it working without the tailscale stuff so don't spend any time investigating this unless you see something obvious to try. Thanks again.

Nothing obvious, but just a couple of notes for when/if you want to look into this a bit further:

Make sure that your Docker host /etc/resolv.conf looks like this:

root@htpc6:~# cat /etc/resolv.conf
# resolv.conf(5) file generated by tailscale
# For more info, see https://tailscale.com/s/resolvconf-overwrite
# DO NOT EDIT THIS FILE BY HAND -- CHANGES WILL BE OVERWRITTEN

nameserver 100.100.100.100
search tailxxxxx.ts.net

This file can be overwritten in Linux several ways, including DHCP lease renewal. Best bet is for your Tailscaled Docker host to use a static IP.

In the case of OliveTIn, be sure your docker compose looks similar to this:

version: '3.9'
services:
  olivetin:
    image: bnhf/olivetin:${TAG} # Add the tag like latest or test to the environment variables below
    container_name: olivetin
    dns_search: ${TAILNET} # For Tailscale users using Magic DNS, add your Tailnet (tailxxxxx.ts.net) to use hostnames for remote nodes
    ports:
      - 1337:1337
    environment:
      - CHANNELS_DVR=${CHANNELS_DVR} # Add your Channels DVR server in the form hostname:port or ip:port
      - CHANNELS_DVR_ALTERNATES=${CHANNELS_DVR_ALTERNATES} # Space separated list of alternate Channels DVR servers to choose from in the form hostname:port or ip:port
      - CHANNELS_CLIENTS=${CHANNELS_CLIENTS} # Space separated list of Channels DVR clients you'd like notifications sent to in the form hostname or IP
      - UPDATE_YAMLS=${UPDATE_YAMLS} # Set this to true to update config.yaml
      - UPDATE_SCRIPTS=${UPDATE_SCRIPTS} # Set this to true to update all included scripts
      - TZ=${TZ} # Add your local timezone in standard linux format. E.G. US/Eastern, US/Central, US/Mountain, US/Pacific, etc
    volumes:
      - ${HOST_DIR}/olivetin:/config # Add the parent directory on your Docker you'd like to use
      - ${DVR_SHARE}:/mnt/${CHANNELS_DVR} # This can either be a Docker volume or a host directory that's connected via Samba or NFS to your Channels DVR network share.
    restart: unless-stopped
#volumes: # use this section if you've setup a docker volume named channels-dvr, with CIFS or NFS, to bind to /mnt/dvr inside the container
  #channels-dvr:
    #external: true

My NAS has a static ip. I'm using the exact same compose file. My resolve.conf looks different than yours.

bash-5.2# cat /etc/resolv.conf
search tail6d9e.ts.net
nameserver 127.0.0.11
options ndots:0