Python script to be notified of channel lineup changes

Great, @chDVRuser! :smiley:

I'm curious about Big Ten Network Alternate on Fubo. Is that right that it appears 3 times on 3 consecutive channel numbers? :hushed: Are they different versions?

Also, it looks like the two examples that you posted came from the same server machine at 192.168.1.3.
How can it be that Fubo starts at 9000 and Pluto at 9001? That's not a bug in my script?
I can see that they are from two different dockers so maybe they are used by different Channels DVR servers?

I have everything on one machine so it was strange at first for me to wrap my head around your configuration. I'm guessing you have something like this:

The Big Ten alternates are different feeds, but typically only show different games during football season.

1 Like

Here's mine copied from the e-mail notification:

Channels DVR server URL: http://media-server6:8089
Channels DVR version: 2024.02.11.0311

--------------------------

Pluto TV: 392 channels (+2)
(http://htpc6:8183/playlist.m3u)

<--- Lineup changes (starting at 0) --->
+ 640 : Little House on the Prairie
+ 690 : She Wrote

<--- Channel changes --->
+ Little House on the Prairie (640)
+ She Wrote (690)

<--- Duplicated channels --->
AspireTV Life: 262, 3220
BET Her: 2050, 258
BET Pluto TV: 2040, 256
Black Cinema: 130, 250
Black Classics: 254, 530
Black Throwbacks: 252, 320
CBS News Chicago: 2570, 5120
CBS News Colorado: 2540, 5130
CBS News Los Angeles: 2560, 5150
CBS News New York: 2550, 5180
Love & Hip Hop: 1690, 264
Vevo R&B: 266, 4730
XITE Gospel: 268, 4800

--------------------------

Samsung TV Plus: 330 channels (+1)
(http://htpc6:8182/playlist.m3u)

<--- Lineup changes (starting at 1002) --->
- 1001 : Heartland
! 1002 : LOL! Network (was Ebony TV by Lionsgate)
! 1003 : Bring It! (was 60 Days In by A&E)
+ 1054 : EBONY TV by Lionsgate
+ 1058 : Heartland
+ 1122 : 60 Days In by A&E
+ 1207 : PBS Antiques Roadshow
- 1247 : Bring It!
! 1284 : FreeTV Estelar (was Tu Cine)
- 1325 : LOL! Network

<--- Channel changes --->
+ EBONY TV by Lionsgate (1054)
- Ebony TV by Lionsgate (1002)
+ FreeTV Estelar (1284)
+ PBS Antiques Roadshow (1207)
- Tu Cine (1284)

--------------------------

FrndlyTV-noEPG: 6 channels (+1)

<--- Lineup changes (starting at 9657) --->
+ 9807 : Bounce

<--- Channel changes --->
+ Bounce (9807)
1 Like

Nice! So you got an email. That's good. :slightly_smiling_face:

All the channel numbers (including starting numbers) are reported correctly?

192.168.1.3 is my old NAS which runs my docker sources like Pluto, Frndly, PBS, Fubo and some utility dockers.

192.168.1.4 is my new NAS that runs multiple Channels DVR servers in docker containers and one using the Synology package.

For all my m3u custom channel setups, I let Channels DVR assign the channel numbers.

@mjitkop
Why do your channel numbers change when a channel is added or removed?

Not sure.
Could it be because of my source options?

I'm guessing it's Prefer channel-number from M3U, mine are set to Ignore channel-number from M3U
Guess it doesn't matter if you don't have passes preferring or ignoring channel numbers.

Thanks. I will change it and see if it makes a difference.

Yes, that was it. I haven't had any channel renumbering since I made the change.
Thank you for questioning this. Much better now.

1 Like

@bnhf there is something strange in OliveTin but I guess that's the way it works: the stdout output on the screen in the Logs tab only showed up to a certain point when I started it and then froze:

It hasn't shown anything else since I started it.

By looking around, I finally figured out that everything gets written to the file 192.168.18.120-8089_channels_dvr_monitor_channels_latest.log. I think you probably mentioned it at some point but I forgot.

By the way, this file will keep on growing the longer this script runs.
Is there any kind of automatic cleanup process that limits the size of a file and then will write over?

I always thought that stdout was only visible on the screen so that's the reason why I added the logging option in the script to log only the times when lineup changes are detected.
I don't see the logging option '-l' being used in OliveTin.

I thought about it more and I think I will push a new version with the logging option as a standard feature and not an option anymore.
That will be more suitable for the execution in OliveTin. :slight_smile:

I would prefer it only writes to the log file when changes are detected.
Maybe the no change events can go to stderr and not the log file?
I have to edit the log files every day or they get very long.
I don't want email/text notification.

It's not that it freezes -- stdout and stderr in OliveTin are not live viewers, they strictly reflect what was output to the console (or whatever else I direct there) at the time of the script run. For scripts that run in the background, I use a calling script that terminates, as this is required for OliveTin to function properly.

For those scripts, like yours that produce output on an ongoing basis, that output can be found in a log file -- as you discovered. Those log files are active until the next container or system restart, when they will be overwritten.

I did an "unpublished" env var for @chDVRuser as he wanted these particular logs to survive restarts. I haven't advertised that variable to prevent the log files from growing indefinitely for the average user. I could obviously implement some sort of log rotation system, but that seems a bit over-the-top for this project.

1 Like

I actually don't need log rotation.
I just don't want the log filling up every time it checks and finds no changes.
Since I don't use notifications (email/text) I'm wondering if you get notified every time it runs and finds no changes?

No, only on changes. I actually like knowing it ran even if there are no changes via the log file, but I'm also using the healthchecks.io option -- which notifies me if the script fails to run for any reason.

I would vote for retaining configurability, as we each have our preferences.

I do too. :slight_smile:
Having a log file that keeps on growing with no rotation, not so much.

I just had a thought. How about this as a compromise...

  • create a file called "last_activity.log"
  • when checking for changes, write to this file what was found (or not) at that moment
  • on the next check, overwrite the file and write the result of the check at that moment (and it will indicate the next time it will check)

This way, we still get to know if the script is still running, and the size of the activity log file is greatly reduced and managed.
I will also have the other log file that will only contain the lineup changes.

Thanks,
This is what I'm looking for.
If that's not possible, I'll just continue using my curl/jq scripts.

Not only is it possible, but it has already been implemented.

The way I did it though is with an option and this option is currently not being used/available in OliveTin.

I will change it to make it a standard feature without having to select an option.

2 Likes

Thanks. Will try it out when OliveTin for Channels is updated with it.

Version 3.1.0:

[IMPROVED] Typo in the name of the data sub-directory

[CHANGED] Logging the lineup changes is a standard feature now

[CHANGED] The log file will contain the lineup changes of the current year.
A new file is created every year with the year number in the name.

[NEW] File "last_activity.log" to log the result of the last check only

@bnhf you can update OliveTin at your earliest convenience. :slight_smile:

1 Like