• The forum software that supports hummy.tv will be upgraded to XenForo 2.3 on Wednesday the 20th of November 2024 starting at 7pm

    There will be some periods where the forum is unavailable, please bear with us. More details can be found in the upgrade thread.

Detect Ads

If you do a 'manual' crop of a file the original is placed in a '_original' folder which seems the best way to me, but if you do a 'auto crop' with detect ads following detection the original stays in place and the cropped file named *.-crop.

Would it not be better if the detect ads auto process kept to the manual process method? If the renaming is prefered would it not be better to rename the original *-orig instead of the cropped as its most likely the cropped is the one that will be kept?
 
The following is an update to the previous mod on adjusting cropping bookmarks and only affects the detectads.jim file, it adds the automatic post crop bookmarks detailed here https://hummy.tv/forum/threads/automatic-edit-point-bookmarks-following-crop.9057/#post-127986 excepting the save is automatic too for this process.

This code will always create at least 2 bookmarks for the file (one at the beginning the other near the end) regardless of any calculated.

Code:
--- /mod/webif/plugin/detectads/detectads_orig.jim
+++ /mod/webif/plugin/detectads/detectads.jim
@@ -152,7 +152,8 @@
       admaxsec  65
       padsec     0
       makethm    0
-      thmoffset  0}
+      thmoffset  0
+      padout     0}
 
     # Override default from settings DB
     foreach {key defvalue} [array get optarray] {
@@ -467,6 +468,7 @@
     $queue_db close
 }
 
+# Manual
 proc ::detectads::run {ts} {
     set file [$ts get file]
 
@@ -479,7 +481,11 @@
            log "Cannot acquire exclusive lock $file, terminating." 0
            return {"DEFER" "Cannot acquire exclusive lock"}
     }
-
+    set stime [$ts get start]
+    set etime [$ts get end]
+    set durn $($etime-$stime)
+    set theend 0
+    set padding 0
     set size [$ts size]
     set numAdBreaks 0
     set bname [file rootname [file tail $file]]
@@ -495,7 +501,14 @@
     foreach {key value} [array get ::opts] {
         set $key $value
     }
-
+       
+    if {$padsec} {
+    set padout 0
+    }
+    if {$padout} {
+    log "Padding out points by $padout secs and ignoring program end bookmark" 0
+    }
+   
     set tailPid 0; # unused (for killing head of pipe on timeout - useful with tail -f recording.ts | ffmpeg ... | silence...)
 
     set silenceArgs "\
@@ -545,9 +558,22 @@
                     startSeconds \
                     endMinutes \
                     endSeconds]} {
-
+   
             set totalStartSeconds [expr {$startMinutes * 60 + $startSeconds}]
-            set totalEndSeconds [expr {$endMinutes * 60 + $endSeconds}]
+            if {$cropcmd eq " " && $totalStartSeconds < 10 && $padout} {
+            set padding 2
+            } elseif {$padout} {
+            set padding $padout
+            }
+            set totalEndSeconds [expr {$endMinutes * 60 + $endSeconds - $padding}]
+            set endMinutes [expr int($totalEndSeconds / 60)]
+            set endSeconds [expr ($totalEndSeconds % 60)]
+            if { [expr {$totalEndSeconds + 10}] > $durn} {
+               set totalEndSeconds [expr {$totalEndSeconds + $padding}]
+               if {$padout} {
+                  set theend 1
+               }
+            }
 
             log "  ad break found $startMinutes:$startSeconds-$endMinutes:$endSeconds ($totalStartSeconds - $totalEndSeconds)" 0
 
@@ -565,7 +591,11 @@
                         ladd bookmarks 0 $totalStartSeconds $totalEndSeconds
                     }
                 } else {
-                    ladd bookmarks $totalStartSeconds $totalEndSeconds
+            if {$theend == 0} {
+            ladd bookmarks $totalStartSeconds $totalEndSeconds
+                     } else {
+            ladd bookmarks $totalStartSeconds
+                     }
                 }
             }
             # Update bookmarks and build up crop cmd line as each break is detected.- mymsman  150408
@@ -660,7 +690,11 @@
         set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
         log "ad detection.processed in ${elapsedSeconds}s $elapsedTime - $numAdBreaks ad breaks bookmarked, crop starting" 0
 
-
+    # calculate post crop edit point bookmarks
+    set len [$ts duration 1]
+    set newbookmark [editpointbm $bookmarks $len]
+    set originalused 0
+         
         # copy & paste from crop/execute.jim  - mymsman 150407
         set rfile $file
         set dir [file dirname $rfile]
@@ -720,6 +754,7 @@
                 set cfile "$tgtpath/$shname-crop.ts"
                 if {![system inuse $cfile]} {  # Rename crop file to original if not in use
                       ts renamegroup "$cfile" "$shname"
+                      set originalused 1
                 }
            } else {
                 log "$file safe_delete failed" 0
@@ -734,6 +769,11 @@
         set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
         log "done...processed in ${elapsedSeconds}s $elapsedTime - $numAdBreaks ad breaks cropped out" 0
         set retcode [list "OK" "$numAdBreaks ad breaks cropped out" ]
+        # save post crop edit point bookmarks
+        if { !$originalused } {
+                set ts [ts fetch "$tgtpath/$shname-crop.ts"]
+            }
+            $ts setbookmarks $newbookmark
     } else  {
         set elapsedSeconds [elapsed $start]
         set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
@@ -746,6 +786,7 @@
     return $retcode
 }
 
+# Chaserun
 proc ::detectads::chaserun {ts {Qid 0} {retrynumb 0}} {
     # run ad detection against currently recording program using dlna helper - mymsman 150505
     # creates decrypted, cropped and shrunk copy of file in video root directory.
@@ -768,12 +809,23 @@
     }
     set statustok [system startop -multiple detectads $file]
     set size [$ts size]
+    set stime [$ts get start]
+    set etime [$ts get end]
+    set durn $($etime-$stime)
+    set theend 0
+    set padding 0
     set numAdBreaks 0
 
     # set each option from settings/overrides
     foreach {key value} [array get ::opts] {
         set $key $value
-    }
+    }       
+    if {$padsec} {
+    set padout 0
+    }
+    if {$padout} {
+    log "Padding out points by $padout secs and ignoring program end bookmark" 0
+    }   
     set tailPid 0; # unused (for killing head of pipe on timeout - useful with tail -f recording.ts | ffmpeg ... | silence...)
 
     set silenceArgs "\
@@ -788,6 +840,7 @@
     set stime [$ts get start]
     set etime [$ts get end]
     set ctime [clock seconds]
+    set len [$ts duration 1]
 
     # Check file sharing enabled
     if {[system param DMS_START_ON]} {
@@ -955,7 +1008,20 @@
                     endSeconds]}  {
 
             set totalStartSeconds [expr {$startMinutes * 60 + $startSeconds}]
-            set totalEndSeconds [expr {$endMinutes * 60 + $endSeconds}]
+            if {$cropcmd eq " " && $totalStartSeconds < 10 && $padout} {
+            set padding 2
+            } elseif {$padout} {
+            set padding $padout
+            }
+            set totalEndSeconds [expr {$endMinutes * 60 + $endSeconds - $padding}]
+            set endMinutes [expr int($totalEndSeconds / 60)]
+            set endSeconds [expr ($totalEndSeconds % 60)]
+            if { [expr {$totalEndSeconds + 10}] > $durn} {
+               set totalEndSeconds [expr {$totalEndSeconds + $padding}]
+               if {$padout} {
+                  set theend 1
+               }
+            }
 
             log "  ad break found $startMinutes:$startSeconds-$endMinutes:$endSeconds ($totalStartSeconds - $totalEndSeconds) Frames: $startFrame - $endFrame" 0
 
@@ -975,7 +1041,11 @@
                         ladd bookmarks 0 $totalStartSeconds $totalEndSeconds
                     }
                 } else {
-                    ladd bookmarks $totalStartSeconds $totalEndSeconds
+            if {$theend == 0} {
+            ladd bookmarks $totalStartSeconds $totalEndSeconds
+                     } else {
+            ladd bookmarks $totalStartSeconds
+                     }
                 }
             }
             # Update bookmarks and build up crop cmd line as each break is detected.- mymsman  150408
@@ -1139,7 +1209,7 @@
             set newtitle  "$title -Len err ([clock format $misdetect -format %T])"
         }
     }
-
+    set originalused 0
     if {$lengtherr == 0} {
         # All OK (as far as we can tell)
         set newtitle  "Done"
@@ -1154,6 +1224,7 @@
                     if {![system inuse $cfile]} {  # Rename crop file to original if not in use
                        exec hmt  "+settitle=$title" "$cpath/$cname.hmt"
                        ts renamegroup "$cfile" "$bname"
+                       set originalused 1
                     }
                     if {![system inuse $tfile]} {  # Delete decrypt file no longer needed
                        $tts delete
@@ -1195,7 +1266,18 @@
             }
             close $recording
     }
-
+   
+    if { $crop } {
+ 
+    set newbookmark [ editpointbm $bookmarks $len ]
+
+        # save post crop edit point bookmarks
+        if { !$originalused } {
+                set ts [ts fetch "$tgtpath/$cname.ts"]
+            }
+            $ts setbookmarks $newbookmark
+    }
+   
     if {$tempQid} {
         # remove temporary entryt from the queue
         log "Removing item $tempQid ($file) from the queue" 1
@@ -1217,7 +1299,8 @@
     log "=============================================================" 1
     set ::auto::loglevel ::autologlevel
     return [list $retcode $retmsg $qtime]
-}
+}   
+## proc detectads::chaserun end
 
 proc set_HMT_durn {hmtfn start durn} {
             # Update recording end & stored recording time in hmt file
@@ -1225,3 +1308,41 @@
             exec hmt "+patch32=0x288:$durn"  "$hmtfn.hmt"
 
 }
+
+# calculate post crop edit point bookmarks
+proc editpointbm {bookmarks len} {
+     set keeping 0
+    set start -1
+    set newbookmark "0 "
+    set i -1
+    foreach b $bookmarks {
+        if {$start < 0} {
+            set start $b
+            set removing $b
+            continue
+        }
+        if {$i == 0} {
+            set start $b
+            set endad $($b - $removing)
+            incr removing $($endad - $startad)
+            set i -1
+            continue
+        }
+        set end $b
+        incr keeping $($end - $start)
+        set startad $($b - $removing)
+        append newbookmark "$($startad +3) "   
+        set i 0
+    }       
+    if {$i < 0 && $start > 0} {
+        incr keeping $($len - $start)
+    }
+    set n $([llength $newbookmark] - 1)
+    if {[lindex $newbookmark end] > [expr $keeping - 8] && $n > 0} {
+        set newbookmark [lreplace $newbookmark $n $n]
+        append newbookmark " $($keeping - 8)"
+    } elseif {$n == 0 && $keeping > 0} {
+        append newbookmark " $($keeping - 8)"
+    }
+    return $newbookmark
+}
 
If you do a 'manual' crop of a file the original is placed in a '_original' folder which seems the best way to me, but if you do a 'auto crop' with detect ads following detection the original stays in place and the cropped file named *.-crop.
Only if the "Delete (move to bin) original recording after processing? " setting is Off or a problem is detected

Would it not be better if the detect ads auto process kept to the manual process method?
The problem with the _original folders is that they are not automatically cleaned up and tend to proliferate, the auto process packages, including detectads, normally put deleted original files in the dustbin where they will automatically be deleted after a period.

You have to seriously like watching paint dry to rum detectads in manual 'Run now' mode, most users use one of the auto processing option or add to queue for on-off detection.
That is why I don't see the need for a jump to Crop page button, after waiting half an hour for ad detection to complete do you really need to save a few seconds and mouse clicks - why not just let it do the the cropping whilst ad detecting.
 
You have to seriously like watching paint dry to rum detectads in manual 'Run now' mode, most users use one of the auto processing option or add to queue for on-off detection.
That is why I don't see the need for a jump to Crop page button, after waiting half an hour for ad detection to complete do you really need to save a few seconds and mouse clicks - why not just let it do the the cropping whilst ad detecting.

You don't have to watch the page whilst it detects, just leave the tab open and use others, check back later to see if its finished. The auto crop did not work for me before as the bookmarks always needed adjusting, but with the padOut option it works well now so I will continue with that. There are a few programs that Ad Detector doesn't work well with like The Big Bang Theory, but that's not often so getting them from the bin will be fine.
 
here are a few programs that Ad Detector doesn't work well with like The Big Bang Theory,
You can now specify different options for specific series by enabling the Auto Detectads flag for the folder and then Editing the Auto DetectAds options.

I have occasional problems with Countdown and 15to1 on Channel 4, they often include long (90sec) charity appeals in the ad breaks which is too much for the normal -adMaxSec 65 setting but increasing it to 95 sometimes leads to mis-cropping in the middle of the numbers games so I use -delOrig n to keep the original for just those recordings to give me the choice which copy to use
 
The two detectads processes return different messages after auto-cropping, one is: x ad breaks cropped out the other: x ad breaks detected,

I suggest the following change to maintain consistency.

Code:
--- /mod/webif/plugin/detectads/detectads_orig.jim
+++ /mod/webif/plugin/detectads/detectads.jim
@@ -1211,13 +1293,17 @@
     set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
     log "done...processed $file in ${elapsedSeconds}s $elapsedTime - $numAdBreaks ad breaks detected" 0
     set retmsg "$numAdBreaks ad breaks detected, $warning"
-
+    if { $crop && $numAdBreaks && $retcode != "FAILED" } {
+        set retmsg "$numAdBreaks ad breaks cropped out. $warning"
+    }
+  
     system endop $statustok
     release_lock $file
     log "=============================================================" 1
     set ::auto::loglevel ::autologlevel
     return [list $retcode $retmsg $qtime]
 
Last edited:
Having used Detectads with my padOut mod for a number of programs now I feel there is just one tweak needed, the 1st break adjustment needs to be 3secs not 2secs

ie both set padding 2 should be set padding 3
 
I found a minor issue with my mod, if the 1st ad break ends within the 1st few secs of the file the padding creates a negative value for the bookmark, the cropping then sees that as at the end of the file and the whole file is cropped!

Simple fix which is included in the full version of the mod in this diff against the latest DetectAds

Summery for anyone jumping straight here:

This mod creates a new option (padOut) which sets number of seconds to pad advert end bookmarks to allow for recording disruption at the 'edit point' following cropping, the start of file bookmark is always padded 3 secs (as that's all it needs there). Setting padOut means the last bookmark is ignored as that cleans the crop at the end.

padSec overrides padOut

Following the file crop the mod also calculates and applies new bookmarks set to appear just after any edit points, that allows edits to be quickly checked, a method to jump any disturbance and a chapter addition for recordings.

The edit point bookmarks is an implementation within DetectAds for my automatic post crop bookmarks detailed here https://hummy.tv/forum/threads/automatic-edit-point-bookmarks-following-crop.9057/#post-127986

Diff:
--- /mod/webif/plugin/detectads/detectads_orig.jim
+++ /mod/webif/plugin/detectads/detectads.jim
@@ -152,7 +152,8 @@
       admaxsec  65
       padsec     0
       makethm    0
-      thmoffset  0}
+      thmoffset  0
+      padout     0}

     # Override default from settings DB
     foreach {key defvalue} [array get optarray] {
@@ -467,6 +468,7 @@
     $queue_db close
}

+# Manual
proc ::detectads::run {ts} {
     set file [$ts get file]

@@ -479,7 +481,11 @@
            log "Cannot acquire exclusive lock $file, terminating." 0
            return {"DEFER" "Cannot acquire exclusive lock"}
     }
-
+    set stime [$ts get start]
+    set etime [$ts get end]
+    set durn $($etime-$stime)
+    set theend 0
+    set padding 0
     set size [$ts size]
     set numAdBreaks 0
     set bname [file rootname [file tail $file]]
@@ -495,7 +501,14 @@
     foreach {key value} [array get ::opts] {
         set $key $value
     }
-
+     
+    if {$padsec} {
+    set padout 0
+    }
+    if {$padout} {
+    log "Padding out points by $padout secs and ignoring program end bookmark" 0
+    }
+ 
     set tailPid 0; # unused (for killing head of pipe on timeout - useful with tail -f recording.ts | ffmpeg ... | silence...)

     set silenceArgs "\
@@ -547,7 +560,23 @@
                     endSeconds]} {

             set totalStartSeconds [expr {$startMinutes * 60 + $startSeconds}]
-            set totalEndSeconds [expr {$endMinutes * 60 + $endSeconds}]
+            if {$cropcmd eq " " && $totalStartSeconds < 10 && $padout} {
+            set padding 3
+            } elseif {$padout} {
+            set padding $padout
+            }
+            set totalEndSeconds [expr {$endMinutes * 60 + $endSeconds - $padding}]
+           if {$totalEndSeconds < 0} {
+               set totalEndSeconds 0
+            }
+            set endMinutes [expr int($totalEndSeconds / 60)]
+            set endSeconds [expr ($totalEndSeconds % 60)]
+            if { [expr {$totalEndSeconds + 10}] > $durn} {
+               set totalEndSeconds [expr {$totalEndSeconds + $padding}]
+               if {$padout} {
+                  set theend 1
+               }
+            }

             log "  ad break found $startMinutes:$startSeconds-$endMinutes:$endSeconds ($totalStartSeconds - $totalEndSeconds)" 0

@@ -565,7 +594,11 @@
                         ladd bookmarks 0 $totalStartSeconds $totalEndSeconds
                     }
                 } else {
-                    ladd bookmarks $totalStartSeconds $totalEndSeconds
+            if {$theend == 0} {
+            ladd bookmarks $totalStartSeconds $totalEndSeconds
+                     } else {
+            ladd bookmarks $totalStartSeconds
+                     }
                 }
             }
             # Update bookmarks and build up crop cmd line as each break is detected.- mymsman  150408
@@ -660,7 +693,11 @@
         set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
         log "ad detection.processed in ${elapsedSeconds}s $elapsedTime - $numAdBreaks ad breaks bookmarked, crop starting" 0

-
+    # calculate post crop edit point bookmarks
+    set len [$ts duration 1]
+    set newbookmark [editpointbm $bookmarks $len]
+    set originalused 0
+       
         # copy & paste from crop/execute.jim  - mymsman 150407
         set rfile $file
         set dir [file dirname $rfile]
@@ -720,6 +757,7 @@
                 set cfile "$tgtpath/$shname-crop.ts"
                 if {![system inuse $cfile]} {  # Rename crop file to original if not in use
                       ts renamegroup "$cfile" "$shname"
+                      set originalused 1
                 }
            } else {
                 log "$file safe_delete failed" 0
@@ -734,6 +772,11 @@
         set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
         log "done...processed in ${elapsedSeconds}s $elapsedTime - $numAdBreaks ad breaks cropped out" 0
         set retcode [list "OK" "$numAdBreaks ad breaks cropped out" ]
+        # save post crop edit point bookmarks
+        if { !$originalused } {
+                set ts [ts fetch "$tgtpath/$shname-crop.ts"]
+            }
+            $ts setbookmarks $newbookmark
     } else  {
         set elapsedSeconds [elapsed $start]
         set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
@@ -746,6 +789,7 @@
     return $retcode
}

+# Chaserun
proc ::detectads::chaserun {ts {Qid 0} {retrynumb 0}} {
     # run ad detection against currently recording program using dlna helper - mymsman 150505
     # creates decrypted, cropped and shrunk copy of file in video root directory.
@@ -768,12 +812,23 @@
     }
     set statustok [system startop -multiple detectads $file]
     set size [$ts size]
+    set stime [$ts get start]
+    set etime [$ts get end]
+    set durn $($etime-$stime)
+    set theend 0
+    set padding 0
     set numAdBreaks 0

     # set each option from settings/overrides
     foreach {key value} [array get ::opts] {
         set $key $value
-    }
+    }     
+    if {$padsec} {
+    set padout 0
+    }
+    if {$padout} {
+    log "Padding out points by $padout secs and ignoring program end bookmark" 0
+    } 
     set tailPid 0; # unused (for killing head of pipe on timeout - useful with tail -f recording.ts | ffmpeg ... | silence...)

     set silenceArgs "\
@@ -788,6 +843,7 @@
     set stime [$ts get start]
     set etime [$ts get end]
     set ctime [clock seconds]
+    set len [$ts duration 1]

     # Check file sharing enabled
     if {[system param DMS_START_ON]} {
@@ -954,9 +1010,24 @@
                     startSeconds  \
                     endMinutes \
                     endSeconds]}  {
-
             set totalStartSeconds [expr {$startMinutes * 60 + $startSeconds}]
-            set totalEndSeconds [expr {$endMinutes * 60 + $endSeconds}]
+            if {$cropcmd eq " " && $totalStartSeconds < 10 && $padout} {
+            set padding 3
+            } elseif {$padout} {
+            set padding $padout
+            }
+            set totalEndSeconds [expr {$endMinutes * 60 + $endSeconds - $padding}]
+            if {$totalEndSeconds < 0} {
+               set totalEndSeconds 0
+            }
+            set endMinutes [expr int($totalEndSeconds / 60)]
+            set endSeconds [expr ($totalEndSeconds % 60)]
+            if { [expr {$totalEndSeconds + 10}] > $durn} {
+               set totalEndSeconds [expr {$totalEndSeconds + $padding}]
+               if {$padout} {
+                  set theend 1
+               }
+            }

             log "  ad break found $startMinutes:$startSeconds-$endMinutes:$endSeconds ($totalStartSeconds - $totalEndSeconds) Frames: $startFrame - $endFrame" 0

@@ -976,7 +1047,11 @@
                         ladd bookmarks 0 $totalStartSeconds $totalEndSeconds
                     }
                 } else {
-                    ladd bookmarks $totalStartSeconds $totalEndSeconds
+            if {$theend == 0} {
+            ladd bookmarks $totalStartSeconds $totalEndSeconds
+                     } else {
+            ladd bookmarks $totalStartSeconds
+                     }
                 }
             }
             # Update bookmarks and build up crop cmd line as each break is detected.- mymsman  150408
@@ -1140,7 +1216,7 @@
             set newtitle  "$title -Len err ([clock format $misdetect -format %T])"
         }
     }
-
+    set originalused 0
     if {$lengtherr == 0} {
         # All OK (as far as we can tell)
         set newtitle  "Done"
@@ -1155,6 +1231,7 @@
                     if {![system inuse $cfile]} {  # Rename crop file to original if not in use
                        exec hmt  "+settitle=$title" "$cpath/$cname.hmt"
                        ts renamegroup "$cfile" "$bname"
+                       set originalused 1
                     }
                     if {![system inuse $tfile]} {  # Delete decrypt file no longer needed
                        $tts delete
@@ -1196,7 +1273,18 @@
             }
             close $recording
     }
-
+ 
+    if { $crop } {
+
+    set newbookmark [ editpointbm $bookmarks $len ]
+
+        # save post crop edit point bookmarks
+        if { !$originalused } {
+                set ts [ts fetch "$tgtpath/$cname.ts"]
+            }
+            $ts setbookmarks $newbookmark
+    }
+ 
     if {$tempQid} {
         # remove temporary entryt from the queue
         log "Removing item $tempQid ($file) from the queue" 1
@@ -1212,13 +1300,17 @@
     set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
     log "done...processed $file in ${elapsedSeconds}s $elapsedTime - $numAdBreaks ad breaks detected" 0
     set retmsg "$numAdBreaks ad breaks detected, $warning"
-
+    if { $crop && $numAdBreaks && $retcode != "FAILED" } {
+     set retmsg "$numAdBreaks ad breaks cropped out. $warning"
+    }
+ 
     system endop $statustok
     release_lock $file
     log "=============================================================" 1
     set ::auto::loglevel ::autologlevel
     return [list $retcode $retmsg $qtime]
-}
+} 
+## proc detectads::chaserun end

proc set_HMT_durn {hmtfn start durn} {
             # Update recording end & stored recording time in hmt file
@@ -1226,3 +1318,45 @@
             exec hmt "+patch32=0x288:$durn"  "$hmtfn.hmt"

}
+
+# calculate post crop edit point bookmarks
+proc editpointbm {bookmarks len} {
+     set keeping 0
+    set start -1
+    set newbookmark "0 "
+    set i -1
+    foreach b $bookmarks {
+        if {$start < 0} {
+            set start $b
+            set removing $b
+            continue
+        }
+        if {$i == 0} {
+            set start $b
+            set endad $($b - $removing)
+            incr removing $($endad - $startad)
+            set i -1
+            continue
+        }
+        set end $b
+        incr keeping $($end - $start)
+        set startad $($b - $removing)
+        append newbookmark "$($startad +3) " 
+        set i 0
+    }     
+    if {$i < 0 && $start > 0} {
+        incr keeping $($len - $start)
+    }
+    set n $([llength $newbookmark] - 1)
+    if {[lindex $newbookmark end] > [expr $keeping - 8] && $n > 0} {
+        set newbookmark [lreplace $newbookmark $n $n]
+        append newbookmark " $($keeping - 8)"
+    } elseif {$n == 0 && $keeping > 0} {
+        append newbookmark " $($keeping - 8)"
+    }
+    if {[lindex $newbookmark end] < [expr $keeping - 60]} {
+        append newbookmark " $($keeping - 8)"
+    }
+ 
+    return $newbookmark
+}

Code:
--- /mod/webif/plugin/detectads/detectads-orig
+++ mod/webif/plugin/detectads/detectads
@@ -133,6 +133,7 @@
                 puts "-brkMinSec  60   = Minimum length of an ad break in seconds"
                 puts "-adMaxSec   65   = Maximum length of a single ad in seconds"
                 puts "-padSec     0    = Adjust ends of ad breaks by n seconds"
+                puts "-padOut     0    = Adjust out points of ad breaks by n seconds"
                 puts "-makeThm    n    = Make thumbnail if it doesn't already exist"
                 puts "-thmOffset  0    = Thumbnail offset from programme start"
         }

Edit: added comments for clarity
 
Last edited:
Before watching Keiser report on RT international I record it. My detectads setting is to bookmark the end of adverts. Months ago detectads used to show bookmarks for the adverts but no longer. Is there any setting that I can use to restore the bookmarking or is detection now a problem with this channel?
 
Before watching Keiser report on RT international I record it. My detectads setting is to bookmark the end of adverts. Months ago detectads used to show bookmarks for the adverts but no longer. Is there any setting that I can use to restore the bookmarking or is detection now a problem with this channel?
What are your detectads settings?
Can you post the content of auto.log and detectads.log for the period around the recording?
 
Thank you for responding:

Detectads settings: chaserun, only bookmark ends of ad breaks, crop recording following ad detection, Delete original recording after processing, write output to same folder as input, other options= none

Could you please indicate where the 2 logs reside.
 
Logs can be viewed on the Diagnostics page,
Since you are using chaserun the detectads.log and possibly chaseget.log would be of most interest
 
Is there any mileage in
only bookmark ends of ad breaks, crop recording following ad detection,
as surely unless both ends of the ads are bookmarked, there is nothing to crop. or will it crop between bookmarks anyway and crop about half of the content? Or am I demonstrating my appalling understanding yet again?
When I set Bookmark Ends Only, I set Crop... to OFF.
 
Is there any mileage in as surely unless both ends of the ads are bookmarked, there is nothing to crop. or will it crop between bookmarks anyway and crop about half of the content? Or am I demonstrating my appalling understanding yet again?
When I set Bookmark Ends Only, I set Crop... to OFF.
Perfectly sensible combination, internally DetectAds knows the both ends of the ad break and can pass them to crop while only storing the end bookmarks on the original file in case you should need to go back to that file if there is a problem with the cropping.
 
I had no idea it did that, presuming the bookmarks were the only communication with crop.

I don't use crop, because I find it no bother to skip to the next bookmark when the ads start, and because I don't want to be forced to review the result in the time window I have before the original gets auto-deleted.
 
I had no idea it did that, presuming the bookmarks were the only communication with crop.

I don't use crop, because I find it no bother to skip to the next bookmark when the ads start, and because I don't want to be forced to review the result in the time window I have before the original gets auto-deleted.
niceplice has always had the option to specify crop points via timestamps on the command line, for chaserun processing where the cut points are not known at invocation time it now reads cutpoints and heartbeats from sysin

You can also keep the input file indefinitely with the Delete input file option, but then you have to manually handle deleting them when no longer required (or create a sweeper rule)

Cropping or not is up to you, personally I prefer hands free viewing and not to have to pick up the remote every few minutes
 
Logs can be viewed on the Diagnostics page,
Since you are using chaserun the detectads.log and possibly chaseget.log would be of most interest
I have just switched off the cropping, and the delete to bin.
Here are extracts from the logs prior to switching of cropping etc.

350525/11/2019 18:40:11 NS(4164)- New Program Length = 0s
350425/11/2019 18:40:11 NS(4164)- Wrote 0 entries to /media/My Video/Renegade Inc__20191125_1830-crop. Stripped 0 packets (0k) of EPG data
350325/11/2019 18:40:11 NS(4164)-
3502at file "/mod/bin/chaseget", line 453
35010 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
3500 Dload Upload Total Spent Left Speed
3499/mod/bin/chaseget:453: Error: % Total % Received % Xferd Average Speed Time Time Time Current
349825/11/2019 18:33:00 NS(4164)- progLen = 0s, 0 bookmarks, HD = 0
349725/11/2019 18:30:02 DA(4164)- ==DETECTADS Chase Run: /media/My Video/Renegade Inc__20191125_1830.ts
349625/11/2019 18:30:02 RM(4144)- DETECTADS: Started /media/My Video/Renegade Inc__20191125_1830.ts for chaserun advert detection
349525/11/2019 18:30:01 RM

Chaseget Log:
500025/11/2019 18:40:11 - CG(8227)- Failed to retrieve entire file 146792448 bytes missing
499925/11/2019 18:39:06 - CG(8227)- System power on attempted
499825/11/2019 18:39:06 - CG(8227)- DLNA Server is NOT running.
499725/11/2019 18:38:06 - CG(8227)- System power on attempted
499625/11/2019 18:38:06 - CG(8227)- DLNA Server is NOT running.
499525/11/2019 18:37:06 - CG(8227)- System power on attempted
499425/11/2019 18:37:06 - CG(8227)- DLNA Server is NOT running.
499325/11/2019 18:36:06 - CG(8227)- System power on attempted
499225/11/2019 18:36:06 - CG(8227)- DLNA Server is NOT running.
499125/11/2019 18:35:06 - CG(8227)- System power on attempted
499025/11/2019 18:35:06 - CG(8227)- DLNA Server is NOT running.
498925/11/2019 18:34:06 - CG(8227)- System power on attempted
498825/11/2019 18:34:06 - CG(8227)- DLNA Server is NOT running.
498725/11/2019 18:33:05 - CG(8227)- System power on attempted
498625/11/2019 18:33:05 - CG(8227)- DLNA Server is NOT running.
498525/11/2019 18:33:05 - CG(8227)- ChaseGet /mod/tmp/Renegade Inc__20191125_1830-inp.ts
 
Last edited:
Ok you are suffering from the same problem described in another thread
Chaseget was unable to start the DLNA server required for decrypting the recording.

The steps for resolving the issue are

Go to the Remote control webif page and check that it controls the Humax
If it doesn't check that the Remote control mode on the Remote Settings page matches the mode in use by the real remote
Next try the "fix-flash-packages" diagnostics on the diagnostic page

If the remote package is working OK try rebuilding the DLNA data base Diag->DLNA Reset->Reset DLNA database
 
Back
Top