Posts Tagged ‘tutorial’

When it comes to acceptance testing your app or repository. It’s good to be able to run through different scenarios, on different operating systems using different boxee versions (alpha/beta). A common scenario is releasing a new version of an existing an app to users, some of whom already have it and some that don’t. Using virtualisation you can mimick those with v1.0 and those without, with a clean Boxee install just like your users customers will be using.

As always there’s more than one way to do this. This is how I did it for free, installing Sun’s Virtual Box v3 onto WinXP box (the host machine) and running Ubuntu as a virtual machine (the guest machine). If you want a more robust testing environment, the legal way, costs money for OS licenses and you’ll need something besides Virtual Box if you want Mac OS as a guest machine. It’s a balance between time/cost and risk. For me, I was moving my repository sub-domain to a different location at my hosts and I needed to be able to check that the repository was up and running OK. The best way to do this was on a boxee install that didn’t already have my repository and apps added.

1. Download and install Virtual Box

Download the edition of Virtual Box for your OS. and install it. It will disconnect your network connection for a few seconds and reconnect again.

2. Download Ubuntu

Download the ubuntu iso from The latest 32-bit desktop version is fine. I’m using 9.10 Karmic Koala.

3. Setup the Virtual Machine

Open Virtual Box and click ‘New’ to launch the new virtual machine wizard.

Step 1 – OS Type

Give the virtual machine a name, choose Linux as the Operating System and Ubuntu as the version.

Virtual Box - New Virtual Machine Step 1

Step 2 – Memory

Go for 512MB of RAM. This is Boxee minimum system requirements. It can also be changed later if it’s too slow

Virtual Box - New Virtual Machine Step 2

Step 3 – Hard Drive

Go with the defaults.

Virtual Box - New Virtual Machine Step 3

Next it takes you through the ‘Create New Virtual Disk Wizard’

Step 4a

I wasn’t sure how much space I’d need for the virtual machines harddrive, so I opted for Dynamically expanding storage.

Virtual Box - New Virtual Machine Step 4

Step 4b

Next you need to tell it where you want the hard disk to be stored and it’s size. The default size of 8GB is fine, this is the Ubuntu’s recommended system requirements.

Virtual Box - New Virtual Machine Step 4b

Then click though the rest of the confirmation screens until you come to the end. You should now see the following.

Virtual Box - New Virtual Machine Final

4. Prepare the Virtual Machine for Ubuntu & Boxee

Open up ‘Settings’ and choose ‘Display’. Up the video memory, I only have a small cheap graphics card so I went for 100MB of Video Memory, although less might also be acceptable. Enable 3D accelaration, this is needed for OpenGL that the Boxee clients uses.

Virtual Box - Settings - Display

Now Choose ‘Storage’ to mount the Ubuntu iso you downloaded earlier. Select the CD image, under IDE Controller node, that’s  labelled Empty. Use the folder button to add/browse to the previously downloaded Ubuntu iso file. This is the virtual equivalent to inserting the Ubuntu install CD into your drive.

Virtual Box is quite good here as it remembers what you’ve mounted before and you can mount these, plus any other iso, whilst inside the Virtual Machine (the virtual way of changing changing the CD in your CD drive).

Virtual Box - Settings - Storage

You’re now ready to install Ubuntu. Click ‘Start’ to boot-up the virtual machine. NB You can tweak anything in the Settings dialog at anytime later on.

5. Install Ubuntu

The Ubuntu installation is really simple and well documented elsewhere, so I wont repeat the steps here. If in doubt with any option go with the default, they’re just fine. Official Ubuntu Installation Guide

6. Install Guest Additions

Amongst providing other useful features (copy and paste between host and guest, higher resolution, prevents capturing and keeping the mouse), this package will get OpenGL up and working properly for the Boxee client. The first time round I forgot this step and Boxee just hung.

With the guest OS running, from the Devices menu select Install Guest Additions… Ignoring any prompts from Ubuntu about applications to launch.

Virtual Box - Install Guest Additions

This will put the a disk called VBoxAdditions_3. on your desktop. Open it and run and this will install guest additions. Reboot for changes to take effect.

Virtual Box - Guest Additions Disk

If this doesn’t work, you can manually mount the Guest Additions iso. In the same way that you mounted the Ubuntu iso in Step 4, mount the C:\Program Files\Sun\VirtualBox\VBoxGuestAdditions.iso. Now when you start your Ubuntu VM you will see the disk on the desktop, open it and run and this will install guest additions.

7. Install Boxee

Login into the Boxee Website on the guest machine and follow the installation/download instructions. Once installed it’s worthing logging into Boxee (to check all is cool) and adding your accounts, so you don’t have to do this step each time you want a clean boxee install.

8. Take a Snapshot

At this point you should take a snapshot of your Virtual Machine, so that you can always rollback to this point and run test after test. Also at any point you can take a snapshot. The first time I did this, I took one just after Ubuntu had installed so I had a clean Ubuntu installation too.

Virtual Box - Snapshot

You can now test stuff on the Boxee client, trash it and always go back to the point where you have just Ubuntu and Boxee installed and do it all over again and again. You can also take snapshots so you can run the common scenarios mentioned at the beginning of the post.

Versions used
  • Virtual Box – 3.1.2 r56127
  • Ubuntu – 9.10 Karmic Koala
  • Boxee – Beta
Other VM Choices
2 Feb 2010

Testing Boxee Apps Using Virtual Box

Author: Tom Philip | Filed under: tutorial

This is a step by step guide to writing your first Boxee app. This is basically how I got started, so I hope it helps.

Boxee apps are written in Python and use xml markup to describe the UI, called skins.

1. Get Yourself an IDE

It’s not absolutely necessary but a good IDE will really help with organising your files, Source Control, Refactoring, Test Running, Syntax and Coding Intellisense.

My development background is in .NET, so Python is totally new to me. I was dying to get started so I only had took quick look at editors. Mainly I wanted something free and good support to help me get to grips with the syntax. I thought I’d give NetBeans a whirl to see how that goes. It supports writing code in other languages, so personally I thought it might be of use as I expand my coding horizons.

The version for Python is still in Early Access release but I’ve had no problems from the IDE. It runs on the most popular OS’s. I’m using WinXP for my sins but I’m trying. It seems it’s also available as a plugin if you already have NetBeans.

Download NetBeans IDE for Python and install.

2. Configure the IDE for Boxee Development

First of all I downloaded and installed the version of Python that Boxee uses, which is 2.4, so that NetBeans can compile my code against this and also provide intellisense for this version. Then I set this up as my default Python platform for NetBeans (Tools > Python Platforms).

Python Platform Manager

Next I got NetBeans to recognise the Boxee api. This gives you intellisense for the api, along with its documentation (the same on the Boxee developer site).

NetBean Python Path for Boxee.png

3. Create the NetBeans Project for Your App

Find the Boxee apps directory on your dev machine. Mine on WinXP is: C:\Documents and Settings\tom\Application Data\BOXEE\userdata\apps

Create a new NetBeans project (File > New Project…)

Choose Apps as the directory to create the project in and give the project a name. This will also be the unique identity of your app. How you choose your unique app id depends on how you’re going to host it.

If your hosting your app in a 3rd party repository, like

every application in a repository must have the application repository id as a prefix to the application id. For example: if your repository is called com.myboxee and you want to build app called “facebook”, then the application id MUST be com.myboxee.facebook. This is required in order to assure global uniqueness in the application ids. –

or with Boxee

Unique identifier for the application. Must be all lower case, alphanumeric and dashes (-). For example: the-wb. Dot characters are not allowed in the application id, unless the application is stored in a 3rd party repository. –

To avoid conflicts and help identify your apps prefix them with your name or company name. As I’m hosting my own apps, mine are:

GreatBoxee.[App ID]

4. Build the Specified Directory Structure

In order for your app to work, files need to be located in a specified folder structure. Create the following folder structure in your netbeans project.

Project/Folder Structure

NetBeans wants you to use their Src folder, for python code files, that they create when you create a project. This isn’t useful at all for the boxee development, as you want to be able to edit your files and see the amendments in Boxee. It took me ages to work out why intellisense and the test runner wouldn’t run tests. The NetBean projects are initially setup to look in the Source folder for the intellisense and tests. Just remove the Src folder and add the root folder as a source, then delete the src folder as you wont need this. Right click the project to get the Properties dialog up.

Removing Src Folder

5. Create an App Logo

To show your app in Boxee you need a thumbnail that represents the app. Use your favourite editor to create a png or jpeg image that is 200px by 200px.

You will then need to host this on the web, usually along with your app. This depends on whose repository your going to put the app. Your own, 3rd-party or Boxees. The Boxee Developer site has some details on the different ways to get your app released.

6. Create the First Screen

Create the first screen (or window) that will open when the app launches. Create and xml file and call it main.xml and save it in the 720p folder. This folder is where all of your UI skin files will go. This is just good practice, it can be named anything, so it’s easy to identify which is the initial opening screen.

The Boxee documentation goes into depth on the xml markup that makes up UI skins. In general each xml file contains a window that has controls on it.

To verify that everything so far has been setup correctly. Create a window and add a simple control to it in the main.xml. This will allow you to run the app with the bare minimum required. Something similar to the following.

<?xml version="1.0"?>
<window type="window" id="14000">
  <control type="label">
   <label>Hello World!</label>

7. Describe It

Create an xml file named descriptor.xml in the root of the folder structure. This contains all the information that will describe your app to the Boxee client, some of which will appear in the Boxee Client. Boxee has the details of what should go into descriptor file.

startWindow will be the ID of the screen/window that will open when the app launches. This will be in your Main.xml, see previous step.

This is how mine looked.

    <description>A webcomic of romance, sarcasm, math, and language.</description>
    <author>Great Boxee</author>
    <copyright>Conker Software Ltd</copyright>

test-app is for local development purposes and will make the Boxee client recognise your app and show it in My Apps. Don’t forget to remove this when you deploy your app.

8. Run the App

Now start Boxee and marvel at the best looking hello world app that you will ever see on a TV.

Now once you’ve finished being impressed you’ll need to write some real code/xml. For that you’ll need a lot more than this, you’ll need the boxee developer site. Also Gonzee have just started a series on Building You First App which starts where this ends.

So far my experience with Netbeans has been ‘just OK’ (it had the bare minimum of refactorings, intellisense and a test runner). I’m used to using Visual Studio with Jetbrain’s Resharper, which for me the colour coding, refactorings, code templates, integrated test runner and intellisense make it a great IDE. I haven’t tried Eclispse or any other Python IDEs, so would love to hear what everyone else is using and your experiences.

30 Oct 2009

Writing Your First Boxee App

Author: Tom Philip | Filed under: tutorial

For Boxee Beta

To add the Great Boxee repository to Boxee (beta version), from the Home Screen select Apps, My Apps will display. Now choose Repositories from the list of options in the left hand menu, right at the bottom. Select Add Repository from the sub-menu and enter (or any other repository url) in the dialog box and click Done. You should now see the Great Boxee repository listed, select it to see the Apps. By opening one of the apps you can run it or add it to the My Apps or Shortcuts Bar for quick ‘n’ easy access.


For Boxee Alpha

To add the Great Boxee repository to Boxee (alpha version), go to the App Box in the left hand menu and then choose Repositories from the options listed. Select Add Repository from the sub-menu and enter (or any other repository url) in the dialog box and click Done. You should now see the Great Boxee repository listed.

23 Sep 2009

Adding the Great Boxee Repository to Boxee

Author: Tom Philip | Filed under: tutorial