ffmpeg-myth1, ffmpeg-myth0 update

ffmpeg-myth1: check the recording basename of the rec and tr-rec, if
they are equal, don't schedule a deletion

ffmpeg-myth0: institute an error handler around ffmpeg-myth1

ffmpeg-myth-do-pending-jobs: institute job control to prevent a collision
This commit is contained in:
Leo Butler 2022-05-12 11:47:58 -05:00
parent 599e269e67
commit f20aa31a72

View File

@ -657,21 +657,34 @@
(mysql-start-transaction "")
(mythconverg-update-recorded-seek-table tr-rec)
(mythconverg-update-recordedmarkup-table tr-rec)
(mythconverg-update-ltbtranscodedtobedeleted rec)
(unless (equal? (recording-basename rec) (recording-basename tr-rec))
(mythconverg-update-ltbtranscodedtobedeleted rec))
;; mysql-commit in this step
(mythconverg-update-recorded-table rec tr-rec)
(mythconverg-execute mysql-cmd)
(list rec tr-rec))
(lambda (key . args)
(list rec tr-rec 'error)))))
(define (ffmpeg-myth0 chanid starttime cut-or-skip)
(catch #t
;; thunk
(lambda () (ffmpeg-myth1 chanid starttime cut-or-skip))
;; handler
(lambda (key . rest) (simple-format #t "Error in ffmpeg-myth0: key=~a\nrest=~a\n" key rest) '())))
(define (ffmpeg-myth-cut c-s)
(ffmpeg-myth0 (car c-s) (cadr c-s) 'cut))
(define (ffmpeg-myth-skip c-s)
(ffmpeg-myth0 (car c-s) (cadr c-s) 'skip))
(define* (ffmpeg-myth-do-pending-jobs #:optional (days 7))
(let ((days (if (number? days) days 7)))
(map ffmpeg-myth-cut (mythconverg-pending-jobs days))))
(let ((days (if (number? days) days 7))
(how-many-running? (read-from-string (shell-command-to-string "ps -C ffmpeg-myth.scm -o pid=,time= | wc -l"))))
(cond ((eq? how-many-running? 1)
(map ffmpeg-myth-cut (mythconverg-pending-jobs days)))
(#t
(simple-format #t "ffmpeg-myth-do-pending-jobs: found ~a instances of ffmpeg-myth.scm running. Abort.\n" how-many-running?)))))
(define* (tmp-test #:optional (x 7))
(simple-format #t "~a\n" x) (force-output))