(concord-assign-genre 'image-resource "/usr/local/var/photo/db")
-(defun concord-images-encode-url-as-id (url)
+(defun concord-images-encode-url-as-id (url &optional base)
(let (ret)
(cond
+ ((and base
+ (string-match (concat "^" (regexp-quote base)) url))
+ (setq ret (substring url (match-end 0)))
+ (if (string-match "\\.[a-zA-Z0-9]+$" ret)
+ (substring ret 0 (match-beginning 0))
+ ret)
+ )
((string-match "^http://\\(hng\\|image\\)\\.\\(chise\\.org\\|kanji\\.zinbun\\.kyoto-u\\.ac\\.jp\\)/images/iiif/" url)
(setq ret (substring url (match-end 0)))
(if (string-match "\\.[a-zA-Z0-9]+$" ret)
(t
url))))
-(defun concord-images-add-url (url &optional iiif iip)
+(defun concord-images-add-url (url &optional iiif iip base)
(let (img-id img-cobj)
(unless (setq img-cobj (concord-decode-object '=location url
'image-resource))
- (setq img-id (intern (concord-images-encode-url-as-id url)))
+ (setq img-id (intern (concord-images-encode-url-as-id url base)))
(setq img-cobj (concord-make-object 'image-resource img-id))
(concord-object-put img-cobj '=location url)
(when iiif
)
img-cobj))
-(defun concord-images-add-iiif (url)
+(defun concord-images-add-iiif (url &optional base)
(let (img-id img-cobj)
(unless (setq img-cobj (concord-decode-object '=location url
'image-resource))
- (setq img-id (intern (concord-images-encode-url-as-id url)))
+ (setq img-id (intern (concord-images-encode-url-as-id url base)))
(setq img-cobj (concord-make-object 'image-resource img-id))
(concord-object-put img-cobj '=location@iiif url))
img-cobj))