Skip to content

Commit

Permalink
Merge pull request #5 from MelleDijkstra/grpc
Browse files Browse the repository at this point in the history
gRPC implementation
  • Loading branch information
Melle Dijkstra authored Feb 24, 2018
2 parents 22b7a4c + 6b861c0 commit ef65569
Show file tree
Hide file tree
Showing 52 changed files with 3,252 additions and 644 deletions.
168 changes: 167 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,174 @@
.idea/

/client.py

### VirtualEnv template
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

/client.py
# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
.static_storage/
.media/
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/
cmake-build-release/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
recursive-include resources *
include README.md
include LICENSE
include requirements.txt
82 changes: 73 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,82 @@
# Python Music Player
[![GitHub license](https://img.shields.io/github/license/MelleDijkstra/PythonMusicPlayer.svg)](https://github.com/MelleDijkstra/PythonMusicPlayer/blob/master/LICENSE)
[![PyPI version](https://badge.fury.io/py/melon-music-player.svg)](https://badge.fury.io/py/melon-music-player)
[![Documentation Status](https://readthedocs.org/projects/pythonmusicplayer/badge/?version=latest)](http://pythonmusicplayer.readthedocs.io/en/latest/?badge=latest)

[![Twitter](https://img.shields.io/twitter/url/https/github.com/MelleDijkstra/PythonMusicPlayer.svg?style=social)](https://twitter.com/intent/tweet?text=MelonMusicPlayer:&url=https%3A%2F%2Fgithub.com%2FMelleDijkstra%2FPythonMusicPlayer)

## Introduction

This repository contains a python music player which acts as a server. It uses the vlc python bindings to play the music and socket communication to communicate with the Android Application which can be found [here](https://github.com/MelleDijkstra/AndroidMusicPlayerClient)

## Installation

If you want to run this program you need:
### Windows

Download executable from here
[Download link]()

__*! I experienced a bug with the windows executable, you sometimes need to press `enter`
to activate the server again !*__

Besides that, it should work fine ;)

### Linux (Debian | Raspberry Pi)

(coming soon, on my todo list)
I published a PyPi package, but I haven't tested it yet.
To install run the following command:
`pip install melon-music-player`

### From source

If you want to install/run the MelonMusicPlayer from source,
or if you want to develop on the current code base (please feel free)
run the following instructions:

- Make sure you have installed python 3.5 or higher. [Python Download](https://www.python.org/downloads/)
- The actual VLC program which can be found here ([VLC Download](http://www.videolan.org/vlc/)).

**Windows**: For windows you can just install the executable

**Linux**: For linux system it should be as easy as running `$ sudo apt-get install vlc`.

**!Although, check their site for correct installation!**

- Clone the project if you haven't already `$ git clone https://github.com/MelleDijkstra/PythonMusicPlayer`
- Go to cloned folder `$ cd PythonMusicPlayer`
- Then run `$ pip install -r requirements.txt` to install the packages needed

(If you are installing the MelonMusicPlayer server on raspberry pi this process
can take some time. The reason is because the server runs on gRPC which
has to compile when installing for raspbian. This will hopefully be changed in the future (Please be patient!))

- Change any settings needed in `config.ini`. This is the configuration file for the server
- Start the music server by running `$ python main.py`.

Then use a client/controller to connect to the server.
if you downloaded the source, there should be a `client.py`. Run this in another terminal/process to test the server.
The client has quite some functionality but I will not be maintaining them. For full experience use one of the controllers
like the [Android App](https://github.com/MelleDijkstra/AndroidMusicPlayerClient).

### TODO
(only server related tasks)

* The actual VLC program which can be found here ([VLC](http://www.videolan.org/vlc/)).
Windows can just install the executable and for linux system it should be as easy as running `$ sudo apt-get install vlc`. **Check their site for correct installation**
* Make sure you have installed python 3.5 or higher. [Python install](https://www.python.org/downloads/)
* Clone the project if you haven't already `$ git clone https://github.com/MelleDijkstra/PythonMusicPlayer`
* Go to cloned folder `$ cd PythonMusicPlayer`
* Then run `$ pip install -r requirements.txt` to install the packages needed
* Change any settings needed in `config.ini`
* Start the music server by running `$ python server-v2.py`. And then use the application to connect to the server
- [ ] Able to send an MRL link to server to download
- [ ] Handle all MediaDownloader RPC calls
- [ ] Create distributions for:
- [x] Windows
- [ ] Debian
- [ ] Ubuntu
- [ ] Mac OS
- [ ] Write good tests ;)
- [ ] Retrieve album covers from media files and send them
- [ ] Able to sync media files with clients/controllers
- [ ] SoundCloud support
- [ ] Store radio station urls in file and be able to stream them
- [x] gRPC implementation
- [x] Handle all MusicPlayer RPC calls (play, pause, ...)
- [x] Retrieve album & song list
- [x] Volume control
- [x] Queue music (next & previous song selection)
- [x] Write tests
7 changes: 7 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off

if exist main.spec (
pyinstaller --onefile main.spec
) else (
echo main.spec file not found
)
25 changes: 0 additions & 25 deletions cli_musicplayer.py

This file was deleted.

25 changes: 14 additions & 11 deletions config.ini
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
[musicserver]
; The port on which the server should operate
port=1010
port = 1010

[musicplayer]
; Starting volume of the music player
start_volume=80
start_volume = 80
; The volume of the sounds when events occur like (ready and connected)
event_volume=80
event_volume = 80
; The location to search for music files and folders (albums).
; Every folder will be treated as an Album and every file with an allowed extension (@see allowed_extensions)
; will be accepted as an playable music file
musiclocation=C:\Users\Melle\Music
musiclocation = C:\Users\Melle\Music
; Allow empty albums (directories)
allow_empty_albums=0
allow_empty_albums = 0
; If the musiclocation specified above should also be treated as an album
musiclocation_is_album=1
musiclocation_is_album = 1
; Allowed extensions seperated by a comma (don't include the . for the extensions)
allowed_extensions=mp3,wav
allowed_extensions = mp3,wav

[musicplayer/events]
; The sound to play when someone connects
onconnected=resources/connected.mp3
onconnected = resources/connected.mp3
; Which file to play when musicplayer is ready, leave blank for no sound
onready=resources/ready.mp3
onready = resources/ready.mp3

[youtube_dl]
[datamanager]
; no configuration yet

[mediadownloader]
; The location where the downloaded files should go
; You can use the templating from youtube_dl
; @see https://github.com/rg3/youtube-dl/#output-template for examples
; This application also has his own templating using brackets e.g. {{example}}
; {{album}} - The selected album
download_location={{album}}/%(title)s.%(ext)s
download_location = {{album}}/%(title)s.%(ext)s
3 changes: 1 addition & 2 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# ignore generated documentation
_build
_templates
build
4 changes: 2 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = MelonMusicPlayer
SOURCEDIR = .
BUILDDIR = _build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
Expand Down
4 changes: 2 additions & 2 deletions docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
set SOURCEDIR=source
set BUILDDIR=build
set SPHINXPROJ=MelonMusicPlayer

if "%1" == "" goto help
Expand Down
File renamed without changes.
Loading

0 comments on commit ef65569

Please sign in to comment.