change csv-parser to ffprobe-out-parser
use #\page as the separator for ffprobe 'csv' output
This commit is contained in:
parent
f37ec47ee1
commit
0839a6be14
@ -17,6 +17,7 @@
|
|||||||
(define mysql-col-sep #\tab)
|
(define mysql-col-sep #\tab)
|
||||||
(define ffmpeg-bin "/usr/local/bin/ffmpeg")
|
(define ffmpeg-bin "/usr/local/bin/ffmpeg")
|
||||||
(define ffprobe-bin "/usr/local/bin/ffprobe")
|
(define ffprobe-bin "/usr/local/bin/ffprobe")
|
||||||
|
(define ffprobe-separator #\page) ;;
|
||||||
(define recordings-directory "/var/lib/mythtv/recordings")
|
(define recordings-directory "/var/lib/mythtv/recordings")
|
||||||
(define working-directory "/mnt/lvraid5/ffmpeg-cut-list.d")
|
(define working-directory "/mnt/lvraid5/ffmpeg-cut-list.d")
|
||||||
(define mythtv-recorded-table->metadata-list '(chanid starttime endtime title subtitle description season episode recordid seriesid programid inetref previouslyshown originalairdate))
|
(define mythtv-recorded-table->metadata-list '(chanid starttime endtime title subtitle description season episode recordid seriesid programid inetref previouslyshown originalairdate))
|
||||||
@ -97,9 +98,8 @@
|
|||||||
(map (lambda(x) (dsv-splitter x d)) s))
|
(map (lambda(x) (dsv-splitter x d)) s))
|
||||||
(#t
|
(#t
|
||||||
(error "dsv-splitter" "encountered a not list/string"))))
|
(error "dsv-splitter" "encountered a not list/string"))))
|
||||||
(define* (csv-parser s #:optional (r #f))
|
(define* (ffprobe-out-parser s)
|
||||||
(let ((l (dsv-splitter (delete "" (dsv-splitter s #\newline)) #\page))) ;; #\page =
|
(dsv-splitter (delete "" (dsv-splitter s #\newline)) ffprobe-separator))
|
||||||
(if r (read-from-string l) l)))
|
|
||||||
(define (k-v-parser s)
|
(define (k-v-parser s)
|
||||||
(read-from-string (dsv-splitter s #\=)))
|
(read-from-string (dsv-splitter s #\=)))
|
||||||
(define (make-dotted-alist s)
|
(define (make-dotted-alist s)
|
||||||
@ -130,15 +130,15 @@
|
|||||||
|
|
||||||
|
|
||||||
(define (ffprobe-video-packets file filter-rule)
|
(define (ffprobe-video-packets file filter-rule)
|
||||||
(let ((frame-info (csv-parser
|
(let ((frame-info (ffprobe-out-parser
|
||||||
(shell-command-to-string (simple-format #f "~a -v error -select_streams v:0 -show_entries frame=pkt_pts_time,pkt_pos,pict_type,coded_picture_number,interlaced_frame:side_data=nil -print_format csv=nokey=1:print_section=0:s='' -i '~a'" ffprobe-bin file)))))
|
(shell-command-to-string (simple-format #f "~a -v error -select_streams v:0 -show_entries frame=pkt_pts_time,pkt_pos,pict_type,coded_picture_number,interlaced_frame:side_data=nil -print_format csv=nokey=1:print_section=0:s='~a' -i '~a'" ffprobe-bin ffprobe-separator file)))))
|
||||||
(read-from-string (filter filter-rule frame-info))))
|
(read-from-string (filter filter-rule frame-info))))
|
||||||
(define (ffprobe-i-frames file)
|
(define (ffprobe-i-frames file)
|
||||||
(ffprobe-video-packets file (lambda(l) (string=? "I" (third l)))))
|
(ffprobe-video-packets file (lambda(l) (string=? "I" (third l)))))
|
||||||
|
|
||||||
(define (ffprobe-stream-info file)
|
(define (ffprobe-stream-info file)
|
||||||
(let* ((stream-info (shell-command-to-string (simple-format #f "~a -v error -show_streams -print_format csv=nokey=0:s='' -i '~a'" ffprobe-bin file))))
|
(let* ((stream-info (shell-command-to-string (simple-format #f "~a -v error -show_streams -print_format csv=nokey=0:s='~a' -i '~a'" ffprobe-bin ffprobe-separator file))))
|
||||||
(map make-dotted-alist (k-v-parser (csv-parser stream-info)))))
|
(map make-dotted-alist (k-v-parser (ffprobe-out-parser stream-info)))))
|
||||||
|
|
||||||
;; (define (mythutil-get-cut/skip-list chanid starttime cut-or-skip)
|
;; (define (mythutil-get-cut/skip-list chanid starttime cut-or-skip)
|
||||||
;; (let ((drop (if (eq? cut-or-skip 'skip) 22 9))
|
;; (let ((drop (if (eq? cut-or-skip 'skip) 22 9))
|
||||||
|
Loading…
Reference in New Issue
Block a user