Opened 10 years ago

Closed 7 years ago

Last modified 6 years ago

#12277 closed Patch - Bug Fix (fixed)

Metadata collection always fails for Manual Record rules

Reported by: Steve Erlenborn <simon.sinister@…> Owned by: Peter Bennett
Priority: minor Milestone: unknown
Component: MythTV - Scheduling Version: 0.27-fixes
Severity: medium Keywords: metadata manual record
Cc: Ticket locked: no

Description

My recording rules are all set up manually. Even though I configured mythTv to automatically download artwork for my recordings, it never worked. I read the Wiki page "Enhancing Recordings with Metadata Lookup" to look for hints. Next, I experimented with running 'mythmetadatalookup --refresh-all-rules'. In the output from that operation, I found the following pattern repeating.

2014-09-06 00:48:14.817623 I Running Grabber: /usr/share/mythtv/metadata/Television/ttvdb.py -l en -a US -N Orphan Black (Manual Record) 2014-04-18 19:00:00 2014-09-06 00:48:15.124764 I Running Grabber: /usr/share/mythtv/metadata/Television/ttvdb.py -l en -a US -M Orphan Black (Manual Record) 2014-09-06 00:48:15.426320 I Metadata Lookup Failed: No Results Orphan Black (Manual Record) 0 0

I noticed that the title string being passed to the utility included "(Manual Record)", so I tried running the same command, by hand, with and without that suffix.

/usr/share/mythtv/metadata/Television/ttvdb.py -l en -a US -M "Orphan Black (Manual Record)" /usr/share/mythtv/metadata/Television/ttvdb.py -l en -a US -M "Orphan Black" <?xml version='1.0' encoding='UTF-8'?> <metadata>

<item>

<language>en</language> <title>Orphan Black</title> <inetref>260315</inetref>

...

This version without " (Manual Record)" was able to retrieve metadata.

In the code, I found that programinfo.cpp adds that string :

 926     description = title =
 927         QString("%1 (%2)").arg(title).arg(QObject::tr("Manual Record"));

I've implemented a fix, in the attached patch, where I strip out the interfering string in two methods in metadatagrabber.cpp. After doing so, automatic collection of metadata is now working for me, at least when the title is unique.

Attachments (2)

mythtv-MetadataForManualRecordRules.patch (1.5 KB) - added by Steve Erlenborn <simon.sinister@…> 10 years ago.
Strip (Manual Record) from titles before searching for metadata
mythtv-12277-Metadata_collection_for_Manual_Record.patch (6.2 KB) - added by simon.sinister@… 7 years ago.
Updated solution to work in release 29

Download all attachments as: .zip

Change History (16)

Changed 10 years ago by Steve Erlenborn <simon.sinister@…>

Strip (Manual Record) from titles before searching for metadata

comment:1 Changed 8 years ago by Karl Egly

Component: MythTV - MythmetadatalookupMythTV - Scheduling
Status: newinfoneeded_new
Type: Patch - Bug FixBug Report - General

Steve, I'm trying to come up with a solution that makes sense for all kinds of recording rules. e.g. manual recording of the "monday night movies" time slot or a people search. If you manually set up series recording rules you can also manually enter the reference to thetvdb. That way MythTV should directly pull in the right series level information, ignoring the recording title.

comment:2 Changed 8 years ago by Karl Egly

Owner: changed from JYA to Karl Egly

comment:3 in reply to:  1 Changed 8 years ago by simon.sinister@…

Replying to dekarl:

Steve, I'm trying to come up with a solution that makes sense for all kinds of recording rules. e.g. manual recording of the "monday night movies" time slot or a people search. If you manually set up series recording rules you can also manually enter the reference to thetvdb. That way MythTV should directly pull in the right series level information, ignoring the recording title.

dekarl,

The patch I provided 14 months ago completely solves the problem. There are only 3 methods which search for a metadata match: MetaGrabberScript::Search(const QString &title, ...), MetaGrabberScript::SearchSubtitle?(const QString &title, ...), and MetaGrabberScript::SearchSubtitle?(const QString &inetref, ...). My solution updates the first two. The third one ignores the 'title' parameter, so it needed no update. For the scenario, you mentioned, the third method should be invoked, since you're providing the inetref value. See metadatadownload.cpp

/**
 * handleTelevision
 * attempt to find television data via the following (in order)
 * 1- By inetref with subtitle
 * 2- By inetref with season and episode
 * 3- By inetref
 * 4- By title and subtitle
 * 5- By title
 */
MetadataLookupList MetadataDownload::handleTelevision(MetadataLookup *lookup)
{

The original Component 'MythTV - Mythmedatalookup' was correct. The original Type 'Patch - Bug Fix' was correct. All I need is someone with privileges to review my solution and merge it in.

comment:4 Changed 8 years ago by paulh

Status: infoneeded_newnew

Changed 7 years ago by simon.sinister@…

Updated solution to work in release 29

comment:5 Changed 7 years ago by simon.sinister@…

My original solution no longer fits in MythTv? release 29 (current branch), so I've modified the solution to work with the current source files. The new fix is attached. Please review my solution and consider merging it into the official load line.

  • Steve

comment:6 Changed 7 years ago by Peter Bennett

Owner: changed from Karl Egly to Peter Bennett
Status: newassigned

I will take a look.

comment:7 Changed 7 years ago by Peter Bennett

I installed the patch then set a manual recording with the name "Hannibal". The metadata lookup failed, although the tv series Hannibal is in thetvdb and is unique. It seems the metadata lookup fails when it does not have a subtitle. The title in my recording is "Hannibal (Manual Record)" and the subtitle is "2017-10-07 14:10:00" Here is the log:

Oct  7 14:19:08 andromeda mythmetadatalookup: mythmetadatalookup[17671]: I MetadataDownload metadatagrabber.cpp:453 (RunGrabber) Running Grabber: /home/peter/proj/build/xenial-amd64/mythtv/master-tst/usr/share/mythtv/metadata/Television/ttvdb.py -l en -a US -N Hannibal 2017-10-07 14:10:00
Oct  7 14:19:08 andromeda mythmetadatalookup: mythmetadatalookup[17671]: I MetadataDownload metadatagrabber.cpp:453 (RunGrabber) Running Grabber: /home/peter/proj/build/xenial-amd64/mythtv/master-tst/usr/share/mythtv/metadata/Television/ttvdb.py -l en -a US -M Hannibal
Oct  7 14:19:08 andromeda mythmetadatalookup: mythmetadatalookup[17671]: I MetadataDownload metadatacommon.cpp:1202 (ParseMetadataItem) Result Found, Season 0 Episode 0
Oct  7 14:19:08 andromeda mythmetadatalookup: mythmetadatalookup[17671]: E MetadataDownload metadatadownload.cpp:252 (findBestMatch) No adequate match or multiple matches found for Hannibal.  Update manually.
Oct  7 14:19:08 andromeda mythmetadatalookup: mythmetadatalookup[17671]: I MetadataDownload metadatadownload.cpp:176 (run) Returning Metadata Results: Hannibal 0 0
Oct  7 14:19:09 andromeda mythmetadatalookup: mythmetadatalookup[17671]: I CoreContext lookup.cpp:296 (customEvent) Unable to match this title, too many possible matches. You may wish to manually set the season, episode, and inetref in the 'Watch Recordings' screen.
Oct  7 14:19:09 andromeda mythmetadatalookup: mythmetadatalookup[17671]: N CoreContext main.cpp:167 (main) MythMetadataLookup run complete.

Please let me know what you do about this or update your patch to fix it.

comment:8 Changed 7 years ago by Peter Bennett

Status: assignedinfoneeded

comment:9 Changed 7 years ago by Peter Bennett

Type: Bug Report - GeneralPatch - Bug Fix

comment:10 Changed 7 years ago by simon.sinister@…

The problem with your test is that "Hannibal" is not unique enough. You can see this by running the python script which retrieves metadata by hand.

/usr/share/mythtv/metadata/Television/ttvdb.py -l en -a US -M "Hannibal"
<?xml version='1.0' encoding='UTF-8'?>
<metadata>
  <item>
    <language>en</language>
    <title>Hannibal</title>
    <inetref>259063</inetref>
    <collectionref>259063</collectionref>
    <description>Both a gift and a curse, Will Graham has the extraordinary ability to think like his prey—he sees what they see, feels what they feel. But while Graham is pursuing an especially troubling, cannibalistic murderer, Special Agent Jack Crawford teams him with a highly respected psychiatrist – a man with a taste for the criminal minded – Dr. Hannibal Lecter.</description>
    <releasedate>2013-04-04</releasedate>
    <images>
      <image type="banner" url="http://www.thetvdb.com/banners/graphical/259063-g.jpg" thumb="http://www.thetvdb.com/banners/_cache/graphical/259063-g.jpg"/>
    </images>
  </item>
  <item>
    <language>en</language>
    <title>Hannibal: Rome's Worst Nightmare</title>
    <inetref>328938</inetref>
    <collectionref>328938</collectionref>
    <description>It is 200 years before the birth of Christ and Rome is the new superpower of the ancient world. She believes she is invincible - but one man is destined to change that. He is a man bound by oath to avenge the wrongs inflicted on his home and, in pursuit of revenge, he will stop at nothing. Hannibal explores the man behind the myth, revealing what drove the 26-year-old to mastermind one of the most audacious military moves in history. With 40,000 soldiers and 37 elephants, he marched 1,500 miles to challenge his enemies on their own soil. It was an act so daring that few people believed it possible.</description>
    <releasedate>2007-05-26</releasedate>
  </item>
  <item>
    <language>en</language>
    <title>Why? With Hannibal Buress</title>
    <inetref>295988</inetref>
    <collectionref>295988</collectionref>
    <description>“Why? With Hannibal Buress” celebrates Buress’ hilariously brilliant off-beat voice and point-of-view. If it’s in the zeitgeist, Buress will address it, providing his unique perspective on each week’s topic, answering the burning questions on his mind through stand-up, filmed segments, man-on-the-street interviews and special, in-studio guests. “Why? With Hannibal Buress” will be a weekly, half-hour series shot in front of a studio audience and each episode will tape the same week it airs. The series is executive produced by Buress, Jeff Stilson (“The Chris Rock Show,” “Da Ali G Show”) and Dave Becky of 3 Arts Entertainment.</description>
    <releasedate>2015-07-08</releasedate>
    <images>
      <image type="banner" url="http://www.thetvdb.com/banners/graphical/295988-g.jpg" thumb="http://www.thetvdb.com/banners/_cache/graphical/295988-g.jpg"/>
    </images>
  </item>
</metadata>

As you can see above, the phrase "Hannibal" matches three different TV series: "Hannibal", "Hannibal: Rome's Worst Nightmare", and "Why? With Hannibal Buress".

Without my patch, the MythTv? backend would execute :

/usr/share/mythtv/metadata/Television/ttvdb.py -l en -a US -M "Hannibal (Manual Record)"

which returns no matches at all.

The automatic lookup of metadata only works well when the title of the recording matches a single series. I do wish that an exact match on the title would take precedence over partial matches. If a title string matches 3 possible solutions, but one of them is an exact match, then the metadata for the exact match should be selected. However, that would best be addressed in a separate ticket.

comment:11 Changed 7 years ago by Peter Bennett

Thank you for that information. I ran some other tests and it is looking good, so I will commit it to master and fixes/29.

comment:12 Changed 7 years ago by Steve Erlenborn <simon.sinister@…>

Resolution: fixed
Status: infoneededclosed

In 594b16057be11be56286e7d7385dc6be686cc4a4/mythtv:

Fixes #12277 Metadata collection for Manual Record rules

Fix metadata grabber so that it does nor pass in the string
"(Manual Record)" , which was causing meatadata lookup to fail.

Signed-off-by: Peter Bennett <pbennett@…>

comment:13 Changed 7 years ago by Steve Erlenborn <simon.sinister@…>

In 0cf1422e206219db797b2b3b08ce1171cab8c7f4/mythtv:

Fixes #12277 Metadata collection for Manual Record rules

Fix metadata grabber so that it does nor pass in the string
"(Manual Record)" , which was causing meatadata lookup to fail.

Signed-off-by: Peter Bennett <pbennett@…>
(cherry picked from commit 594b16057be11be56286e7d7385dc6be686cc4a4)

comment:14 Changed 6 years ago by Peter Bennett

Owner: changed from Peter Bennett to Peter Bennett
Note: See TracTickets for help on using tickets.