[mythtv-users] New frequency for NY NBC OTA channel 4

Stephen Worthington stephen_agent at jsw.gen.nz
Tue Apr 3 07:58:08 UTC 2018


On Mon, 2 Apr 2018 20:26:35 -0400, you wrote:

>I just found out the hard way that apparently NY NBC channel 4
>apparently changed frequency on April 1.
>
>I'd love to be able to just find out what the new frequency is and to
>possible change it in the database. I HATE scanning for channels
>frankly. For one thing I have a bunch of disabled Philadelphia
>channels that I need to keep, but which can't be picked up without
>turning my antenna, and among other things I do NOT want it to delete
>any of those.
>
>I've never been comfortable doing that channel scan. Frankly it about
>gives me a heart attack. It's NEVER clear as to what it's going to do
>etc and I always have visions of needing to restore my database. In
>the past I've had it arbitrarily rename all my channels from using the
>dot I have now (for example 4.1) to dashes (4-1). If I recall
>correctly there used to be some option for that but I'm not sure there
>is any longer. I haven't needed to rescan much at all in the 10+ years
>I've been using MythTV. Maybe it's just me, but doing so seems to have
>been more harrowing  every time I've done it.
>
>If I could find what the new frequency is I could probably change it
>manually. I can't find anything anywhere except the fact that it
>changed. As far as I'm aware in MythTV that's just based on this:
>
>select chanid, channum, mplexid from channel where channum like '4.%'
>
>+--------+---------+---------+
>| chanid | channum | mplexid |
>+--------+---------+---------+
>|   1041 | 4.1     |       3 |
>|   1042 | 4.2     |       3 |
>|   1044 | 4.4     |       3 |
>+--------+---------+---------+
>
>select * from dtv_multiplex where mplexid=3
>
>*************************** 1. row ***************************
>          mplexid: 3
>         sourceid: 1
>      transportid: NULL
>        networkid: NULL
>        frequency: 557000000
>        inversion: NULL
>       symbolrate: NULL
>              fec: NULL
>         polarity: NULL
>       modulation: 8vsb
>        bandwidth: NULL
>     lp_code_rate: NULL
>transmission_mode: NULL
>   guard_interval: NULL
>          visible: 0
>    constellation: NULL
>        hierarchy: NULL
>     hp_code_rate: NULL
>          mod_sys: 1
>          rolloff: NULL
>       sistandard: atsc
>   serviceversion: 33
>  updatetimestamp: 2007-05-02 12:38:30
>default_authority:
>1 row in set (0.00 sec)
>
>Any advise would be appreciated. Thanks!
>Tom

You should be able to find the new frequency by doing a scan using the
command line tools.  I have scripts that do that for me.  Then I
manually adjust the database from my Windows box using the nice
HeidiSQL program.  I would presume that the command line tools would
work with ATSC tuners just as they do with DVB ones.  However, if you
are using network tuners, you would need to have a tool that scanned
them and gave you the right information.

Here is the script I use for scanning my DVB-T tuners
(FreeviewHD-scan.sh):

#!/bin/bash

# Scan all Freeview DVB-T frequencies for channel information.

# DVB-T multiplex frequencies (kHz)
declare -a DVB_T_FREQS=(530000 562000 578000 594000 610000)
declare -a FREQS=${DVB_T_FREQS[*]}

# Adapter number of DVB-T card.
DEFAULT_ADAPTER=17

# Number of times to try a scan of a frequency when a scan fails
NUM_TRIES=5

# Output file to store the results of the scan.
OUTPUT_FILE=FreeviewHD_scan.txt

./rotate.sh $OUTPUT_FILE

#if [ -e "$OUTPUT_FILE" ] && [ -f "$OUTPUT_FILE" ] ; then
#    rm "$OUTPUT_FILE"
#fi

if [ "$1" != "" ]; then
    ADAPTER=$1
else
    ADAPTER=$DEFAULT_ADAPTER
fi

for a in ${FREQS[*]}; do
    echo "[[Tuning to $a Hz]]" | tee -a "$OUTPUT_FILE"
    tries=$NUM_TRIES
    while [ $tries -ne 0 ]; do
        let tries-=1
        dvbtune -f $a -qam 64 -gi 16 -cr 3_4 -bw 8 -tm 8 -m -c
$ADAPTER 2>&1 >/dev/nul &
        DVBTUNE_PID=$!
        sleep 1
        scan-s2 -c -q -o vdr -x -2 -t 7 -a $ADAPTER | tee -a
$OUTPUT_FILE
        rc=${PIPESTATUS:0}
        kill $DVBTUNE_PID >/dev/nul
        if [ $rc -eq 0 ]; then
            break
        fi
    done
done

And here is the supporting rotate.sh file:

#!/bin/sh
#http://stackoverflow.com/questions/3690936/change-file-name-suffixes-using-sed/3691279#3691279

## Move "$1.$2" to "$1.$(($2+1))", first rotating the target as well.
rotate () {
  if [ -e "$1.$(($2+1))" ]; then rotate "$1" $(($2+1)); fi
  mv -- "$1.$2" "$1.$(($2+1))"
}

for x; do
  ## Break each argument into FILE.NUMBER or just FILE.
  suffix=${x##*.}
  case $suffix in
    *[!0-9]*)
      if [ -e "$x.0" ]; then rotate "$x" 0; fi
      mv -- "$x" "$x.0";;
    *) rotate "${x%.*}" "$suffix";;
  esac
done


You would need to adjust the script to tune your ATSC tuner.  And the
scan-s2 program I am using is from the TBS drivers.  The source code
is available if you download their proprietary drivers for the TBS9522
tuner.  I think I had to adjust the code to make it work with tuner
numbers > 9, but that should not affect you.  If you are using Ubuntu
16.04 or a relative of it, I have put the scan-s2 executable on my web
server - it works with later Ubuntu versions too:

http:/www.jsw.gen.nz/mythtv/scan-s2

To get the frequencies you need for the script, try this SQL:

select mplexid,sourceid,transportid,networkid,frequency from
dtv_multiplex order by frequency;

However, if the channel is now on a new multiplex, then you will need
to find out the frequency for that from some other source.  w_scan is
able to do blind scans, but I do not know if it supports ATSC.  You
could try scanning from what looks to be the full list of all ATSC
frequencies in this file (on Mythbuntu 16.04):

/usr/share/dvb/atsc/us-ATSC-center-frequencies-8VSB


More information about the mythtv-users mailing list