You aren't signed in     Sign In    Help

Flickr Pipes / Discuss

Current Discussion

group pool rss -- date submitted
Latest: 8 hours ago
MagpieRSS and thumbnail
Latest: 3 weeks ago
Pipe: Flickr photoset (updated @ 2008-04-27)
Latest: 6 weeks ago
Flickr Group syndication
Latest: 6 weeks ago
Flickr geofeed with BBOX
Latest: 6 weeks ago
Favorites and Sorting, Missing the Addded Date?
Latest: 6 weeks ago
Newlines lost in photo.getInfo description
Latest: 6 weeks ago
random image pipe?
Latest: 2 months ago
Pipe: In which group pools are your photos?
Latest: 2 months ago
Pipes implementations of Flickr API methods
Latest: 2 months ago
Pipe: Flickr relationships (updated @ 2008-04-16)
Latest: 3 months ago
Pipe: Flickr user photostream
Latest: 3 months ago
More...
spacer image

random image pipe?

view profile

frogwasteland  Pro User  says:

Hello, I've been poking around yahoo pipes, and I can't find a module to grab a random value. Maybe this is really basic and I overlooked something? I'm trying to make a pipe that will grab 1 random image from my account, and make an rss feed from that. Each time the feed was called, a new image would result from it.
Any pointers would be greatly appreciated.
Posted at 3:49AM, 4 April 2008 PDT ( permalink )

view photostream

alto maltés is a group administrator alto maltés  Pro User  says:

One solution is to use the web-services offered by random.org to get a random number in your desired range.

Another solution is to generate the current time by setting a “Date Builder” to “Today”, taking its “utime” field, and applying the math to that. I prefer this method. Have a look at this.
Posted 3 months ago. ( permalink )

view photostream

frogwasteland  Pro User  says:

Hi, thanks so much for the link. I have implemented the beginnings of a pipe, but I'm lacking some basic knowledge. I have a module calling a feed, I have your tips on how to generate a random number, but I lack the glue to fit them together. Do I count the image feed, and extract the number for that? I am close, I can feel it, just missing some tools.
Posted 2 months ago. ( permalink )

view photostream

alto maltés is a group administrator alto maltés  Pro User  says:

frogwasteland, let us see…

The objective is to choose 1 photo at random from your photostream.

Suppose we have the total number of photos available through a “Number input” module. Let us call it total. We can get the current UNIX time by creating a “Date Builder” set to “Today”. We connect it to a “String builder” just so that we can choose its “utime” field. Since the pipe will always be called at a different time, we could assume that from one pipe-run to another, this is a large random number, which I shall call time. If we use a “Math” module to perform time % total, then the resultant number is a random number between 0 and total - 1. If we add 1, we get a random number between 1 and total, which is what we want. Let us call this number n.

Once we have n, our task is to get the nth photo in our photostream. One way of doing this is by calling flickr.people.getPublicPhotos with per_page = 1 and page = n.

So now we have a pipe that takes the total number of photos in your photostream as input, and outputs a single item containing the info of a random photo from your photostream.

We create a new pipe that calls flickr.people.getPublicPhotos to get the “total” attribute off the “photos” element (using per_page=1 to economise on bandwidth, since we only need the total), and then pass that total to the pipe we built before, by embedding it inside a “Loop” module.

Some simple transformations to convert the XML to a nice RSS item, and we’re done :)

Make sure you make it take a generic NSID… and post it here for all to use ;)
Posted 2 months ago. ( permalink )

view photostream

frogwasteland  Pro User  says:

Hi, thank you so much for your help so far. So I've created 2 pipes. One just fetches flickr.people.getPublicPhotos to get the total amount (the "number input module". )However, its output seems to be capped at 100 pictures. Is this the flickr max? The second module is working, and calling a different file each time, if I hardcode a number into the simple math field. I've run into some problems embedding the pipe in a loop. If the pipe that is inside the loop is expecting the total value, how exactly is that passed to the simple math number field? I've made a user input module called 'total' and tried to get the photos.photo count into the field, but the pipe will not let me drop the amount in there, which means there is something obvious that has escaped me again.
Originally posted 2 months ago. ( permalink )
frogwasteland edited this topic 2 months ago.

Would you like to comment?

Sign up for a free account, or sign in (if you're already a member).

RSS 2.0 feedSubscribe to a feed of stuff on this page...</!!> Feed – Subscribe to Flickr Pipes discussion threads
Add to My Yahoo!