Opened 9 years ago

Closed 9 years ago

#8661 closed defect (Fixed)

MythWeb shows duplicate power searchs in recording schedules

Reported by: MarcT <myrdhn@…> Owned by: Rob Smith
Priority: minor Milestone: 0.24
Component: Plugin - MythWeb Version: Master Head
Severity: low Keywords:
Cc: Ticket locked: no

Description

Mythweb is showing duplicated power search on recording schedules page and not showing the final power search. On the page (see attached screenshot) it shows All CSI, then All NCIS, then All NCIS again. My 3 power searches are All CSI, All NCIS, and All Stargate.

mysql> select recordid,title,type from record order by title;
+----------+-----------------------------+------+
| recordid | title                       | type |
+----------+-----------------------------+------+
|      259 | All CSI (Power Search)      |    4 |
|      260 | All NCIS (Power Search)     |    4 |
|      277 | All Stargate (Power Search) |    4 |
|      300 | Bones                       |    3 |
|      225 | Castle                      |    3 |
|      143 | Chuck                       |    3 |
|      314 | Eureka                      |    3 |
|      146 | Family Guy                  |    3 |
|      216 | Fringe                      |    3 |
|      315 | Haven                       |    3 |
|       32 | House                       |    3 |
|      287 | Lie to Me                   |    3 |
|       33 | NUMB3RS                     |    3 |
|       39 | Rules of Engagement         |    3 |
|       11 | Smallville                  |    3 |
|      320 | South Park                  |    3 |
|      144 | The Big Bang Theory         |    3 |
|      295 | The Good Wife               |    3 |
|      302 | The Mentalist               |    3 |
|      292 | The Vampire Diaries         |    3 |
|      283 | V                           |    3 |
|      319 | Warehouse 13                |    3 |
+----------+-----------------------------+------+

Attachments (3)

recordingschedules.png (124.6 KB) - added by MarcT <myrdhn@…> 9 years ago.
record.2.sql (12.0 KB) - added by Nicolas Riendeau 9 years ago.
Trying to atach file for reporter…
duplicate-missing.patch (13.3 KB) - added by Bill Meek <keemllib@…> 9 years ago.
Lightly tested with lite template, works for me with default.

Download all attachments as: .zip

Change History (21)

Changed 9 years ago by MarcT <myrdhn@…>

Attachment: recordingschedules.png added

comment:1 Changed 9 years ago by robertm

Status: newassigned

comment:2 Changed 9 years ago by Rob Smith

Milestone: unknown0.24

comment:3 Changed 9 years ago by Rob Smith

Status: assignedinfoneeded

Are the links to the ID's messed up as well? I can't seem to duplicate this

comment:4 Changed 9 years ago by MarcT <myrdhn@…>

Status: infoneededassigned

Both NCIS links take you to the same powersearch page. Just an FYI, for one of my troubleshooting steps I backed up the table, dropped it and reinserted the existing data from the backup as new records so the recordid's are different now.

|       15 | All CSI (Power Search)      |    4 |
|        7 | All NCIS (Power Search)     |    4 |
|        9 | All Stargate (Power Search) |    4 |

This had no effect. Both NCIS records take me to http://SITE/mythweb/tv/schedules/custom/7 If you want I can upload a dump of the record table from my database so you can use it for your research.

comment:5 Changed 9 years ago by MarcT <myrdhn@…>

Note, I also just tried dropping the entire table, recreating it, and then adding the 3 power searches back in manually using mythweb, same deal. 3 searches show, but I see CSI, NCIS, and NCIS.

All CIS code:
program.title LIKE 'CSI: %'
AND program.hdtv > 0

All NCIS code:
program.title LIKE 'NCIS%'
AND program.hdtv > 0

All Stargate code:
program.title LIKE 'Stargate%'

Stargate has a priority of 3, CIS and NCIS have a priority of 2.

comment:6 Changed 9 years ago by Rob Smith

Status: assignedinfoneeded

If you add another search, what happens?

comment:7 Changed 9 years ago by MarcT <myrdhn@…>

Status: infoneededassigned

I assumed you meant another power search. I added an "All Z" search and "All Stargate" became the duplicate. I then changed the All Z to All S and it became the duplicate. I then changed All S to All N and NCIS became the duplicate again. Just to reinforce this, the last power search does not display on the Recording Schedules page. Instead what you get displayed, with link, is the second to last power search listed twice. Under the power searches all your other scheduled items display normally without duplication.

comment:8 Changed 9 years ago by Bill Meek <keemllib@…>

In short, I don't believe this is limited to Custom rules.

My system has 6 Custom rules, 1 had not been displaying and 1 was duplicated. After removing white space at the end of the query for the duplicated CSI rule, it was no longer duplicated, but, now my Law & Order rule was. Made the same change to the L&O query and it was no longer duplicated. I did re-add the white space to see if the rule would duplicate again, but it didn't.

However, now a non Custom rule for This Old House rule was duplicated (my Anything Presidential Custom rule was still hidden.)

I had to delete the This Old House rule and re-enter it to stop its duplication. The duplication 'moved' to yet another rule, which I did the delete/re-enter on. Repeated this for most of my 24 rules and finally the duplications stopped AND my missing Anything Presidential rule reappeared.

The status of all tables is OK and an Extended Check showed no errors.

comment:9 Changed 9 years ago by Rob Smith

Status: assignedinfoneeded

I need the database dump of record, I can't duplicate this.

comment:10 in reply to:  9 Changed 9 years ago by mythtv@…

Replying to kormoc:

I need the database dump of record, I can't duplicate this.

If the original reporter doesn't get back to you, I'm also seeing a similar problem... at least one of my recording schedules appears as a duplicate in mythweb. I also see a duplicate in the upcoming recordings listing.

Do you need specific tables, or the whole database? I've got a bzipped dump which is about 5.6 MB.

Changed 9 years ago by Nicolas Riendeau

Attachment: record.2.sql added

Trying to atach file for reporter...

comment:11 Changed 9 years ago by MarcT <myrdhn@…>

Thanks to Nick for adding the file. I was getting a message about the database being locked when I attempted to attach it.

comment:12 Changed 9 years ago by MarcT <myrdhn@…>

Status: infoneededassigned

comment:13 Changed 9 years ago by Bill Meek < keemllib@…>

This came back for me when I tweaked my Anything Presidential (Power Search) rule again.

Using various var_dump($the_schedules...); lines, I was able to prove that the information in $the_schedules was correct, however when the page was rendered, I had 2 instances of 'Saturday Night Live' and none of 'NUMB3RS'.

In modules/tv/tmpl/default/schedules.php, I changed every instance of $schedule to $sched_elmt. [g/\$schedule/s\$sched_elmt/g]

This solved the duplicate/missing rows for me, however, I don't speak PHP so I'll let someone who does decide if this is a proper fix (and I only tested the default template.)

Note that the initial query sorts by 'starttime ASC, title ASC', and that makes the 2 shows mentioned above the last 2 lines. A 2nd sort is done in sorting.php and that is what shows on the page. In my case 'SNL/#s' were then the 11th and 12th lines. Also, $schedule is used in modules/tv/schedules.php which ends with require_once tmpl_dir.'schedules.php';

Changed 9 years ago by Bill Meek <keemllib@…>

Attachment: duplicate-missing.patch added

Lightly tested with lite template, works for me with default.

comment:14 Changed 9 years ago by Bill Meek <keemllib@…>

Attached a patch last night. Tested adding, deleting, changing and details of recording rules without any problems. Below is a simpler version that passes the same tests (and also fixes the problem.)

Index: mythplugins/mythweb/modules/tv/schedules.php
===================================================================
--- mythplugins/mythweb/modules/tv/schedules.php	(revision 26590)
+++ mythplugins/mythweb/modules/tv/schedules.php	(working copy)
@@ -43,6 +43,7 @@
     // Add this show
         $the_schedules[] = &$schedule;
     }
+    unset($schedule);
 
 // Sort the recordings
     if (count($the_schedules))

comment:15 Changed 9 years ago by MarcT <myrdhn@…>

The patch in the above comment fixed this for me. Can we get this applied?

comment:16 Changed 9 years ago by robertm

Ticket locked: set

Marc, come on, you know better. Things get applied when their maintainer has the time to check out fixes and determine whether they are acceptable or correct. Randomly applying tickets that seem to fix one problem is a quick way of creating a dozen others. You have been around long enough that I shouldn't need to refer you to the ticket howto. Not locking the ticket as I normally would, but I will in future occurrences of this kind of thing.

comment:17 Changed 9 years ago by robertm

Ticket locked: unset

comment:18 Changed 9 years ago by Rob Smith

Resolution: Fixed
Status: assignedclosed

(In [26649]) Fixes #8661. This prevents a reference leak from causing duplicate schedules appearing in the list

Note: See TracTickets for help on using tickets.