[mythtv-commits] [MythTV/mythtv] c67625: TVmaze: Adding routine to collect all artwork

Steve Erlenborn noreply at github.com
Mon Apr 5 13:09:14 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/MythTV/mythtv
  Commit: c67625bb49b0893d5a8bd07c6c7a6363dd0454f9
      https://github.com/MythTV/mythtv/commit/c67625bb49b0893d5a8bd07c6c7a6363dd0454f9
  Author: Steve Erlenborn <1751095+SteveErl at users.noreply.github.com>
  Date:   2021-04-05 (Mon, 05 Apr 2021)

  Changed paths:
    A mythtv/bindings/python/tvmaze/artwork.py
    M mythtv/bindings/python/tvmaze/endpoints.py
    M mythtv/bindings/python/tvmaze/tvmaze_api.py

  Log Message:
  -----------
  TVmaze: Adding routine to collect all artwork

This adds functionality to grab addtional artworks to the
tvmaze api.

Refs #336

Signed-off-by: Roland Ernst <rcrernst at gmail.com>


  Commit: 87e48c2a136129820885f218affbed4257a9181b
      https://github.com/MythTV/mythtv/commit/87e48c2a136129820885f218affbed4257a9181b
  Author: Steve Erlenborn <1751095+SteveErl at users.noreply.github.com>
  Date:   2021-04-05 (Mon, 05 Apr 2021)

  Changed paths:
    M mythtv/programs/scripts/metadata/Television/tvmaze.py
    M mythtv/programs/scripts/metadata/Television/tvmaze_tests.txt

  Log Message:
  -----------
  Get more artwork and favor artwork from official source

The TvMaze website sets a flag called Main to True when the source
of the image is the network which produced the show.
Usually these are high quality images, so we want to default
to these "official" images.
This is done by putting them first in the list.
By default, the first item of each artwork type (Coverart, Fanart, Banner)
is the one which gets automatically assigned.
In addition, after consulting the MythTV_Universal_Metadata_Format page,
my impression is that during the query operation, ./grabbername -M "title",
one one of each artwork type is expected, though this is not explicitly specified.
It's during the collection operation, ./grabbername -C <tvmaze_id>, that we
need ALL of the artworks listed.
I modified the script to follow this convention and then tested both
automatic metadata assignment, and manual override
(e.g. Metadata Options -> Find Coverart Online) to validate that all
of the artwork options are presented to the user.

Refs #336

Signed-off-by: Roland Ernst <rcrernst at gmail.com>


  Commit: 3f2973695840e58ba03e6c9b86fa76d09a580a31
      https://github.com/MythTV/mythtv/commit/3f2973695840e58ba03e6c9b86fa76d09a580a31
  Author: Steve Erlenborn <1751095+SteveErl at users.noreply.github.com>
  Date:   2021-04-05 (Mon, 05 Apr 2021)

  Changed paths:
    M mythtv/programs/scripts/metadata/Television/tvmaze.py
    M mythtv/programs/scripts/metadata/Television/tvmaze_tests.txt

  Log Message:
  -----------
  Adding output of popularity and userrating

The code which handles automatic assignment of metadata uses "popularity" as one
of the factors when deciding between multiple database entries with exact
title matches.
In the TvMaze scheme popularity shows up as the 'weight' field. This commit adds
output of the popularity, and also adds output of userrating to the '-M' and '-C'
versions. It was already in the '-D' version.

Refs #336

Signed-off-by: Roland Ernst <rcrernst at gmail.com>


  Commit: 9f6655fd0ce6c391a237b130feb1f54895c4dfdf
      https://github.com/MythTV/mythtv/commit/9f6655fd0ce6c391a237b130feb1f54895c4dfdf
  Author: Steve Erlenborn <1751095+SteveErl at users.noreply.github.com>
  Date:   2021-04-05 (Mon, 05 Apr 2021)

  Changed paths:
    M mythtv/programs/scripts/metadata/Television/tvmaze.py
    M mythtv/programs/scripts/metadata/Television/tvmaze_tests.txt

  Log Message:
  -----------
  TVMaze: Improved search for subtitle

This has a number of enhancements to handle situations where there are
multiple matches on subtitle, and to better search for a subtitle
match when there are multiple shows with a matching title
(e.g. "The Flash").

I found some weaknesses in the string matching algorithm, so I modified
it. The Levenshtein distance is the minimum number of single character
edits required to change one string into another.
It's valuable information in trying to find a best match.
However, it's problematic to make decisions solely upon this distance.
If the strings are really long or really short, a simple rule, such as
"accept any distance < 6" can provide poor results. If we're comparing
"Risk" and "Call", the Levenshtein distance is 4, but it's a terrible
match. If we're comparing "In Sickness and in Health" and
"Sickness and Health", the Levenshtein distance value is 6. This would
fail the given rule, even though the strings are really a pretty good
match. 60% of the characters are in common. To establish how good of a
match we have, we'll use the Levenshtein distance to figure out the
ratio of matching characters in the longer string divided by the length
of the longer string. I call this 'match_quality'. This ratio ranges
from 0 (no match at all) to 1.0 (a perfect match).
This performs well for short, average, and long strings.

Refs #336

Signed-off-by: Roland Ernst <rcrernst at gmail.com>


  Commit: 1f2d417433b5f507a344ff243cbd7a1933a7e12d
      https://github.com/MythTV/mythtv/commit/1f2d417433b5f507a344ff243cbd7a1933a7e12d
  Author: Steve Erlenborn <1751095+SteveErl at users.noreply.github.com>
  Date:   2021-04-05 (Mon, 05 Apr 2021)

  Changed paths:
    M mythtv/programs/scripts/metadata/Television/tvmaze.py
    M mythtv/programs/scripts/metadata/Television/tvmaze_tests.txt

  Log Message:
  -----------
  Added tvmaze.py -N <title> <date time> support

For manual recordings, the program mythmetadatalookup starts its search
with a call to <grabber> -l <lang> -a <country> <title> <date time>,
where the <date time> is the local time stamp in ISO format.
For example:
tvmaze.py -l en -a US -N "CBS Sunday Morning" "2021-03-21 08:00:00"

This used to always fail, because grabbers like tvmaze.py were only
looking for a text <subtitle> as the last argument. I've added code
to check whether that field is in the form of a <date time>. If so,
this field is parsed to create a datetime which gets processed into
an argument for a call to tvmaze.get_show_episodes_by_date(), which
retrieves episode specific information from the database.

Updated and modified the --doctest handling to only be verbose when
the '--debug' option is also provided on the command line.

Refs #336

Signed-off-by: Roland Ernst <rcrernst at gmail.com>


Compare: https://github.com/MythTV/mythtv/compare/83e9b26f6a06...1f2d417433b5


More information about the mythtv-commits mailing list