Fix dropped albums list - remove duplicates and correct data
- 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>
This commit is contained in:
parent
42374fa016
commit
a2713e9fb1
18 changed files with 158 additions and 24 deletions
88
scripts/fix_dropped_albums.py
Normal file
88
scripts/fix_dropped_albums.py
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
#!/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()
|
||||
62
scripts/fix_white_album.py
Normal file
62
scripts/fix_white_album.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Fix the White Album duplication - it's listed both in main list and dropped.
|
||||
"""
|
||||
|
||||
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)
|
||||
|
||||
print("🔍 Looking for White Album duplication...")
|
||||
|
||||
# Find White Album entries
|
||||
white_album_entries = []
|
||||
for album in albums:
|
||||
if album['Artist'] == 'The Beatles' and ('White Album' in album['Album'] or album['Album'] == 'The Beatles'):
|
||||
white_album_entries.append(album)
|
||||
print(f" Found: Rank {album['Rank']} - {album['Artist']} - {album['Album']} ({album['Status']})")
|
||||
|
||||
if len(white_album_entries) > 1:
|
||||
print(f"\n❌ Found {len(white_album_entries)} White Album entries - removing duplicate")
|
||||
|
||||
# Remove the dropped version (should be rank 502)
|
||||
fixed_albums = []
|
||||
removed_count = 0
|
||||
|
||||
for album in albums:
|
||||
# Remove the dropped White Album entry
|
||||
if (album['Artist'] == 'The Beatles' and
|
||||
'White Album' in album['Album'] and
|
||||
album['Status'].startswith('Dropped')):
|
||||
print(f" 🗑️ Removed duplicate: Rank {album['Rank']} - {album['Album']}")
|
||||
removed_count += 1
|
||||
else:
|
||||
fixed_albums.append(album)
|
||||
|
||||
# Renumber the remaining albums after rank 500
|
||||
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} duplicate entry")
|
||||
print(f"📊 Total albums now: {len(fixed_albums)}")
|
||||
else:
|
||||
print("✅ No duplicates found")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue