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

Figured out that it didn’t like this link that I put into the image field.

https://www.wwe.com/f/styles/wwe_16_9_xl_r/public/all/2023/11/20231121_SS_WG_Men's_Match_FC_Day_Date--6f60e726b0e8230450fe9fde1eef6b1b.jpg

I ended up finding another and it worked.

https://www.wrestlezone.com/wp-content/uploads/sites/8/2022/09/wwe-survivor-series-war-games-2022.jpg

1 Like

I bet it's the apostrophe in "Men's" in the link -- and I'll fix that for the next build. Thanks for closing the loop on this.

Saw the same behavior using VS Code earlier today. It’s a bit of an edge use case, but I’ll see if there’s anything I can tweak to sort it out.

Ultimately writing the output to a file in the Python script, rather than redirecting console output might be the best fix. I’ll let you know if changing anything in the foreground bash script looks promising.

What worked for me is changing the output redirect > to an append >> in channels_dvr_monitor_channels.sh

nohup python3 -u /config/$foregroundScript.py -i $channelsHost -p $channelsPort -f $frequency $optionalArguments >> /config/"$channelsHost"-"$channelsPort"_monitor_channels.log 2>&1 &

That also has the advantage of preserving the log file if you change parameters or restart the container.

Excellent. I'll make that change in the next build.

I'm working on an "M3U generator" of sorts for Channels DVR using OliveTin. The idea is to both create an M3U using a Channels DVR as the source and curl the results all in one operation. I'd like to get some input on anything I should add to this, but here's what I've done so far:

Are there other options that should be included?

EDIT: Added true/false field for "abr" (Adaptive Bitrate), and "duration" for generating matching optional URL for XML guide data spanning x seconds.

2 Likes

Cool stuff. :+1:

I think what would make it more awesome is if you could display on the screen the list of channels from the source and give the option to the user to change the channel numbers.
Then save it as another source.

Just an idea. :grinning:

Would this mainly be for those using this M3U in non-Channels DVR scenarios? If so, I could probably add some sort of offset option -- e.g. add 10000 to every existing channel number.

If you're using one Channels DVR as a source for another, the option to ignore existing channel numbers and re-assign to another number range is already present in the Custom Channels dialog right?

New OliveTin-for-Channels :test tag build pushed that includes the M3U generator described a few posts back:

The M3U can be seen in stdout, but is also output in ready-to-use form in /config/data. If desired you can host the data directory using the static-file-server container. This gives you a URL you can use on your LAN or Tailnet, and would allow for hosting an edited version of the m3u:

version: '3.9'
services:
  static-file-server:
    image: halverneus/static-file-server:${TAG}
    container_name: static-file-server
    dns_search: ${DOMAIN} # This can be your local or tailnet domain name
    ports:
      - 8080:8080 # Change the value to the left of the colon if 8080 is in use on your system
    environment:
      - FOLDER=${FOLDER} # The name of the folder in the static-file-server container you'd like to host. (usually /web)
    volumes:
      - ${HOST_DIR}/olivetin/data:${FOLDER}
    restart: unless-stopped

Example environment variables:

TAG=latest
DOMAIN=localdomain
FOLDER=/web
HOST_DIR=/data 

In this example, the M3U would be available at http://[olivetin]:8080/[dvr]-[port].m3u

@chDVRuser, the change we discussed above is available via the :test tag build I just pushed. Check it out when you have a chance. Use of an interval of 0 will both kill the desired active process, and also delete the log file. Other than that, the log for should now be perpetual.

Latest :test tag build includes this change too. The "ping" is now a curl to confirm Channels DVR is running:

1 Like

Hey @bnhf, how does the Fix Thumbnail script determine which video groups to run the fix thumbnail script on? I created a new folder with videos and added them to the videos library. The videos show up in the library but when I run the olivetin fix thumbnails script it does not identify the new video folder. So the filenames and thumbnail do not get tweaked.

I can use the API & Feed Explorer in the web interface see the video_group_id for this new video group. The script does see other video groups just fine but for some reason not this one.

It curls the endpoint:

curl http://$dvr/api/v1/video_groups

then extracts the IDs:

echo "$videoGroups" | jq -r '.[] | .id'

and runs the Ruby script on each ID.

Are there any clues in stderr?

Weird. Running those commands I get this for video groups.


But when I run the script it gets this:

Here is stderr:

Any ideas?

Could you edit fix_thumbnails.sh and add the echo "$ids" >> "$logFile" shown below, and then re-run the Action? I'd like to see if all the video groups are getting captured:

#!/bin/bash

dvr=$1
channelsHost=$(echo $dvr | awk -F: '{print $1}')
channelsPort=$(echo $dvr | awk -F: '{print $2}')
runInterval=$2
healthchecksIO=$3
logFile=/config/"$channelsHost"-"$channelsPort"_fix_thumbnails_latest.log

while true; do
  [[ $runInterval == "once" ]] && echo "Retrieving YouTube video_groups for $dvr..." >> "$logFile"
  videoGroups=$(curl http://$dvr/api/v1/video_groups)

  ids=$(echo "$videoGroups" | jq -r '.[] | .id')
  echo "$ids" >> "$logFile"
  
  for id in $ids; do
    echo "Fixing thumbnails for video_group $id" >> "$logFile"
    ruby /config/fix_thumbnails.rb "$id"
  done

  [[ $runInterval == "once" ]] && echo "done." >> "$logFile" \
  && exit 0

  [[ -n $healthchecksIO ]] \
  && curl -m 10 --retry 5 $healthchecksIO

  [[ $runInterval != "once" ]] \
  && sleep $runInterval  
done
1 Like

Ok. Here is the stdout. BTW the video group that I added begins with f308b7...

My guess is that the array of video groups should be space separated rather than linefeed separated (which is actually what I originally intended). So to fix that, change/add these three lines:

videoGroups=$(echo "$videoGroups" | jq -r '.[] | .id' | tr '\n' ' ')
ids=(${videoGroups})
for id in "${ids[@]}"; do

as shown below:

#!/bin/bash

dvr=$1
channelsHost=$(echo $dvr | awk -F: '{print $1}')
channelsPort=$(echo $dvr | awk -F: '{print $2}')
runInterval=$2
healthchecksIO=$3
logFile=/config/"$channelsHost"-"$channelsPort"_fix_thumbnails_latest.log

while true; do
  [[ $runInterval == "once" ]] && echo "Retrieving YouTube video_groups for $dvr..." >> "$logFile"
  videoGroups=$(curl http://$dvr/api/v1/video_groups)
  videoGroups=$(echo "$videoGroups" | jq -r '.[] | .id' | tr '\n' ' ')

  ids=(${videoGroups})  
  for id in "${ids[@]}"; do
    echo "Fixing thumbnails for video_group $id" >> "$logFile"
    ruby /config/fix_thumbnails.rb "$id"
  done

  [[ $runInterval == "once" ]] && echo "done." >> "$logFile" \
  && exit 0

  [[ -n $healthchecksIO ]] \
  && curl -m 10 --retry 5 $healthchecksIO

  [[ $runInterval != "once" ]] \
  && sleep $runInterval  
done

I only have three groups to work with, so your larger data set is the better test. Hopefully, this will do the trick. Use an interval of 0 between runs if you need to clean out the logs.

1 Like

Are you sure this :test build is good? It errors out for me and I have to remake the entire stack just to get :latest to work again.

It's the one I'm using, but I don't update scripts and yamls, so let me point it at a new data directory and double check it. I'll get back to you in a bit...

@Rice My fault. Fixed, and tested, now though. Apologies. New :test build live.

1 Like