(defvar stuffcast-pmp-pre-command nil
"Command to be executed before accessing the PMP.")
(defvar stuffcast-pmp-wipe-command '("gnupod_search" "-m" "/media/IPOD/" "--delete")
"Command to wipe the PMP clean of previous content.")
(defvar stuffcast-pmp-load-track-command '("gnupod_addsong" "-m" "/media/IPOD/")
"Arguments to load a single track to the PMP.")
(defvar stuffcast-pmp-post-command '("mktunes" "-m" "/media/IPOD/")
"Command to be executed after accessing the PMP.")
(defvar stuffcast-source-file-directory "~/audio/talk/"
"Pathname for the top of the content directory tree.")
(defvar stuffcast-pmp-compatible-file-list '("mp3")
"A list of formats your PMP can play.")
(defmacro with-message (string &rest body)
"Convenience macro for being verbose.
Argument STRING message to the user.
Optional argument BODY forms to evaluate."
`(let* ((before (concat ,string "..."))
(after (concat before "...done")))
(defun stuffcast-newest-file (dir)
"Return the newest file in DIR."
(let ((queue (directory-files dir t (regexp-opt stuffcast-pmp-compatible-file-list)))
(when queue (setq newest (car queue)))
(setq queue (cdr queue))
(when (file-regular-p (car queue))
(nth 4 (file-attributes newest))
(nth 4 (file-attributes (car queue))))
(setq newest (car queue))))
(setq queue (cdr queue)))
(defun stuffcast-do-directory-list (root)
"Return a list of the newest files for each directory in ROOT."
(let ((queue (directory-files root t))
(let ((element (car queue)))
(when (file-directory-p element)
(setq out (append out (list (stuffcast-newest-file element)))))
(setq queue (cdr queue))))
(defun stuffcast-load-file-list (fl)
"Load each file in FL onto the PMP."
(dolist (file fl)
(when (and file (file-regular-p file))
(let ((program (car stuffcast-pmp-load-track-command))
(arguments (cdr stuffcast-pmp-load-track-command)))
(concat "loading " file)
(append arguments (list file))))))))
(defun stuffcast-do-command (command)
"Excecute COMMAND with `call-process'."
(defun stuffcast ()
"Wipe the PMP clean and load the newest content back on."
"running pre command"
"nuking the current contents of the PMP"
"running post command"