Question 13: Music Player

🎶 Your Music Player Tracker 

Create a fun and interactive music player where users can:

  • Choose music based on their current mood

  • Click a button to play a song (via YouTube or Spotify link)

  • Automatically track how many times each song has been played

  • See which songs are the most popular using charts

✅ 1. Mood Categories

Use a radio button or sidebar selection to let users pick a mood:

['Happy', 'Gospel', 'Study', 'Family'] etc

Each mood will display a curated list of songs with:

  • A thumbnail or album cover

  • A short description (artist and duration)

  • A Play button


✅ 2. Song Display & Play Button

Use columns to arrange songs in a grid. For each song:

st.image('album_cover_url.jpg')
st.write('Song Title - Artist')
st.success('3:45')
if st.button('Play Song', key='unique_key'):
    webbrowser.open('https://youtube.com/your_song_link')

✅ 3. CSV Tracking

Create or load a CSV file that looks like this:

Happy Song 1Chill Song 1Study Song 1Workout Song 1
3524

Whenever a song is played, increase its count:

videolink.loc[0, 'Happy Song 1'] += 1
videolink.to_csv(videourl, index=False)

✅ 4. Play Count Chart

Melt the CSV and display as a bar chart or pie chart using Plotly:

melted = videolink.melt(var_name='Song', value_name='Plays')
fig = px.bar(melted, x='Song', y='Plays', title='Most Played Songs')
st.plotly_chart(fig)
Write what you are looking for, and press enter to begin your search!