seriesmarker.persistence.factory.base_factory module

class BaseFactory[source]

Bases: object

Base class of factories, offers common operations.

__init__()[source]
_handle_list_attribute(items, pytvdb_values, cls)[source]

Maps simple list attributes (containing strings) between pytvdbapi and seriesmarker.

This method compares a list of strings, given by the pytvdbapi-object, with a given list of objects in the database. It creates and adds a new object, of the given class, to the database if the pytvdbapi-list contains an unknown string. It respectively removes objects from the database if a related string can not be found at the pytvdbapi-list.

Note

This method is intended to be used for simple data from TheTVDB, only. It applies to data, which has no relation to other objects and thus no dependencies, which need to be resolved on removal from the database.

Todo

Logging should be used to list differences on update of series/episodes.

Parameters:
  • items (list) – The list of objects from the database.
  • pytvdb_values (list) – The list of strings from TheTVDB to compare with.
  • cls – The class which shall be used to create a new instance from.
reset()[source]

Resets the factory log/history of performed updates.