dry_run
¶
Dry Run Module.
This module provides a dry run simulation for cleaning and genre updates. It defines classes that can be used by the main application to simulate AppleScript interactions and processing logic without modifying the actual music library.
DryRunAppleScriptClient
¶
Bases: AppleScriptClientProtocol
AppleScript client that logs actions instead of modifying the library.
Initialize the DryRunAppleScriptClient with dependencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
real_client
|
AppleScriptClientProtocol
|
The real AppleScript client to delegate fetch operations to |
required |
config
|
AppConfig
|
Typed application configuration |
required |
console_logger
|
Logger
|
Logger for console output |
required |
error_logger
|
Logger
|
Logger for error output |
required |
Source code in src/core/dry_run.py
initialize
async
¶
Initialize the DryRunAppleScriptClient.
Delegates initialization to the underlying real client to ensure all fetch operations work correctly in dry-run mode.
run_script
async
¶
run_script(
script_name,
arguments=None,
timeout=None,
context_artist=None,
context_album=None,
context_track=None,
label=None,
)
Run an AppleScript by name in dry run mode.
For 'fetch' operations, delegates to the real client to get actual tracks. For update operations, log the action without making any changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script_name
|
str
|
Name of the AppleScript to run. |
required |
arguments
|
list[str] | None
|
List of arguments to pass to the script. |
None
|
timeout
|
float | None
|
Optional timeout in seconds. |
None
|
context_artist
|
str | None
|
Artist name for contextual logging (optional). |
None
|
context_album
|
str | None
|
Album name for contextual logging (optional). |
None
|
context_track
|
str | None
|
Track name for contextual logging (optional). |
None
|
label
|
str | None
|
Custom label for logging (defaults to script_name). |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: The script output if this is a fetch operation, DRY_RUN_SUCCESS_MESSAGE otherwise. |
Source code in src/core/dry_run.py
fetch_tracks_by_ids
async
¶
Fetch tracks by IDs - delegates to real client in dry-run mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track_ids
|
list[str]
|
List of track IDs to fetch |
required |
batch_size
|
int
|
Maximum number of IDs per batch (default: 1000) |
1000
|
timeout
|
float | None
|
Timeout in seconds for script execution |
None
|
Returns:
| Type | Description |
|---|---|
list[dict[str, str]]
|
List of track dictionaries with metadata |
Source code in src/core/dry_run.py
fetch_all_track_ids
async
¶
Fetch all track IDs - delegates to real client in dry-run mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float | None
|
Timeout in seconds for script execution |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of track ID strings |
Source code in src/core/dry_run.py
get_actions
¶
Get the list of actions recorded during the dry run.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of dictionaries, each containing: |
list[dict[str, Any]]
|
|
list[dict[str, Any]]
|
|