Skip to content

Commit 14e8078

Browse files
committed
Merge branch 'mongoose'
2 parents f0c1317 + 1edb663 commit 14e8078

23 files changed

+5884
-1063
lines changed

.drone.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
image: gcc4.8
2+
script:
3+
- sudo apt-get install -y libmpdclient-dev &> /dev/null
4+
- cmake . -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=Debug
5+
- make VERBOSE=1
6+
notify:
7+
email:
8+
recipients:
9+
10+
irc:
11+
server: irc.freenode.org
12+
nick: droneBot
13+
channel: '#nicotest'
14+
on_started: true
15+
on_success: true
16+
on_failure: true
17+

CMakeLists.txt

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,51 @@ cmake_minimum_required(VERSION 2.6)
33
project (ympd)
44
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
55
set(CPACK_PACKAGE_VERSION_MAJOR "1")
6-
set(CPACK_PACKAGE_VERSION_MINOR "0")
6+
set(CPACK_PACKAGE_VERSION_MINOR "2")
77
set(CPACK_PACKAGE_VERSION_PATCH "0")
8-
set(CPACK_GENERATOR "DEB;RPM;TGZ")
9-
set(CPACK_SOURCE_GENERATOR "TBZ2")
10-
set(DEBIAN_PACKAGE_SECTION "web")
11-
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPD web client based on Websockets and Bootstrap")
12-
set(CPACK_PACKAGE_CONTACT "Andrew Karpow <[email protected]>")
13-
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "[email protected]")
14-
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libssl1.0.0,libmpdclient2")
15-
16-
option(WITH_STATIC_WEBSOCKETS "Build with static libwebsockets library" ON)
8+
179
option(WITH_MPD_HOST_CHANGE "Let users of the web frontend change the MPD Host" ON)
1810

1911
find_package(LibMPDClient REQUIRED)
20-
find_package(LibWebSockets REQUIRED)
21-
if(WITH_STATIC_WEBSOCKETS)
22-
find_package(OpenSSL REQUIRED)
23-
find_package(ZLIB REQUIRED)
24-
endif()
12+
find_package(Threads REQUIRED)
2513

26-
configure_file(${PROJECT_SOURCE_DIR}/src/config.h.in
27-
${PROJECT_BINARY_DIR}/config.h)
28-
include_directories(${PROJECT_BINARY_DIR} ${LIBWEBSOCKETS_INCLUDE_DIR})
14+
configure_file(src/config.h.in ${PROJECT_BINARY_DIR}/config.h)
15+
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
2916

3017
include(CheckCSourceCompiles)
31-
include(CPack)
3218

3319
set(CMAKE_C_FLAGS "-std=gnu99 -Wall")
3420
set(CMAKE_C_FLAGS_DEBUG "-ggdb -pedantic")
3521

22+
file(GLOB RESOURCES
23+
RELATIVE ${PROJECT_SOURCE_DIR}
24+
htdocs/js/*
25+
htdocs/assets/*
26+
htdocs/css/*.min.css
27+
htdocs/fonts/*
28+
htdocs/index.html
29+
)
30+
31+
add_executable(mkdata htdocs/mkdata.c)
32+
get_target_property(MKDATA_EXE mkdata LOCATION)
33+
34+
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/assets.c
35+
COMMAND ${MKDATA_EXE} ${RESOURCES} > ${PROJECT_BINARY_DIR}/assets.c
36+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
37+
DEPENDS ${RESOURCES}
38+
)
39+
3640
set(SOURCES
3741
src/ympd.c
3842
src/http_server.c
3943
src/mpd_client.c
44+
src/mongoose.c
45+
src/json_encode.c
46+
assets.c
4047
)
4148

4249
add_executable(ympd ${SOURCES})
43-
44-
# TODO: use generator expressions introduced to CMake 2.8.12, too fresh yet
45-
if(WITH_STATIC_WEBSOCKETS)
46-
find_library(LIBWEBSOCKETS_LIBRARY_STATIC libwebsockets.a)
47-
target_link_libraries(ympd ${LIBMPDCLIENT_LIBRARY}
48-
${LIBWEBSOCKETS_LIBRARY_STATIC} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
49-
else()
50-
target_link_libraries(ympd ${LIBMPDCLIENT_LIBRARY}
51-
${LIBWEBSOCKETS_LIBRARIES})
52-
endif()
53-
50+
target_link_libraries(ympd ${LIBMPDCLIENT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
5451

5552
install(TARGETS ympd DESTINATION bin)
5653
install(FILES ympd.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
57-
install(DIRECTORY htdocs DESTINATION share/${PROJECT_NAME})

LICENSE

Lines changed: 340 additions & 22 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
ympd
22
====
3+
[![Build Status](http://ci.ympd.org/github.com/notandy/ympd/status.png?branch=mongoose)](https://ci.ympd.org/github.com/notandy/ympd)
34

45
Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS
56

7+
68
http://www.ympd.org
79

10+
![ScreenShot](http://www.ympd.org/assets/ympd_github.png)
811

912
Dependencies
1013
------------
11-
- libwebsockets master branch: http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets
1214
- libmpdclient 2: http://www.musicpd.org/libs/libmpdclient/
1315
- cmake 2.6: http://cmake.org/
14-
- Optional: OpenSSL for SSL support in libwebsockets webserver
1516

1617
Unix Build Instructions
1718
-----------------------
1819

19-
1. Install Dependencies, cmake, openssl and libmpdclient are available from all major distributions.
20+
1. Install Dependencies, cmake and libmpdclient are available from all major distributions.
2021
2. create build directory ```cd /path/to/src; mkdir build; cd build```
2122
3. create makefile ```cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr```
2223
4. build ```make```
23-
5. install ```sudo make install``` or build debian package ```cpack -G DEB; sudo dpkg -i ympd*.deb```
24+
5. install ```sudo make install``` or just run with ```./ympd```
2425

2526
Copyright
2627
---------

cmake/FindLibWebSockets.cmake

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

contrib/init.debian

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ SCRIPTNAME=/etc/init.d/$NAME
2121
LOG_OUT=/var/log/$NAME.out
2222
LOG_ERR=/var/log/$NAME.err
2323
YMPD_USER=mpd
24-
YMPD_GROUP=mpd
25-
DAEMON_OPT="--uid $YMPD_USER --gid $YMPD_GROUP --webport 80"
24+
DAEMON_OPT="--user $YMPD_USER --webport 80"
2625

2726
# Exit if the package is not installed
2827
[ -x "$DAEMON" ] || exit 0

htdocs/css/mpd.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ body {
2828
min-width: 50px;
2929
}
3030

31+
#search {
32+
margin-right: -10px;
33+
}
34+
3135
.btn-group-hover {
3236
opacity: 20%;
3337
}

htdocs/css/mpd.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

htdocs/index.html

Lines changed: 55 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
<title>ympd</title>
1111

1212
<!-- Bootstrap core CSS -->
13-
<link href="css/bootstrap.css" rel="stylesheet">
13+
<link href="css/bootstrap.min.css" rel="stylesheet">
14+
<link href="css/bootstrap-theme.min.css" rel="stylesheet">
1415

1516
<!-- Custom styles for this template -->
16-
<link href="css/mpd.css" rel="stylesheet">
17+
<link href="css/mpd.min.css" rel="stylesheet">
1718
<link href="assets/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
1819

1920
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
@@ -37,9 +38,8 @@
3738
<div class="collapse navbar-collapse">
3839

3940
<ul id="nav_links" class="nav navbar-nav">
40-
<li id="playlist"><a href="#/">Playlist</a></li>
41-
<li id="browse"><a href="#/browse/">Browse database</a></li>
42-
<li><a href="#" data-toggle="modal" data-target="#about" onclick="getVersion();">About</a></li>
41+
<li id="queue"><a href="#/">Queue</a></li>
42+
<li id="browse"><a href="#/browse/0/">Browse database</a></li>
4343
<li><a href="#" data-toggle="modal" data-target="#settings" onclick="getHost();">Settings</a></li>
4444
</ul>
4545

@@ -65,6 +65,11 @@
6565
</div>
6666
</div>
6767
</div>
68+
<form id="search" class="navbar-form navbar-right" role="search">
69+
<div class="form-group">
70+
<input type="text" class="form-control" placeholder="Search">
71+
</div>
72+
</form>
6873
</div><!--/.nav-collapse -->
6974
</div>
7075
</div>
@@ -77,7 +82,7 @@
7782

7883
<div class="panel panel-primary">
7984
<!-- Default panel contents -->
80-
<div id="panel-heading" class="panel-heading">Playlist</div>
85+
<div class="panel-heading"><b id="panel-heading">Queue</b></div>
8186
<div class="panel-body">
8287
<h1>
8388
<span id="track-icon" class="glyphicon glyphicon-play"></span>
@@ -111,6 +116,10 @@ <h4>
111116
</tbody>
112117
</table>
113118
</div><!-- /.panel -->
119+
<ul class="pager">
120+
<li id="prev" class="page-btn hide"><a href="">Previous</a></li>
121+
<li id="next" class="page-btn"><a href="">Next</a></li>
122+
</ul>
114123
</div><!-- /.col-md-10 -->
115124

116125
<div class="col-md-2 col-xs-12" >
@@ -150,42 +159,21 @@ <h4>
150159
</div><!-- /.container -->
151160

152161
<!-- Modal -->
153-
<div class="modal fade" id="about" tabindex="-1" role="dialog" aria-labelledby="aboutLabel" aria-hidden="true">
162+
<div class="modal fade" id="settings" tabindex="-1" role="dialog" aria-labelledby="settingsLabel" aria-hidden="true">
154163
<div class="modal-dialog">
155164
<div class="modal-content">
156165
<div class="modal-header">
157166
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
158-
<h2 class="modal-title" id="aboutLabel">About</h2>
167+
<h2 class="modal-title" id="settingsLabel"><span class="glyphicon glyphicon-wrench"></span> Settings</h2>
159168
</div>
160169
<div class="modal-body">
161170
<h4><a href="http://www.ympd.org"><span class="glyphicon glyphicon-play-circle"></span> ympd</a>&nbsp;&nbsp;&nbsp;<small>MPD Web GUI - written in C, utilizing Websockets and Bootstrap/JS</small></h4>
162171
<p>
163172
ympd is a lightweight MPD (Music Player Daemon) web client that runs without a dedicated werbserver or interpreters like PHP, NodeJS or Ruby. It's tuned for minimal resource usage and requires only very litte dependencies.</p>
164-
<p class="text-muted">
165-
ympd <span id="ympd_version"></span><br/>
166-
libmpdclient <span id="mpd_version"></span><br/>
167-
</p>
168173
<h5>ympd uses following excellent software:</h5>
169-
<h6><a href="http://libwebsockets.org">libWebSockets</a> <small>LGPL2.1 + static link exception</small></h6>
174+
<h6><a href="http://cesanta.com/docs.html">Mongoose</a> <small>GPLv2</small></h6>
170175
<h6><a href="http://www.musicpd.org/libs/libmpdclient/">libMPDClient</a> <small>BSD License</small></h6>
171-
<br/>
172-
</div>
173-
<div class="modal-footer">
174-
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
175-
</div>
176-
</div><!-- /.modal-content -->
177-
</div><!-- /.modal-dialog -->
178-
</div><!-- /.modal -->
179-
180-
<!-- Modal -->
181-
<div class="modal fade" id="settings" tabindex="-1" role="dialog" aria-labelledby="settingsLabel" aria-hidden="true">
182-
<div class="modal-dialog">
183-
<div class="modal-content">
184-
<div class="modal-header">
185-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
186-
<h2 class="modal-title" id="settingsLabel"><span class="glyphicon glyphicon-wrench"></span> Settings</h2>
187-
</div>
188-
<div class="modal-body">
176+
<hr />
189177
<form role="form">
190178
<div class="row">
191179
<div class="form-group col-md-9">
@@ -197,16 +185,51 @@ <h2 class="modal-title" id="settingsLabel"><span class="glyphicon glyphicon-wren
197185
<input type="text" class="form-control" id="mpdport" />
198186
</div>
199187
</div>
188+
<div class="row">
189+
<div class="form-group col-md-6">
190+
<label class="control-label" for="mpd_pw">MPD Password</label>
191+
<input type="password" class="form-control" id="mpd_pw" placeholder="Password"/>
192+
</div>
193+
<div class="form-group col-md-6">
194+
<label class="control-label" for="mpd_pw_con">MPD Password (Confirmation)</label>
195+
<input type="password" class="form-control" id="mpd_pw_con" placeholder="Password confirmation"
196+
data-placement="right" data-toggle="popover" data-content="Password does not match!"
197+
data-trigger="manual" />
198+
</div>
199+
<div class="form-group col-md-12">
200+
<div id="mpd_password_set" class="hide alert alert-info">
201+
<button type="button" class="close" aria-hidden="true">&times;</button>
202+
MPD Password is set
203+
</div>
204+
</div>
205+
206+
</div>
200207
</form>
201208
</div>
202209
<div class="modal-footer">
203210
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
204-
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="setHost();">Save</button>
211+
<button type="button" class="btn btn-default" onclick="confirmSettings();">Save</button>
205212
</div>
206213
</div><!-- /.modal-content -->
207214
</div><!-- /.modal-dialog -->
208215
</div><!-- /.modal -->
209216

217+
<div class="modal fade bs-example-modal-sm" id="wait" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" aria-hidden="true">
218+
<div class="modal-dialog">
219+
<div class="modal-content">
220+
<div class="modal-header">
221+
<h1>Searching...</h1>
222+
</div>
223+
<div class="modal-body">
224+
<div class="progress progress-striped active">
225+
<div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
226+
<span class="sr-only">Please Wait</span>
227+
</div>
228+
</div>
229+
</div>
230+
</div>
231+
</div>
232+
</div>
210233

211234

212235
<!-- Bootstrap core JavaScript

0 commit comments

Comments
 (0)