Click here to show or hide the menubar.

Home >  Archive >  2011 >  March >  11

Previous / Next

Writing callbacks for mediaRSS
By Adam Curry on Friday, March 11, 2011 at 5:49 PM.
This is a running log of my progress on writing callbacks to create a mediaRSS feed in Radio2 permalink
Easiest way seems to add some kind of 'trigger' in the Description field of the post that will alert the callbacks to work. permalink
Something like: [THUMBNAIL:https://s3.amazonaws.com/adamcurry/BAS+Appisodes/2011/03/10/aloqaLabel.png] permalink
The script needs to: permalink
recognize it permalink
write the namespace tag appropriately permalink
erase the trigger from the post permalink
First I want to see if I can get the callbacks to work at all, by using the example script. permalink
return ("" + random (1, 1000) + "") permalink
dialog.alert (addRandomNumber (nil, nil)) permalink
Attempting to get the item level call backs to work. This sin't happening for some reason with the test script. permalink
I think I have to change the adrfeed to something like adritem permalink
adritem isn't the right one. permalink
I'm now going to walk through the post code to see if I can figure out what gets written and what adr I need to be looking at. permalink
OK, I was missing a parameter. The full list is: (adruser, adrfeed, adritem) permalink
3/11/11; 11:41:25 AM by AC It is now writing my thumbnail at the item level permalink
3/11/11; 11:50:02 AM by AC HA! I was able to create a 'trap'. by adding the string [THUMBNAIL] to the post, it triggered a write from the callback with a URL, without the trigger word, it wrote a line saying it didn't work. permalink
return ("" + "https://s3.amazonaws.com/adamcurry/BAS+Appisodes/2011/03/10/aloqaLabel.png" + "") permalink
return ("" + "The trap didn't work" + "") permalink
dialog.alert (addThumbnail (nil, nil, nil)) permalink
Use the trigger word followed by a URL to the thumbnail permalink
Add ONLY the url to the callback write permalink
Delete the whole trigger line from the post so it doesn't get written in the feed. permalink
s = string.firstWord (adritem^.description) permalink
s = string.delete (s, 1, 10) permalink
return ("" + s + "") permalink
return ("" + "The trap didn't work" + "") permalink
dialog.alert (addThumbnail (nil, nil, nil)) permalink
Now I need to delete the url and the trigger from the actual post. permalink
If possible permalink
I got pretty far! permalink
I now can add the trigger, have the url written and the trigger removed from the description, but I still have to publish twice in order for the trigger to get stripped out of the description in the actual feed. permalink
All in all not bad! permalink
s = string.firstWord (adritem^.description) permalink
s = string.delete (s, 1, 10) permalink
table.assign (@adritem^.thumbnail, s) permalink
t = adritem^.thumbnail permalink
table.assign (@scratchpad.adamTemp, adritem^.description) permalink
z = string.replace (scratchpad.adamTemp, "THUMBNAIL:" + t, "") permalink
table.assign (@adritem^.description, z) permalink
return ("" + t + "") permalink
t = adritem^.thumbnail permalink
return ("" + t + "") permalink
dialog.alert (addThumbnail (nil, nil, nil)) permalink
s = string.firstWord (adritem^.description) permalink
s = string.delete (s, 1, 10) permalink
table.assign (@adritem^.thumbnail, s) permalink
t = adritem^.thumbnail permalink
table.assign (@scratchpad.adamTemp, adritem^.description) permalink
z = string.replace (scratchpad.adamTemp, "THUMBNAIL:" + t, "") permalink
table.assign (@adritem^.description, z) permalink
return ("\r\t\t\t\t\r\t\t\t") permalink
t = adritem^.thumbnail permalink
return ("\r\t\t\t\t\r\t\t\t") permalink
dialog.alert (addThumbnail (nil, nil, nil)) permalink
3/11/11; 5:19:27 PM by AC permalink
I see now that I am running into a problem, I need to be able to declare the namespace for media content. Hopefully there is a callback to do that somehwere in here... Link permalink
Line needed: "+"\r\t\txmlns:media=\"http://search.yahoo.com/mrss/\" permalink



This site contributes to the scripting.com community river.


© Copyright 1997-2012 Adam Curry. Last update: Saturday, March 12, 2011 at 12:40 AM GMT. Last build: 5/8/2012; 2:44:58 PM. "It's even worse than it appears."

RSS feed for blog.curry.com

Previous / Next