Monday, November 22, 2010

Neglected blog but not neglected code

Been awhile since I posted on here. Just been busy supporting my own sites as well as all the sites I have done for work. Any way I just wanted to point out that I have made an update to the youtube library I wrote for CodeIgniter. Apparently there was an issue with larger responses from YouTube not being handled properly. Basically for larger requests the data is broken into chunks with a specified size. The problem was that my read method was only reading the first chunk. Which wasn't a problem for me until I finally went over the one chunk threshold and was losing data. Anyway that is fixed and should now correctly get all chunks of data. (Though I could only test with 2 as that is my current threshold)

Also I added a new api method to that library which will allow you to post comments on a video or reply to a comment thread for a video. The method is called addComment and it accepts 2 parameters with an optional 3rd if you are replying. The first is the videoId which is the video to post the comment on, the next is the comment text, and the optional 3rd parameters is the commentId if you are responding.  

I also updated the wiki post on the codeigniter site here
And placed the latest version in my dropbox share here

One thing to note I think I left the code in debug mode, which shouldn't do anything really, it will just write out a bunch of stuff to your php error log. You can turn it off by setting the DEBUG flag to false.

[EDIT] Looks like there was another bug. If a youtube response had newlines in it, maybe in a description field or something, then we would only read to the new line and stop. I fixed this as well the updated version is on the drop box share. Also updates are on the wiki.