View Single Post
Old 10-28-2009, 06:26 AM   #841
jj2me
Guru
jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.jj2me ought to be getting tired of karma fortunes by now.
 
Posts: 820
Karma: 8820388
Join Date: Dec 2008
Device: Sony PRS-505, -350; Kindle 3 3G, DX, PW 2; various tablets
Does anybody have some sample code for dealing with incrementing days/months/years in a cover URL?

Here's how the URLs progress for the two recipes I've contributed in this thread:

Sports Illustrated covers (weekly)
http://i.cdn.turner.com/sivault/si_o...1026_large.jpg
http://i.cdn.turner.com/sivault/si_o...1101_large.jpg

Smithsonian covers (monthly):
http://media.smithsonianmag.com/images/200910_cover.jpg
http://media.smithsonianmag.com/images/200911_cover.jpg

Somehow, the code needs to figure out the current date, and try the next likely increment. If failure, decrement 7 days (or 1 month for the monthly magazine).

Since my two home-grown recipes both have this kind of pattern, I presume that others have encountered and solved this problem already. Or is this the exercise that gets me to learn Python?

[EDIT: Ack, the url tags that got automatically inserted for clickability, managed to hide the part of the Sports Illustrated URL which contains year information. Here is what they should look like:
h ttp://i.cdn.turner.com/sivault/si_online/covers/images/2009/1026_large.jpg
h ttp://i.cdn.turner.com/sivault/si_online/covers/images/2009/1101_large.jpg ]

Last edited by jj2me; 10-28-2009 at 10:30 AM.
jj2me is offline