Software architecture

From Wikibabel

Jump to: navigation, search

All lessons are stored as an XML string in a standard wiki page that contains nothing else.

Contents

[edit] Mediawiki

Mediawiki provides all the standard wiki features (to cut a long story short: more or less all the features of wikipedia). This is a list of the main feature we actually use for wikibabel:

  • basic page viewing and editing (see how we extend it below)
  • sessions and authentication
  • user preferences and interface localisation (not implemented in our extensions yet)
  • page versioning
  • media file storage and versioning

[edit] The lesson viewer

On top of the normal wiki page, wikibabel lessons are contained within <wikibabel> tags that trigger a specific processing when someone tries to view one of them. This code is contained in ViewLesson.php. Mediawiki provides a hook for this, and we just implement how we should respond to such a call.

In our case, we load the XML content of the lesson, format it to HTML using PHP built-in XSLT processing and send it back to Mediawiki to display. The XSLT code is in ViewLesson.xsl

[edit] The lesson editor

There is a special hook to perform specific actions when the user requests to edit a page. When "edit" is requested for a lesson page, we ignore the standard edit system, and run ours, which is defined in EditLesson.php. Most of the interaction with the user during editing is contained in the javascript code in EditLesson.js.

[edit] The sound recorder

During the editing session, each time the user clicks the microphone icon to record some sound, Javascript code in SoundRecorder.js is executed. Javascript is used to display the overlay containing the flash app and the relevant information around it.

[edit] Client side

The sound recording itself is done by a small flash app which is described in micro/micro.mxml. The code is very short thanks to the nice functions provided by the flash streaming server. Basically, we request the server to open a recording stream, give it a name, plug the microphone into it, and say "thank you" when we're done with recording. The encoding, streaming, buffering and all those details are handled by flash. Easy.

[edit] Server side

Red5 is an open source implementation of a Flash server. We use it to stream the sound recordings from the client side recording flash application to the server side. Red5 simply saves a .flv file on the server, which we then process into an OGG file using php and ffmpeg+sox for actual sound processing.

[edit] The wikicast generator

Every time a lesson is saved, a new version of the wikicast is generated. More exactly, a request to generate a new version is queued in Mediawiki's job queue (but on our server, there isn't much more than these jobs anyway).

Each time a generation job is picked from the queue, the generator does the following:

  • get the lesson XML content from the database
  • use XSLT to convert that XML to a list of SoundBit files (.ogg)
  • get the full path to those files and check if the file exists. If not, stop processing.
  • add an intro and ending sound (the ones that say: "this is a Wikibabel podcast" and "this is the end of the lesson...")
  • concatenate all the Soundbits together
  • run some sound processing to clean up the result (deactivated for now)
  • add tags to the file
  • and save it in a proper location, ready for downloading.

[edit] Backoffice stuff

Support classes and functions. (TODO)

[edit] Other bits

[edit] Subversion

All the source code to the project is kept on a Subversion repository, as it seems to be fairly simple to start using and scalable well beyond our needs.