rahims/SoCo — pull request #19 by KennethNielsen (2013-02-08 22:55:49+00:00)
Title: Various text encoding fixes

I noticed some text encoding issues, because I live in a country with a few non-ascii characters. I noticed it while querying the zone names (Kitchen is spelled Køkken in Danish ;)) and then decided to have a look at the track info and favorite radio stations methods as well. I also included a few minor changes besides text encoding changes, described below:

get_speaker_info: Trivial fix to encode zone names as utf-8

get_current_track_info:
* I had to encode as utf-8 already before the first time the text is parsed as xml (line 583), otherwise I got an exception on music tracks with non-ascii letters.
* I moved the default values for 'title', 'artist' 'album' and 'album_art' up before the if-conditional. The reason for this is that those values were not always being filled in, depending on where in the large conditional you end up (described below). This way we are sure they are always there and we can remove all the default "something equals empty string" assignments in the conditional.
* I replaced the try-except at the .find(' - ') line 600 with a simple if-else. I wasn't able to make those statements produce an exception and actually if we don't produce an exception and we didn't find the string, then we never make the track['title'] = trackinfo assignment.

__get_radio_favorites: Trivial fix to encode names as utf-8