Opened 13 years ago

Closed 13 years ago

#1354 closed patch (fixed)

MythVideo fails to display files with square brackets in properly

Reported by: scoultas@… Owned by: cpinkham
Priority: minor Milestone: unknown
Component: mythvideo Version: 0.19
Severity: low Keywords: mythvideo display files square brackets
Cc: Ticket locked: no

Description

If I have two files, named 'Test [1 - 1].avi' and 'Test [2 - 1].avi', and use Video Manager to import them into the videometadata table, they show up successfully in that table, but with the same value in the title column, 'Test'. When browsing videos, this causes only one of them to show up in the Tree View (also seems to be a problem in Gallery Mode). Removing the square brackets and reloading the database through Video Manager allows both files to be seen correctly. This problem has been introduced since Myth 0.18 - previously such files displayed correctly.

Attachments (2)

mythvideo-multiple_videos_same_title.patch (546 bytes) - added by sphery <mtdean@…> 13 years ago.
mythvideo-multiple_videos_same_title-2.patch (576 bytes) - added by sphery <mtdean@…> 13 years ago.
Updated patch--sorts like-named titles by video ID

Download all attachments as: .zip

Change History (6)

comment:1 Changed 13 years ago by sphery <mtdean@…>

As discussed in http://www.gossamer-threads.com/lists/mythtv/dev/184376#184376 , removing the bracketed text from the filename to create the video name is most likely not a bug (but, rather, the intended behavior); however, the inability to display multiple videos with the same name is a bug.

The problem is in videolist.cpp. If the user chooses to sort videos by title, VideoList re-sorts the videos after stripping articles from the beginning of the video name. (All other sorting is done by MySQL with the query, so the bug only appears if sorting by title.) The VideoList uses a hack with a QMap keyed by the video name without the initial articles to perform the sort. Because the QMap replaces values given the same key, only one video with any given name (before or after the initial articles are removed) survives the sort.

Since QMap's insertMulti() function and QMultiMap were introduced in QT4, I couldn't just modify the hack to use either of them, instead. And, since QPtrList is only available in QT4 as a QT3 compatibility class, it seemed that doing a proper sort by creating a subclass of QPtrList and providing a compareItems() function would result in a new class that would be completely unnecessary if Myth is ported to QT4 (especially since QT4 allows passing a "compare" function to qSort() for sorting a QList).

Therefore, I added a hack to the hack by appending the string version of the video's ID to the end of the key. That way, each key used for the map is unique and all videos survive the sort.

If you prefer a proper sort, let me know and I'll do another patch. (Sorry about the long description for the short patch. :)

Changed 13 years ago by sphery <mtdean@…>

comment:2 Changed 13 years ago by sphery <mtdean@…>

Type: defectpatch

comment:3 Changed 13 years ago by cpinkham

Owner: changed from jdonavan to cpinkham

Changed 13 years ago by sphery <mtdean@…>

Updated patch--sorts like-named titles by video ID

comment:4 Changed 13 years ago by cpinkham

Resolution: fixed
Status: newclosed

(In [9694]) Allow MythVideo? to display multiple files with the same title when sorting by title.

Closes #1354 by applying a slightly modified version of the patch in the ticket.

Note: See TracTickets for help on using tickets.