Script to find out which pass triggered the recording of a program

Example with a program already recorded and obviously in my library:

image

Run my script:

python cdvr_find_pass.py -t "A Safari Romance"

> Using Channels DVR server located at: http://127.0.0.1:8089.
> 
> Looking for matches...
> 
> |-------------------|
> | Library programs  |
> |-------------------|
> 
>  - Movie "A Safari Romance (2023)" triggered by pass: "Andrew Walker"
>     "D:\DVR\Movies\A Safari Romance (2023) 2023-08-12-1959.mpg"

Looks like it could be useful, but I haven't run a python script in years.
Figured I'd try it on my Synology NAS which has Python 3.8.15 pre-installed.
Getting an error that it can't find the dateutil module

File "/volume1/arkives/cdvr_find_pass.py", line 25, in <module>
from dateutil import tz
ModuleNotFoundError: No module named 'dateutil'

I remember now why I haven't run a python script in years :grin:

Thank you for reporting this issue.

I'm not sure if you are willing to give it a try but see this:

To be honest, I don't remember if I had to install it manually on my Windows machine or if it was part of the standard Python installation.

I will see if somehow I can work around it and not use this module.
I will see if other users report the same issue too.

Or, how about running the script from a computer that can actually host it and its dependencies? (I don't assume that this was meant to be run directly from a NAS, container, or otherwise minimally equipped install ...)

Thanks, but I'll pass on it for now. I already have curl/jq scripts setup to get most of what your utility provides without having to add more software.

I'm sure many users will find it useful.

Fair enough. Thank you for being the first to give it a try. :slightly_smiling_face:

1 Like

Based on the issue reported by @chDVRuser, I took another look at my code and realized that I was over thinking it when I tried to handle the times.
After simplifying the code, it turns out that the dateutil module is not needed at all so I removed it.

I uploaded a new version that should work better on simple systems. :crossed_fingers:

Looks good.

Gave it a quick test on all 4 of my servers and this is the only thing that stands out.
If an episode is listed as E0 (Episode 0), your output drops the E0 and following space as seen below.

|----------------------|
| Scheduled recordings |
|----------------------|

 - Episode "The Smurfs" S1triggered by pass: "The Smurfs (1981) 9 Seasons, 422 Episodes"
   will be recorded on Monday, 08/14/2023 @ 04:30:00 on channel 813

 - Episode "The Smurfs" S1E1 triggered by pass: "The Smurfs (1981) 9 Seasons, 422 Episodes"
   will be recorded on Wednesday, 08/16/2023 @ 04:00:00 on channel 813

|-------------------|
| Library programs  |
|-------------------|

 - Episode "The Smurfs" S1triggered by pass: "The Smurfs (1981) 9 Seasons, 422 Episodes"
    "/shares/dvr/TV/The Smurfs/The Smurfs S01E00 1981-09-26 King Smurf 2023-08-08-0420.mpg"

 - Episode "The Smurfs" S1E3 triggered by pass: "The Smurfs (1981) 9 Seasons, 422 Episodes"
    "/shares/dvr/TV/The Smurfs/The Smurfs S01E03 1981-09-19 St Smurf and the Dragon 2023-08-09-0430.mpg"
1 Like

Cool, it's not too bad. :grin:

Was the episode number actually present in the json data with the value 0 or was it empty?

In both cases (scheduled and recorded) there is no Episode in the json data, only Season 1.
I assume Channels DVR just adds Episode 0 when that happens.
Screenshot 2023-08-13 at 18-55-39 Channels Schedule
Screenshot 2023-08-13 at 18-53-46 Channels The Smurfs

1 Like

Thanks for taking the time to test it and report the issues, I really appreciate it.

I will make a fix so that it matches the behavior of Channels and use E0 by default when it's not provided. :slightly_smiling_face:

1 Like

Maybe if it's an episodic show you could default the Season and Episode to 0 instead of NULL if not found in the json.
if program.category in ["Episode", "Series"]:
I have recorded Series and Season Specials where they appear as S00E00, S00E02 and S05E00, etc. in Channels DVR.

Forget about Airing.Raw.program.entityType and Airing.Raw.program.subType
They're only in Gracenote EPG data.
Where Airing.Raw.program.entityType is "Episode"

Examples of Airing.Raw.program.entityType and Airing.Raw.program.subType
"entityType": "Episode","subType": "Miniseries",
"entityType": "Episode","subType": "Series",

"entityType": "Movie","subType": "Feature Film",
"entityType": "Movie","subType": "Short Film",
"entityType": "Movie","subType": "TV Movie",

"entityType": "Show","subType": "Series",
"entityType": "Show","subType": "Special",

1 Like

Thanks for the suggestion! I will implement as soon as I get the chance. :slight_smile:

As of the latest pre-release, the pass that is responsible for the recording is now linked to in the View Details modal:

8 Likes
1 Like
1 Like

Thanks! You saved me some work and time. :slightly_smiling_face:

1 Like
1 Like

Nice! Fantastic work. Thank you for this great feature. :+1:

2 Likes

Awesome, gives me hope this one might be possible too!