XBMC Media Center Logo

Adventures with XBMC

My Smart TV and PS3 both struggle to support certain codecs. They both fail as a complete digital media player. I decided to have a play with XBMC to create a networked media device that would play anything I throw at it. The main storage source is currently a Windows 7 PC on a gigabit network.

A basic HTPC does not require a very powerful computer. I am going to attempt this with some old computer parts that I had laying around. The new Intel NUC is a popular choice. Some people like the Raspberry Pi or Android based devices.

TV/Monitor
Samsung Series 6 LED/LCD 40″ Full-HD TV
Audio Equipment
Logitech Z5500 (via COAX)
Case + Power Supply
ATX/mATX case with Antec EarthWatts 380w
Motherboard
GA-945GCM-S2L
Memory
2GB DDR2 @ 800Mhz
Processor
Pentium Dual Core E2180 @ 2GHz
Hard Drive
500GB
Video Card
Nvidia 9600GT 512MB (sound on HDMI via SPDIF, if needed)
Infrared Receiver
HP USB IR Receiver (RC6 / eHome compatible, purchased on eBay)
Remote
Logitech Harmony 700
HTPC Setup Guide

Make it Work

I’ve tried three separate XBMC setups on this computer. XBMC on Windows 7, XBMCbuntu and OpenELEC. Long story short, Windows 7 and XBMCbuntu did not perform well. I ran into almost constant issues with freezing and poor performance – started to think the old components were to blame. After hours of frustration, I stumbled on OpenELEC.

OpenELEC is a standalone Linux distribution for XBMC. The installation is tiny, and it runs on my old computer perfectly. I chose the Generic image of OpenELEC for this computer, as it is Intel based with an Nvidia video card. To my surprise, everything worked out of the box. There was no performance issues at all.

I did have some issues installing OpenELEC. The motherboard was unable to read the Live USB. PLOP Boot Manager on a CD-ROM was required to force USB 1.1 and the flash memory had to be smaller than 2GB for it to successfully boot.

XBMC Screenshot

The Harmony remote worked out of the box using the Windows Media Center preset provided. I have made some small customisations that I wont go into here. If you don’t have a remote or IR receiver, XBMC has an Andriod and iOS App that works over Wi-Fi. The computer goes into an S3 sleep state, and runs only the bare essentials to reduce noise and power consumption. The possibilities are endless. I would like to move the computer into a slimline HTPC case one day.

For more information about how to configure OpenELEC see the Wiki. One note to avoid confusion, you will need to SSH (I used Putty) to access restricted terminal functionality over your home network. If you want to get under the hood.

WordPress Logo

WordPress 3.6, Read More Links Broken

My WordPress sites updated to 3.6 pretty smoothly.

Read More links for post excerpts are not being output by functions.php.

The fix is simple. Just change … to … in the filter.

/**
 * Add 'Read More' link to excerpts.
 */
add_filter( 'the_excerpt', 'tsg_excerpt_read_more_link' );
function tsg_excerpt_read_more_link( $output )
{
    global $post;
    return str_replace(' [&hellip;]', '.. <a class="read-more" href="'. get_permalink($post->ID) . '">Read More...</a>', $output);
}
WordPress Logo

WordPress Pagination Breaks when Custom Posts are Included in the Query

I’ve been using All-in-One Event Calender for a recent client project. They would like to show both recent blog posts and ai1ec_event (custom) posts in one blog feed style page.

If I disable pagination (increase the limit) they all display fine, but as soon as I enable pagination I see 404 when I try to access page 3, sometimes I can get page 2 to work. You would think if pagination was not working it would 404 on page 2 every time.

Here is the query I was trying.

$wp_query =  new WP_Query(array('post_type' => array('post', 'ai1ec_event'), 'paged' => $paged));

// Proceed with the loop.

After a few days of persistent searching, I found a similar solution for custom post types. It turned out to be a WordPress 3.4 bug.

The below code needs to be added to your functions.php if you are experiencing this bug. What triggered me to believe it isn’t the plugin, was that pagination worked fine in the search result output.

/**
 * Fixes pagination bug with WP 3.4 and the homepage when using 
 * custom post types (latest posts).
 */
add_action( 'pre_get_posts', 'custom_query_for_homepage' );
function custom_query_for_homepage( $query )
{
    if( $query->is_main_query() && $query->is_home() )
        $query->set( 'post_type', array( 'post', 'ai1ec_event' ) );
}

Hopefully this helps a few people.