Third draft

This commit is contained in:
M00T 2025-08-02 03:46:52 -04:00
parent 1bd6d12276
commit 165fe82177

View File

@ -29,34 +29,17 @@
(cdr (assoc `preferred-video-codes defaults))
(cdr (assoc `preferred-audio-codes defaults)))
(define (fetch-formats port)
(define* (codes #:optional new-codes)
(if (procedure? codes)
"PROCEDURE"
(format #t "NOT PROCEDURE\nNEW-CODES: ~a\n" new-codes)))
(define (lines-to-values port)
(let* ((this-line (get-line port)))
(if (not (eof-object? this-line))
(let ((video-match (match-video-format this-line))
(audio-match (match-audio-format this-line)))
(cond
(video-match
(let ((video-code (match:substring video-match 1))
(video-resolution (match:substring video-match 2))
(video-moreinfo (match:substring video-match 3)))
(format #t "~a\n" video-code)))
(audio-match
(let ((audio-code (match:substring audio-match 1))
(audio-moreinfo (match:substring audio-match 2)))
(format #t "~a\n" audio-code))))
(fetch-formats port))
(codes))))
;;(define (format-codes ytdl-formats)
(begin
(and audio-match (format #t "~a\n" audio-match))
(and video-match (format #t "~a\n" video-match))
(lines-to-values yt-dlp-port))))))
;; Main
(format #t "~a\n" (fetch-formats yt-dlp-port))
(lines-to-values yt-dlp-port)
(close-port yt-dlp-port)