A Flask App that works with yt_dlp to download playlist MP3 files and store them on a MicroSD card or USB storage on a Raspberry Pi. It also functions as a music player that allows you to stream and play the downloaded music.
- Download full video playlists from YouTube or individual videos by providing an artist name and a valid YouTube playlist URL.
- Extract audio files in MP3 format for each track.
- Store the files in a removable storage drive or SD card, organized by artist and album.
- Display all downloaded music on the /Music page of the app.
- Play tracks randomly or by artist/album using the default browser media player.
- Display artist images using Deezer's free API if available (no key required).
Note: This app has only been tested on a Raspberry Pi 4.
- Update your Pi:
sudo apt-get update
Install yt-dlp by following the instructions on their repo here.
- Clone this repo to your Raspberry Pi:
$ git clone https://github.com/vivertido/yt-music-getter.git
-
Connect a microSD card or USB storage device to your Raspberry Pi. Media storage devices should appear in the /media/pi/<your_device_id> folder.
-
Create a dedicated directory on the device to store all music files, e.g., /media/pi/9C33-6BBD/Music-Library.
-
Update the app.py Flask file with your Music Library Path:
albums_path = '/media/pi/<SOME-DRIVE>/Music-Library'
- Update the song_getter4.sh Shell file with this path:
# Music base directory
music_base="/media/pi/<SOME-DRIVE>/Music-Library"
- Run the app on the Raspberry Pi (connected to a local WiFi network) by navigating to the project directory (/path_to_your_project/song_extractions) and running:
python app.py
-
Open a browser on the Pi and verify that it works using localhost:5000.
-
Find your Raspberry Pi IP address by running:
$ hostname -I
It should return something like 10.2.34.143. Use this to connect from other devices on the same local network by adding the IP address to your browser.
-
Find a playlist on YouTube that you have permission to download. Copy the URL and paste it on the home page of the Flask app. Enter the artist name and click "Get Music".
-
Wait for the download to complete. You can go to the /explore page to check if the songs are present.
-
Go to /player to stream and play music from any connected device!
This app still needs the following feature upgrades:
- Use SQLite to store the songs in a local database for better UX.
- Allow for remote streaming via a Cloudflare tunnel.
- Enable creation of playlists and saving favorite tracks.
- Implement authentication.