xbmc file upload / playlist insert example
[clinton/scratch.git] / rename-x-files.lisp
CommitLineData
34f4b089
CE
1(mapcar #'ql:quickload '(:cl-fad :cl-ppcre))
2
3(defun copy-season (source target)
4 (fad:walk-directory source
5 (lambda (x) (multiple-value-bind (target-name matched?)
6 (ppcre:regex-replace ".*/([0-9]{2})[.]([0-9]{2})[.](?:[0-9]{2})- (.*)"
7 (namestring x)
8 '("Season " 0 " Episode " 1 " - " 2))
9 (when matched?
10 (format t "matched, copying: ~A / ~A~%" x target-name)
11 (fad:copy-file x (merge-pathnames target-name (make-pathname :directory `(:absolute ,target)))))))))
12
13"/srv/archive/video/tv/The X-Files/Season 01"