seriesmarker.persistence.factory.series_factory module

class SeriesFactory[source]

Bases: seriesmarker.persistence.factory.base_factory.BaseFactory

Factory to create series objects from TheTVDB data.

_handle_roles(series, pytvdb_actors)[source]

Updates or adds the roles of a series.

By using the RoleFactory, each role of the series data is compared to existing roles in the database, to update the series. New roles are added, existing roles are updated and missing roles will be deleted.

Parameters:
  • series (Series) – The series to update role data for.
  • pytvdb_actors (list) – The new role data from TheTVDB.
_handle_seasons(series, pytvdb_seasons)[source]

Updates or adds the seasons of a series.

By using the SeasonFactory, each season of the series data is compared to existing seasons in the database, to update the series. New seasons are added, existing seasons are updated and missing seasons will be deleted.

Parameters:
  • series (Series) – The series to update season data for.
  • pytvdb_seasons (list) – The new season data from TheTVDB.
new_series(pytvdb_show, update=None)[source]

Creates a persistable series object from TheTVDB data.

This method will create a new Series instance from pytvdbapi data. If a series object is given, the existing one will be updated with the data instead. In both cases, it also traverses the seasons and episodes of a series, using SeasonFactory, to populate it with data.

Parameters:
  • pytvdb_show (pytvdbapi.api.Show) – The data to create the series instance from.
  • update (Series) – A series to update with new data.
Returns:

The newly created or updated Series instance.