September 2008 Entries



Well, not exactly, but you can now partake of ten free online Computer Science and Electrical Engineering  courses for free.  No need to signup or anything, just browse and view lectures:

http://www.deviceguru.com/2008/09/17/stanford-frees-cs-robotics-courses/

http://see.stanford.edu




For those that are unfamiliar with Odiogo, it is a site that provides free text-to-speech abilities to your blog and does a pretty good job!  The site takes your RSS feed and converts all the articles in the feed to MP3s.  It also gives you the ability to add a “Listen” button that makes it easy for people to listen to your posts. 

This post will show you a method to insert the Odiogo “Listen” button to all your posts automatically.  The method used here is kind of hacked together, but seems to work.  There may be easier methods, but it was early AM hours and wanted to get it functional.  At the end of the day, it might be best to make a user control for the button, but this should get your started.

Getting started:

The first step is to go to the following link and signup for an account (is quite simple and only takes a couple minutes):

http://www.odiogo.com

After a period of time, your account will be created and they will email you the information about your account which will include your feed#. 

Here is a sample (from this site’s account) of what that will look like:

Important Information:

  • Your Odiogo Feed ID: 153595
  • Your Odiogo Control Page Url: http://podcasts.odiogo.com/aggregated-blogs/podcasts-html.php
  • Your Odiogo RSS Feed Url: http://podcasts.odiogo.com/aggregated-blogs/podcasts-xml.php
  • Your Blog Title: Aggregated Blogs
  • Your Blog Url: http://reflectedthought.com/mainfeed.aspx
  • Your Blog Feed Url: http://reflectedthought.com/mainfeed.aspx

For our purpose the feed ID is the only information we need to add the button to our posts. 

On my installation of Subtext Version 2.0.0.43, I modified the following controls to the skin I use along with added the Odiogo JavaScript link in the header of the DSP.aspx file to automatically include it to all skins and blogs.

Additions to the DSP.aspx page:

Before the close of the </head> tag, add:

<script type="text/javascript" src="http://podcasts.odiogo.com/odiogo_js.php?feed_id=153595&platform=be"></script>

Additions to the Days.ascx and EntryList.ascx:

At the top of the page after the import statements and before the HTML starts, I added this routine:

<script runat="server">

string SetUrlPage(string theValue)
{
   string urlPage = theValue.Substring(0, theValue.Length - 5).Replace('-', '_');
   urlPage = urlPage.Substring(urlPage.LastIndexOf(
"/")+1);
   return urlPage;
}
</script>

In the skin I based my skin off of, it has a “<div class="post">“ right under the <itemtemplate>.  This is where I inserted after the div:

<script type="text/javascript"><!--
showOdiogoReadNowButton('153595', '<%# DataBinder.Eval(Container.DataItem, "Title") %>', '<%# SetUrlPage((string) DataBinder.Eval(Container.DataItem, "Url")) %>', 290, 55);
//--></script><br />
<
script type="text/javascript"><!--
showInitialOdiogoReadNowFrame(
'153595','<%# SetUrlPage((string) DataBinder.Eval(Container.DataItem, "Url")) %>',290, 0);

//—>

</script><br />

Here, you would replace the feed ID (153595) with your own feed ID.

Additions to ViewPost.aspx:

ViewPost was a bit different though.  I did not see a way to access the entry class data, so I ended up retrieving the data and working with it directly.  Where I wanted the listen button to appear (in mine just above the body), I inserted:

<%

Entry entry = Subtext.Framework.Data.Cacher.GetEntryFromRequest(CacheDuration.Short);
string urlPage = entry.FullyQualifiedUrl.Segments[6];
urlPage = urlPage.Substring(0,urlPage.Length-5).Replace(
'-','_');

%>

<script type="text/javascript"><!--
showOdiogoReadNowButton(
'153595', '<%= entry.Title %>', '<%= urlPage %>', 290, 55);
//--></script><br />
<
script type="text/javascript"><!--
showInitialOdiogoReadNowFrame(
'153595','<%= urlPage %>',290, 0);
//--></script>

Again, you need to change the feed ID (‘153595’) to the feed ID you received from Odiogo.