[bknr-cvs] hans changed trunk/projects/quickhoney/upgrade-stuff/
BKNR Commits
bknr at bknr.net
Tue Sep 16 11:54:40 UTC 2008
Revision: 3903
Author: hans
URL: http://bknr.net/trac/changeset/3903
Add more images, update import script.
A trunk/projects/quickhoney/upgrade-stuff/delicious.gif
U trunk/projects/quickhoney/upgrade-stuff/import.lisp
A trunk/projects/quickhoney/upgrade-stuff/type-animation.png
A trunk/projects/quickhoney/upgrade-stuff/type-birdview.png
A trunk/projects/quickhoney/upgrade-stuff/type-headon.png
A trunk/projects/quickhoney/upgrade-stuff/type-icons.png
A trunk/projects/quickhoney/upgrade-stuff/type-smallworld.png
A trunk/projects/quickhoney/upgrade-stuff/type-spot.png
Added: trunk/projects/quickhoney/upgrade-stuff/delicious.gif
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/delicious.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/projects/quickhoney/upgrade-stuff/import.lisp
===================================================================
--- trunk/projects/quickhoney/upgrade-stuff/import.lisp 2008-09-15 19:22:05 UTC (rev 3902)
+++ trunk/projects/quickhoney/upgrade-stuff/import.lisp 2008-09-16 11:54:39 UTC (rev 3903)
@@ -10,8 +10,7 @@
(error (e)
(format t "~&; error importing ~S: ~A~%" pathname e))))
-(dolist (name '(#p"type-news.png" #p"type-pixel.png" #p"type-shop.png"
- #p"type-vector.png" #p"type-stuff.png" #p"type-pen.png"))
+(dolist (name (directory #P"type-*.png"))
(replace-image name :keywords '(:type)))
(dolist (pathname '(#P"overlay-close.gif"
@@ -72,10 +71,6 @@
(dolist (image (images-in-category '(:shop)))
(setf (slot-value image 'cat-sub) '(:shop :shop))))
-(with-transaction (:categorize-pen-imports)
- (dolist (image (get-keyword-store-images :pen-imports))
- (setf (slot-value image 'cat-sub) (mapcar #'make-keyword-from-string (bknr.images::store-image-directory image)))))
-
(with-transaction (:initialize-news)
(setf (slot-value (find-rss-channel "quickhoney") 'bknr.rss::items)
(sort (remove-if (lambda (image)
@@ -85,6 +80,42 @@
:key #'blob-timestamp)))
(with-transaction (:initialize-animation-mime-types)
- (dolist (animation (mapcar #'quickhoney-animation-image-animation (class-instances 'quickhoney-animation-image)))
+ (dolist (animation (mapcar #'quickhoney-animation-image-animation
+ (class-instances 'quickhoney-animation-image)))
(unless (slot-boundp animation 'bknr.datastore::type)
- (setf (slot-value animation 'bknr.datastore::type) "application/x-shockwave-flash"))))
\ No newline at end of file
+ (setf (slot-value animation 'bknr.datastore::type) "application/x-shockwave-flash"))))
+
+(with-transaction (:delete-obsolete-buttons)
+ (dolist (subcategory '(:birdview :parts :editorial :icons))
+ (dolist (image (get-keywords-intersection-store-images (list :button :pixel subcategory)))
+ (delete-object image))))
+
+(defun import-or-update-image (pathname)
+ (destructuring-bind (cat sub &rest name)
+ (mapcar #'make-keyword-from-string (last (split "/" (namestring (truename pathname))) 3))
+ (declare (ignore name))
+ (let* ((pathname-name (pathname-name pathname))
+ (name (if (scan "^[0-9][0-9]" pathname-name)
+ (format nil "smallworld-~A" pathname-name)
+ pathname-name))
+ (existing-image (store-image-with-name name)))
+ (cond
+ (existing-image
+ (format t "updating existing image ~A from new file~%" name)
+ (copy-file pathname (blob-pathname existing-image))
+ (with-transaction (:update-cat-sub)
+ (setf (slot-value existing-image 'cat-sub) (list cat sub))))
+ (t
+ (format t "importing new image ~A~%" name)
+ (import-image pathname
+ :name name
+ :user (find-user (if (eq :pixel cat) "n" "p"))
+ :keywords-from-dir nil
+ :class-name 'quickhoney-image
+ :initargs (list :cat-sub (list cat sub))))))))
+
+(defun import-directory (directory-pathname)
+ (dolist (pathname (directory (merge-pathnames #P"**/*.*" directory-pathname)))
+ (if (member (pathname-type pathname) '(:png :gif :jpg) :test #'string-equal)
+ (import-or-update-image pathname)
+ (warn "Ignoring file ~A with unknown extension" pathname))))
\ No newline at end of file
Added: trunk/projects/quickhoney/upgrade-stuff/type-animation.png
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/type-animation.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/projects/quickhoney/upgrade-stuff/type-birdview.png
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/type-birdview.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/projects/quickhoney/upgrade-stuff/type-headon.png
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/type-headon.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/projects/quickhoney/upgrade-stuff/type-icons.png
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/type-icons.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/projects/quickhoney/upgrade-stuff/type-smallworld.png
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/type-smallworld.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/projects/quickhoney/upgrade-stuff/type-spot.png
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/type-spot.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the Bknr-cvs
mailing list