update_executor
¶
Track update execution module.
This module handles track update operations including: - Single and batch property updates - Dry run recording - Security validation - Cache invalidation after updates
TrackUpdateExecutor
¶
TrackUpdateExecutor(
ap_client,
cache_service,
security_validator,
config,
console_logger,
error_logger,
analytics,
*,
dry_run=False
)
Executes track metadata updates via AppleScript.
This class handles: - Individual and batch property updates - Security validation of parameters - Dry run mode recording - Cache invalidation after successful updates
Initialize the update executor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ap_client
|
AppleScriptClientProtocol
|
AppleScript client for executing updates |
required |
cache_service
|
CacheServiceProtocol
|
Cache service for invalidation |
required |
security_validator
|
SecurityValidator
|
Validator for sanitizing inputs |
required |
config
|
AppConfig
|
Typed application configuration |
required |
console_logger
|
Logger
|
Logger for info/debug messages |
required |
error_logger
|
Logger
|
Logger for error messages |
required |
analytics
|
AnalyticsProtocol
|
Service for performance tracking |
required |
dry_run
|
bool
|
If True, record actions without executing |
False
|
Source code in src/core/tracks/update_executor.py
set_dry_run
¶
Update dry run mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dry_run
|
bool
|
New dry run state |
required |
get_dry_run_actions
¶
Get the list of dry-run actions recorded.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of dry-run action dictionaries |
update_track_async
async
¶
update_track_async(
track_id,
new_track_name=None,
new_album_name=None,
new_genre=None,
new_year=None,
track_status=None,
original_artist=None,
original_album=None,
original_track=None,
)
Update multiple properties of a track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track_id
|
str
|
ID of the track to update |
required |
new_track_name
|
str | None
|
New track name (optional) |
None
|
new_album_name
|
str | None
|
New album name (optional) |
None
|
new_genre
|
str | None
|
New genre (optional) |
None
|
new_year
|
str | None
|
New year (optional) |
None
|
track_status
|
str | None
|
Track status to check for prerelease (optional) |
None
|
original_artist
|
str | None
|
Original artist name for contextual logging (optional) |
None
|
original_album
|
str | None
|
Original album name for contextual logging (optional) |
None
|
original_track
|
str | None
|
Original track name for contextual logging (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if all updates are successful, False if any failed |
Source code in src/core/tracks/update_executor.py
update_artist_async
async
¶
Update the artist name for a track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track
|
TrackDict
|
Track dictionary representing the target track |
required |
new_artist_name
|
str
|
Artist name to apply |
required |
original_artist
|
str | None
|
Original artist for logging context (optional) |
None
|
update_album_artist
|
bool
|
If True, also update album_artist field when it matches the old or new artist name from configuration mapping |
False
|
Returns:
| Type | Description |
|---|---|
bool
|
True if update succeeded, False otherwise |