1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-27 09:24:45 +00:00

Extend Flickr helpers to support photoTiddlerTemplate parameter

This commit is contained in:
jeremy@jermolene.com 2023-04-19 10:17:21 +01:00
parent d0572147a3
commit 20e873ad31

View File

@ -4,7 +4,7 @@ tags: $:/tags/Macro
<!--
Get items from a Flickr album/interestingness/collection etc.
-->
\procedure flickr-get-items(per_page:"100",page_number:"1",method:"flickr.photosets.getPhotos",paramName:"group_id",paramValue:"",resultPhotoRoot:"photoset",photoTiddlerTemplate:"$:/plugins/tiddlywiki/geospatial/macros/Flickr/DefaultPhotoTemplate")
\procedure flickr-get-items(per_page:"100",page_number:"1",method:"flickr.photosets.getPhotos",paramName:"group_id",paramValue:"",resultPhotoRoot:"photoset",photoTiddlerTemplate)
\procedure completion()
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
@ -24,11 +24,6 @@ Get items from a Flickr album/interestingness/collection etc.
>
<$list filter="[<photoTiddlerTemplate>indexes[]]" variable="fieldName">
<$let fieldValueFilter={{{ [<photoTiddlerTemplate>getindex<fieldName>] }}}>
<$action-log
$tiddler=<<photoTiddlerTitle>>
$field=<<fieldName>>
$value={{{ [subfilter<fieldValueFilter>] }}}
/>
<$action-setfield
$tiddler=<<photoTiddlerTitle>>
$field=<<fieldName>>
@ -57,44 +52,48 @@ Get items from a Flickr album/interestingness/collection etc.
https://api.flickr.com/services/rest/
\end request-url
<$action-sendmessage
$message="tm-http-request"
url=<<request-url>>
method="GET"
query-method=<<method>>
query-extras="geo"
query-per_page=<<per_page>>
query-page=<<page_number>>
query-format="json"
query-nojsoncallback="1"
$names="[<paramName>addprefix[query-]]"
$values=<<paramValue>>
header-accept="application/json"
password-query-api_key="flickr-api-key"
bind-status="$:/temp/flickr/status"
bind-progress="$:/temp/flickr/progress"
oncompletion=<<completion>>
onprogress=<<progress>>
var-method=<<method>>
var-per_page=<<per_page>>
var-page_number=<<page_number>>
var-resultPhotoRoot=<<resultPhotoRoot>>
var-photoTiddlerTemplate=<<photoTiddlerTemplate>>
/>
<$let
photoTiddlerTemplate={{{ [<photoTiddlerTemplate>!is[blank]else[$:/plugins/tiddlywiki/geospatial/macros/Flickr/DefaultPhotoTemplate]] }}}
>
<$action-sendmessage
$message="tm-http-request"
url=<<request-url>>
method="GET"
query-method=<<method>>
query-extras="geo"
query-per_page=<<per_page>>
query-page=<<page_number>>
query-format="json"
query-nojsoncallback="1"
$names="[<paramName>addprefix[query-]]"
$values=<<paramValue>>
header-accept="application/json"
password-query-api_key="flickr-api-key"
bind-status="$:/temp/flickr/status"
bind-progress="$:/temp/flickr/progress"
oncompletion=<<completion>>
onprogress=<<progress>>
var-method=<<method>>
var-per_page=<<per_page>>
var-page_number=<<page_number>>
var-resultPhotoRoot=<<resultPhotoRoot>>
var-photoTiddlerTemplate=<<photoTiddlerTemplate>>
/>
</$let>
\end
\procedure flickr-get-photos-of-user-items(userID)
<$macrocall $name="flickr-get-items" method="flickr.people.getPhotosOf" paramName="user_id" paramValue=<<userID>> resultPhotoRoot="photos"/>
\procedure flickr-get-photos-of-user-items(userID,photoTiddlerTemplate)
<$macrocall $name="flickr-get-items" method="flickr.people.getPhotosOf" paramName="user_id" paramValue=<<userID>> resultPhotoRoot="photos" photoTiddlerTemplate=<<photoTiddlerTemplate>>/>
\end
\procedure flickr-get-group-items(groupID)
<$macrocall $name="flickr-get-items" method="flickr.groups.pools.getPhotos" paramName="group_id" paramValue=<<groupID>> resultPhotoRoot="photos"/>
\procedure flickr-get-group-items(groupID,photoTiddlerTemplate)
<$macrocall $name="flickr-get-items" method="flickr.groups.pools.getPhotos" paramName="group_id" paramValue=<<groupID>> resultPhotoRoot="photos" photoTiddlerTemplate=<<photoTiddlerTemplate>>/>
\end
\procedure flickr-get-album-items(albumID)
<$macrocall $name="flickr-get-items" method="flickr.photosets.getPhotos" paramName="photoset_id" paramValue=<<albumID>> resultPhotoRoot="photoset"/>
\procedure flickr-get-album-items(albumID,photoTiddlerTemplate)
<$macrocall $name="flickr-get-items" method="flickr.photosets.getPhotos" paramName="photoset_id" paramValue=<<albumID>> resultPhotoRoot="photoset" photoTiddlerTemplate=<<photoTiddlerTemplate>>/>
\end
\procedure flickr-get-interesting-items()
<$macrocall $name="flickr-get-items" method="flickr.interestingness.getList" resultPhotoRoot="photos"/>
\procedure flickr-get-interesting-items(photoTiddlerTemplate)
<$macrocall $name="flickr-get-items" method="flickr.interestingness.getList" resultPhotoRoot="photos" photoTiddlerTemplate=<<photoTiddlerTemplate>>/>
\end