I am developing a Plex plugin that lets you watch recordings made on a MythTV server. I am currently working to "prettify" the interface: icons and background (thumb & art), descriptions, etc.
But I have noticed that some clients (Roku, web) sometimes revert to showing just the title of the recordings, instead of all the pretty artwork. Other clients (iPad) show the same list just fine.
Analyzing the scenarios, the problems seem to appear whenever an ObjectContainer has an entry with unicode (eg. æøå) or special characters (eg. ") in it. I've written some pseudo-code to demonstrate what's causing the problem:
...
oc = ObjectContainer(title2="MythTV recordings", art=backgroundUrl)
oc.add(
DirectoryObject(
key=
Callback(
RecordingDetails,
recordingTitle='Some recording title with æøå'
),
title='Some recording title with æøå',
summary='The new season of "Some recording title with æøå" starts'
thumb=iconUrl
)
@route(’/video/mythrecordings/RecordingDetails’)
def RecordingDetails(recordingTitle):
…
Looking at the XML that's produced by the code, it looks something like this
...
...
I notice two potential problems here - one the special characters in the key (which is just a relative URL), the other the extra double-quotes in the summary attribute.
(Note: oddly enough, selecting the DirectiryItem above actually still leads you to the proper recording details screem - it's just the presentation that fails)
The strings with weird characters come from MythTV (which in turn gets them from my EPG provider), so "just use strings without special characters" is not a solution.
Instead I've tried all sorts of encodings - cgi.encode(), string.encode('ascii', 'xmlcharrefreplace') - on these strings, but then I get an on-screen title that reads something like
Some recording title with æøâle
So obviously some of the strings should not be encoded.
But which strings are causing the problems? And how should they be encoded?
I am not done experimenting yet, but I was wondering if anyone out there had ever seen this problem?
/thomas
PS: I'm writing this on my way to work, so all the examples are from memory - I'll update with the correct examples and possibly screenshots when I get home