Skip to content

Commit ef65569

Browse files
author
Melle Dijkstra
authored
Merge pull request #5 from MelleDijkstra/grpc
gRPC implementation
2 parents 22b7a4c + 6b861c0 commit ef65569

52 files changed

Lines changed: 3252 additions & 644 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 167 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,174 @@
11
.idea/
22

3+
/client.py
4+
5+
### VirtualEnv template
6+
# Virtualenv
7+
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
8+
.Python
9+
[Bb]in
10+
[Ii]nclude
11+
[Ll]ib
12+
[Ll]ib64
13+
[Ll]ocal
14+
[Ss]cripts
15+
pyvenv.cfg
16+
.venv
17+
pip-selfcheck.json
18+
### Python template
319
# Byte-compiled / optimized / DLL files
420
__pycache__/
521
*.py[cod]
622
*$py.class
723

8-
/client.py
24+
# C extensions
25+
*.so
26+
27+
# Distribution / packaging
28+
.Python
29+
build/
30+
develop-eggs/
31+
dist/
32+
downloads/
33+
eggs/
34+
.eggs/
35+
lib/
36+
lib64/
37+
parts/
38+
sdist/
39+
var/
40+
wheels/
41+
*.egg-info/
42+
.installed.cfg
43+
*.egg
44+
MANIFEST
45+
46+
# PyInstaller
47+
# Usually these files are written by a python script from a template
48+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
49+
*.manifest
50+
*.spec
51+
52+
# Installer logs
53+
pip-log.txt
54+
pip-delete-this-directory.txt
55+
56+
# Unit test / coverage reports
57+
htmlcov/
58+
.tox/
59+
.coverage
60+
.coverage.*
61+
.cache
62+
nosetests.xml
63+
coverage.xml
64+
*.cover
65+
.hypothesis/
66+
67+
# Translations
68+
*.mo
69+
*.pot
70+
71+
# Django stuff:
72+
*.log
73+
.static_storage/
74+
.media/
75+
local_settings.py
76+
77+
# Flask stuff:
78+
instance/
79+
.webassets-cache
80+
81+
# Scrapy stuff:
82+
.scrapy
83+
84+
# Sphinx documentation
85+
docs/_build/
86+
87+
# PyBuilder
88+
target/
89+
90+
# Jupyter Notebook
91+
.ipynb_checkpoints
92+
93+
# pyenv
94+
.python-version
95+
96+
# celery beat schedule file
97+
celerybeat-schedule
98+
99+
# SageMath parsed files
100+
*.sage.py
101+
102+
# Environments
103+
.env
104+
.venv
105+
env/
106+
venv/
107+
ENV/
108+
env.bak/
109+
venv.bak/
110+
111+
# Spyder project settings
112+
.spyderproject
113+
.spyproject
114+
115+
# Rope project settings
116+
.ropeproject
117+
118+
# mkdocs documentation
119+
/site
120+
121+
# mypy
122+
.mypy_cache/
123+
124+
### JetBrains template
125+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
126+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
127+
128+
# User-specific stuff:
129+
.idea/**/workspace.xml
130+
.idea/**/tasks.xml
131+
.idea/dictionaries
132+
133+
# Sensitive or high-churn files:
134+
.idea/**/dataSources/
135+
.idea/**/dataSources.ids
136+
.idea/**/dataSources.xml
137+
.idea/**/dataSources.local.xml
138+
.idea/**/sqlDataSources.xml
139+
.idea/**/dynamic.xml
140+
.idea/**/uiDesigner.xml
141+
142+
# Gradle:
143+
.idea/**/gradle.xml
144+
.idea/**/libraries
145+
146+
# CMake
147+
cmake-build-debug/
148+
cmake-build-release/
149+
150+
# Mongo Explorer plugin:
151+
.idea/**/mongoSettings.xml
152+
153+
## File-based project format:
154+
*.iws
155+
156+
## Plugin-specific files:
157+
158+
# IntelliJ
159+
out/
160+
161+
# mpeltonen/sbt-idea plugin
162+
.idea_modules/
163+
164+
# JIRA plugin
165+
atlassian-ide-plugin.xml
166+
167+
# Cursive Clojure plugin
168+
.idea/replstate.xml
169+
170+
# Crashlytics plugin (for Android Studio and IntelliJ)
171+
com_crashlytics_export_strings.xml
172+
crashlytics.properties
173+
crashlytics-build.properties
174+
fabric.properties

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
recursive-include resources *
2+
include README.md
3+
include LICENSE
4+
include requirements.txt

README.md

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,82 @@
11
# Python Music Player
2+
[![GitHub license](https://img.shields.io/github/license/MelleDijkstra/PythonMusicPlayer.svg)](https://github.com/MelleDijkstra/PythonMusicPlayer/blob/master/LICENSE)
3+
[![PyPI version](https://badge.fury.io/py/melon-music-player.svg)](https://badge.fury.io/py/melon-music-player)
4+
[![Documentation Status](https://readthedocs.org/projects/pythonmusicplayer/badge/?version=latest)](http://pythonmusicplayer.readthedocs.io/en/latest/?badge=latest)
5+
6+
[![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)
27

38
## Introduction
49

510
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)
611

712
## Installation
813

9-
If you want to run this program you need:
14+
### Windows
15+
16+
Download executable from here
17+
[Download link]()
18+
19+
__*! I experienced a bug with the windows executable, you sometimes need to press `enter`
20+
to activate the server again !*__
21+
22+
Besides that, it should work fine ;)
23+
24+
### Linux (Debian | Raspberry Pi)
25+
26+
(coming soon, on my todo list)
27+
I published a PyPi package, but I haven't tested it yet.
28+
To install run the following command:
29+
`pip install melon-music-player`
30+
31+
### From source
32+
33+
If you want to install/run the MelonMusicPlayer from source,
34+
or if you want to develop on the current code base (please feel free)
35+
run the following instructions:
36+
37+
- Make sure you have installed python 3.5 or higher. [Python Download](https://www.python.org/downloads/)
38+
- The actual VLC program which can be found here ([VLC Download](http://www.videolan.org/vlc/)).
39+
40+
**Windows**: For windows you can just install the executable
41+
42+
**Linux**: For linux system it should be as easy as running `$ sudo apt-get install vlc`.
43+
44+
**!Although, check their site for correct installation!**
45+
46+
- Clone the project if you haven't already `$ git clone https://github.com/MelleDijkstra/PythonMusicPlayer`
47+
- Go to cloned folder `$ cd PythonMusicPlayer`
48+
- Then run `$ pip install -r requirements.txt` to install the packages needed
49+
50+
(If you are installing the MelonMusicPlayer server on raspberry pi this process
51+
can take some time. The reason is because the server runs on gRPC which
52+
has to compile when installing for raspbian. This will hopefully be changed in the future (Please be patient!))
53+
54+
- Change any settings needed in `config.ini`. This is the configuration file for the server
55+
- Start the music server by running `$ python main.py`.
56+
57+
Then use a client/controller to connect to the server.
58+
if you downloaded the source, there should be a `client.py`. Run this in another terminal/process to test the server.
59+
The client has quite some functionality but I will not be maintaining them. For full experience use one of the controllers
60+
like the [Android App](https://github.com/MelleDijkstra/AndroidMusicPlayerClient).
61+
62+
### TODO
63+
(only server related tasks)
1064

11-
* The actual VLC program which can be found here ([VLC](http://www.videolan.org/vlc/)).
12-
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**
13-
* Make sure you have installed python 3.5 or higher. [Python install](https://www.python.org/downloads/)
14-
* Clone the project if you haven't already `$ git clone https://github.com/MelleDijkstra/PythonMusicPlayer`
15-
* Go to cloned folder `$ cd PythonMusicPlayer`
16-
* Then run `$ pip install -r requirements.txt` to install the packages needed
17-
* Change any settings needed in `config.ini`
18-
* Start the music server by running `$ python server-v2.py`. And then use the application to connect to the server
65+
- [ ] Able to send an MRL link to server to download
66+
- [ ] Handle all MediaDownloader RPC calls
67+
- [ ] Create distributions for:
68+
- [x] Windows
69+
- [ ] Debian
70+
- [ ] Ubuntu
71+
- [ ] Mac OS
72+
- [ ] Write good tests ;)
73+
- [ ] Retrieve album covers from media files and send them
74+
- [ ] Able to sync media files with clients/controllers
75+
- [ ] SoundCloud support
76+
- [ ] Store radio station urls in file and be able to stream them
77+
- [x] gRPC implementation
78+
- [x] Handle all MusicPlayer RPC calls (play, pause, ...)
79+
- [x] Retrieve album & song list
80+
- [x] Volume control
81+
- [x] Queue music (next & previous song selection)
82+
- [x] Write tests

build.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
3+
if exist main.spec (
4+
pyinstaller --onefile main.spec
5+
) else (
6+
echo main.spec file not found
7+
)

cli_musicplayer.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

config.ini

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
[musicserver]
22
; The port on which the server should operate
3-
port=1010
3+
port = 1010
44

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

2121
[musicplayer/events]
2222
; The sound to play when someone connects
23-
onconnected=resources/connected.mp3
23+
onconnected = resources/connected.mp3
2424
; Which file to play when musicplayer is ready, leave blank for no sound
25-
onready=resources/ready.mp3
25+
onready = resources/ready.mp3
2626

27-
[youtube_dl]
27+
[datamanager]
28+
; no configuration yet
29+
30+
[mediadownloader]
2831
; The location where the downloaded files should go
2932
; You can use the templating from youtube_dl
3033
; @see https://github.com/rg3/youtube-dl/#output-template for examples
3134
; This application also has his own templating using brackets e.g. {{example}}
3235
; {{album}} - The selected album
33-
download_location={{album}}/%(title)s.%(ext)s
36+
download_location = {{album}}/%(title)s.%(ext)s

docs/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# ignore generated documentation
2-
_build
3-
_templates
2+
build

docs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
SPHINXPROJ = MelonMusicPlayer
8-
SOURCEDIR = .
9-
BUILDDIR = _build
8+
SOURCEDIR = source
9+
BUILDDIR = build
1010

1111
# Put it first so that "make" without argument is like "make help".
1212
help:

docs/make.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ REM Command file for Sphinx documentation
77
if "%SPHINXBUILD%" == "" (
88
set SPHINXBUILD=sphinx-build
99
)
10-
set SOURCEDIR=.
11-
set BUILDDIR=_build
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
1212
set SPHINXPROJ=MelonMusicPlayer
1313

1414
if "%1" == "" goto help
File renamed without changes.

0 commit comments

Comments
 (0)