Open Shelf…

A correction: CFBundleName vs. FRApplianceName 31May07 | 10

So, I’ve mentioned on a number of occasions that the non-localized ‘CFBundleName’ showing up in the main menu can be alleviated through developers adding an FRApplianceName key to their Info.plist. I even explicitly pointed this out on the huge video tutorial — which is being downsized by my good friend (and also my hosting provider, at RGHosting) as I type this, ready to become the start of a proper podcast.

However, there needs to be a little change to this information. It’s technically true, except for a little bug in the implementation, due I would guess to the addition of some layers above the NSBundle API used to fetch the localized string value.

The code used by the BRApplianceManager looks something like this:

locName = [BRLocalizedStringManager localizedStringForKey: @"CFBundleName"
           inFile: @"InfoPlist" fromBundle: bundle];
if ( locName != nil )
    [dict setObject: locName forKey: @"FRApplianceName"];

The call into BRLocalizedStringManager on the first line can be effectively replaced with the following:

[NSBundle localizedStringForKey: @"CFBundleName"
                         inFile: @"InfoPlist" 
                     fromBundle: bundle];

…which is in turn the API underlying the NSLocalizedString functions. And you know what those routines do when you haven’t created your localizations yet? That’s right, they return the key.

So, we end up with some code which contains a fallback, but that fallback will never actually be used, because the function called never returns nil.

Oops.

So, I have to apologize for giving out what essentially amounted to misinformation there. Hopefully when Apple delivers the YouTube plugin they can fix this bug too, so we can have a working locale-independent fallback for the plugin name.

While we’re at it, why not make it fall back on the plain ‘CFBundleName’ property?

shrug

Nice bug you got there 30May07 | 0

So, iTunes 7.2 came out today, and along with it a lovely bug that’s crashing not only everyone’s Apple TVs, but also the BDK application. Well doh.

It seems that the iTunes Music Store is returning an invalid property list to the BRMusicStore class in BackRow, which is therefore throwing an exception parsing it, which goes to the Finder’s uncaught exception handler, which tries to allocate a BRPostedAlertController, which crashes the Finder. It actually looks like a weird issue I’ve seen where occasionally the toll-free bridging gets confused between a CFTypeRef and an NSObject, and tries to use objc_msgSend() for what is actually a CFTypeRef.

Here’s the exception details:


May 30 19:48:06 AppleTV FrontRow[926]: *** NSEXCEPTION RAISED ***
NSParseErrorException: XML parser error:
Encountered non-empty  tag on line 1
Old-style plist parser error:
Malformed data byte group at line 1; uneven length

0x9258f166: -[NSString(NSExtendedStringPropertyListParsing) propertyList] (in Foundation)
0x9e95e230: -[BRMusicStore(Private) _seedMusicStore] (in BackRow)
0x924ef2a8: forkThreadForFunction (in Foundation)
0x900243e7: _pthread_body (in libSystem.B.dylib)

And here’s a crash log.

So, the Word Of The Day? “DOH!”

Well Darn 30May07 | 0

So, looking at Engadget’s live updates for Steve Jobs’ Interview, it would appear that Apple is looking to make ASoT obsolete. Here’s a pic of the forthcoming YouTube integration in June’s AppleTV software update, courtesy of Engadget:

YouTube plugin screenshot

So, I guess Xdog will be kinda miffed, huh?

Although, apparently Steve is still in the habit of calling people personally to recruit them. So, Steve, if you’d like to email me, I can give you my phone number; I’m ‘alan’ at this domain. Thanks mate, talk soon ;)

Implementing an ‘About’ page 29May07 | 0

I was asked just now to explain how the ‘About’ page in ATV Loader works, and since it’s actually really simple, I thought I’d share it here.

It actually uses BRDocumentController, which can display any of the following components:

  • Title header, with or without an icon
  • Scrollable text (actually a BRParagraphTextControl)
  • A button, with a target & action

You can create your About.txt file in TextEdit in plain text mode (or your favourite plain-text editor), but be sure to save it using UTF-16 format. That last bit is important, because that’s what BRParagraphTextControl expects by default, although you can provide a different encoding by calling -setDocumentPath:encoding: instead of -setDocumentPath: as I do in the following example. I prefer UTF-16 though, since that means it’s fully localizable (you’ll never need to worry that under a different locale you’ll need a different encoding, at run time).

To use BRDocumentController, you call your choice of the header, document, and button setup methods, and finally call -doLayout to arrange your chosen items prior to display. This last is also important — without that, everything will be positioned at the lower-left, on top of one another. Any setup functions you don’t call will not create that object, so, as in the example below, not calling -setButtonTitle:action:target: will result in no button being created or displayed.

Here’s the code I use in ATV Loader, tweaked slightly to inline a separate method:


- (BRLayerController *) _showAbout
{
    // 'About' file path
    NSBundle * bundle = [NSBundle bundleForClass: [self class]];
    NSString * path = [bundle pathForResource: @"About" ofType: @"txt"];
    if ( path == nil )
        return ( nil );

    BRDocumentController * result = [[BRDocumentController alloc]
                                     initWithScene: [self scene]];

    // by default uses Unicode (UTF-16), which is what we used when
    // creating the file
    [result setDocumentPath: path];

    [result setHeaderTitle:
        BRLocalizedString(@"About ATVLoader", @"'About' document header")];
    [result setHeaderIcon: [self listIcon]
         horizontalOffset: [self listIconHorizontalOffset]
            kerningFactor: [self listIconKerningFactor]];

    [result doLayout];

    return ( [result autorelease] );
}

The Links They Are A-Movin’ 28May07 | 0

Looks like someone at MacNN noticed the BDK, and so I’ve had a fair bit more traffic pop up today. As a precaution, file downloads are going to be moved to another server with more bandwidth a little later today.

Just a heads-up.

Update: I worked out how to use mod_rewrite to redirect things instead. So the links haven’t changed after all — yay!

ATVLoader v1.0.6 28May07 | 1

Version 1.0.6 is now available for download, both from the link below and from your Apple TV. This version includes a French localization by GoldstarQC, German by therealkerni, and Spanish by dordoka. It also adds indications of updated plugins in the plugin list, which will look like this:

Image of Updated Items UI

For plugin authors, the implementation works by checking the FRApplianceName and CFBundleName values in your bundle (the former is the localized CFBundleName, btw). If neither of those match the title or the ’short name’ under which you’ve registered your plugin at plugins.awkwardtv.org, then you can add a new key to your Info.plist, like so:

<key>ATVPluginShortName</key>
<string>myshortname</name>

The short name is the value which appears after the ?recordID= bit in the URL for your plugin page at the plugins site.

Yeah, I needed to do that to make it work for loader, which is ‘ATV Loader’ out here, but ‘AwkwardTV’ inside the plugin. Let’s hear it for forward-thinking!1 ;)

And of course, the manual installer is located at the usual place:

Download Installer Download version 1.0.6


  1. Note to prospective employers at Apple: don’t let that fool you, this was all planned, I tell you, all planned!!! 

Greetings Apple-folk 28May07 | 2

So, after a few hits from what I would guess are actually Apple Stores here & there (either that or Apple is handing out IPs to its employees to use from home), I’m now seeing a bunch of visits (one or two per day for about five days now) from Cupertino.

So, greetings Apple people. If there are any AppleTV programmers looking, would you care to let me know how accurate my tutorials are? :P

Oh, and if the person using a French OS X browser happens to be Bertrand Serlet: Bonjour, monsieur— aimez-vous me donner un travail? ;) 1

Actually, that goes for pretty much anyone at Apple with the ability to prod the HR department into action; all job offers graciously accepted…


  1. The author wishes to apologize in advance for any terrible grammar in the translation. It’s been almost 17 years since he studied French at high school, so he ended up having to use the OS X translator widget. He is prepared to bow his head in shame and accept punishment for his crime during the job interview. 

Look at the size of that thing 25May07 | 0

I got my video tutorial done….. almost 20 minutes of it…. and it was 4.3GB in size (uncompressed). So, I proceeded to try & encode it using H.264 into a smaller file size. But it ganked the text too much, so I tried again, with a higher bitrate. And again. And again.

In the end I gave up & just did ‘Export to Apple TV’ instead. It produced a 100.3MB file. Hm.

So, I uploaded it to the Internet Archive, rather than kill my hosting provider. It’s a 1152×720 resolution video, Mpeg-4 using H.264. Right-click the link below to download it, left-click to stream it directly within your browser.

Go straight to the .m4v file

BackRow Developers’ Kit Released 24May07 | 0

So finally I can release to the public what I’ve been working on for the past couple of weeks. It’s been a bit of a labour of love for me, and I wanted to get a few things just so, including proper online help modeled upon Apple’s own, a fabulous Apple Devtools-style icon from BigBaconAndEggs, and incorporating feedback and suggestions from my testers ericIII, xdog, and |bile| on the AwkwardTV IRC channel.

It includes an Xcode project template to get you started, a set of class-dumped header files for the necessary frameworks, and an application which lets you run the Apple TV interface in a window on your desktop.

So, without further ado, I shall direct you towards the official product page itself for more information and a download link.

Sunday really isn’t a good day for me… 20May07 | 3

Okay, so the plugin did not in fact handle redirects correctly, it just happened to be the case that my Mint download counter redirection URL didn’t cause problems during testing, but everything else actually did, including the one just added to the XML feed used by ATV Loader.

sigh…

So, here we have version 1.0.5.

Pray, people. Pray.

Download Installer Download it here