List Passes with Channel number restrictions

While moving sources and Passes from one server to another, I wrote a crude curl/jq script that outputs to two files;

  1. All Channels DVR Passes
  2. Only Passes having a Channel restriction

In a Pass you can select the following for Channel

  • EQUALS (==)
  • NOT EQUAL (!=)
  • LESS THAN (<)
  • GREATER THAN (>)
  • CONTAINS
  • EXCLUDES

Since I moved Sources, the Channel numbers changed (and I specifically used START Channel# on some after moving them).

I used the script output to adjust the Pass Channel number restrictions on the new Passes (to adjust or eliminate the specific Channel number restrictions on the new Passes).

You could use the outputs of the script to identify which Passes have Channel number restrictions (for whatever reason) and to get a list of all your Passes.

@bnhf Might be useful as an OliveTin for Channels action (with modification, of course, my six servers are all at IP 192.168.1.4 and only differ by Port#)

Simple Linux Shell Script

curl -s http://192.168.1.4:8089/dvr/rules | jq --raw-output "sort_by(.Name) | .[] | \"8089 \(.Name) PAD(\(.PaddingStart),\(.PaddingEnd)) EQ-\(.EQ) NE-\(.NE) GT-\(.GT) LT-\(.LT) IN-\(.IN) NI-\(.NI)\"" | tee    /volume1/arkives/_Passes.txt | grep '"Channel":'  > /volume1/arkives/_Passes_with_Channel_restriction.txt
curl -s http://192.168.1.4:8189/dvr/rules | jq --raw-output "sort_by(.Name) | .[] | \"8189 \(.Name) PAD(\(.PaddingStart),\(.PaddingEnd)) EQ-\(.EQ) NE-\(.NE) GT-\(.GT) LT-\(.LT) IN-\(.IN) NI-\(.NI)\"" | tee -a /volume1/arkives/_Passes.txt | grep '"Channel":' >> /volume1/arkives/_Passes_with_Channel_restriction.txt
curl -s http://192.168.1.4:8190/dvr/rules | jq --raw-output "sort_by(.Name) | .[] | \"8190 \(.Name) PAD(\(.PaddingStart),\(.PaddingEnd)) EQ-\(.EQ) NE-\(.NE) GT-\(.GT) LT-\(.LT) IN-\(.IN) NI-\(.NI)\"" | tee -a /volume1/arkives/_Passes.txt | grep '"Channel":' >> /volume1/arkives/_Passes_with_Channel_restriction.txt
curl -s http://192.168.1.4:8289/dvr/rules | jq --raw-output "sort_by(.Name) | .[] | \"8289 \(.Name) PAD(\(.PaddingStart),\(.PaddingEnd)) EQ-\(.EQ) NE-\(.NE) GT-\(.GT) LT-\(.LT) IN-\(.IN) NI-\(.NI)\"" | tee -a /volume1/arkives/_Passes.txt | grep '"Channel":' >> /volume1/arkives/_Passes_with_Channel_restriction.txt
curl -s http://192.168.1.4:8389/dvr/rules | jq --raw-output "sort_by(.Name) | .[] | \"8389 \(.Name) PAD(\(.PaddingStart),\(.PaddingEnd)) EQ-\(.EQ) NE-\(.NE) GT-\(.GT) LT-\(.LT) IN-\(.IN) NI-\(.NI)\"" | tee -a /volume1/arkives/_Passes.txt | grep '"Channel":' >> /volume1/arkives/_Passes_with_Channel_restriction.txt
curl -s http://192.168.1.4:8489/dvr/rules | jq --raw-output "sort_by(.Name) | .[] | \"8489 \(.Name) PAD(\(.PaddingStart),\(.PaddingEnd)) EQ-\(.EQ) NE-\(.NE) GT-\(.GT) LT-\(.LT) IN-\(.IN) NI-\(.NI)\"" | tee -a /volume1/arkives/_Passes.txt | grep '"Channel":' >> /volume1/arkives/_Passes_with_Channel_restriction.txt

Example Output

8189 America's Test Kitchen-PBS PAD(0,0) EQ-{"Channel":"706","SeriesID":"329265"} NE-null GT-null LT-null IN-null NI-null
8489 Descending sid-9083998 13 part Documentary-x2232Samsung PAD(30,60) EQ-{} NE-null GT-null LT-null IN-{"Title":"Descending"} NI-{"Channel":"2232"}

EDIT: Changed grep statement and added Padding

A couple thoughts. This was a quick and dirty script for my purposes.

  • Might want to modify the grep Channel command in case Channel is too broad a search.
  • Listing all Passes could be moved to another Action that includes other Pass(rules) fields.