top500albums/scripts/fix_new_albums.py
Johan Lundberg 88a6434132 Finalize dropped albums list with correct 8 albums and balance new albums
- Corrected dropped albums to exactly 8 albums through detailed comparison analysis
- Updated dropped albums list (ranks 501-508) with proper albums that were truly removed
- Fixed "New in 2023" markings to show only 8 albums (balancing the 8 dropped)
- Downloaded cover art for all 8 dropped albums
- Removed incorrect cover art files for albums that weren't actually dropped
- Updated data files with corrected artist/album name formatting for accurate matching

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-01 03:32:16 +02:00

62 lines
No EOL
2.3 KiB
Python

#!/usr/bin/env python3
"""
Update the CSV to mark only the correct 8 albums as "New in 2023".
"""
import csv
def main():
# The correct 8 new albums
correct_new_albums = {
491: ('Harry Styles', "Harry's House"),
466: ('Black Uhuru', 'Red'),
437: ('Gorillaz', 'Demon Days'),
430: ('Bad Bunny', 'Un Verano Sin Ti'),
358: ('Olivia Rodrigo', 'Sour'),
351: ('SZA', 'SOS'),
170: ('Taylor Swift', 'Folklore'),
71: ('Beyonce', 'Renaissance')
}
print(f"✅ Correcting to mark only {len(correct_new_albums)} albums as 'New in 2023'")
# Read current data
albums = []
with open('top_500_albums_2023.csv', 'r', encoding='utf-8') as file:
reader = csv.DictReader(file)
for row in reader:
albums.append(row)
# Update statuses
updated_count = 0
for album in albums:
rank = int(album['Rank'])
# If this rank should be marked as "New in 2023"
if rank in correct_new_albums:
expected_artist, expected_album = correct_new_albums[rank]
# Verify it matches
if album['Artist'] == expected_artist or expected_album.lower() in album['Album'].lower():
album['Status'] = 'New in 2023'
updated_count += 1
print(f"✅ #{rank} - {album['Artist']} - {album['Album']} -> New in 2023")
else:
print(f"⚠️ Rank {rank} mismatch: expected {expected_artist} - {expected_album}, got {album['Artist']} - {album['Album']}")
# If it's currently marked as "New in 2023" but not in our list, change it
elif 'New in 2023' in album.get('Status', ''):
album['Status'] = 'No change'
print(f"❌ #{rank} - {album['Artist']} - {album['Album']} -> Changed to No change")
# Write updated CSV
with open('top_500_albums_2023.csv', 'w', newline='', encoding='utf-8') as file:
fieldnames = ['Rank', 'Artist', 'Album', 'Status', 'Info', 'Description']
writer = csv.DictWriter(file, fieldnames=fieldnames)
writer.writeheader()
writer.writerows(albums)
print(f"\n✅ Updated CSV with {updated_count} albums marked as 'New in 2023'")
print(f"📁 Saved to: top_500_albums_2023.csv")
if __name__ == "__main__":
main()