Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Faker for Music #370

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -866,3 +866,12 @@ ErrorRuntime() error
```go
School() string
```

### Song

```go
Song() *SongInfo
SongName() string
SongArtist() string
SongGenre() string
```
1 change: 1 addition & 0 deletions data/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var Data = map[string]map[string][]string{
"book": Books,
"movie": Movies,
"school": School,
"song": Songs,
"product": Product,
}

Expand Down
246 changes: 246 additions & 0 deletions data/song.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
package data

// Songs: Year-end Charts Hot 100 Songs from Billboard
// Source: https://www.billboard.com/charts/year-end/hot-100-songs/

// Artists: Greatest of All Time Artists based on Billboard rate
// Source: https://www.billboard.com/charts/greatest-of-all-time-artists/

var Songs = map[string][]string{
"name": {
"A Bar Song (Tipsy)",
"A Holly Jolly Christmas",
"Act II: Date @ 8",
"Agora Hills",
"Ain't No Love In Oklahoma",
"All I Want For Christmas Is You",
"Austin",
"Beautiful Things",
"Birds Of A Feather",
"Bulletproof",
"Burn It Down",
"Carnival",
"Cowgirls",
"Cruel Summer",
"Dance The Night",
"Die With A Smile",
"Down Bad",
"End Of Beginning",
"Espresso",
"Euphoria",
"Everybody",
"Exes",
"FE!N",
"FTCU",
"Fast Car",
"Feather",
"First Person Shooter",
"Flowers",
"Fortnight",
"Fukumean",
"Gata Only",
"Get It Sexyy",
"Good Good",
"Good Luck, Babe!",
"Greedy",
"High Road",
"Hot To Go!",
"Houdini",
"Houdini",
"I Am Not Okay",
"I Can Do It With A Broken Heart",
"I Had Some Help",
"I Like The Way You Kiss Me",
"I Remember Everything",
"IDGAF",
"Is It Over Now?",
"Jingle Bell Rock",
"La Diabla",
"Last Christmas",
"Last Night",
"Lies Lies Lies",
"Like That",
"Lil Boo Thang",
"Lose Control",
"Lovin On Me",
"Lunch",
"Made For Me",
"Miles On It",
"Million Dollar Baby",
"Monaco",
"Need A Favor",
"Never Lose Me",
"Not Like Us",
"On My Mama",
"Paint The Town Red",
"Pink Skies",
"Please Please Please",
"Pour Me A Drink",
"Pretty Little Poison",
"Redrum",
"Rich Baby Daddy",
"Rockin' Around The Christmas Tree",
"Saturn",
"Save Me",
"Slow It Down",
"Snooze",
"Stargazing",
"Stick Season",
"Taste",
"Texas Hold 'Em",
"The Painter",
"Thinkin' Bout Me",
"Too Sweet",
"Truck Bed",
"Type Shit",
"Vampire",
"Wanna Be",
"Water",
"We Can't Be Friends (Wait For Your Love)",
"What Was I Made For?",
"Whatever She Wants",
"Where It Ends",
"Where The Wild Things Are",
"White Horse",
"Wild Ones",
"Wildflower",
"Wind Up Missin' You",
"World On Fire",
"Yeah Glo!",
"Yes, And?",
},
"artist": {
"Adele",
"Aerosmith",
"Alicia Keys",
"Aretha Franklin",
"Barbra Streisand",
"Barry Manilow",
"Bee Gees",
"Beyonce",
"Billy Joel",
"Bob Dylan",
"Bob Seger",
"Bon Jovi",
"Boyz II Men",
"Britney Spears",
"Bruce Springsteen & The E Street Band",
"Bruno Mars",
"Bryan Adams",
"Carole King",
"Carpenters",
"Celine Dion",
"Chicago",
"Chris Brown",
"Commodores",
"Creedence Clearwater Revival",
"Daryl Hall John Oates",
"Def Leppard",
"Diana Ross",
"Donna Summer",
"Drake",
"Eagles",
"Earth, Wind & Fire",
"Ed Sheeran",
"Elton John",
"Elvis Presley",
"Eminem",
"Eric Clapton",
"Fleetwood Mac",
"Foreigner",
"Garth Brooks",
"Guns N' Roses",
"Heart",
"Herb Alpert",
"Huey Lewis & The News",
"JAY-Z",
"James Taylor",
"Janet Jackson",
"John Denver",
"John Mellencamp",
"Journey",
"Justin Bieber",
"Justin Timberlake",
"Kanye West",
"Katy Perry",
"Kelly Clarkson",
"Kenny Rogers",
"Lady Gaga",
"Led Zeppelin",
"Linda Ronstadt",
"Linkin Park",
"Lionel Richie",
"Madonna",
"Mariah Carey",
"Maroon 5",
"Marvin Gaye",
"Mary J. Blige",
"Michael Bolton",
"Michael Jackson",
"Miley Cyrus",
"Neil Diamond",
"Nelly",
"Nickelback",
"Olivia Newton-John",
"P!nk",
"Paul McCartney",
"Paula Abdul",
"Phil Collins",
"Pink Floyd",
"Prince",
"Queen",
"R. Kelly",
"Rihanna",
"Rod Stewart",
"Santana",
"Simon & Garfunkel",
"Stevie Wonder",
"Taylor Swift",
"The Beach Boys",
"The Beatles",
"The Black Eyed Peas",
"The Jacksons",
"The Monkees",
"The Rolling Stones",
"The Supremes",
"The Temptations",
"Three Dog Night",
"Tim McGraw",
"U2",
"Usher",
"Van Halen",
"Whitney Houston",
},
"genre": {
"Acoustic Pop",
"Alternative Hip-Hop",
"Alternative Pop",
"Chillwave",
"Contemporary R&B",
"Country",
"Dancehall",
"Electro-pop",
"Electronic Dance Music (EDM)",
"Emo Rap",
"Funk",
"Gospel-inspired Pop",
"Hip-Hop",
"Indie Pop",
"Latin Pop",
"Lo-fi Hip-Hop",
"Melodic Rap",
"Pop",
"Pop Punk",
"Pop Rock",
"R&B",
"Rap",
"Reggaeton",
"Rock",
"Singer-Songwriter",
"Soul",
"Synthwave",
"Trap",
"Trap Soul",
"Urban Contemporary",
},
}
1 change: 1 addition & 0 deletions lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func initLookup() {
addPersonLookup()
addProductLookup()
addSchoolLookup()
addSongLookup()
addStringLookup()
addTemplateLookup()
addWeightedLookup()
Expand Down
87 changes: 87 additions & 0 deletions song.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package gofakeit

func SongName() string { return songName(GlobalFaker) }

func (f *Faker) SongName() string { return songName(f) }

func songName(f *Faker) string { return getRandValue(f, []string{"song", "name"}) }

func SongArtist() string { return songArtist(GlobalFaker) }

func (f *Faker) SongArtist() string { return songArtist(f) }

func songArtist(f *Faker) string { return getRandValue(f, []string{"song", "artist"}) }

func SongGenre() string { return songGenre(GlobalFaker) }

func (f *Faker) SongGenre() string { return songGenre(f) }

func songGenre(f *Faker) string { return getRandValue(f, []string{"song", "genre"}) }

type SongInfo struct {
Name string `json:"name" xml:"name"`
Artist string `json:"artist" xml:"artist"`
Genre string `json:"genre" xml:"genre"`
}

func Song() *SongInfo { return song(GlobalFaker) }

func (f *Faker) Song() *SongInfo { return song(f) }

func song(f *Faker) *SongInfo {
return &SongInfo{
Name: songName(f),
Artist: songArtist(f),
Genre: songGenre(f),
}
}

func addSongLookup() {
AddFuncLookup("song", Info{
Display: "Song",
Category: "song",
Description: "Song with a drum and horn instrumentation",
Example: `{
"name": "New Rules",
"genre": "Tropical house"
}`,
Output: "map[string]string",
ContentType: "application/json",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return song(f), nil
},
})

AddFuncLookup("songname", Info{
Display: "Song Name",
Category: "song",
Description: "Title or name of a specific song used for identification and reference",
Example: "New Rules",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return songName(f), nil
},
})

AddFuncLookup("songartist", Info{
Display: "Song Artist",
Category: "song",
Description: "The artist of maker of song",
Example: "Dua Lipa",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return songArtist(f), nil
},
})

AddFuncLookup("songgenre", Info{
Display: "Genre",
Category: "song",
Description: "Category that classifies song based on common themes, styles, and storytelling approaches",
Example: "Action",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return songGenre(f), nil
},
})
}
Loading