Skip to content
Snippets Groups Projects
Commit 589fa61d authored by hdd29's avatar hdd29
Browse files

Inital commit: data structure building and list method proof of concept completed

parent 4f310776
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
#
#
#
#
#
from abc import ABC
class Album(metaclass=ABCMeta):
def __init__(self, artist):
self.name = 0
self.artist = 0
self.songs = []
self.date = 0
def addSong(self, song):
self.song.append(song)
@abstractmethod
def update():
pass
#Write to temp,
#then write to file
albumDict= {}
#write add album to album list here
def list(albumDict):
def artistMenu(albumDict):
print('Here are the artists: \n')
enum = 1
for artist in albumDict.keys():
print(f'{enum}. {artist} ')
enum += 1
enum = 0
res = input('Enter a number to choose the corresponding artist as listed above, \n \
or press "q" to exit this menu')
if str(res) == 'q':
sys.exit()
else:
listAlbums(res, albumDict)
return
def listAlbums(res, albumDict):
albumList = sorted(albumDict[res], key=lambda album: album.date)
for album in albumList:
enum += 1
print(f'{enum}. {album}')
enum = 0
res2 = input("Enter a number to choose the corresponding album as listed above, \n \
or press 'a' to return to the artist menu")
if str(res2) == 'a':
artistMenu(albumDict)
return
else:
for song in albumList[res2-1].songs:
print(song)
res3 = input(str('Return to the previous (the album) menu? (press any key = yes, 0 = no)'))
if res3 == '0': ########EXIT HERE!!!!!! REMEMBER TO CHECK AGAIN
sys.exit()
else:
listAlbums(res, albumDict) ###RECURSIVELY CALLS ITSELF HERE
Led Zeppelin
1979 In Through the Outdoor
-In the Evening
-South Bound Saurez
-Fool in the Rain
-Hot Dog
-Carouselambra
-All My Love
-I'm Gonna Crawl
Led Zeppelin
1969 II
-Whole Lotta Love
-What Is and What Should Never Be
-The Lemon Song
-Thank You
-Heartbreaker
-Living Loving Maid (She's Just a Woman)
-Ramble On
-Moby Dick
-Bring It on Home
Bob Dylan
1966 Blonde on Blonde
-Rainy Day Women #12 & 35
-Pledging My Time
-Visions of Johanna
-One of Us Must Know (Sooner or Later)
-I Want You
-Stuck Inside of Mobile with the Memphis Blues Again
-Leopard-Skin Pill-Box Hat
-Just Like a Woman
-Most Likely You Go Your Way (And I'll Go Mine)
-Temporary Like Achilles
-Absolutely Sweet Marie
-4th Time Around
-Obviously 5 Believers
-Sad Eyed Lady of the Lowlands
#!/usr/bin/env python3
import sys
class Album():
def __init__(self, name, artist, songs, date):
self.name = name
self.artist = artist
self.songs = songs
self.date = date
albumB1 = Album('Blonde on Blonde', 'Bob Dylan', ['Rainy Days', 'Visions', 'Pledge','I want you'], 1966)
albumB2 = Album('Red', 'Bob Dylan', ['22', 'Read Read', 'Duck', 'Cocaine', 'Hotel California'], 1987)
albumB3 = Album('Burgundy', 'Bob Dylan', ['Gun N Roses', 'Lonely Rose', 'Tale of a Hitchhiker'], 1957)
albumL1 = Album('In Through the Outdoor', 'Led Zeppelin', ['In the Evening', 'South Bound', 'Hot dog', 'All'], 1979)
albumL2 = Album('II', 'Led Zeppelin', ['Vung Tau', 'Da Nang', 'Ha Noi', 'Da Lat', 'HCM'], 1969)
albumDict = {'Bob Dylan': [albumB1, albumB2, albumB3], 'Led Zeppelin': [albumL1, albumL2]}
def artistMenu(albumDict):
print('Here are the artists: \n')
enum = 1
orderArtist = []
for artist in albumDict.keys():
print(f'{enum}. {artist} ')
orderArtist.append(artist)
enum += 1
enum = 0
res = input('Enter a number to choose the corresponding artist as listed above, \n \
or press "q" to exit this menu')
if str(res) == 'q':
sys.exit()
else:
listAlbums(orderArtist[int(res)-1], albumDict)
return
def listAlbums(res, albumDict):
albumList = sorted(albumDict[res], key=lambda album: album.date)
enum = 0
for album in albumList:
enum += 1
print(f'{enum}. {album.name}')
res2 = input("Enter a number to choose the corresponding album as listed above, \n \
or press 'a' to return to the artist menu")
if str(res2) == 'a':
artistMenu(albumDict)
return
else:
for song in albumList[int(res2)-1].songs:
print(song)
res3 = input(str('Return to the previous (the album) menu? (press any key = yes, 0 = no)'))
if res3 == '0': ########EXIT HERE!!!!!! REMEMBER TO CHECK AGAIN
sys.exit()
else:
listAlbums(res, albumDict) ###RECURSIVELY CALLS ITSELF HERE
artistMenu(albumDict)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment