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

OK, if it matters, I had removed the :latest build container and image and emptied the /config mapped directory before installing this :test version. So it's a fresh install using the same environment variables I was using before.

docker pull bnhf/olivetin:test
docker run \
 -d \
 --name=olivetin \
 --network=cdvr-net \
 -p 192.168.1.3:1337:1337/tcp \
 --restart=unless-stopped \
 -v /volume1/docker/olivetin:/config \
 -e "TZ=America/Los_Angeles" \
 -e "UPDATE_SCRIPTS=true" \
 -e "UPDATE_YAMLS=true" \
 -e "CHANNELS_DVR=192.168.1.4:8489" \
 -e "CHANNELS_DVR_ALTERNATES=192.168.1.4:8389 192.168.1.4:8089 192.168.1.4:8189 192.168.1.4:8289" \
 bnhf/olivetin:test

@chDVRuser :test build should be good-to-go now. I pulled it here, and seemed fine in some quick testing. I'll work on adding additional log files to actions that could benefit from them next.

Here's my current recommended docker-compose for this project:

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/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

And, sample environment variables:

TAG=latest
TAILNET=tailxxxxx.ts.net
CHANNELS_DVR=media-server6:8089
CHANNELS_DVR_ALTERNATES=utheater-pc:8089
CHANNELS_CLIENTS=appletv4k firestick-master
UPDATE_YAMLS=true
UPDATE_SCRIPTS=true
TZ=US/Mountain
HOST_DIR=/data
DVR_SHARE=/mnt/dvr

:test build working here now.
Tried a couple things and enabled channel change notifications again.

New :test build available, with a couple of new features to validate:

  • Ping Channels DVR Server - I've been using this for a few days myself, and I really like it. This allows one to setup a scheduled ping of one or more servers -- with or without a healthchecks.io tie-in. If you're an Organizr user, there's a homepage integration for healthchecks.io:

And the second change (as requested by @chDVRuser) is the addition of:

  • Support for use of a saved file with the "Generate Filtered Channels DVR Log" Action. Save a file in the /config directory with a .grep extension, and then reference it as file://your_saved_filter.grep in the filter field. NOTE: Any special characters in the saved grep search file will be escaped for you!

BTW, healthchecks.io supports lots of different integrations, so if you want push notifications on your phone instead of (or in addition to) e-mails you can set that up through healthchecks.io:

2 Likes

Thanks.
Working great.
Although it's easier to open the file with my grep parameters, copy & paste it than it is to key in
file://recordings.grep or file://scheduler.grep

Well shoot, sounds like we missed the mark then.

EDIT: Looking at the script, it appears the file:// part can be used or not -- the .grep at the end of the filename is the important part.

Much better!
It does work by entering the filename scheduler.grep

Remove Comskip Markers from a Recording timed out and failed.
Ran my windows command script on the file and it worked.

Here's an earlier run on a different recording that worked.

We need to increase the timeout from the default then. I'm thinking maybe 20 seconds? Depends on the max size of recordings that are being processed I'd imagine. If you could add a timeout to this section of the config.yaml, and if it seems adequate, I'll change it permanently. Make it the last line of the section, and be sure it lines up in the same column as title, icon, shell and arguments:

  - title: Remove Comskip Markers from a Recording
    icon: '<img src = "https://community-assets.getchannels.com/original/2X/5/55232547f7e8f243069080b6aec0c71872f0f537.png" width = "48px"/>'
    shell: /config/marknocommercials.sh "{{ dvr }}" {{ file_id }}
    arguments:
      - name: dvr
        description: Channels DVR server to use.
        choices:
          - title: media-server6:8089
            value: media-server6:8089
          - title: utheater-pc:8089
            value: utheater-pc:8089
          #lastchoice dvr default
      - name: file_id
        type: int
        description: The File ID can be found using Library - TV Shows / Movies - <show name> - <episode name> - Options - View Details - File ID.
    timeout: 20

That will most likely fix it, but it will take a week or so to be sure since I only do a few of these per week.

If the timeout is for the action, then since this one issues 3 curl commands and each response is the whole file json, it might be exceeding the default timeout.

What is the default timeout value?

I read somewhere that it's 3 seconds -- though my sense is that it's actually a second or two more than that.

I would say make the change permamnent.
I can't see it taking more than 20 seconds.
The thing that takes the longest is regenerating the video index, but the curl command returns as soon as that starts and doesn't wait for it to complete, as evidenced by the DVR log.

2023/11/04 21:28:15.724242 [IDX] Generating video index for file-2517: TV/Planet Earth III/Planet Earth III S01E01 Coasts 2023-11-04-1700.mpg
2023/11/04 21:28:32.765977 [IDX] Finished video index generation for file-2517 in 17s

Using the time command you can see how long each curl command took.

~$ time curl -XPOST "http://192.168.1.4:8089/dvr/files/2517/comskip/edit?source=local" --data-raw "[]"
{"ID":"2517","JobID":"1699142400-172","RuleID":"172","GroupID":"25873335","Path":"TV/Planet Earth III/Planet Earth III S01E01 Coasts 2023-11-04-1700.mpg","CreatedAt":1699142400,"FileSize":1651563832,"Duration":2980.410767,"Completed":true,"Processed":true,"Airing":{"Source":"tms","Channel":"6087","OriginalDate":"2023-10-22","Time":1699142400,"Duration":4260,"Title":"Planet Earth III","EpisodeTitle":"Coasts","Summary":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts.","FullSummary":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts, where animals fight for survival amid constant change; there are some unexpected residents on Namibia's Skeleton Coast.","Image":"https://tmsimg.fancybits.co/assets/p25873335_b_h9_aa.jpg?w=720\u0026h=540","Categories":["Episode","Series"],"Genres":["Nature","Documentary"],"Tags":["Series Premiere","New","HD","Stereo","CC"],"SeriesID":"25873335","ProgramID":"EP049004200001","SeasonNumber":1,"EpisodeNumber":1,"Cast":["David Attenborough"],"ReleaseYear":2023,"Raw":{"startTime":"2023-11-05T00:00Z","endTime":"2023-11-05T01:11Z","duration":71,"channels":["6087"],"stationId":"64492","qualifiers":["CC","HD 1080i","HDTV","New","Series Premiere"],"program":{"tmsId":"EP049004200001","rootId":"25873369","seriesId":"25873335","entityType":"Episode","subType":"Series","title":"Planet Earth III","titleLang":"en-GB","episodeTitle":"Coasts","episodeNum":1,"seasonNum":1,"releaseYear":2023,"releaseDate":"2023-10-22","origAirDate":"2023-10-22","descriptionLang":"en","shortDescription":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts.","longDescription":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts, where animals fight for survival amid constant change; there are some unexpected residents on Namibia's Skeleton Coast.","topCast":null,"genres":["Nature","Documentary"],"preferredImage":{"uri":"https://tmsimg.fancybits.co/assets/p25873335_b_h9_aa.jpg?w=720\u0026h=540","height":"540","width":"720","primary":"true","category":"Banner-L1","text":"yes","tier":"Series"}}}},"ChannelNumber":"6087","DeviceID":"TVE-Comcast_SSO","UpdatedAt":1699209829870,"Version":6,"JobTime":1699142400,"JobDuration":4380,"HighestPTS":394808760,"BufferStats":{"BufferPct":{"Initial":0,"Last":0,"Min":0,"Max":0,"Sum":0,"GoodCount":0,"BadCount":2185},"BufferDrop":{"Initial":0,"Last":0,"Min":0,"Max":0,"Sum":0,"GoodCount":2185,"BadCount":0}},"CommercialsAligned":true,"CommercialsEdited":true,"CommercialDetectSource":"local","PlaybackTime":181,"PlayedAt":1699142825594}
real    0m0.529s
user    0m0.010s
sys     0m0.005s
~$ time curl -XPUT "http://192.168.1.4:8089/dvr/files/2517/reprocess"
{"ID":"2517","JobID":"1699142400-172","RuleID":"172","GroupID":"25873335","Path":"TV/Planet Earth III/Planet Earth III S01E01 Coasts 2023-11-04-1700.mpg","CreatedAt":1699142400,"FileSize":1651563832,"Duration":2980.410767,"Completed":true,"Processed":true,"Airing":{"Source":"tms","Channel":"6087","OriginalDate":"2023-10-22","Time":1699142400,"Duration":4260,"Title":"Planet Earth III","EpisodeTitle":"Coasts","Summary":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts.","FullSummary":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts, where animals fight for survival amid constant change; there are some unexpected residents on Namibia's Skeleton Coast.","Image":"https://tmsimg.fancybits.co/assets/p25873335_b_h9_aa.jpg?w=720\u0026h=540","Categories":["Episode","Series"],"Genres":["Nature","Documentary"],"Tags":["Series Premiere","New","HD","Stereo","CC"],"SeriesID":"25873335","ProgramID":"EP049004200001","SeasonNumber":1,"EpisodeNumber":1,"Cast":["David Attenborough"],"ReleaseYear":2023,"Raw":{"startTime":"2023-11-05T00:00Z","endTime":"2023-11-05T01:11Z","duration":71,"channels":["6087"],"stationId":"64492","qualifiers":["CC","HD 1080i","HDTV","New","Series Premiere"],"program":{"tmsId":"EP049004200001","rootId":"25873369","seriesId":"25873335","entityType":"Episode","subType":"Series","title":"Planet Earth III","titleLang":"en-GB","episodeTitle":"Coasts","episodeNum":1,"seasonNum":1,"releaseYear":2023,"releaseDate":"2023-10-22","origAirDate":"2023-10-22","descriptionLang":"en","shortDescription":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts.","longDescription":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts, where animals fight for survival amid constant change; there are some unexpected residents on Namibia's Skeleton Coast.","topCast":null,"genres":["Nature","Documentary"],"preferredImage":{"uri":"https://tmsimg.fancybits.co/assets/p25873335_b_h9_aa.jpg?w=720\u0026h=540","height":"540","width":"720","primary":"true","category":"Banner-L1","text":"yes","tier":"Series"}}}},"ChannelNumber":"6087","DeviceID":"TVE-Comcast_SSO","UpdatedAt":1699209830566,"Version":6,"JobTime":1699142400,"JobDuration":4380,"HighestPTS":394808760,"BufferStats":{"BufferPct":{"Initial":0,"Last":0,"Min":0,"Max":0,"Sum":0,"GoodCount":0,"BadCount":2185},"BufferDrop":{"Initial":0,"Last":0,"Min":0,"Max":0,"Sum":0,"GoodCount":2185,"BadCount":0}},"CommercialsAligned":true,"CommercialsEdited":true,"CommercialDetectSource":"local","PlaybackTime":181,"PlayedAt":1699142825594}
real    0m0.658s
user    0m0.012s
sys     0m0.004s
~$ time curl -XPUT "http://192.168.1.4:8089/dvr/files/2517/m3u8"
{"ID":"2517","JobID":"1699142400-172","RuleID":"172","GroupID":"25873335","Path":"TV/Planet Earth III/Planet Earth III S01E01 Coasts 2023-11-04-1700.mpg","CreatedAt":1699142400,"FileSize":1651563832,"Duration":2980.410767,"Completed":true,"Processed":true,"Airing":{"Source":"tms","Channel":"6087","OriginalDate":"2023-10-22","Time":1699142400,"Duration":4260,"Title":"Planet Earth III","EpisodeTitle":"Coasts","Summary":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts.","FullSummary":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts, where animals fight for survival amid constant change; there are some unexpected residents on Namibia's Skeleton Coast.","Image":"https://tmsimg.fancybits.co/assets/p25873335_b_h9_aa.jpg?w=720\u0026h=540","Categories":["Episode","Series"],"Genres":["Nature","Documentary"],"Tags":["Series Premiere","New","HD","Stereo","CC"],"SeriesID":"25873335","ProgramID":"EP049004200001","SeasonNumber":1,"EpisodeNumber":1,"Cast":["David Attenborough"],"ReleaseYear":2023,"Raw":{"startTime":"2023-11-05T00:00Z","endTime":"2023-11-05T01:11Z","duration":71,"channels":["6087"],"stationId":"64492","qualifiers":["CC","HD 1080i","HDTV","New","Series Premiere"],"program":{"tmsId":"EP049004200001","rootId":"25873369","seriesId":"25873335","entityType":"Episode","subType":"Series","title":"Planet Earth III","titleLang":"en-GB","episodeTitle":"Coasts","episodeNum":1,"seasonNum":1,"releaseYear":2023,"releaseDate":"2023-10-22","origAirDate":"2023-10-22","descriptionLang":"en","shortDescription":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts.","longDescription":"Sir David Attenborough explores the dangerous frontiers created by the world's coasts, where animals fight for survival amid constant change; there are some unexpected residents on Namibia's Skeleton Coast.","topCast":null,"genres":["Nature","Documentary"],"preferredImage":{"uri":"https://tmsimg.fancybits.co/assets/p25873335_b_h9_aa.jpg?w=720\u0026h=540","height":"540","width":"720","primary":"true","category":"Banner-L1","text":"yes","tier":"Series"}}}},"ChannelNumber":"6087","DeviceID":"TVE-Comcast_SSO","UpdatedAt":1699209830566,"Version":6,"JobTime":1699142400,"JobDuration":4380,"HighestPTS":394808760,"BufferStats":{"BufferPct":{"Initial":0,"Last":0,"Min":0,"Max":0,"Sum":0,"GoodCount":0,"BadCount":2185},"BufferDrop":{"Initial":0,"Last":0,"Min":0,"Max":0,"Sum":0,"GoodCount":2185,"BadCount":0}},"CommercialsAligned":true,"CommercialsEdited":true,"CommercialDetectSource":"local","PlaybackTime":181,"PlayedAt":1699142825594}
real    0m0.019s
user    0m0.011s
sys     0m0.004s

And time marknocommercials.sh should show how long the shell script took to execute

Makes sense. 20 seconds it is. I don't think there's much downside to allowing plenty of margin in this case.

RE: Add manual recording.

Is there any way to tag these as Movie so they get added as such instead of TV?

Never tried before, but just made one.
I think the key is using Airing.MovieID and no Airing.SeriesID but will have to test more to be sure.
This worked as an experiment

{
  "Name": "Elf (2003)",
  "Time": 1699233480,
  "Duration": 60,
  "Channels": ["6034"],
  "Airing": {
    "Source": "manual",
    "Channel": "6034",
    "OriginalDate": "2003-11-07",
    "Time": 1699233480,
    "Duration": 60,
    "Title": "Elf (2003)",
    "Summary": "A man (Will Ferrell) leaves Santa's workshop to search for his family.",
    "FullSummary": "Buddy (Will Ferrell) was accidentally transported to the North Pole as a toddler and raised to adulthood among Santa's elves. Unable to shake the feeling that he doesn't fit in, the adult Buddy travels to New York, in full elf uniform, in search of his real father. As it happens, this is Walter Hobbs (James Caan), a cynical businessman. After a DNA test proves this, Walter reluctantly attempts to start a relationship with the childlike Buddy with increasingly chaotic results.",
    "Image": "https://tmsimg.fancybits.co/assets/p32828_v_v12_at.jpg?w=480&h=720",
    "Categories": ["Movie","Feature Film"],
    "Genres": ["Children","Holiday","Comedy","Fantasy"],
    "Tags": ["CC","DVS","HD 1080i","HDTV"],
    "MovieID": "manual/6034",
    "Directors": ["Jon Favreau"],
    "Cast": ["Will Ferrell","James Caan","Bob Newhart"],
    "QualityRating": 3,
    "ReleaseYear": 2003,
    "ContentRating": "PG"
  }
}


1 Like

Just have to provide Airing.Categories: ["Movie"]

{
  "Name": "Elf (2003)  Movie Categories at 1752",
  "Time": 1699235520,
  "Duration": 60,
  "Channels": ["6034"],
  "Airing": {
    "Source": "manual",
    "Channel": "6034",
    "Time": 1699235520,
    "Duration": 60,
    "Title": "Elf (2003)  Movie Categories at 1752",
    "Categories": ["Movie"]
  }
}

I don't see a Categories option in OliveTin.

OliveTin for Channels would have to be modified.

1 Like

OliveTin updated to support manual recording of Movies. It's now required to select the recording "type" in the bottom field -- TV Series or Movie:

Pull the updated bnhf/olivetin, :latest or :test tag -- they're both the same at present.

1 Like