- Removed 15 albums incorrectly marked as dropped that are still in main list - Fixed White Album duplication (was listed at both rank 29 and 502) - Beatles albums Sgt. Pepper's (#24) and White Album (#29) are NOT dropped - Final dropped albums: 7 genuinely removed albums (ranks 501-507) - Updated JavaScript validation for correct range (1-507) - Removed unnecessary cover art files for incorrectly marked albums Correctly identifies only truly dropped albums from 2020→2023 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
88 lines
No EOL
3.2 KiB
Python
88 lines
No EOL
3.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Fix the dropped albums list by removing albums that are actually still in the main Top 500 list.
|
|
"""
|
|
|
|
import csv
|
|
|
|
def main():
|
|
# Read current CSV
|
|
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)
|
|
|
|
# Find albums in main list (ranks 1-500)
|
|
main_albums = {}
|
|
for album in albums:
|
|
rank = int(album['Rank'])
|
|
if rank <= 500:
|
|
key = (album['Artist'], album['Album'])
|
|
main_albums[key] = album
|
|
|
|
print(f"📊 Found {len(main_albums)} albums in main Top 500 list")
|
|
|
|
# Find incorrectly marked as dropped
|
|
incorrect_drops = []
|
|
correct_drops = []
|
|
|
|
for album in albums:
|
|
rank = int(album['Rank'])
|
|
if rank > 500 and album['Status'].startswith('Dropped'):
|
|
key = (album['Artist'], album['Album'])
|
|
if key in main_albums:
|
|
print(f"❌ INCORRECT: {album['Artist']} - {album['Album']} (marked as dropped but is in main list at rank {main_albums[key]['Rank']})")
|
|
incorrect_drops.append(album)
|
|
else:
|
|
correct_drops.append(album)
|
|
|
|
print(f"\n🔍 Analysis:")
|
|
print(f" ❌ Incorrectly marked as dropped: {len(incorrect_drops)}")
|
|
print(f" ✅ Correctly marked as dropped: {len(correct_drops)}")
|
|
|
|
if incorrect_drops:
|
|
print(f"\n🧹 Removing {len(incorrect_drops)} incorrect dropped entries...")
|
|
|
|
# Remove incorrect drops
|
|
fixed_albums = []
|
|
removed_count = 0
|
|
|
|
for album in albums:
|
|
rank = int(album['Rank'])
|
|
if rank > 500 and album['Status'].startswith('Dropped'):
|
|
key = (album['Artist'], album['Album'])
|
|
if key not in main_albums:
|
|
# Keep this dropped album (it's correctly dropped)
|
|
fixed_albums.append(album)
|
|
else:
|
|
# Remove this (it's incorrectly marked as dropped)
|
|
removed_count += 1
|
|
print(f" 🗑️ Removed: {album['Artist']} - {album['Album']}")
|
|
else:
|
|
# Keep all main list albums
|
|
fixed_albums.append(album)
|
|
|
|
# Renumber the remaining dropped albums
|
|
current_rank = 501
|
|
for album in fixed_albums:
|
|
if int(album['Rank']) > 500:
|
|
album['Rank'] = str(current_rank)
|
|
current_rank += 1
|
|
|
|
# Write corrected 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(fixed_albums)
|
|
|
|
print(f"\n✅ Fixed! Removed {removed_count} incorrect entries")
|
|
print(f"📊 Total albums now: {len(fixed_albums)}")
|
|
print(f" - Main list (1-500): 500 albums")
|
|
print(f" - Correctly dropped (501+): {len(correct_drops)} albums")
|
|
else:
|
|
print(f"\n✅ No fixes needed - all dropped albums are correct!")
|
|
|
|
if __name__ == "__main__":
|
|
main() |