I have a slideshow. User can select a button "Like This Image" - this gets URLtransfer to download a file to /tmp, but the point is simply accessing the URL, which is a PHP file which sends me email with the name of the image the user clicked on. All this works fine. The problem is it only works with one particular image. It will work repeatedly while on that image. The debugger prints that the proper title/variable is present in the urlTransfer function on all images, but this only works with this particular image, weather its first or 10th in the slideshow. I dont see how the Roku cares which image its on in this case as its getting the proper titles from the variable curr_photo below. Here are the two releveant lines form the code:
The title of the image that works is "Midtown". Its the first one in that particular slideshow. It also appears in another slideshow at a random location. In both cases the email thing goes through. The second title is "Second Avenue". It doesn't work, nor does a couple of others i tried. Is there something wrong with my /tmp title? It should be making unique names for each as in "xxMidtown", "xxSecondAvenue" etc. I'm under the impression that I"m solving any cache problems that way, No? Does the Roku check for the existence of the file first, and if its there it doesn't send the url request? That would definitely indicate a cache problem
How do I delete the file in tmp/ each time? I would try that since its not needed anyway.
theEndless - I have a print command in the function that does all this, and it is printing the proper title each time. There is a canvas that pops up and says "thank you" for 2 seconds and then the debugger prints the proper title, so i think that means the right value is set for that variable, am I wrong about that?
Ok i just tried starting the app fresh, and the email worked with a different image, but then not with any others, so the problem is it works once and then not again, the image itself is not the problem it seems like cache issues yes?
I agree with TheEndless - You want to watch it work in the debugger and add some prints. UT.SetUrl("http://www.xxx.com/roku/url/thankyou.php?subject=" + curr_photo.GetTitle() + ".roku") print UT.GetURL() UT.AsyncGetToFile("tmp:/xx"+ curr_photo.GetTitle())
The reason for GetURL is to make sure it is properly encoded to grab the correct image from your server script. Maybe execute your php script manually in a browser with some echo'd debugging information using the URL that was printed for the retrieval request too. If it's caching, then you can add a cache breaker using a timestamp on the url request - ie
Alternately, you could retrieve the file as a new name each time in the tmp folder and keep track of the new name in an array, older files will be pushed out of tmp when it fills up. To learn how to delete a file - look at roFileSystem
Ok thanks both of you. I'll work on it awhile, I'm got it to work with one slideshow but not another, I think I'm confusing the roku somehow with how its written, I'll add some prints and see what happens. thanks again for weighing in, i know i'll get it eventually.
Thanks again to theEndless and destruk, I have solved this. It really wasn't a Roku problem. I was using the image title in the GetURL, and some of the titles had two words, so there was a space in between and thats a no-go in a URL. I switched to sending the filename of the image, where there no spaces and it works every time. Using the print command on GetUrl made it obvious once i tried it on a bunch of pics in a row. Also did work out deleting the tmp file but it wasn't really the issue, nice to be tidy i guess.