Recently Written · git

librivox

Automated youtube uploading of audiobooks

git clone https://github.com/equwal/librivox

Log | Files | Refs


src/uploader.lisp (1697 bytes)

1 ;;;; Example request:
2 ;;;; python upload_video.py --file="/tmp/test_video_file.flv"
3 ;;;; --title="Summer vacation in California"
4 ;;;; --description="Had fun surfing in Santa Cruz"
5 ;;;; --keywords="surfing,Santa Cruz"
6 ;;;; --category="22"
7 ;;;; --privacyStatus="private"
8 
9 (in-package #:librivox)
10 
11 (defun pair-keywords (keywords)
12   "Generate a proper bash call for paired keywords."
13   (labels ((inner (keywords first acc)
14              (if (null keywords)
15                  ""
16                  (if first
17                      (inner (cdr keywords) nil (car keywords))
18                      (inner (cdr keywords) nil (concatenate 'string
19                                                             ","
20                                                             (car keywords)))))))
21     (inner keywords t "")))
22 
23 (defun upload (&key file
24                  title
25                  description
26                  keywords
27                  category
28                  privacy-status)
29   (run-line (concatenate 'string
30                          "--file=\""
31                          *downloads-dir*
32                          file
33                          "\" "
34                          "--title=\""
35                          title
36                          "\" "
37                          "--description=\""
38                          description
39                          "\" "
40                          "--keywords=\""
41                          (pair-keywords keywords)
42                          "\" "
43                          "--category=\""
44                          category
45                          "\" "
46                          "--privacyStatus=\""
47                          privacy-status
48                          "\"")))