[mythtv-commits] [MythTV/mythtv] 0e5dab: Handle null timestamp or runtime TvMaze fields

Steve Erlenborn noreply at github.com
Sun Jan 22 20:39:09 UTC 2023


  Branch: refs/heads/master
  Home:   https://github.com/MythTV/mythtv
  Commit: 0e5dab4042612a7b619fc616a2d882f74daccbfc
      https://github.com/MythTV/mythtv/commit/0e5dab4042612a7b619fc616a2d882f74daccbfc
  Author: Steve Erlenborn <1751095+SteveErl at users.noreply.github.com>
  Date:   2023-01-22 (Sun, 22 Jan 2023)

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

  Log Message:
  -----------
  Handle null timestamp or runtime TvMaze fields

In rare cases, the TvMaze database provides null timestamp
or runtime data fields. To make the metadata retrieval script
more fault tolerant, null checks have been added for these values.

When the timestamp field is null, don't use it to generate a
datetime to use in a search for a matching episode.

When the runtime duration field is null, the delta size is
now set to zero minutes. The code which looks for an episode
match has been updated to separate "on time" recordings from
"a little late" recordings to accommodate the possible delta
size of zero.

Refs: #654


  Commit: e4c55b551a9ca92584811e9452e01099c73ceaa0
      https://github.com/MythTV/mythtv/commit/e4c55b551a9ca92584811e9452e01099c73ceaa0
  Author: Steve Erlenborn <1751095+SteveErl at users.noreply.github.com>
  Date:   2023-01-22 (Sun, 22 Jan 2023)

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

  Log Message:
  -----------
  Handle null Country TvMaze field

A recording of a broadcast of the first episode in
season 16 of "Criminal Minds" on CBS lead to a metadata
lookup failure. The general syntax for this metadata
lookup was:
    tvmaze.py -N "Criminal Minds" "2022-11-24 11:00:00"
Investigation revealed that for recent years this show is
normally only available on a streaming service called
Paramount+.
  https://api.tvmaze.com/shows/81
    ...
    "webChannel":{"id":107,"name":"Paramount+",
    "country":null,"officialSite":
    "https://www.paramountplus.com/"}
    ...

The null value for Country caused the Timezone
retrieval code in tvmaze.py to fail. The code has
been updated to handle a null Country field.

While regression testing, another crash appeared.
    tvmaze.py -N "The Masked Singer" "2022-11-24 19:00:00"
This show has distinct versions in many countries and
timezones.

country='United States',  timezone='America/New_York'
country='United Kingdom', timezone='Europe/London'
country='Australia',      timezone='Australia/Sydney'
country='Belgium',        timezone='Europe/Brussels'
country=None, show_tz =None  (Japanese version)
country='Finland',        timezone='Europe/Helsinki'
country='Germany',        timezone='Europe/Busingen'
country='Israel',         timezone='Asia/Jerusalem'
country='Mexico',         timezone='America/Monterrey'

The null Country field for the Japanese version is
handled fine, but passing 'Asia/Jerusalem' to
astimezone() caused it to throw an exception.

  UnboundLocalError: local variable 'ttmfmt'
  referenced before assignment

This appears to be a bug in python3. To prevent
it from crashing our script, UnboundLocalError
has been added to the exception catcher.

Some of the debug print messages have also been
updated to improve their format.

Refs: #654


  Commit: ebcf061eb293e6c0a60a8f33173fb68a2bde424c
      https://github.com/MythTV/mythtv/commit/ebcf061eb293e6c0a60a8f33173fb68a2bde424c
  Author: Steve Erlenborn <1751095+SteveErl at users.noreply.github.com>
  Date:   2023-01-22 (Sun, 22 Jan 2023)

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

  Log Message:
  -----------
  Removing catch of UnboundLocalError exception

The previous commit added an exception catch for
UnboundLocalError because regression testing
revealed a failure in handling the Asia/Jerusalem
timezone. This timezone uses the version 3 data
format. A new issue #672 was opened to ask for
support for version 3. Since that issue has now
been fixed, we no longer need to catch
UnboundLocalError.

Refs: #654


Compare: https://github.com/MythTV/mythtv/compare/f4df2fbefd9c...ebcf061eb293


More information about the mythtv-commits mailing list