Skip to content

A modern Windows desktop application for managing music collections with MySQL backend and YouTube integration

License

Notifications You must be signed in to change notification settings

DD099/SQL-music-app

Repository files navigation

SQL Music App

A modern Windows desktop application for managing your music collection with a sleek, Spotify-inspired interface. This application allows you to organize albums, view track listings, and watch YouTube videos directly within the app.

🎡 Features

  • Album Management: Add, view, and search through your music albums
  • Track Integration: View detailed track listings for each album
  • YouTube Integration: Watch music videos directly in the application
  • Modern UI: Clean, dark theme inspired by popular music streaming services
  • Database-Driven: Robust MySQL backend for data persistence
  • Image Support: Display album artwork from URLs

πŸ› οΈ Technology Stack

Frontend

  • C# - Primary programming language
  • Windows Forms - GUI framework
  • Microsoft WebView2 - Embedded browser for YouTube integration
  • Newtonsoft.Json - JSON processing

Backend

  • MySQL - Database management system
  • MySql.Data - .NET MySQL connector

Development Tools

  • .NET 9.0 - Runtime framework
  • Visual Studio - Development environment

πŸ“‹ System Requirements

  • Windows 10 or later
  • .NET 9.0 Runtime
  • MySQL Server
  • Internet connection (for YouTube videos and album images)

πŸš€ Installation & Setup

1. Prerequisites

Install the following software:

2. Database Setup

Create the Database

  1. Open MySQL Command Line Client or MySQL Workbench
  2. Execute the following SQL commands:
-- Create the database
CREATE DATABASE music;

-- Use the database
USE music;

-- Create albums table
CREATE TABLE albums (
    ID INT AUTO_INCREMENT PRIMARY KEY,
    album_title VARCHAR(255) NOT NULL,
    artist_name VARCHAR(255) NOT NULL,
    year INT NOT NULL,
    image_url VARCHAR(500),
    description TEXT
);

-- Create tracks table
CREATE TABLE tracks (
    ID INT AUTO_INCREMENT PRIMARY KEY,
    track_title VARCHAR(255) NOT NULL,
    track_number INT NOT NULL,
    video_url VARCHAR(500),
    lyrics TEXT,
    albums_ID INT,
    FOREIGN KEY (albums_ID) REFERENCES albums(ID) ON DELETE CASCADE
);

-- Insert sample data (optional)
INSERT INTO albums (album_title, artist_name, year, image_url, description) VALUES
('Abbey Road', 'The Beatles', 1969, 'https://upload.wikimedia.org/wikipedia/en/4/42/A_With_Recording.jpg', 'The eleventh studio album by the English rock band the Beatles'),
('Thriller', 'Michael Jackson', 1982, 'https://upload.wikimedia.org/wikipedia/en/5/55/Michael_Jackson_-_Thriller.png', 'The sixth studio album by American singer and songwriter Michael Jackson');

INSERT INTO tracks (track_title, track_number, video_url, lyrics, albums_ID) VALUES
('Come Together', 1, 'https://www.youtube.com/watch?v=3QhoVYUKkLQ', 'Here come old flattop, he come groovin'' up slowly...', 1),
('Something', 2, 'https://www.youtube.com/watch?v=QF2RvU4c0dQ', 'Something in the way she moves...', 1),
('Thriller', 1, 'https://www.youtube.com/watch?v=sOnqjkJTMaA', 'It''s close to midnight...', 2),
('Beat It', 2, 'https://www.youtube.com/watch?v=82Tl4kLF1iQ', 'They told him don''t you ever come around here...', 2);

Configure Database Connection

  1. Open AlbumsDAO.cs in the project
  2. Update the connection string to match your MySQL setup:
private string connectionString = "datasource=localhost;username=your_username;password=your_password;database=music";

Replace:

  • your_username with your MySQL username (commonly 'root')
  • your_password with your MySQL password
  • localhost with your MySQL server address if different

3. Build and Run

Option A: Using Visual Studio

  1. Open SQLMusicApp.sln in Visual Studio
  2. Restore NuGet packages (right-click solution β†’ Restore NuGet Packages)
  3. Build the solution (Build β†’ Build Solution)
  4. Run the application (Debug β†’ Start Debugging)

Option B: Using Command Line

  1. Navigate to the project directory in Command Prompt
  2. Run: dotnet restore
  3. Run: dotnet build
  4. Run: dotnet run

πŸ“– Usage Guide

Adding Albums

  1. Click "Add Album" button
  2. Fill in the album details:
    • Album Name (required)
    • Artist Name (required)
    • Year (required)
    • Image URL (optional)
    • Description (optional)
  3. Click "Add Album" to save

Viewing Albums

  1. Click "Load Albums" to display all albums
  2. Use the search box to filter albums by name
  3. Click on an album row to view its tracks

Managing Tracks

  1. Select an album to view its tracks
  2. Click on a track to watch its YouTube video
  3. Use "Delete Track" to remove selected tracks

YouTube Integration

  • Videos load automatically when you select a track
  • If embedded playback fails, a link opens in your default browser
  • Supports various YouTube URL formats

πŸ—‚οΈ Project Structure

SQLMusicApp/
β”œβ”€β”€ Form1.cs              # Main application form and UI logic
β”œβ”€β”€ AlbumsDAO.cs          # Data Access Object for database operations
β”œβ”€β”€ Album.cs              # Album data model
β”œβ”€β”€ Tracks.cs             # Track data model
β”œβ”€β”€ Program.cs            # Application entry point
β”œβ”€β”€ SQLMusicApp.csproj    # Project configuration
β”œβ”€β”€ SQLMusicApp.sln       # Visual Studio solution file
└── README.md            # This file

πŸ”§ Customization

UI Customization

The application uses a modern dark theme. To customize colors:

  1. Open Form1.cs
  2. Modify the color constants in ApplyModernStylingToControls() method
  3. Colors are defined using RGB values for precise control

Database Schema

The current schema supports basic album and track management. To extend functionality:

  1. Modify the database tables in your MySQL server
  2. Update the corresponding C# classes (Album.cs, Tracks.cs)
  3. Update the SQL queries in AlbumsDAO.cs

πŸ› Troubleshooting

Common Issues

Application won't start:

  • Ensure .NET 9.0 is installed
  • Check that all NuGet packages are restored
  • Verify database connection string is correct

Database connection errors:

  • Confirm MySQL server is running
  • Check username/password in connection string
  • Ensure the 'music' database exists

YouTube videos not loading:

  • Check internet connection
  • Verify YouTube URL format is correct
  • Try opening the video in a browser first

Album images not displaying:

  • Check image URL is valid
  • Ensure the URL is accessible from your network
  • Some image hosts may block programmatic access

Getting Help

If you encounter issues:

  1. Check the error messages in the application
  2. Verify your database setup
  3. Ensure all dependencies are installed
  4. Review the connection string configuration

🀝 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

πŸ“„ License

This project is open source and available under the MIT License.

πŸ™ Acknowledgments

  • Spotify - For the beautiful UI inspiration
  • YouTube - For the video integration
  • MySQL - For the reliable database backend
  • .NET Foundation - For the excellent development platform

Note: This application is for educational and personal use. Ensure you have proper rights to any music content you manage.

About

A modern Windows desktop application for managing music collections with MySQL backend and YouTube integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages