Verifying Commercial removal for DVR Scripts

I have a set of scripts that at midnight see if I have a recording that I would like to catalog away in a plex like data structure that I have modified from others that have contributed.

I was reluctant to automatically have commercial removal (chose to do chapter markings) and just transcoded to (HEVC) for the content. There is a significant decrease in size with HEVC and flexibility of where/how I do playback.

Now there is a method via my iPhone or Channels DVR web to edit the commericals so that they are very good. On the iPhone, it is the verify commercials function and when it is complete it states that the commercials are verified. On the Channels DVR web it shows that I have a local with edits state.

What I would like to do is to do the automatic commercial removal by querying the "commercial verified state" and if it is verified to do the automatic commercial removal. I have been doing this manually.

I noticed in the recording.json that there is the following:

"CommercialsAligned": true,
"CommercialsEdited": true,
"CommercialsVerified": false,
"CommercialDetectSource": "local",
"CloudComskip": {
"Successful": false

I was hoping to use the CommericalsVerified to trigger the automatic removal of the commercials but I noticed that this is false. I suspect that since I edited the Commericals that I could use the CommercialsEdited field instead (for now) but I am wondering if there is a plan to update the CommericalsVerified field.

Maybe there is another way as well

For now, you can check if either CommercialsEdited or CommercialsVerified is true and use that as the indicator.

We're talking internally about what we intended to be using those flags for.

I have been use this script for exactly that. This have been great combined with the commercial editing on the iPhone.

I noticed that if you just save the commercial without edits is gets flagged as verified. If you made some edit then the edited flag is set. So, I check for either flag set. I made some dots in the script as well to check for those conditions.

It is on autopilot right now and only transfers things to Plex that have the flag set.

https://github.com/karllmitchell/Channels-DVR-to-Plex

Can you share the code snippet that checks for the two flags ? It would save some time .

I started with the link you referred to a couple of years ago and made many hacks to personalize it to my needs. It isn't very easy making code changes to this base but it works.

Request for snippet: oring two Json flags into a variable
checking that If I have confirm=1 and if either of these two flags are on..

I have concut script that I will call to do the commercial cutting and put it back.

He does some preprocessing to grab a list of recording ids and then he runs it through the jq query.

"${JQ_CLI}" -r '.[] | select (.Path | contains("'"${i}"'")) | select (.Deleted == false) | select (.Processed == true) | select ((.CommercialsEdited == true) or (.CommercialsVerified == true)) | {ID} | join(" ")' < "${jlist}" >> tmp.list

The crux of what you are looking for is this:
select ((.CommercialsEdited == true) or (.CommercialsVerified == true))

Thank You! Just what I needed.

I did implement the code given and had to make one change. I had to change it from .Path to .ID and it works great.

1 Like