year_batch
¶
Batch processing for album year updates.
This module handles batch processing of album year updates, including concurrency control and progress tracking.
Track-level update operations are delegated to TrackUpdater, and prerelease handling is delegated to PrereleaseHandler.
YearBatchProcessor
¶
YearBatchProcessor(
*,
year_determinator,
track_processor,
retry_handler,
console_logger,
error_logger,
config,
analytics,
dry_run=False
)
Handles batch processing of album years.
Responsibilities: - Batch album processing with rate limiting - Sequential and concurrent processing modes - Progress tracking and reporting - Orchestration of prerelease handling and track updates
Initialize the YearBatchProcessor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year_determinator
|
YearDeterminator
|
Component for determining album years |
required |
track_processor
|
TrackProcessor
|
Processor for track updates |
required |
retry_handler
|
DatabaseRetryHandler
|
Retry handler for transient error recovery |
required |
console_logger
|
Logger
|
Logger for console output |
required |
error_logger
|
Logger
|
Logger for error messages |
required |
config
|
AppConfig
|
Typed application configuration |
required |
analytics
|
AnalyticsProtocol
|
Service for performance tracking |
required |
dry_run
|
bool
|
Whether to run in dry-run mode |
False
|
Source code in src/core/tracks/year_batch.py
process_albums_in_batches
async
¶
Process albums in batches with rate limiting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grouped_albums
|
dict[tuple[str, str], list[TrackDict]]
|
Dictionary mapping (artist, album) tuples to lists of tracks. |
required |
updated_tracks
|
list[TrackDict]
|
List to append updated tracks to. |
required |
changes_log
|
list[ChangeLogEntry]
|
List to append change entries to. |
required |
force
|
bool
|
If True, bypass skip checks and re-query API for all albums. |
False
|
Source code in src/core/tracks/year_batch.py
group_tracks_by_album
staticmethod
¶
Group tracks by album (album_artist, album) key.
Uses album_artist instead of artist to properly handle collaboration tracks where multiple artists appear on the same album.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tracks
|
list[TrackDict]
|
List of tracks to group |
required |
Returns:
| Type | Description |
|---|---|
dict[tuple[str, str], list[TrackDict]]
|
Dictionary mapping (album_artist, album) tuples to lists of tracks |
Source code in src/core/tracks/year_batch.py
get_dry_run_actions
¶
update_album_tracks_bulk_async
async
¶
Update year for multiple tracks. Delegates to TrackUpdater.