pyrekordbox.db6.registry#

class pyrekordbox.db6.registry.RekordboxAgentRegistry(db)[source]#

Bases: object

Rekordbox Agent Registry handler.

The Rekordbox Agent Registry handler is responsible for tracking changes to the Rekordbox database. It is used to keep track of changes to the database, provide a history of changes and to update the global and individual USN (unique sequence number) values of the database entries.

This object should not be instantiated directly. It is used by the RekordboxDatabase class to track changes to the database.

Parameters:
dbRekordboxDatabase

The Rekordbox database instance.

classmethod on_update(instance, key, value)[source]#

Called when an instance of a database model is updated.

Parameters:
instancetables.Base

The table entry instance.

keystr

The name of the updated column.

valueAny

The new value of the updated column.

classmethod on_create(instance)[source]#

Called when an instance of a database model is created.

Parameters:
instancetables.Base

The table entry instance.

classmethod on_delete(instance)[source]#

Called when an instance of a database model is deleted.

Parameters:
instancetables.Base

The table entry instance.

classmethod on_move(instances)[source]#

Called when instanced of a database model are moved.

Parameters:
instanceslist[tables.Base]

The table entry instance.

classmethod clear_buffer()[source]#

Clears the update buffer and update history.

classmethod enable_tracking()[source]#

Enables the tracking of database changes.

classmethod disable_tracking()[source]#

Disables the tracking of database changes.

classmethod disabled()[source]#

Context manager to temporarily disable the tracking of database changes.

Examples

>>> registry = RekordboxAgentRegistry(db)  # noqa
>>> registry.__enabled__
True
>>> with registry.disabled():
...     print(registry.__enabled__)
False
get_registries()[source]#

Returns all agent registries.

Returns:
registrieslist[tables.AgentRegistry]
get_registry(key)[source]#

Returns the agent registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

Returns:
registrytables.AgentRegistry
get_string(key)[source]#

Returns the string value of the registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

Returns:
valuestr
get_text(key)[source]#

Returns the text value of the registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

Returns:
valuestr
get_int(key)[source]#

Returns the integer value of the registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

Returns:
valueint
get_date(key)[source]#

Returns the date value of the registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

Returns:
valuedatetime.datetime
set_string(key, value)[source]#

Sets the string value of the registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

valuestr

The new value.

set_text(key, value)[source]#

Sets the text value of the registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

valuestr

The new value.

set_int(key, value)[source]#

Sets the integer value of the registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

valueint

The new value.

set_date(key, value)[source]#

Sets the date value of the registry with the given key.

Parameters:
keystr

The registry identifier (registry_id).

valuedatetime.datetime

The new value.

get_local_update_count()[source]#

Returns the current global local USN (unique sequence number).

set_local_update_count(value)[source]#

Sets the global local USN (unique sequence number).

Parameters:
valueint

The new USN value.

increment_local_update_count(num=1)[source]#

Increments the global local USN (unique sequence number) by the given number.

Parameters:
numint, optional

The number to increment the USN by. The default is 1.

Returns:
usn: int

The new global local USN.

autoincrement_local_update_count(set_row_usn=True)[source]#

Auto-increments the global local USN (unique sequence number).

The number of changes in the update buffer is used to determine the number to increment the USN by. After the update the buffer is cleared.

Parameters:
set_row_usnbool, optional

If True the local USN of each database entry is updated with the corresponding value in the order the changes were made.

Returns:
usn: int

The new global local USN.