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

1 Like

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))

1 Like

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

Hi Eric,

Do you happen to have an update on the usage of these flags? It appears that the CommercialsVerified key no longer exists. I assume that CommercialsEdited is now the flag being used to mark a recording as "Verified". Is this correct?

Thanks!

Both flags still exist but are omitted when false.

Apologies for the naive question, but where does this json file reside? Are the CommercialsEdited and CommercialsVerified attributes supposed to be present in the sidecar .json file next to the recorded media file? (Mine are created at the beginning of the recording and never update after commercial detection.)

I believe nowhere. The JSON data is the response that the DVR server returns when you GET /dvr/files/####. From a quick glance at the script referenced above, it is the script that is creating the JSON file.

The only sidecar json file I'm aware of is the recordings metadata when you enable the experimental setting
MCEBuddy Metadata - Export .json file next to each recording for MCEBuddy processing