Permalink
Browse files

Automatr: most-faved works.

  • Loading branch information...
1 parent 10af8d7 commit eda6b6df0a4ff21042902945ef58774a59710dde @schani schani committed Sep 12, 2005
Showing with 21 additions and 2 deletions.
  1. +13 −2 automatr.lisp
  2. +5 −0 clickr.lisp
  3. +3 −0 flickr.lisp
View
@@ -13,8 +13,9 @@
(defparameter *actions* nil)
(defun add-action (name action condition)
- (push (make-action :name name :action action :condition condition)
- *actions*))
+ (let ((actions (remove name *actions* :key #'action-name)))
+ (setf *actions* (cons (make-action :name name :action action :condition condition)
+ actions))))
(defstruct entity
name
@@ -126,6 +127,9 @@
((add-tag ?raw)
(let ((text (text-for-raw-tag raw)))
(not (member text (photo-tags photo) :key #'tag-text :test #'string-equal))))
+ ((add-to-set ?id)
+ (let ((set (make-photoset id)))
+ (not (member photo (photoset-photos set)))))
(?a
(error "Unknown action ~A" a))))
@@ -143,6 +147,9 @@
(case-match (action-action action)
((add-tag ?raw)
(add-tag photo (list raw)))
+ ((add-to-set ?id)
+ (let ((set (make-photoset id)))
+ (add-photo photo set)))
(?a
(error "Unknown action ~A" a))))
@@ -215,3 +222,7 @@
(add-action (intern (format nil "TOP-C~A" num))
`(add-tag ,(format nil "top-c~A" num))
`(>= (count (filter comments (not (eq sender *me*)))) ,bound))))
+
+(add-action 'most-faved
+ '(add-to-set "487122")
+ '(>= (count faves) 6))
View
@@ -355,3 +355,8 @@
(defmethod add-tag ((photo photo) tags)
(photos-add-tags (photo-id photo) tags)
(slot-makunbound photo 'tags))
+
+(defmethod add-photo ((photo photo) (set photoset))
+ (photosets-add-photo (photoset-id set) (photo-id photo))
+ (slot-makunbound photo 'sets)
+ (slot-makunbound set 'photos))
View
@@ -396,6 +396,9 @@
per-page page
optional-args)))
+(defcall "photosets.addPhoto" (photoset-id photo-id)
+ (call :|photoset_id| photoset-id :|photo_id| photo-id))
+
(defcall "photosets.getInfo" (photoset-id)
(let ((result (call :|photoset_id| photoset-id)))
(make-flickr-photoset-info result)))

0 comments on commit eda6b6d

Please sign in to comment.