Module: show

This module provides objects used to retrieve shows, show information, and show details from a copy of the Wait Wait Don't Tell Me! Stats database.

Show

class wwdtm.show.Show(connect_dict=None, database_connection=None)

Show retrieval class.

Contains methods used to retrieve basic and detailed show information, including hosts, scorekeepers, guests, panelists and scores.

Parameters:
  • connect_dict (dict[str, Any]) -- A dictionary containing database connection settings as required by MySQL Connector/Python

  • database_connection (MySQLConnection | PooledMySQLConnection) -- MySQL database connection object

retrieve_all()

Retrieves basic show information for all shows.

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_all_best_of_repeats()

Alias for wwdtm.show.Show.retrieve_all_repeat_best_ofs().

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_all_best_of_repeats_details()

Alias for wwdtm.show.Show.retrieve_all_repeat_best_ofs_details().

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

list[dict[str, Any]]

retrieve_all_best_ofs(inclusive=True)

Retrieves basic show information for all Best Of shows.

The list of Best Of shows includes repeat Best Of shows.

Parameters:

inclusive (bool) -- Include repeat shows in the list of Best Of shows

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_all_best_ofs_details(inclusive=True)

Retrieves detailed show information for all Best Of shows.

The list of Best Of shows includes repeat Best Of shows.

Parameters:

inclusive (bool) -- Include repeat shows in the list of Best Of shows

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

list[dict[str, Any]]

retrieve_all_counts_by_year(inclusive=False)

Retrieves show counts for all years, grouped by year.

Returns:

A dictionary with year as keys with corresponding counts for all shows, Best Of shows, repeat shows, and repeat Best Of shows as values

Parameters:

inclusive (bool)

Return type:

dict[int, dict[str, int]]

retrieve_all_dates()

Retrieves all show dates, sorted by show date.

Returns:

A list of all show date strings in YYYY-MM-DD format

Return type:

list[str]

retrieve_all_dates_tuple()

Retrieves all show dates as a tuple.

Returns:

A list of all show dates as a tuple of year, month and day

Return type:

list[tuple[int, int, int]]

retrieve_all_details()

Returns a list of dictionaries with show information and details for all shows.

Returns:

List of all shows and their corresponding details. If show information could not be retrieved, an empty list will be returned.

Return type:

list[dict[str, Any]]

retrieve_all_ids()

Retrieves all show IDs, sorted by show date.

Returns:

A list of all show IDs as integers

Return type:

list[int]

retrieve_all_repeat_best_ofs()

Retrieves basic show information for all Repeat Best Of shows.

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_all_repeat_best_ofs_details()

Retrieves detailed show information for all Repeat Best Of shows.

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

list[dict[str, Any]]

retrieve_all_repeats(inclusive=True)

Retrieves basic show information for all repeat shows.

Parameters:

inclusive (bool) -- Include Best Of shows in repeat show counts

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_all_repeats_details(inclusive=True)

Retrieves detailed show information for all repeat shows.

Parameters:

inclusive (bool) -- Include Best Of shows in repeat show counts

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

list[dict[str, Any]]

retrieve_all_show_years_months()

Retrieves all show years and months.

Returns:

A list of all show years and month as a string in YYYY-MM format

Return type:

list[str]

retrieve_all_shows_years_months_tuple()

Retrieves all show years and months as a tuple.

Returns:

A list of all show dates as a tuple of year and month

Return type:

list[tuple[int, int]]

retrieve_best_ofs_by_year(year, inclusive=True)

Retrieves basic show information for Best Of shows by year.

The list of Best Of shows includes repeat Best Of shows.

Parameters:
  • year (int) -- Four-digit year

  • inclusive (bool) -- Include repeat shows in the list of Best Of shows

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_best_ofs_details_by_year(year, inclusive=True)

Retrieves detailed show information for Best Of shows by year.

Parameters:
  • year (int) -- Four-digit year

  • inclusive (bool) -- Include repeat shows in the list of Best Of shows

Returns:

List of recent shows and corresponding details. If show information could not be retrieved, an empty list will be returned.

Return type:

list[dict[str, Any]]

retrieve_by_date(year, month, day)

Retrieves basic show information.

Parameters:
  • year (int) -- Four-digit year

  • month (int) -- One or two-digit month

  • day (int) -- One or two-digit day

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

dict[str, Any]

retrieve_by_date_string(date_string)

Retrieves basic show information.

Parameters:

date_string (str) -- Show date in YYYY-MM-DD format

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

dict[str, Any]

retrieve_by_id(show_id)

Retrieves basic show information.

Parameters:

show_id (int) -- Show ID

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

dict[str, Any]

retrieve_by_month_day(month, day)

Retrieves basic show information for shows by month and day.

Parameters:
  • month (int) -- One or two-digit month

  • day (int) -- One or two-digit day

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_by_year(year)

Retrieves basic show information by year.

Parameters:

year (int) -- Four-digit year

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_by_year_month(year, month)

Retrieves basic show information by year and month.

Parameters:
  • year (int) -- Four-digit year

  • month (int) -- One or two-digit month

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_counts_by_year(year, inclusive=False)

Retrieves show counts by year.

Counts of Best Of shows includes repeat Best Of shows.

Parameters:
  • year (int) -- Four-digit year

  • inclusive (bool) -- Include Best Of shows in repeat show counts

Returns:

A dictionary containing counts for all shows, Best Of shows, repeat shows, and repeat Best Of shows

Return type:

dict[str, int]

retrieve_details_by_date(year, month, day)

Retrieves detailed show information.

Parameters:
  • year (int) -- Four-digit year

  • month (int) -- One or two-digit month

  • day (int) -- One or two digit day

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

dict[str, Any]

retrieve_details_by_date_string(date_string)

Retrieves detailed show information.

Parameters:

date_string (str) -- Show date in YYYY-MM-DD format

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

dict[str, Any]

retrieve_details_by_id(show_id)

Retrieve detailed show information.

Parameters:

show_id (int) -- Show ID

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

dict[str, Any]

retrieve_details_by_month_day(month, day)

Retrieves detailed show information by month and day.

Parameters:
  • month (int) -- One or two-digit month

  • day (int) -- One or two-digit day

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

list[dict[str, Any]]

retrieve_details_by_year(year)

Retrieves detailed show information by year.

Parameters:

year (int) -- Four-digit year

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

list[dict[str, Any]]

retrieve_details_by_year_month(year, month)

Retrieves detailed show information by year and month.

Parameters:
  • year (int) -- Four-digit year

  • month (int) -- One or two-digit month

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

list[dict[str, Any]]

retrieve_months_by_year(year)

Retrieves show months for a year.

Parameters:

year (int) -- Four-digit year

Returns:

A list of available show months

Return type:

list[int]

retrieve_random()

Retrieves information for a random show.

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

dict[str, Any]

retrieve_random_by_year(year)

Retrieves information for a random show for a specific year.

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Parameters:

year (int)

Return type:

dict[str, Any]

retrieve_random_date()

Retrieves a date for a random show.

Returns:

show date string for a random show, in YYYY-MM-DD format.

Return type:

str

retrieve_random_date_by_year(year)

Retrieves a date for a random show for a specific year.

Returns:

show date string for a random show, in YYYY-MM-DD format.

Parameters:

year (int)

Return type:

str

retrieve_random_date_object()

Retrieves a date object for a random show.

Returns:

Date object for a random show.

Return type:

date

retrieve_random_date_object_by_year(year)

Retrieves a date object for a random show for a specific year.

Returns:

Date object for a random show.

Parameters:

year (int)

Return type:

date

retrieve_random_details()

Retrieves information and appearances for a random show.

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Return type:

dict[str, Any]

retrieve_random_details_by_year(year)

Retrieves information and appearances for a random show for a specific year.

Returns:

A dictionary containing show ID, show date, Best Of show flag, repeat show ID (if applicable), show URL at NPR.org, host, scorekeeper, location, panelists and guests

Parameters:

year (int)

Return type:

dict[str, Any]

retrieve_random_id()

Retrieves an ID for a random show.

Returns:

ID for a random show.

Return type:

int

retrieve_random_id_by_year(year)

Retrieves an ID for a random show for a specific year.

Returns:

ID for a random show.

Parameters:

year (int)

Return type:

int

retrieve_recent(include_days_ahead=7, include_days_back=32)

Retrieves basic show information for recent shows.

Parameters:
  • include_days_ahead (int) -- Number of days in the future to include

  • include_days_back (int) -- Number of days in the past to include

Returns:

List of recent shows and corresponding information. If show information could not be retrieved, an empty list will be returned.

Return type:

list[dict[str, Any]]

retrieve_recent_details(include_days_ahead=7, include_days_back=32)

Retrieves detailed show information for recent shows.

Parameters:
  • include_days_ahead (int) -- Number of days in the future to include

  • include_days_back (int) -- Number of days in the past to include

Returns:

List of recent shows and corresponding details. If show information could not be retrieved, an empty list will be returned.

Return type:

list[dict[str, Any]]

retrieve_repeat_best_ofs_by_year(year)

Retrieves basic show information for repeat Best Of shows by year.

Parameters:

year (int) -- Four-digit year

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_repeat_best_ofs_details_by_year(year)

Retrieves detailed show information for repeat Best Of shows by year.

Parameters:

year (int) -- Four-digit year

Returns:

List of recent shows and corresponding details. If show information could not be retrieved, an empty list will be returned.

Return type:

list[dict[str, Any]]

retrieve_repeats_by_year(year, inclusive=True)

Retrieves basic show information for repeat shows by year.

The list of repeat Best Of shows includes repeat Best Of shows.

Parameters:
  • year (int) -- Four-digit year

  • inclusive (bool) -- Include Best Of shows in the list of repeat shows

Returns:

A list of dictionaries containing show ID, show date, Best Of show flag, repeat show ID (if applicable) and show URL at NPR.org

Return type:

list[dict[str, Any]]

retrieve_repeats_details_by_year(year, inclusive=True)

Retrieves detailed show information for repeat shows by year.

The list of repeat Best Of shows includes repeat Best Of shows.

Parameters:
  • year (int) -- Four-digit year

  • inclusive (bool) -- Include Best Of shows in the list of repeat shows

Returns:

List of recent shows and corresponding details. If show information could not be retrieved, an empty list will be returned.

Return type:

list[dict[str, Any]]

retrieve_scores_by_year(year)

Retrieves panelist scores for all shows as a tuple.

Parameters:

year (int) -- Four-digit year

Returns:

A list of tuples each containing show date and panelist scores

Return type:

list[tuple[str, int | Decimal]]

retrieve_years()

Retrieves show years.

Returns:

A list of available show years

Return type:

list[int]

ShowInfo

class wwdtm.show.ShowInfo(connect_dict=None, database_connection=None)

Show information retrieval class.

Contains methods used to retrieve panelist, guest and Bluff the Listener information.

Parameters:
  • connect_dict (dict[str, Any]) -- A dictionary containing database connection settings as required by MySQL Connector/Python

  • database_connection (MySQLConnection | PooledMySQLConnection) -- MySQL database connection object

retrieve_bluff_info_by_id(show_id)

Retrieves Bluff the Listener information.

Parameters:

show_id (int) -- Show ID

Returns:

A dictionary containing Bluff the Listener segment ID and information about the chosen Bluff panelist and correct Bluff panelist.

Return type:

list[dict[str, Any]]

retrieve_core_info_by_id(show_id)

Retrieves core information.

Parameters:

show_id (int) -- Show ID

Returns:

A dictionary containing host, scorekeeper, location, description and notes

Return type:

dict[str, Any]

retrieve_guest_info_by_id(show_id)

Retrieves Not My Job guest information.

Parameters:

show_id (int) -- Show ID

Returns:

A dictionary containing Not My Job guest information, including score and scoring exception for each guest

Return type:

list[dict[str, Any]]

retrieve_panelist_info_by_id(show_id)

Retrieves panelist information.

Parameters:

show_id (int) -- Show ID

Returns:

A dictionary containing panelist information, scores and rankings

Return type:

list[dict[str, Any]]

ShowInfoMultiple

class wwdtm.show.ShowInfoMultiple(connect_dict=None, database_connection=None)

Multiple show information retrieval class.

Contains methods used to retrieve panelist, guest and Bluff the Listener information for multiple shows.

Parameters:
  • connect_dict (dict[str, Any]) -- A dictionary containing database connection settings as required by MySQL Connector/Python

  • database_connection (MySQLConnection | PooledMySQLConnection) -- MySQL database connection object

retrieve_bluff_info_all()

Retrieves Bluff the Listener information for all shows.

Returns:

A dictionary containing Bluff the Listener segment ID and information about the chosen Bluff panelist and correct Bluff panelist.

Return type:

dict[int, list[dict[str, Any]]]

retrieve_bluff_info_by_ids(show_ids)

Retrieves Bluff the Listener information for a list of shows.

Parameters:
  • show_id -- A list of show IDs

  • show_ids (list[int])

Returns:

A dictionary containing Bluff the Listener segment ID and information about the chosen Bluff panelist and correct Bluff panelist.

Return type:

dict[int, list[dict[str, Any]]]

retrieve_core_info_all()

Retrieves core information for all shows.

Returns:

A dictionary containing host, scorekeeper, location, description and notes

Return type:

dict[int, dict[str, Any]]

retrieve_core_info_by_ids(show_ids)

Retrieves core information for a list of shows.

Parameters:

show_ids (list[int]) -- A list of show IDs

Returns:

A dictionary containing host, scorekeeper, location, description and notes

Return type:

dict[int, dict[str, Any]]

retrieve_guest_info_all()

Retrieves Not My Job guest information for all shows.

Returns:

A dictionary containing Not My Job guest information, including score and scoring exception for each guest

Return type:

dict[int, list[dict[str, Any]]]

retrieve_guest_info_by_ids(show_ids)

Retrieves Not My Job guest information for all shows.

Parameters:

show_ids (list[int]) -- A list of show IDs

Returns:

A dictionary containing Not My Job guest information, including score and scoring exception for each guest.

Return type:

dict[int, list[dict[str, Any]]]

retrieve_panelist_info_all()

Retrieves panelist information for all shows.

Returns:

A dictionary containing panelist information, scores and rankings

Return type:

dict[int, list[dict[str, Any]]]

retrieve_panelist_info_by_ids(show_ids)

Retrieves panelist information for a list of shows.

Parameters:

show_ids (list[int]) -- A list of show IDs

Returns:

A dictionary containing panelist information, scores and rankings

Return type:

dict[int, list[dict[str, Any]]]

ShowUtility

class wwdtm.show.ShowUtility(connect_dict=None, database_connection=None)

Show information and utility class.

Contains methods to convert between show ID and date, and to check if show IDs and dates exist.

Parameters:
  • connect_dict (dict[str, Any]) -- A dictionary containing database connection settings as required by MySQL Connector/Python

  • database_connection (MySQLConnection | PooledMySQLConnection) -- MySQL database connection object

convert_date_to_id(year, month, day)

Converts a show date to the corresponding show ID.

Parameters:
  • year (int) -- Year portion of a show date

  • month (int) -- Month portion of a show date

  • day (int) -- Day portion of a show date

Returns:

Show ID if a corresponding value is found. Otherwise, None is returned

Return type:

int | None

convert_id_to_date(show_id)

Converts a show ID to the corresponding show date.

Parameters:

show_id (int) -- Show ID

Returns:

Show date if a corresponding value is found. Otherwise, None is returned

Return type:

str | None

date_exists(year, month, day)

Validates if a show date exists.

Parameters:
  • year (int) -- Year portion of a show date

  • month (int) -- Month portion of a show date

  • day (int) -- Day portion of a show date

Returns:

True if the show date exists, otherwise False

Return type:

bool

id_exists(show_id)

Validates if a show ID exists.

Parameters:

show_id (int) -- Show ID

Returns:

True if the show ID exists, otherwise False

Return type:

bool