Music Playlist Creator
Music Playlist Creator
AIM:
Build a playlist manager to add, remove, and play songs. Use
arrays and file handling to store playlist details.
ALGORTITHM:
Initialize:
• Load playlist from playlist.txt.
Display Menu:
• Show options: Add Song, Display Playlist, Exit.
Process Choice:
• Add Song:
Get title, URL, and file path.
Download song and save details if successful.
• Display Playlist:
Print all song details.
• Exit:
Save playlist to playlist.txt and quit.
Repeat:
• Loop until user chooses Exit.
SOURCE CODE:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define MAX_SONGS 100
#define MAX_LEN 100
Song playlist[MAX_SONGS];
int song_count = 0;
}
fclose(file);
}
song_count = 0;
while (fscanf(file, "%[^;];%[^;];%[^\n]\n", playlist[song_count].title,
playlist[song_count].filepath, playlist[song_count].url) != EOF) {
song_count++;
}
fclose(file);
}
// remove newline
Playlist Manager
1. Add Song
2. Display Playlist
3. Exit
Enter your choice: 2
Current Playlist:
1. Shape of You
Filepath: ./shape_of_you.mp3
URL: https://example.com/shape_of_you.mp3
Playlist Manager
1. Add Song
2. Display Playlist
3. Exit
Enter your choice: 3
Exiting...
KEY NOTES:
If the song's URL is invalid or the download fails, the
program will display:
Downloading file...
Failed to download the song.
SAMPLE VIDEO:
LINK:https://drive.google.com/file/d/
1p1K733mGr6hKM6KZYDVJcIwKHs7TrMfA/view?usp=drive_link