[mythtv-users] recgroup with an apostrophe in it causes duplicate entries
mythtv at mikeholden.org
Sat Dec 11 21:32:24 UTC 2010
If I create a Recording Group with an apostrophe in the name (e.g.
"Mike's Faves"), then if a recording has also been added to that
recording group, then when editing a recording schedule, the new
recording group appears twice in the list of recording groups.
1) Modify an existing recording schedule, and assign it to a new
recording group called Mike's Faves (note the apostrophe in the
2) Modify a second recording schedule and go to the Storage Options
page. In the list of recording groups, note that the list contains
the new recording group only once. Abandon the changes to this item.
3) Modify an existing recording to belong to the new recording
group, so that the value now appears in both the "record" and
4) Repeat step 2, noting this time that the new recording group
At first glance at the code in scheduleeditor.cpp in
StoreOptEditor::Load, around line 770, we can replace the existing 2
pass method using 2 separate queries, with one pass using the
query.prepare("SELECT DISTINCT recgroup FROM record "
"SELECT DISTINCT recgroup FROM recorded "
"ORDER BY recgroup");
This fixes the issue. Note also that using the above ORDER BY clause
should remove the need to sort the list afterwards using
groups.sort(), thus possibly being a tad more efficient.
However this error may point to a deeper issue in that the code line:
groups += value
surely shouldn't be adding the new item to the list in this case
during the 2nd pass, since it already exists in the list from the
1st pass. It seems likely that some "safe string" handling is going
on in that code, and not parsing the apostrophe correctly?
I also note the comment at the top of this function, which says
"Count the ways the following is _wrong_" - well so far, the count
would appear to be at least 1 :-)
More information about the mythtv-users