Bug 5121 - Accented characters in Genre broken in Random Mix Web Interface
: Accented characters in Genre broken in Random Mix Web Interface
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Web Interface
: 6.5.2
: PC Windows XP
: P2 normal (vote)
: ---
Assigned To: Squeezebox QA Team email alias
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-15 11:04 UTC by Robin V.
Modified: 2008-12-18 11:12 UTC (History)
4 users (show)

See Also:
Category: ---


Attachments
genre tag example (399.08 KB, application/octet-stream)
2007-06-15 15:21 UTC, Ross Levine
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin V. 2007-06-15 11:04:26 UTC
When using FLAC with multiple genres (; separated) and probably also with other sorts of file and without multiple genres, accented characters don't show in the "random mix genre selection". 
Those genres appear as a select box but without any label.

For example:
[ ] Chamber     [ ] Pop
[ ] Chamber Pop [ ] Pop Rock
[ ] Chanson     [ ] Pop-Soul
[ ] 	        [ ] Post-bop
[ ] Choral      [ ] Post-Punk

The missing genre is "Chanson Française".

In the database, tags are correct:

mysql> select genres.name from genres order by genres.name;
+-----------------------------+
| name                        |
+-----------------------------+
| ...                         |
| Chamber                     |
| Chamber Pop                 |
| Chanson                     |
| Chanson Française          |
| Choral                      |
| Cl18                        |


When browsing genres on the squeezebox and when watching files details with the web interface, all is perfect.
Comment 1 Robin V. 2007-06-15 11:08:56 UTC
Here is the source code resulting in html code:

<tr class="even">
<td><input name="genre_19" id="genre_19" value="1" onclick="changeNumSelected(this)" type="checkbox">
<label for="genre_19">Chanson</label></td>
<td><input name="genre_43" id="genre_43" value="1" onclick="changeNumSelected(this)" type="checkbox">
<label for="genre_43">Pop-Soul</label></td>
</tr>
<tr class="odd">
<td><input name="genre_" id="genre_" value="1" onclick="changeNumSelected(this)" type="checkbox">

<label for="genre_"></label></td>

<td><input name="genre_53" id="genre_53" value="1" onclick="changeNumSelected(this)" type="checkbox">
<label for="genre_53">Post-bop</label></td>
</tr>
Comment 2 Ross Levine 2007-06-15 15:21:26 UTC
Created attachment 2042 [details]
genre tag example
Comment 3 Ross Levine 2007-06-15 15:22:05 UTC
Verified with attached file. 
Comment 4 Robin V. 2007-06-16 12:52:34 UTC
It seems that this patch get rid of the problem:

< [%- genreid = "genre_" _ pluginRandomGenreList.$genre.id %]
---
> [%- genreid = "genre_" _ pluginRandomGenreList.item("$genre").id %]
84c89
< <label for="[% genreid %]">[% pluginRandomGenreList.$genre.name | html %]</label></td>
---
> <label for="[% genreid %]">[% pluginRandomGenreList.item("$genre").name | html %]</label></td>
167d171
<
Comment 5 Robin V. 2007-06-16 12:54:22 UTC
I forgot the path of the file the patch was for:
SlimServer_v6.5.2/Plugins/RandomPlay/HTML/EN/plugins/RandomPlay/randomplay_list.html

< [%- genreid = "genre_" _ pluginRandomGenreList.$genre.id %]
---
> [%- genreid = "genre_" _ pluginRandomGenreList.item("$genre").id %]
84c89
< <label for="[% genreid %]">[% pluginRandomGenreList.$genre.name | html
%]</label></td>
---
> <label for="[% genreid %]">[% pluginRandomGenreList.item("$genre").name | html %]</label></td>
167d171
<
Comment 6 Robin V. 2007-06-16 13:04:23 UTC
When display fixed, the selection is still broken. If "Chanson Française" is clicked and saved, the new page appear without the style selected.

Here is the complete code with this last correction:
(line 171 of "Plugins/RandomPlay/HTML/EN/plugins/RandomPlay/randomplay_list.html" )

===============================
                <table border="0" width="100%">[% USE table pluginRandomGenreList.keys.sort, cols=2, pad=0 %]
                        [%- FOREACH genrerow = table.rows %]
                                <tr class="[% odd ? "odd" : "even" %]">
                                [%- FOREACH genre = genrerow %]
                                [%- genreid = "genre_" _ pluginRandomGenreList.item("$genre").id %]
                                        <td><input type="checkbox" name="[% genreid %]" id="[% genreid %]" value="1" [% pluginRandomGenreList.item("$genre").enabled ? "checked" : "" %] onclick="changeNumSelected(this)">
                                        <label for="[% genreid %]">[% pluginRandomGenreList.item("$genre").name | html %]</label></td>
                                [%- END %]
                                </tr>
                                [% odd = (not odd) %]
                        [%- END %]
                </table>
===============================

Sorry not commit it in SVN, can anybody commit code in the repository?
Comment 7 Michael Herger 2007-06-18 03:31:46 UTC
Robin - could you please do a "svn diff" against a clean SVN tree?

How did you tag your files, what encoding are you using? I did some tests with my files (MP3 only), but wasn't able to reproduce your case.
Comment 8 Robin V. 2007-06-18 04:10:05 UTC
I think Ross Levine verified the bug with a flac file (see attached file on this post). I tag my flac files using latest version of MP3Tag on WinXP. I think it's using unicode utf8. Problem is the same with slimserver on XP or on Linux.

The problem is clearly related to "TemplateToolkit" as I debugged output Hash data from GetGenre in RandomPlay module and all genres was present, even genres with accented characters.

The workaround was for me te replace
< [%- genreid = "genre_" _ pluginRandomGenreList.$genre.id %]

With:
> [%- genreid = "genre_" _ pluginRandomGenreList.item("$genre").id %]

I'll try to get clean svn this evening and post the diff as you requested. For a quick start, what is the "repository name/command line" to get a clean svn checkout?
Comment 9 Michael Herger 2007-06-18 04:20:13 UTC
svn co https://svn.slimdevices.com/repos/slim/trunk/server

Thanks!
Comment 10 Robin V. 2007-06-18 04:41:24 UTC
I may have missed something with svn but after the CO, i can't find the file I modified (i'm not skilled with slimserver tree handling nor with svn).

I modified 
/usr/local/squeezebox/SlimServer_v6.5.2/Plugins/RandomPlay/HTML/EN/plugins/RandomPlay/randomplay_list.html

And only find in my svn checkout:
$ find /tmp/slimsvn/ | grep -i randomplay_list.html
/tmp/slimsvn/server/HTML/ExBrowse3/plugins/RandomPlay/.svn/text-base/randomplay_list.html.svn-base
/tmp/slimsvn/server/HTML/ExBrowse3/plugins/RandomPlay/randomplay_list.html

What's wrong with this?
Comment 11 Michael Herger 2007-06-18 05:01:35 UTC
Oops... Sorry: the link I gave you is for the trunk (7.0) only, for 6.5.x please use the following:

https://svn.slimdevices.com/repos/slim/branches/6.5/server
Comment 12 Robin V. 2007-06-18 05:12:26 UTC
Here it is (the commented <pre> ... </pre> block at the beginning is just some debugging code):

sun:/tmp/slimsvn/server/Plugins/RandomPlay/HTML/EN/plugins/RandomPlay# svn diff
Index: randomplay_list.html
===================================================================
--- randomplay_list.html        (revision 12260)
+++ randomplay_list.html        (working copy)
@@ -75,13 +75,18 @@
                <p>[% "PLUGIN_RANDOM_GENRE_FILTER_WEB" | string %]</p>

                [% odd = 1 %]
+       <!--    <pre>
+                   [% FOREACH key IN pluginRandomGenreList.keys.sort %]
+                          * [% key %] = [% pluginRandomGenreList.item("$key").item('id') %]
+                   [% END %]
+               </pre> -->
                <table border="0" width="100%">[% USE table pluginRandomGenreList.keys.sort, cols=2, pad=0 %]
                        [%- FOREACH genrerow = table.rows %]
                                <tr class="[% odd ? "odd" : "even" %]">
                                [%- FOREACH genre = genrerow %]
-                               [%- genreid = "genre_" _ pluginRandomGenreList.$genre.id %]
-                                       <td><input type="checkbox" name="[% genreid %]" id="[% genreid %]" value="1" [% pluginRandomGenreList.$genre.enabled ? "checked" : "" %] onclick="changeNumSelected(this)">
-                                       <label for="[% genreid %]">[% pluginRandomGenreList.$genre.name | html %]</label></td>
+                               [%- genreid = "genre_" _ pluginRandomGenreList.item("$genre").id %]
+                                       <td><input type="checkbox" name="[% genreid %]" id="[% genreid %]" value="1" [% pluginRandomGenreList.item("$genre").enabled ? "checked" : "" %] onclick="changeNumSelected(this)">
+                                       <label for="[% genreid %]">[% pluginRandomGenreList.item("$genre").name | html %]</label></td>
                                [%- END %]
                                </tr>
                                [% odd = (not odd) %]
Comment 13 KDF 2007-06-18 11:17:26 UTC
looks good here with the patch.

as a note, for debugging you can also use something like this:
[% USE Dumper; Dumper.dump_html(pluginRandomGenreList) %]
Comment 14 Ross Levine 2007-06-18 11:54:31 UTC
Was this checked in? Robin could you please attach the change number? Thanks! :)
Comment 15 Michael Herger 2007-06-18 12:05:01 UTC
Change 12261
Comment 16 KDF 2007-06-18 12:11:08 UTC
Thanks Michael.  what do we think about porting this to 6.5.3 as well, given that it's a rather simple fix?
Comment 17 Robin V. 2007-06-18 12:17:24 UTC
If I have the permission to commit it, I'm doing it right now. I didn't know I could commit into the repository and I didn't know if my correction was good enough (if working is good enough, it was, at least for me).
Let's see this...

svn talk me bad:
svn: Commit failed (details follow):
svn: MKACTIVITY of '/repos/slim/!svn/act/ef8a8b1f-257e-4220-9de9-6194988bbed0': 404 Not Found (http://svn.slimdevices.com)
svn: Your commit message was left in a temporary file:
svn:    '/tmp/slimsvn/server/Plugins/RandomPlay/HTML/EN/plugins/svn-commit.tmp'
sun:/tmp/slimsvn/server/Plugins/RandomPlay/HTML/EN/plugins/RandomPlay#

I had to checkout using http and not https, maybe this error is related to this changing of url. (svn asked me for a password when I tried to co with https and I didn't find one suitable, when I switch to http, checkout worked fine).

By the way, it seems that the patch was commited by "mherger".
Comment 18 Michael Herger 2007-06-18 12:22:40 UTC
This was 6.5.3 only - sorry. Trunk is change 12262.
Comment 19 Ross Levine 2007-06-18 15:50:17 UTC
Verified to be fixed in 6.5.3 and 7. Thank you Robin and Michael. 
Comment 20 James Richardson 2008-05-15 13:04:50 UTC
This bug has recently been fixed in the latest release of SqueezeCenter 7.0.1

Please try that version, if you still see the error, then reopen this bug.

To download this version, please navigate to: http://www.slimdevices.com/su_downloads.html