Python script to be notified of channel lineup changes

Thank you for providing the data, @cyoungers.

After reviewing your data, I immediately identified the issue: your source "EPLUS" has zero channels.
My script did not account for this scenario.

Sorry you ran into this issue and thank you for reporting this.

Thanks to you, this will be fixed in the next version of my script that I'm planning on releasing later today.

Cool. My EPLUS container stopped working awhile ago and I never got around to fixing it. Glad it uncovered this edge case I guess.

1 Like

I have made changes to the script and I am in the testing phase now.

If everything goes well, I will release a new version tomorrow.


Update 5/11:

Test failed. I broke something in the code. 🫤

Today is a busy day and I probably won't be able to look at it until late evening, if at all.
Maybe tomorrow morning.

Version 3.2.0:

[IMPROVED] Ignore sources that have the "Lineup" field empty

[FIXED] Crash when a new source with zero channels is detected

[NEW] Detect, report, and back up removed sources (in "Deleted_Sources" subdirectory)


@bnhf please integrate in OliveTin at your convenience. :slight_smile:

@chDVRuser sorry for the delay, this is a release that is long overdue with your requested change. :wink:

@cyoungers it should work for you now :crossed_fingers:

1 Like

Thanks! Works great.

2 Likes

Version 3.3.0

[FIXED] Two or more sources each using the same HDHomeRun device model were combined into one source.

Note: sources that use a HDHomeRun device will be reported as new sources the first time this version of the script is run. The names of their channel lineup log files will contain the device IDs to differentiate them in case they use the same HDHomeRun device model.

I really like this idea, so I'm just trying this out in command line on a Windows 11 machine. I'm trying to monitor on a different PC than the one where Channels server is located and I get the error message below.

C:> python channels_dvr_monitor_channels.py -f 15 -i 192.168.88.240
Traceback (most recent call last):
File "C:\channels_dvr_monitor_channels.py", line 62, in
import argparse, glob, os, requests, smtplib, sys, time
ModuleNotFoundError: No module named 'requests'

1 Like

The "ModuleNotFoundError: No module named 'requests'" occurs when you forget to install the requests module before importing it or if you install it in an incorrect environment. To resolve this error, follow these steps:

  1. Install the requests module:

    • Open your terminal or command prompt.
    • Navigate to your project's root directory.
    • Run the following command to install the requests module:
      pip install requests
      
      If you're using Python 3, use:
      pip3 install requests
      
  2. Check your Python installation:

    • Make sure you have Python and pip installed.
    • If pip is not in your path, you can use:
      python -m pip install requests
      
      For Python 3:
      python3 -m pip install requests
      
  3. Alternative methods:

    • On Linux, you can use your system's package manager:
      • CentOS: sudo yum install python-requests
      • Debian/Ubuntu (Python 2): sudo apt-get install python-requests
      • Debian/Ubuntu (Python 3): sudo apt-get install python3-requests
    • On Windows, use:
      pip install requests
      
      Or if pip is not in your path:
      python -m pip install requests
      

Remember to install the requests module in the correct environment, and you should be good to go! :rocket:¹²³⁴⁵

Source: Conversation with Copilot, 5/31/2024
(1) python - ImportError: No module named requests - Stack Overflow. python - ImportError: No module named requests - Stack Overflow.
(2) ModuleNotFoundError: No module named 'requests' in Python. ModuleNotFoundError: No module named 'requests' in Python | bobbyhadz.
(3) Solved: ModuleNotFoundError: No module named 'requests' in Python 3. Solved: ModuleNotFoundError: No module named 'requests' in Python 3 | CyberITHub.
(4) ModuleNotFoundError: no module named 'requests' [Solved in Python Django]. ModuleNotFoundError: no module named 'requests' [Solved in Python Django].
(5) python - ModuleNotFoundError: No module named 'requests' - Stack Overflow. python - ModuleNotFoundError: No module named 'requests' - Stack Overflow.
(6) undefined. PyPI · The Python Package Index.
(7) undefined. requests · PyPI.

Thank you for the quick response! Installed the module; all is running now and the number of channels in the log for each source I have is the same as what is listed in Channels settings. Thank you again.

2 Likes

@daldana7296 are you using the latest version of the script, version 3.3.0?

Yes. It just did it's first update and logged correctly.

1 Like

Perfect. Thank you for confirming. :slightly_smiling_face:

And below is what I get with after reloading the Pluto source. It's looks like it's working very nicely!

Check time: 2024-05-31 09:54:47

Server version: 2024.05.26.0350

Channels DVR server URL: http://192.168.88.240:8089
Channels DVR version: 2024.05.26.0350


Pluto TV: 406 channels (+1)
(https://nocords.xyz/pluto/playlist.m3u)

<--- Lineup changes (starting at 0) --->

  • 4490 : Telemundo Noticias Noreste

<--- Channel changes --->

  • Telemundo Noticias Noreste (4490)

<--- Duplicated channels --->
CBS News Baltimore: 2540, 5070
CBS News Chicago: 2570, 5120
CBS News Los Angeles: 2560, 5150
CBS News New York: 2550, 5180
Pluto TV Cars: 0, 1560

Next check: 2024-05-31 10:09:47

1 Like

Latest version (v3.3.0) of this script incorporated into OliveTin-for-Channels, and pushed as bnhf/olivetin:latest with all the usual OliveTin bells and whistles:

screenshot-htpc6-2024.05.31-11_38_21

2 Likes

Thanks, @bnhf

Let me know if you can figure out how to enable a start time.
I will be manually removing and adding the one server to check tomorrow.
I have it start at 11:05 and check every 12 hrs

I haven't had enough time yet to sit down and work on my code. :worried:

No rush. Just letting you know that when you do, I'll test it.

1 Like

@chDVRuser I'm starting to think about adding a start time to my script.

In your case, would you want to be able to specify just a time or a combination of day + time?

Thanks, Just a 24hr time is fine. 00:00 - 23:59

I like checking mine after the daily morning guide fetch is done (09:00-11:00), but I have a few sources fetching the playlist and XMLTV using a cron job. Pluto is done every 2hrs and the fetch is done by 11:06, so that's when I have it checking my Pluto Server.

1 Like