You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
Common Lisp
62 lines
1.7 KiB
Common Lisp
;;;; seanut.lisp
|
|
|
|
(in-package #:seanut)
|
|
|
|
(define-opts
|
|
(:name :help
|
|
:short #\h
|
|
:long "help"
|
|
:description "prints this help")
|
|
(:name :version
|
|
:short #\v
|
|
:long "version"
|
|
:description "prints the version")
|
|
(:name :output
|
|
:short #\o
|
|
:long "output"
|
|
:meta-var "DIR"
|
|
:arg-parser #'uiop:ensure-directory-pathname
|
|
:description "location to save downloaded media")
|
|
(:name :media-type
|
|
:short #\m
|
|
:long "media-type"
|
|
:meta-var "TYPE"
|
|
:arg-parser #'validate-media-type
|
|
:description "media type to base our query on")
|
|
(:name :token
|
|
:short #\t
|
|
:long "token"
|
|
:meta-var "TOKEN"
|
|
:arg-parser #'identity
|
|
:description "access token for specified jellyfin server")
|
|
(:name :season-number
|
|
:short #\s
|
|
:long "season"
|
|
:meta-var "SEASON"
|
|
:arg-parser #'maybe-parse-integer
|
|
:description "specify specific season to download, if downloading a show"))
|
|
|
|
(defun build-search-query ())
|
|
|
|
(defun download-media (name url header &optional destination)
|
|
"downloads the media at URL, using HEADER as the authorization header.
|
|
|
|
if DESTINATION is non-nil, dumps media into that directory, otherwise it uses CWD"
|
|
(let ((output (or destination #P"./")))
|
|
(dexador:fetch url (merge-pathnames name output)
|
|
:if-exists nil
|
|
:headers `(("X-Emby-Authorization" . ,header)))))
|
|
|
|
(defun main ()
|
|
"binary entry point"
|
|
(multiple-value-bind (opts args) (get-opts)
|
|
(when (getf opts :help)
|
|
(opts:describe :usage-of "seanut"
|
|
:args "DOMAIN MEDIA-NAME")
|
|
(uiop:quit 0))
|
|
|
|
(when (getf opts :version)
|
|
(quit-with-message 0 "seanut v~A" (seanut-version)))
|
|
|
|
(destructuring-bind (domain search-term) args)))
|