Since I do this frequently enough I created a script that prompts for a channel name/callsign search phrase, searches Channels DVR for it and saves the sorted tabulated results to a text file named for the search phrase.
Since I occasionally see users asking for a station id, figured I would share the script. Enjoy.
It's a Windows command script I named _Get_stationId.cmd
It should work for anyone using windows that has curl and jq in their path.
If they aren't in your path you could edit this command script to include the paths to them.
i.e. "C:\Path To My Curl Executable\curl" OR "C:\Path To My Jq Executable\jq"
The only other thing you may need to edit is the IP and Port of your Channels DVR Server, if it's not at 192.168.1.4:8089.
These are all on line 26 that starts with curl http://192.168.1.4:8089/
_Get_stationId.cmd
@ECHO OFF
setlocal enabledelayedexpansion
REM we want to pass a double quoted search string to the Channels DVR API endpoint to act as a search phrase to match
REM /tms/stations/"NFL Sunday Ticket"
REM otherwise it searches by ORing the search words
REM /tms/stations/NFL Sunday Ticket
REM so we add url encoded double quotes (%22) around the Station Name search string entered by the user
REM curl doesn't parse a "double quoted string" as a phrase, it breaks it up on spaces, so URL encode spaces (%20) in the Station Name search string
REM in a windows command file the percent sign % must be escaped by preceding it with another percent sign %% otherwise it's interpreted as a parameter passed on the command line
SET "fndthis= "
SET rplwith=%%20
:GETSEARCHSTR
SET _SEARCHSTR=
SET _OUTFNAME=
REM SET /P prompts user for input and assigns it to the variable _SEARCHSTR
SET /P _SEARCHSTR=Enter the Station Name to search for, or press ENTER to cancel:
REM ECHO You entered "%_SEARCHSTR%"
REM If user pressed ENTER (no search) then EXIT
IF "%_SEARCHSTR%."=="." GOTO FINISHED
REM Save jq tabulated search results in a text file named for the search phrase
SET _OUTFNAME=_stationId_%_SEARCHSTR%.txt
ECHO Searching for Station Names matching "%_SEARCHSTR%"
REM Double quote the search string so Channels DVR treats it as a phrase to match and url encode the double quotes and spaces
SET _SEARCHSTR=%%22!_SEARCHSTR:%fndthis%=%rplwith%!%%22
REM replace 192.168.1.4:8089 in the curl command below with the IP and Port of your Channels DVR Server if different
curl http://192.168.1.4:8089/tms/stations/%_SEARCHSTR% | jq --raw-output "sort_by(.type, .name) | .[] | \"type: \(.type), name: \(.name), callSign: \(.callSign), stationId: \(.stationId), logo: \(.preferredImage.uri)\"" > "%_OUTFNAME%"
ECHO Saved results to file "%_OUTFNAME%"
ECHO.
GOTO GETSEARCHSTR
:FINISHED
EXIT
Example run
Enter the Station Name to search for, or press ENTER to cancel: nfl sunday ticket
Searching for Station Names matching "nfl sunday ticket"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 18490 0 18490 0 0 319k 0 --:--:-- --:--:-- --:--:-- 322k
Saved results to file "_stationId_nfl sunday ticket.txt"
Enter the Station Name to search for, or press ENTER to cancel:
Output File _stationId_nfl sunday ticket.txt
type: Cable Only, name: NFL Sunday Ticket 2 (Sasktel), callSign: NFLS2, stationId: 61188, logo: sources/generic/generic_sources_h3.png
type: Cable Only, name: NFL Sunday Ticket 3 (Sasktel), callSign: NFLS3, stationId: 61189, logo: sources/generic/generic_sources_h3.png
type: Cable Only, name: NFL Sunday Ticket 4 (Sasktel), callSign: NFLS4, stationId: 61198, logo: sources/generic/generic_sources_h3.png
type: Cable Only, name: NFL Sunday Ticket 5 (Sasktel), callSign: NFLS5, stationId: 61199, logo: sources/generic/generic_sources_h3.png
type: Cable Only, name: NFL Sunday Ticket 6 (Sasktel), callSign: NFLS6, stationId: 61202, logo: sources/generic/generic_sources_h3.png
type: Cable Only, name: NFL Sunday Ticket HD - 712, callSign: NFLSHD9, stationId: 106626, logo: https://tmsimg.fancybits.co/assets/s17686_h3_aa.png?w=360&h=270
type: Cable Only, name: NFL Sunday Ticket HD - 714, callSign: NFLSH11, stationId: 106627, logo: https://tmsimg.fancybits.co/assets/s17728_h3_aa.png?w=360&h=270
type: Cable Only, name: NFL Sunday Ticket HD - 717, callSign: NFLSH14, stationId: 106630, logo: https://tmsimg.fancybits.co/assets/s26686_ll_h15_aa.png?w=360&h=270
type: Cable Only, name: NFL Sunday Ticket HD - 718, callSign: NFLSH15, stationId: 106631, logo: https://tmsimg.fancybits.co/assets/s31477_ll_h15_aa.png?w=360&h=270
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST, callSign: NFLST, stationId: 20604, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST10, callSign: NFLST10, stationId: 20821, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST11, callSign: NFLST11, stationId: 20822, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST13, callSign: NFLST13, stationId: 20824, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST14, callSign: NFLST14, stationId: 20825, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST16, callSign: NFLST16, stationId: 20827, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST3, callSign: NFLST3, stationId: 20814, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST4, callSign: NFLST4, stationId: 20815, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST7, callSign: NFLST7, stationId: 20818, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST8, callSign: NFLST8, stationId: 20819, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: DirecTV - NFL Sunday Ticket - NFLST9, callSign: NFLST9, stationId: 20820, logo: sources/generic/generic_sources_h3.png
type: Satellite, name: NFL Sunday Ticket - 704, callSign: NFL704, stationId: 17678, logo: https://tmsimg.fancybits.co/assets/s17678_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 705, callSign: NFL705, stationId: 17679, logo: https://tmsimg.fancybits.co/assets/s17679_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 706, callSign: NFL706, stationId: 17680, logo: https://tmsimg.fancybits.co/assets/s17680_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 707, callSign: NFL707, stationId: 17681, logo: https://tmsimg.fancybits.co/assets/s17681_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 708, callSign: NFL708, stationId: 17682, logo: https://tmsimg.fancybits.co/assets/s17682_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 709, callSign: NFL709, stationId: 17683, logo: https://tmsimg.fancybits.co/assets/s17683_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 710, callSign: NFL710, stationId: 17684, logo: https://tmsimg.fancybits.co/assets/s17684_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 711, callSign: NFL711, stationId: 17685, logo: https://tmsimg.fancybits.co/assets/s17685_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 713, callSign: NFL713, stationId: 24258, logo: https://tmsimg.fancybits.co/assets/s24258_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 715, callSign: NFL715, stationId: 17729, logo: https://tmsimg.fancybits.co/assets/s17729_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket - 716, callSign: NFL716, stationId: 17789, logo: https://tmsimg.fancybits.co/assets/s17789_ll_h15_aa.png?w=360&h=270
type: Satellite, name: NFL Sunday Ticket NFL7 (HDTV), callSign: NFLHD7, stationId: 44458, logo: https://tmsimg.fancybits.co/assets/s112287_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 1, callSign: YNFLS1, stationId: 139448, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 10, callSign: YNFLS10, stationId: 139489, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 11, callSign: YNFLS11, stationId: 139490, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 12, callSign: YNFLS12, stationId: 139491, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 13, callSign: YNFLS13, stationId: 139492, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 14, callSign: YNFLS14, stationId: 139493, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 15, callSign: YNFLS15, stationId: 139494, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 16, callSign: YNFLS16, stationId: 139495, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 2, callSign: YNFLS2, stationId: 139481, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 3, callSign: YNFLS3, stationId: 139482, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 4, callSign: YNFLS4, stationId: 139483, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 5, callSign: YNFLS5, stationId: 139484, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 6, callSign: YNFLS6, stationId: 139485, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 7, callSign: YNFLS7, stationId: 139486, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 8, callSign: YNFLS8, stationId: 139487, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: Streaming, name: NFL Sunday Ticket 9, callSign: YNFLS9, stationId: 139488, logo: https://tmsimg.fancybits.co/assets/s139448_ll_h15_aa.png?w=360&h=270
type: TMS Specialty, name: NFL SUNDAY TICKET - NFL13, callSign: NFL13, stationId: 40749, logo: sources/generic/generic_sources_h3.png
type: TMS Specialty, name: SEG NFL SUNDAY TICKET 15, callSign: 40799, stationId: 40799, logo: sources/generic/generic_sources_h3.png
This is now available in OliveTin for Channels, so no need to use windows, curl and jq.