The seedbox.db.models
Module¶
Model classes to represent the structures of data.
-
class
seedbox.db.models.
AppState
(name, value)¶ Bases:
seedbox.db.models.Model
Represents the state of the application and internal processing.
Initializes new instance.
Parameters: - name (str) – an identifier for the capturing a state attribute
- value (str | int | bool | datetime.datetime) – the data associated with the identifier
Returns: an instance of the AppState object
Return type: -
PK_NAME
= 'name'¶
-
class
seedbox.db.models.
MediaFile
(media_id, torrent_id, filename, file_ext, file_path=None, size=None, compressed=None, synced=None, missing=None, skipped=None, error_msg=None, total_time=None)¶ Bases:
seedbox.db.models.Model
Represents the attributes of media files associated to a torrent.
Also the associated state based on parsing and processing.
Initializes new instance.
Parameters: - media_id (int) – primary key identifier of media file
- torrent_id (int) – foreign key identifier of torrent
- filename (str) – name of media file
- file_ext (str) – extension of media file
- file_path (str) – location of media file
- size (int) – file size of media file
- compressed (bool) – flag indicating compressed file
- synced (bool) – flag indicating sync to remote location
- missing (bool) – flag indicating file not found on file system
- skipped (bool) – flag indicating if skipped during processing
- error_msg (str) – error message that happened during processing
- total_time (int) – total amount of time to process file
Returns: an instance of the MediaFile object
Return type: -
PK_NAME
= 'media_id'¶
-
class
seedbox.db.models.
Model
(**kwds)¶ Bases:
object
Provides base methods for interacting with database model
Parameters: kwds (dict) – keyword parameters and values of the model -
PK_NAME
= 'id'¶
-
as_dict
()¶ Generates a dictionary representation of the model.
Returns: model as dict Return type: dict
-
items
()¶ Provides a generator of key-value pair attributes for a model.
-
classmethod
make_empty
()¶ Create an instance of the model.
Using the defined attributes from the parameters of the model.
Returns: model class Return type: Model
-
classmethod
pk_filter
(value=None)¶ Creates a primary key filter for the given model.
Parameters: value – primary key value Returns: primary key filter Return type: dict
-
-
class
seedbox.db.models.
Torrent
(torrent_id, name, created_at=None, updated_at=None, state=None, retry_count=None, failed=None, error_msg=None, invalid=None, purged=None, media_files=None)¶ Bases:
seedbox.db.models.Model
Represents the attributes of a torrent.
Also the associated state based on parsing and processing of the torrent.
Initializes new instance.
Parameters: - torrent_id (int) – primary key identifier of torrent
- name (str) – name of the torrent file
- created_at (datetime.datetime) – date when db entry created
- updated_at (datetime.datetime) – date when db entry updated
- state (str) – current state of processing of torrent (init, ready, active, done, cancelled)
- retry_count (int) – number of times entry was reprocessed
- failed (bool) – flag indicating processing failed
- error_msg (str) – error message generated during processing
- invalid (bool) – flag indicating entry was invalid
- purged (bool) – flag indicating entry details were purged
- media_files (list) – list of associated media file(s)
Returns: an instance of the Torrent object
Return type: -
PK_NAME
= 'torrent_id'¶