MythTV / mythweb

The official MythTV mythweb repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RFE: Display people in priority order when displaying program details

garybuhrmaster opened this issue · comments

RFE: Display people in priority order when displaying program details

With MythTV commit bf47572d56 (Include actor roles in cast info) the credits table now maintains the order received from a XMLTV feed(1). The following proposed patch returns the credits in the order specified for display purposes. Because an actor may play multiple characters in certain shows, only return an actor's name once.

diff --git a/modules/tv/classes/Program.php b/modules/tv/classes/Program.php
index 1de5c777..519a8b14 100644
--- a/modules/tv/classes/Program.php
+++ b/modules/tv/classes/Program.php
@@ -565,12 +565,13 @@ class Program extends MythBase {
     // No cached value -- load it
         if (!isset($this->credits[$role][$add_search_links])) {
         // Get the credits for the requested role
-            $result = $db->query('SELECT people.name
+            $result = $db->query('SELECT UNIQUE(people.name)
                                      FROM credits, people
                                     WHERE credits.person    = people.person
                                       AND credits.role      = ?
                                       AND credits.chanid    = ?
-                                      AND credits.starttime = FROM_UNIXTIME(?)',
+                                      AND credits.starttime = FROM_UNIXTIME(?)
+                                      ORDER BY credits.priority',
                                    $role,
                                    $this->chanid,
                                    $this->starttime

(1) All compliant XMLTV grabbers, per the DTD, are expected to provide the credits in order of billing (to the best of their ability).

@garybuhrmaster I'd be happy to champion this getting merged as it seems quite a simple patch. Might I suggest you create a PR?

@garybuhrmaster I'd be happy to champion this getting merged as it seems quite a simple patch. Might I suggest you create a PR?

While (very) late, I have created the requested PR.