A simple project to transfer files between a server and a client, resembling a music streaming service. A user can play the songs stored in the server (which downloads them) or play songs that are stored locally. The main focus for this project was to use concurrency and client-server communication.
-
Install Python 3.8+.
-
In Ubuntu run the command
sudo apt-get install libasound2-dev
. For Windows, you may need to install Microsoft Visual C++ Build Tools. -
Install the requirements. It is recommended to first create a virtual environment.
pip install -r requirements.txt
Run the server first:
$ py server.py
(Server) INFO: Server is listening ...
Then the client:
$ py client.py
(MainThread) INFO: Playlist: ['Coral.wav', 'Fushiguro.wav', 'Solitude.wav']
>
The client script gets the commands from the user. These commands are described below, the arguments inside brackets are optional. >
represents the prompt for user input.
-
search [query]
lists all server files, or the files that match the query.> search ma Magic.wav Makani.wav
-
ls
lists the local files (fromsongs/
).> ls Coral.wav Fushiguro.wav Solitude.wav
-
play [filename ...]
plays the list of songs. Will play the main playlist made of all the songs fromsongs/
if no arguments are passed.> play Coral.wav Solitude.wav "What If.wav"
-
stop
stops all audio playback. -
pause
pauses the current song. -
resume
resumes the paused song. -
prev
plays the previous song. -
next
orskip
plays the next song. -
add filename [filename ...]
adds a song (or list of songs) to the main playlist. Use quotes to pass names with spaces.> add Makani.wav "Hollow Sun.wav" (Player) INFO: Playlist: ['Coral.wav', 'Fushiguro.wav', 'Solitude.wav', 'What If.wav', 'Makani.wav', 'Hollow Sun.wav']
-
del filename [filename ...]
deletes a song (or list of songs) fromsongs/
. Also removes them from the main playlist.> del Fushiguro.wav "What If.wav" (Player) INFO: Playlist: ['Coral.wav', 'Solitude.wav', 'Makani.wav', 'Hollow Sun.wav']
-
rm filename [filename ...]
removes a song (or list of songs) from the main playlist.> rm Coral.wav "Hollow Sun.wav" (Player) INFO: Playlist: ['Solitude.wav', 'Makani.wav']
-
info
prints the playlist.> info (Player) INFO: Playlist: ['Solitude.wav', 'Makani.wav']
-
exit
orCTRL+C
exits theclient.py
execution.
The source code uses the MIT license, while the songs fall under the Creative Commons license.
The following songs use the Creative Commons Attribution 3.0 Unported License.
- Coral by LiQWYD | https://www.liqwydmusic.com
- Dreamers by Nettson | https://soundcloud.com/nettson
- Hollow Sun by Punch Deck | https://soundcloud.com/punch-deck
- Let Go by LiQWYD | https://www.liqwydmusic.com
- Makani by Scandinavianz & AXM | https://soundcloud.com/scandinavianz
- What If by Jay Someday | https://soundcloud.com/jaysomeday
These songs use the Creative Commons Attribution-ShareAlike 3.0 Unported.
- Fushiguro by Deoxys Beats | https://soundcloud.com/deoxysbeats1
- Solitude by Purrple Cat | https://purrplecat.com
This song uses the Attribution 4.0 International (CC BY 4.0).
- Magic by Savfk | https://www.youtube.com/savfkmusic
Music promoted by https://www.free-stock-music.com