year_update
¶
Year Update Service.
Handles year update operations for tracks including revert, update, and pipeline steps.
YearUpdateService
¶
YearUpdateService(
track_processor,
year_retriever,
snapshot_manager,
config,
console_logger,
error_logger,
cleaning_service=None,
artist_renamer=None,
)
Service for year update operations.
Handles year updates, reverts, and pipeline steps for track metadata.
Initialize the year update service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track_processor
|
TrackProcessor
|
Processor for fetching and updating tracks. |
required |
year_retriever
|
YearRetriever
|
Retriever for year operations. |
required |
snapshot_manager
|
PipelineSnapshotManager
|
Manager for pipeline snapshots. |
required |
config
|
AppConfig
|
Typed application configuration. |
required |
console_logger
|
Logger
|
Logger for console output. |
required |
error_logger
|
Logger
|
Logger for error output. |
required |
cleaning_service
|
TrackCleaningService | None
|
Optional service for cleaning track metadata. |
None
|
artist_renamer
|
ArtistRenamer | None
|
Optional service for renaming artists. |
None
|
Source code in src/app/year_update.py
set_test_artists
¶
Set test artists for filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_artists
|
set[str] | None
|
Set of artist names to filter to, or None to process all. |
required |
get_tracks_for_year_update
async
¶
Get tracks for year update based on artist filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str | None
|
Optional artist filter. |
required |
Returns:
| Type | Description |
|---|---|
list[TrackDict] | None
|
List of tracks or None if not found. |
Source code in src/app/year_update.py
run_update_years
async
¶
Update album years for all or specific artist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str | None
|
Optional artist filter. |
required |
force
|
bool
|
Force update even if year exists. |
required |
fresh
|
bool
|
Fresh mode - invalidate cache before processing, implies force. |
False
|
Source code in src/app/year_update.py
run_revert_years
async
¶
Revert year updates for an artist (optionally per album).
Uses backup CSV if provided; otherwise uses the latest changes_report.csv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str
|
Artist name. |
required |
album
|
str | None
|
Optional album name filter. |
required |
backup_csv
|
str | None
|
Optional path to backup CSV file. |
None
|
Source code in src/app/year_update.py
run_restore_release_years
async
¶
Restore year from Apple Music's release_year field.
Finds albums where 'year' differs dramatically from 'release_year' and updates year to match release_year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str | None
|
Optional artist name filter. |
None
|
album
|
str | None
|
Optional album name filter (requires artist). |
None
|
threshold
|
int
|
Year difference threshold (default: 5 years). |
5
|
Source code in src/app/year_update.py
update_all_years_with_logs
async
¶
Update years for all tracks and return change logs (Step 4 of pipeline).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tracks
|
list[TrackDict]
|
List of tracks to process. |
required |
force
|
bool
|
Force update - bypass cache/skip checks and re-query API for all albums. |
required |
fresh
|
bool
|
Fresh mode - invalidate cache before processing, implies force. |
False
|
Returns:
| Type | Description |
|---|---|
list[ChangeLogEntry]
|
List of change log entries. |