track_cleaning
¶
Track Cleaning Service.
Handles metadata cleaning operations for tracks (removing promotional text, normalizing names, etc.).
TrackCleaningService
¶
Service for cleaning track and album metadata.
Removes promotional text, normalizes names, and handles batch cleaning operations with proper change logging.
Initialize the cleaning service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track_processor
|
TrackProcessor
|
Processor for updating tracks. |
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/app/track_cleaning.py
extract_and_clean_metadata
¶
Extract and clean track metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track
|
TrackDict
|
Track data to process. |
required |
Returns:
| Type | Description |
|---|---|
tuple[TrackFieldValue, str, TrackFieldValue, TrackFieldValue, str, str]
|
Tuple of (track_id, artist_name, track_name, album_name, cleaned_track_name, cleaned_album_name). |
Source code in src/app/track_cleaning.py
process_single_track
async
¶
Process a single track for cleaning.
This unified method handles both standalone cleaning and pipeline cleaning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track
|
TrackDict
|
Track data to process. |
required |
artist_override
|
str | None
|
Optional artist name override for logging. If None, uses artist from track metadata. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[TrackDict | None, ChangeLogEntry | None]
|
Tuple of (updated_track, change_entry) or (None, None) if no update needed. |
Source code in src/app/track_cleaning.py
process_all_tracks
async
¶
Process multiple tracks for cleaning with change logging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tracks
|
list[TrackDict]
|
List of tracks to process. |
required |
artist
|
str
|
Artist name for logging. |
required |
Returns:
| Type | Description |
|---|---|
tuple[list[TrackDict], list[ChangeLogEntry]]
|
Tuple of (updated_tracks, changes_log). |
Source code in src/app/track_cleaning.py
clean_all_metadata_with_logs
async
¶
Clean metadata for all tracks with change logging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tracks
|
list[TrackDict]
|
List of tracks to clean. |
required |
Returns:
| Type | Description |
|---|---|
list[ChangeLogEntry]
|
List of change log entries for cleaned tracks. |