- Create wikipedia_500_albums.csv from Wikipedia:WikiProject_Albums/500 - Generate top_500_albums_2023.csv comparing 2020 vs 2023 rankings - Add ranking change analysis (192 new, 164 improved, 113 dropped) - Integrate Info and Description from 2020 Rolling Stone data - Fill missing album information for 70+ additional albums - Include Python scripts for data processing and analysis - Update CLAUDE.md with project documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
330 lines
No EOL
29 KiB
Python
330 lines
No EOL
29 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Script to update missing Info and Description fields in the Top 500 Albums CSV file.
|
|
This script identifies albums with empty Info/Description columns and fills them with
|
|
information from a comprehensive lookup dictionary.
|
|
"""
|
|
|
|
import csv
|
|
import os
|
|
import shutil
|
|
from datetime import datetime
|
|
|
|
def create_album_lookup():
|
|
"""
|
|
Create a comprehensive lookup dictionary for famous albums.
|
|
Key format: (Artist, Album) -> (Info, Description)
|
|
"""
|
|
return {
|
|
# The Beatles
|
|
("The Beatles", 'The Beatles ("The White Album")'): (
|
|
"Apple, 1968",
|
|
"The Beatles' ambitious double album, officially titled 'The Beatles' but universally known as 'The White Album' due to its stark cover, showcased the band's incredible diversity and individual creativity. Recorded at Abbey Road Studios during a period of growing tensions within the group, the album contains 30 songs ranging from hard rock to experimental sound collages. Each member contributed distinctive material - from McCartney's vaudeville-inspired 'Honey Pie' to Lennon's minimalist 'Revolution 9' to Harrison's spiritual 'While My Guitar Gently Weeps' featuring Eric Clapton. The album's eclectic nature reflects the band's willingness to experiment with different genres and their growing interest in individual artistic expression, making it both a creative triumph and a harbinger of their eventual breakup."
|
|
),
|
|
|
|
# Jimi Hendrix
|
|
("Jimi Hendrix Experience", "Are You Experienced"): (
|
|
"Reprise/Track, 1967",
|
|
"Jimi Hendrix's explosive debut album revolutionized rock guitar and established him as one of music's most innovative artists. Recorded in London with producer Chas Chandler, the album showcased Hendrix's unprecedented guitar techniques including feedback, distortion, and his signature use of the wah-wah pedal. Songs like 'Purple Haze,' 'Hey Joe,' and the title track became instant classics, while 'The Wind Cries Mary' revealed his softer, more introspective side. The album's psychedelic production, combined with Hendrix's virtuosic playing and poetic lyrics, created a new template for rock music. His ability to blend blues, rock, and experimental sounds while pushing the electric guitar to its limits made this album a cornerstone of the psychedelic era."
|
|
),
|
|
|
|
("The Jimi Hendrix Experience", "Electric Ladyland"): (
|
|
"Reprise, 1968",
|
|
"Hendrix's ambitious double album showcased his studio wizardry and experimental vision at its peak. Recorded across multiple sessions in New York, the album features extended jams, intricate overdubs, and innovative production techniques. The epic 'Voodoo Child (Slight Return)' and his iconic cover of Dylan's 'All Along the Watchtower' demonstrated his ability to transform any song into something uniquely his own. The album's diverse range, from the funky 'Crosstown Traffic' to the ethereal '1983... (A Merman I Should Turn to Be),' established Hendrix as not just a guitarist but a visionary composer and producer."
|
|
),
|
|
|
|
# Nick Drake
|
|
("Nick Drake", "Five Leaves Left"): (
|
|
"Island, 1969",
|
|
"Nick Drake's haunting debut album is a masterpiece of melancholy folk that established him as one of Britain's most gifted singer-songwriters. Recorded with producer Joe Boyd and featuring lush orchestral arrangements by Robert Kirby, the album's delicate acoustic guitar work and Drake's whispered vocals create an intimate, almost fragile atmosphere. Songs like 'River Man' and 'Day is Done' showcase his sophisticated harmonic sense and poetic sensibility. Despite its initial commercial failure, the album has gained recognition as a profound work of art that captures the uncertainty and introspection of late-1960s youth culture."
|
|
),
|
|
|
|
# Otis Redding
|
|
("Otis Redding", "Otis Blue/Otis Redding Sings Soul"): (
|
|
"Volt, 1965",
|
|
"Recorded in a single day at Stax Studios in Memphis, this album captures Otis Redding's raw vocal power and emotional intensity at its peak. The album features his definitive versions of 'Respect' (later immortalized by Aretha Franklin), 'I've Been Loving You Too Long,' and his tender interpretation of 'A Change Is Gonna Come.' Backed by Booker T. & the M.G.'s and the Memphis Horns, Redding's passionate delivery and the tight rhythm section created a template for Southern soul. The album's mix of original compositions and inspired covers demonstrates Redding's ability to inhabit any song completely."
|
|
),
|
|
|
|
# Simon & Garfunkel
|
|
("Simon & Garfunkel", "Bookends"): (
|
|
"Columbia, 1968",
|
|
"Simon & Garfunkel's fourth studio album is a conceptual meditation on aging and the passage of time, bookended by different versions of the title track. The album features some of their most beloved songs, including 'Mrs. Robinson' (featured in 'The Graduate'), 'America,' and 'Hazy Shade of Winter.' Paul Simon's sophisticated songwriting, exploring themes of alienation and American society, combined with Art Garfunkel's pristine harmonies, created folk-rock of unprecedented literary depth. The album's seamless flow between individual songs and the 'Voices of Old People' interludes gives it a unified, almost cinematic quality."
|
|
),
|
|
|
|
# The Ramones
|
|
("The Ramones", "Ramones"): (
|
|
"Sire, 1976",
|
|
"The Ramones' self-titled debut album stripped rock & roll down to its essential elements and invented punk rock in the process. Recorded in just 18 days for $6,400, the album's 14 songs clock in at under 30 minutes, featuring buzzsaw guitars, pounding drums, and Joey Ramone's nasal vocals. Songs like 'Blitzkrieg Bop,' 'I Wanna Be Your Boyfriend,' and 'Now I Wanna Sniff Some Glue' combined teenage themes with breakneck tempos and three-chord simplicity. The album's aesthetic of deliberate amateurism and punk attitude influenced countless bands and launched the punk movement."
|
|
),
|
|
|
|
# Frank Sinatra
|
|
("Frank Sinatra", "Songs for Swingin' Lovers!"): (
|
|
"Capitol, 1956",
|
|
"One of Sinatra's finest Capitol albums, this collection of love songs arranged by Nelson Riddle showcases the Chairman of the Board at his swinging best. The album features definitive versions of American songbook standards like 'I've Got You Under My Skin,' 'Anything Goes,' and 'Makin' Whoopee.' Sinatra's mature vocal style, combining technical precision with emotional depth, paired with Riddle's sophisticated arrangements, created the template for the classic American pop album. The album's joyful celebration of romance and its impeccable production values made it both a commercial and artistic triumph."
|
|
),
|
|
|
|
# The Stooges
|
|
("The Stooges", "Raw Power"): (
|
|
"Columbia, 1973",
|
|
"The Stooges' final studio album is a primal scream of garage rock fury that anticipated punk rock by several years. Produced by David Bowie and featuring James Williamson's slashing guitar work alongside Iggy Pop's unhinged vocals, the album's raw energy and nihilistic attitude influenced generations of punk and alternative rock musicians. Songs like 'Search and Destroy' and 'I Need Somebody' combine primitive power with sophisticated songcraft. Despite its initial commercial failure, the album is now recognized as a crucial link between garage rock and punk."
|
|
),
|
|
|
|
# PJ Harvey
|
|
("PJ Harvey", "To Bring You My Love"): (
|
|
"Island, 1995",
|
|
"Polly Jean Harvey's third album marked a dramatic shift toward a more experimental and theatrical approach. Recorded with producer Flood, the album features Harvey's most diverse musical palette yet, incorporating blues, gospel, and electronic elements. Songs like 'Down by the Water' and 'C'mon Billy' showcase her powerful vocals and provocative lyrics, while tracks like 'Long Snake Moan' reveal her deep connection to American roots music. The album's dark, atmospheric production and Harvey's fearless artistic vision established her as one of the most important alternative rock artists of the 1990s."
|
|
),
|
|
|
|
# Björk
|
|
("Björk", "Post"): (
|
|
"One Little Indian, 1995",
|
|
"Björk's second solo album expanded her artistic palette beyond the experimental rock of 'Debut' to incorporate electronic music, jazz, and world music influences. Working with producers including Nellee Hooper, Tricky, and Graham Massey, Björk created a genre-defying album that features the hit singles 'Army of Me' and 'It's Oh So Quiet.' The album's adventurous spirit, combining her unique vocal style with cutting-edge production, established Björk as one of the most innovative artists of the 1990s. Her fearless experimentation with different genres while maintaining her distinctive artistic voice makes 'Post' a landmark of electronic music."
|
|
),
|
|
|
|
# Modern Hip-Hop/R&B Artists
|
|
("The Weeknd", "House of Balloons"): (
|
|
"XO/Republic, 2011",
|
|
"The Weeknd's debut mixtape, later remastered and commercially released, established Abel Tesfaye as a major force in contemporary R&B. The album's dark, atmospheric production and sexually explicit lyrics created a new template for alternative R&B. Songs like 'Wicked Games' and 'The Morning' showcase his distinctive falsetto and the album's nocturnal, drug-hazed aesthetic. The mysterious circumstances of its initial release and its influence on a generation of R&B artists make it a defining work of 2010s music."
|
|
),
|
|
|
|
("Travis Scott", "Astroworld"): (
|
|
"Cactus Jack/Grand Hustle, 2018",
|
|
"Travis Scott's third studio album is a psychedelic journey through hip-hop that draws inspiration from the defunct AstroWorld theme park in Houston. The album features innovative production techniques, auto-tuned vocals, and collaborations with artists ranging from Drake to Tame Impala. Songs like 'SICKO MODE' and 'STARLIGHT' showcase Scott's ability to create immersive sonic landscapes. The album's theme park concept and its blend of hip-hop with psychedelic and electronic elements established Scott as one of the most creative forces in contemporary rap."
|
|
),
|
|
|
|
("Tyler, the Creator", "Igor"): (
|
|
"Columbia, 2019",
|
|
"Tyler's fifth studio album marked a complete artistic transformation, moving away from the shock value of his early work toward a more mature exploration of love and relationships. The album's lush production, featuring live instrumentation and Tyler's increasingly sophisticated songwriting, creates a cohesive narrative arc. Songs like 'EARFQUAKE' and 'I THINK' showcase his growth as both a rapper and singer. The album's Grammy win and critical acclaim established Tyler as one of hip-hop's most creative and unpredictable artists."
|
|
),
|
|
|
|
# Electronic/Ambient
|
|
("Burial", "Untrue"): (
|
|
"Hyperdub, 2007",
|
|
"Burial's second album is a masterpiece of UK electronic music that captures the melancholy and alienation of urban life. Using a collage technique that incorporates vocal samples, vinyl crackle, and atmospheric textures, William Bevan created a deeply emotional form of dubstep. Tracks like 'Archangel' and 'Near Dark' evoke the ghostly atmosphere of London's nighttime streets. The album's influence on electronic music and its unique aesthetic of urban decay and romantic longing make it a defining work of 2000s electronic music."
|
|
),
|
|
|
|
("Aphex Twin", "Selected Ambient Works 85-92"): (
|
|
"R&S/Sire, 1992",
|
|
"Richard D. James's debut album as Aphex Twin established him as electronic music's most innovative and influential artist. Recorded primarily on analog equipment in his bedroom, the album's combination of ambient textures and intricate rhythms created a new form of electronic music. Tracks like 'Xtal' and 'Pulsewidth' showcase his ability to create both beautiful and unsettling soundscapes. The album's influence on electronic music genres from IDM to ambient techno cannot be overstated."
|
|
),
|
|
|
|
("Boards of Canada", "Music Has the Right to Children"): (
|
|
"Warp/Skam, 1998",
|
|
"The Scottish duo's debut album created a nostalgic, dream-like form of electronic music that seemed to capture the hazy memories of childhood. Using analog synthesizers, tape manipulation, and field recordings, Michael Sandison and Marcus Eoin crafted an album that feels both futuristic and deeply nostalgic. Tracks like 'Roygbiv' and 'Turquoise Hexagon Sun' feature their signature combination of warm melodies and degraded textures. The album's unique aesthetic and emotional depth established Boards of Canada as masters of ambient electronic music."
|
|
),
|
|
|
|
# Alternative/Indie Rock
|
|
("Weezer", "Pinkerton"): (
|
|
"DGC, 1996",
|
|
"Rivers Cuomo's deeply personal second album was initially dismissed by critics but has since been recognized as a masterpiece of alternative rock. Named after the character from Puccini's 'Madame Butterfly,' the album explores themes of loneliness, sexual frustration, and cultural identity with unprecedented honesty. Songs like 'El Scorcho' and 'The Good Life' combine Cuomo's neurotic lyrics with the band's powerful pop-rock sound. The album's raw emotional content and innovative song structures influenced countless alternative rock bands."
|
|
),
|
|
|
|
("Elliott Smith", "XO"): (
|
|
"DreamWorks, 1998",
|
|
"Elliott Smith's major-label debut expanded his intimate acoustic style with lush orchestration and multi-tracked vocals while maintaining his gift for melody and devastating emotional honesty. Songs like 'Waltz #2 (XO)' and 'Baby Britain' showcase his sophisticated harmonic sense and whispered vocal delivery. The album's themes of depression, addiction, and alienation, combined with its beautiful melodies, created a template for indie rock introspection. Smith's tragic death in 2003 has only enhanced the album's reputation as a classic of alternative rock."
|
|
),
|
|
|
|
("Bright Eyes", "I'm Wide Awake, It's Morning"): (
|
|
"Saddle Creek, 2005",
|
|
"Conor Oberst's most accessible album as Bright Eyes showcased his evolution from lo-fi indie folk to a more polished, country-influenced sound. Recorded with a full band including Emmylou Harris, the album features some of Oberst's most memorable songs, including 'First Day of My Life' and 'Lover I Don't Have to Love.' The album's political themes and personal revelations, combined with its warm production, established Bright Eyes as one of indie rock's most important voices."
|
|
),
|
|
|
|
# Hip-Hop Classics
|
|
("LL Cool J", "Radio"): (
|
|
"Def Jam, 1985",
|
|
"LL Cool J's debut album was one of the first rap albums to achieve mainstream commercial success while maintaining street credibility. Produced by Rick Rubin, the album's raw, stripped-down production and LL's aggressive delivery on tracks like 'Rock the Bells' and 'I Can't Live Without My Radio' established the template for hardcore rap. The album's success helped launch Def Jam Records and proved that rap could be both commercially viable and artistically innovative."
|
|
),
|
|
|
|
("UGK", "Ridin' Dirty"): (
|
|
"Jive, 1996",
|
|
"UGK's fourth studio album is considered a masterpiece of Southern hip-hop, establishing the duo of Bun B and Pimp C as pioneers of the genre. The album's laid-back production, featuring live instrumentation and jazz samples, provides the perfect backdrop for their distinctive flows and street narratives. Songs like 'One Day' and 'Murder' showcase their ability to balance hardcore rap with melodic sensibilities. The album's influence on Southern rap and its role in establishing Houston as a hip-hop center cannot be overstated."
|
|
),
|
|
|
|
# Grunge/Alternative
|
|
("Soundgarden", "Superunknown"): (
|
|
"A&M, 1994",
|
|
"Soundgarden's fourth studio album marked the band's creative and commercial peak, combining heavy metal with psychedelic and experimental elements. Chris Cornell's powerful vocals and the band's innovative use of alternate tunings created a unique sound that set them apart from their grunge peers. Songs like 'Black Hole Sun' and 'Spoonman' became alternative radio staples, while deeper cuts like '4th of July' and 'Limo Wreck' showcased the band's experimental side. The album's Grammy wins and multi-platinum success established Soundgarden as one of the most important bands of the 1990s."
|
|
),
|
|
|
|
# Punk/Alternative
|
|
("Fugazi", "Repeater"): (
|
|
"Dischord, 1990",
|
|
"Fugazi's debut full-length album established the Washington D.C. band as leaders of the post-hardcore movement. Ian MacKaye and Guy Picciotto's dual vocals and the band's innovative use of dynamics created a more complex form of punk rock. Songs like 'Waiting Room' and 'Merchandise' combine political lyrics with experimental song structures. The band's DIY ethics and refusal to sign with major labels made them heroes of the underground punk scene."
|
|
),
|
|
|
|
("Dead Kennedys", "Fresh Fruit for Rotting Vegetables"): (
|
|
"Alternative Tentacles, 1980",
|
|
"The Dead Kennedys' debut album is a scorching indictment of American society and politics wrapped in some of the most energetic punk rock ever recorded. Jello Biafra's provocative lyrics and theatrical vocals, combined with East Bay Ray's surf-punk guitar work, created a unique sound that influenced countless punk bands. Songs like 'Holiday in Cambodia' and 'California Über Alles' showcase their ability to combine political commentary with irresistible hooks."
|
|
),
|
|
|
|
# Electronic/Dance
|
|
("The Chemical Brothers", "Dig Your Own Hole"): (
|
|
"Freestyle Dust/Virgin, 1997",
|
|
"The Chemical Brothers' second album established them as leaders of the big beat movement and masters of electronic dance music. The album's combination of rock samples, breakbeats, and psychedelic elements created a new form of electronic music that worked equally well in clubs and on headphones. Tracks like 'Block Rockin' Beats' and 'Setting Sun' (featuring Noel Gallagher) became dancefloor anthems, while the album's innovative production techniques influenced a generation of electronic artists."
|
|
),
|
|
|
|
("The Avalanches", "Since I Left You"): (
|
|
"Modular, 2000",
|
|
"The Avalanches' debut album is a masterpiece of sample-based music, constructed from over 3,500 vinyl samples. The Australian group's cut-and-paste technique creates a dreamy, nostalgic journey through decades of recorded music. The title track and songs like 'Frontier Psychiatrist' showcase their ability to create coherent songs from disparate sources. The album's joyful celebration of musical history and its innovative production techniques make it a landmark of electronic music."
|
|
),
|
|
|
|
# Classic Rock/Metal
|
|
("Iron Maiden", "The Number of the Beast"): (
|
|
"EMI, 1982",
|
|
"Iron Maiden's third studio album, and the first to feature vocalist Bruce Dickinson, established them as leaders of the New Wave of British Heavy Metal. The album's epic compositions, galloping rhythms, and literary lyrics created a more sophisticated form of heavy metal. Songs like 'Run to the Hills' and the title track became metal classics, while Steve Harris's complex bass lines and the dual guitar attack of Dave Murray and Adrian Smith set the template for melodic metal."
|
|
),
|
|
|
|
("Judas Priest", "British Steel"): (
|
|
"Columbia, 1980",
|
|
"Judas Priest's sixth studio album streamlined their heavy metal sound into a more accessible form without sacrificing power. Rob Halford's operatic vocals and the band's twin-guitar attack on songs like 'Breaking the Law' and 'Living After Midnight' created anthems that defined heavy metal for the 1980s. The album's leather-and-studs aesthetic and uncompromising metal sound influenced countless metal bands."
|
|
),
|
|
|
|
# More Alternative/Indie
|
|
("Queens of the Stone Age", "Songs for the Deaf"): (
|
|
"Interscope, 2002",
|
|
"Queens of the Stone Age's third album, featuring Dave Grohl on drums, is a desert rock masterpiece that combines heavy riffs with psychedelic elements. The album's concept as a road trip through Palm Desert radio stations provides a unifying theme for Josh Homme's distinctive songwriting. Songs like 'No One Knows' and 'First It Giveth' showcase the band's ability to create heavy music that's both aggressive and melodic."
|
|
),
|
|
|
|
("Animal Collective", "Merriweather Post Pavilion"): (
|
|
"Domino, 2009",
|
|
"Animal Collective's eighth studio album marked their transition to a more electronic, dance-influenced sound while maintaining their experimental edge. The album's layered production, featuring Panda Bear's rhythmic vocals and Avey Tare's melodic contributions, creates a psychedelic electronic landscape. Songs like 'My Girls' and 'Summertime Clothes' showcase their ability to create accessible pop songs within an experimental framework."
|
|
),
|
|
|
|
("Bon Iver", "For Emma, Forever Ago"): (
|
|
"Jagjaguwar, 2007",
|
|
"Justin Vernon's debut album as Bon Iver was recorded in isolation at a remote cabin in Wisconsin, creating an intimate folk album that captured the loneliness and beauty of rural life. The album's sparse arrangements, featuring acoustic guitar, falsetto vocals, and subtle electronic textures, created a new template for indie folk. Songs like 'Skinny Love' and 'Re: Stacks' showcase Vernon's gift for melody and his ability to create emotional depth through minimalism."
|
|
),
|
|
|
|
# R&B/Soul
|
|
("Maxwell", "Urban Hang Suite"): (
|
|
"Columbia, 1996",
|
|
"Maxwell's debut album established him as a leader of the neo-soul movement, combining classic soul with contemporary R&B production. The album's sophisticated arrangements and Maxwell's smooth vocal delivery on songs like 'Ascension (Don't Ever Wonder)' and 'Whenever Wherever Whatever' created a more mature alternative to contemporary R&B. The album's influence on artists like D'Angelo and Erykah Badu helped establish neo-soul as a major force in 1990s music."
|
|
),
|
|
|
|
# Jazz
|
|
("Thelonious Monk", "Brilliant Corners"): (
|
|
"Riverside, 1957",
|
|
"Thelonious Monk's breakthrough album showcased his unique approach to jazz composition and performance. The album's angular melodies and unconventional harmonies, particularly on the title track, established Monk as one of jazz's most important innovators. Working with saxophonist Sonny Rollins and other top musicians, Monk created a form of jazz that was both challenging and deeply swinging."
|
|
),
|
|
|
|
("Charles Mingus", "The Black Saint and the Sinner Lady"): (
|
|
"Impulse!, 1963",
|
|
"Charles Mingus's extended composition is considered one of the greatest achievements in jazz, combining elements of classical music, gospel, and blues into a cohesive whole. The album's complex arrangements and Mingus's passionate bass playing create a deeply emotional musical journey. The work's integration of different musical styles and its emotional intensity make it a landmark of modern jazz."
|
|
),
|
|
|
|
# Additional entries for other notable albums
|
|
("Can", "Tago Mago"): (
|
|
"United Artists, 1971",
|
|
"Can's second studio album is a groundbreaking work of experimental rock that helped establish the krautrock movement. The German band's combination of repetitive rhythms, electronic textures, and improvised elements created a hypnotic form of rock music. The album's two-disc format allowed for extended compositions like 'Halleluhwah' and 'Aumgn' that showcased their ability to create trance-like states through repetition and subtle variation."
|
|
),
|
|
|
|
("Gorillaz", "Demon Days"): (
|
|
"Parlophone/Virgin, 2005",
|
|
"Damon Albarn's virtual band project reached its creative peak on this genre-blending masterpiece featuring collaborations with De La Soul, MF DOOM, and Neneh Cherry. The album's dark themes and eclectic musical palette, from the hip-hop of 'Feel Good Inc.' to the gospel-influenced 'DARE,' created a unique sound that defied categorization. The album's success proved that experimental pop could achieve mainstream success."
|
|
),
|
|
|
|
("Kate Bush", "The Dreaming"): (
|
|
"EMI, 1982",
|
|
"Kate Bush's fourth studio album marked her complete artistic independence and her most experimental phase. Produced entirely by Bush herself, the album's dense, layered production and unconventional song structures pushed the boundaries of pop music. Songs like 'Suspended in Gaffa' and the title track showcase her unique vocal style and artistic vision. The album's initial commercial disappointment has been reversed by critical reappraisal recognizing it as her most adventurous work."
|
|
),
|
|
|
|
("Ariana Grande", "thank u, next"): (
|
|
"Republic, 2019",
|
|
"Ariana Grande's fifth studio album emerged from personal trauma and public scrutiny to become a statement of resilience and self-empowerment. The album's trap-influenced production and Grande's powerful vocals on songs like the title track and '7 rings' created some of the most memorable pop music of the late 2010s. The album's themes of healing and growth, combined with its commercial success, established Grande as one of pop's most important voices."
|
|
),
|
|
|
|
("Justin Timberlake", "FutureSex/LoveSounds"): (
|
|
"Jive, 2006",
|
|
"Justin Timberlake's second solo album, produced by Timbaland, created a futuristic form of pop-R&B that dominated the mid-2000s. The album's innovative production, featuring unconventional rhythms and electronic textures, provided the perfect backdrop for Timberlake's smooth vocals. Songs like 'SexyBack' and 'My Love' showcased his evolution from boy band member to serious solo artist."
|
|
),
|
|
}
|
|
|
|
def read_csv_file(filepath):
|
|
"""Read the CSV file and return the data."""
|
|
with open(filepath, 'r', encoding='utf-8') as f:
|
|
reader = csv.DictReader(f)
|
|
return list(reader)
|
|
|
|
def identify_missing_albums(data):
|
|
"""Identify albums with missing Info and Description."""
|
|
missing_albums = []
|
|
for row in data:
|
|
if not row.get('Info', '').strip() and not row.get('Description', '').strip():
|
|
missing_albums.append(row)
|
|
return missing_albums
|
|
|
|
def update_album_info(data, lookup_dict):
|
|
"""Update albums with information from the lookup dictionary."""
|
|
updated_count = 0
|
|
|
|
for row in data:
|
|
# Check if this album needs updating
|
|
if not row.get('Info', '').strip() and not row.get('Description', '').strip():
|
|
# Try to find it in our lookup dictionary
|
|
key = (row['Artist'], row['Album'])
|
|
if key in lookup_dict:
|
|
info, description = lookup_dict[key]
|
|
row['Info'] = info
|
|
row['Description'] = description
|
|
updated_count += 1
|
|
print(f"Updated: {row['Artist']} - {row['Album']}")
|
|
|
|
return updated_count
|
|
|
|
def write_csv_file(filepath, data, fieldnames):
|
|
"""Write the updated data back to CSV file."""
|
|
with open(filepath, 'w', newline='', encoding='utf-8') as f:
|
|
writer = csv.DictWriter(f, fieldnames=fieldnames)
|
|
writer.writeheader()
|
|
writer.writerows(data)
|
|
|
|
def main():
|
|
"""Main function to run the update process."""
|
|
csv_file = '/home/lundberg/projects/top500albums/top_500_albums_2023.csv'
|
|
backup_file = f'/home/lundberg/projects/top500albums/top_500_albums_2023_backup_{datetime.now().strftime("%Y%m%d_%H%M%S")}.csv'
|
|
|
|
print(f"Reading CSV file: {csv_file}")
|
|
|
|
# Read the original data
|
|
data = read_csv_file(csv_file)
|
|
total_albums = len(data)
|
|
|
|
print(f"Total albums in database: {total_albums}")
|
|
|
|
# Identify albums with missing information
|
|
missing_albums = identify_missing_albums(data)
|
|
print(f"Albums with missing Info/Description: {len(missing_albums)}")
|
|
|
|
# Create backup
|
|
print(f"Creating backup: {backup_file}")
|
|
shutil.copy2(csv_file, backup_file)
|
|
|
|
# Create lookup dictionary
|
|
lookup_dict = create_album_lookup()
|
|
print(f"Lookup dictionary contains {len(lookup_dict)} albums")
|
|
|
|
# Update the data
|
|
print("\nUpdating albums...")
|
|
updated_count = update_album_info(data, lookup_dict)
|
|
|
|
# Write the updated data back to file
|
|
if updated_count > 0:
|
|
fieldnames = ['Rank', 'Artist', 'Album', 'Status', 'Info', 'Description']
|
|
write_csv_file(csv_file, data, fieldnames)
|
|
print(f"\nSuccessfully updated {updated_count} albums!")
|
|
print(f"Updated file saved as: {csv_file}")
|
|
print(f"Backup saved as: {backup_file}")
|
|
else:
|
|
print("\nNo albums were updated.")
|
|
|
|
# Show remaining missing albums
|
|
remaining_missing = identify_missing_albums(data)
|
|
print(f"\nRemaining albums with missing info: {len(remaining_missing)}")
|
|
|
|
if remaining_missing:
|
|
print("\nFirst 10 albums still missing information:")
|
|
for i, album in enumerate(remaining_missing[:10]):
|
|
print(f"{album['Rank']}. {album['Artist']} - {album['Album']}")
|
|
|
|
if __name__ == "__main__":
|
|
main() |