finishing up the StatusNet plugin for popcorn-js

Well, it’s been an interesting journey trying to finish the status.net plugin for popcorn-js.  The past weekend I’ve been busy getting it finished in between studying for exams.  I had finished writing the plugin and a demo page for it, but I needed to write unit tests for it using the qunit framework.  I had some troubles getting the test to work properly, but I hopped onto the #popcorn channel on IRC and dseif was very helpful and supportive in looking over my code and my unit test – a pre-unit review review, so to speak.  He helped me figure out writing tests, and also pointed out an initial flaw in my plugin – that if you rewind or restart the popcorn video, the events would not reappear (commit f7 on the statusnet branch.)  He gave some pointers on how to go about fixing that issue, and I ended up rewriting a lot of my plugin code.  I had a lot of code in a separate function that could have been moved into the setup function of the plugin; additionally I altered the functionality of my plugin to do css display changing on the start and end function so that the statusnet events would be able to appear and reappear even after replaying the video.

Unfortunately, due to the limitations of the status.net javascript API, the plugin will only work when run against your own instance of StatusNet.  As quoted directly from the statusnet api wiki:

Let’s make the Connection First

  • First you need to acquire a Consumer Key and a Secret for your callback url (which is your webpage)
  • you can get them from here – http://mystatus.net/settings/oauthapps (http://mystatus.net – change this with your StatusNet URL)
  • Then paste following code in the head section of your web page of blog
    <script type='text/javascript' src='http://mystatus.net/js/api.js' ></script>  
    <script type="text/javascript">
        SN.init('your consumer key', 'your consumer secret);
    </script>

The api requires a unique customer key and secret to work.  So as far as I understand, unless someone else gave your their own consumer key and secret (who would do that?), you would not be able to create widgets for them.

In any case, I had finally finished the plugin, the demo, and the unit tests.  So on Sunday I put it up for review.  cadecairos reviewed it on Monday, and after seeing that the plugin required an instance of StatusNet to run properly, said that while the plugin was interesting, he was unable to include it in the official repo until the structure of the plugin community was finalized.  😦  But who knows.  Maybe one day the StatusNet api will become more flexible and thus allow the statusnet plugin to really come alive.

As always, the plugin is available at https://github.com/nm486/popcorn-js/tree/statusnet under the plugin/statusnet folder, latest commit.  Thanks to everyone involved in helping make this an interesting learning experience for me into the world of open source.  I wish it worked out better in the end.

Advertisements

~ by stan on December 14, 2011.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: