Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jul 18, 2023
2 parents 86d8b8e + 623638c commit eb25db2
Show file tree
Hide file tree
Showing 272 changed files with 14,246 additions and 8,535 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"eqeqeq": ["error", "always", {
"null": "ignore"
}],
"semi": [2, "always"],
"no-alert": "error",
"no-caller": "error",
"no-console": "off",
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
/osc/
/package/
/release/
/test/build/

#debug build files
/htdocs/assets/ligatures.json
Expand Down
84 changes: 84 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,90 @@ https://github.com/jcorporation/myMPD/

***

## myMPD v11.0.0 (2023-07-18)

This release improves the queue and playlist management in many ways. You can now select multiple songs or playlists and take actions on this selection. There are new methods to copy, merge, validate and deduplicate playlists. Further the mpd error handling and the mpd communication was improved by using command lists.

### Notes

- This is the first release that enforces the OpenSSL dependency.
- Some home icons are invalid, you must re-add the icons, sorry for that.

### API changes

This release changes definitions of many API methods.

- MYMPD_API_JUKEBOX_RM: parameters changed
- MYMPD_API_QUEUE_RM_SONG -> MYMPD_API_QUEUE_RM_IDS: parameters changed
- MYMPD_API_QUEUE_MOVE_SONG -> MYMPD_API_QUEUE_MOVE_POSITION: parameters changed
- MYMPD_API_QUEUE_MOVE_RELATIVE: new
- MYMPD_API_QUEUE_APPEND_URI -> MYMPD_API_QUEUE_APPEND_URIS: parameters changed
- MYMPD_API_QUEUE_INSERT_URI -> MYMPD_API_QUEUE_INSERT_URIS: parameters changed
- MYMPD_API_QUEUE_REPLACE_URI -> MYMPD_API_QUEUE_REPLACE_URIS: parameters changed
- MYMPD_API_QUEUE_APPEND_PLAYLIST -> MYMPD_API_QUEUE_APPEND_PLAYLISTS: parameters changed
- MYMPD_API_QUEUE_INSERT_PLAYLIST -> MYMPD_API_QUEUE_INSERT_PLAYLISTS: parameters changed
- MYMPD_API_QUEUE_REPLACE_PLAYLIST -> MYMPD_API_QUEUE_REPLACE_PLAYLISTS: parameters changed
- MYMPD_API_QUEUE_PRIO_SET: parameters changed
- MYMPD_API_QUEUE_PRIO_SET_HIGHEST: parameters changed
- MYMPD_API_QUEUE_APPEND_ALBUMS: new
- MYMPD_API_QUEUE_INSERT_ALBUMS: new
- MYMPD_API_QUEUE_REPLACE_ALBUMS: new
- MYMPD_API_QUEUE_APPEND_ALBUM_DISC: new
- MYMPD_API_QUEUE_INSERT_ALBUM_DISC: new
- MYMPD_API_QUEUE_REPLACE_ALBUM_DISC: new
- MYMPD_API_PLAYLIST_CONTENT_RM_SONG -> MYMPD_API_PLAYLIST_CONTENT_RM_POSITIONS: parameters changed
- MYMPD_API_PLAYLIST_CONTENT_MOVE_SONG -> MYMPD_API_PLAYLIST_CONTENT_MOVE_POSITION: parameters changed
- MYMPD_API_PLAYLIST_CONTENT_APPEND_URI -> MYMPD_API_PLAYLIST_CONTENT_APPEND_URIS: parameters changed
- MYMPD_API_PLAYLIST_CONTENT_INSERT_URI -> MYMPD_API_PLAYLIST_CONTENT_INSERT_URIS: parameters changed
- MYMPD_API_PLAYLIST_CONTENT_REPLACE_URI -> MYMPD_API_PLAYLIST_CONTENT_REPLACE_URIS: parameters changed
- MYMPD_API_PLAYLIST_CONTENT_MOVE_TO_PLAYLIST: new
- MYMPD_API_PLAYLIST_RM: parameters changed
- MYMPD_API_PLAYLIST_COPY: new
- MYMPD_API_PLAYLIST_CONTENT_VALIDATE: new
- MYMPD_API_PLAYLIST_CONTENT_DEDUP: new
- MYMPD_API_PLAYLIST_CONTENT_VALIDATE_DEDUP: new
- MYMPD_API_PLAYLIST_CONTENT_VALIDATE_ALL: new
- MYMPD_API_PLAYLIST_CONTENT_DEDUP_ALL: new
- MYMPD_API_PLAYLIST_CONTENT_VALIDATE_DEDUP_ALL: new
- MYMPD_API_PLAYLIST_CONTENT_APPEND_ALBUMS: new
- MYMPD_API_PLAYLIST_CONTENT_INSERT_ALBUMS: new
- MYMPD_API_PLAYLIST_CONTENT_REPLACE_ALBUMS: new
- MYMPD_API_PLAYLIST_CONTENT_APPEND_ALBUM_DISC: new
- MYMPD_API_PLAYLIST_CONTENT_INSERT_ALBUM_DISC: new
- MYMPD_API_PLAYLIST_CONTENT_REPLACE_ALBUM_DISC: new
- MYMPD_API_WEBRADIO_FAVORITE_RM: parameters changed
- MYMPD_API_SCRIPT_VALIDATE: new

### Changelog

- Feat: add multiple selections and actions #1001
- Feat: improve queue and playlist management #1001
- Feat: copy, merge, validate and deduplicate playlists #1038
- Feat: migrate to JavaScript fetch() API #1006
- Feat: add test target to cmake #1023
- Feat: improve mpd error handling #1028
- Feat: improve mpd communication
- Feat: add quick remove and quick play buttons to more views
- Feat: support MUSICBRAINZ_RELEASEGROUPID tag (MPD 0.24)
- Feat: handle preflighted requests in CORS
- Feat: add consume one shot to queue context menu
- Upd: Mongoose 7.11 #1060
- Upd: Bootstrap 5.3.0 final
- Upd: libmympdclient 1.0.21
- Upd: OpenSSL is now required #1033
- Upd: Replace tinymt with OpenSSL prng #1034
- Upd: use OpenSSL hash functions
- Upd: documentation improvements
- Upd: improve error handling in build system
- Upd: show stream name in title tag
- Fix: various small css and javascript fixes
- Fix: improve Mongoose logging #1032
- Fix: set correct song start time sticker #1044
- Fix: Fall back from AlbumArtist to Artist tag for MusicBrainz tags #1056
- Fix: correct position in last played list #1063

***

## myMPD v10.3.3 (2023-06-02)

This is a small bugfix release.
Expand Down
52 changes: 25 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cmake_policy(SET CMP0003 NEW)
# myMPD is written in C
# supported compilers: gcc, clang
project(mympd
VERSION 10.3.3
VERSION 11.0.0
LANGUAGES C
)

Expand Down Expand Up @@ -48,14 +48,14 @@ if(NOT DEFINED MYMPD_DEBUG)
endif()

# available options
option(MYMPD_BUILD_TESTING "Enables building of unit tests" "OFF")
option(MYMPD_DEBUG "Enables myMPD debug mode, default OFF, ON for Debug" "OFF")
option(MYMPD_EMBEDDED_ASSETS "Embed assets in binary, default ON, OFF for Debug" "ON")
option(MYMPD_ENABLE_FLAC "Enables flac support, default ON" "ON")
option(MYMPD_ENABLE_IPV6 "Enables IPv6, default ON" "ON")
option(MYMPD_ENABLE_LIBASAN "Enables build with libasan, default OFF" "OFF")
option(MYMPD_ENABLE_LIBID3TAG "Enables libid3tag support, default ON" "ON")
option(MYMPD_ENABLE_LUA "Enables lua support, default ON" "ON")
option(MYMPD_ENABLE_SSL "Enables OpenSSL support, default ON" "ON")
option(MYMPD_MANPAGES "Creates and installs manpages" "ON")
option(MYMPD_MINIMAL "Enables minimal myMPD build, disables all MYMPD_ENABLE_* flags" "OFF")
option(MYMPD_STRIP_BINARY "Enables stripping the binaries for Release, default ON" "ON")
Expand All @@ -65,7 +65,6 @@ if(MYMPD_MINIMAL)
set(MYMPD_ENABLE_IPV6 "OFF")
set(MYMPD_ENABLE_LUA "OFF")
set(MYMPD_ENABLE_LIBID3TAG "OFF")
set(MYMPD_ENABLE_SSL "OFF")
endif()

# cmake modules
Expand Down Expand Up @@ -102,46 +101,42 @@ endif()
message("Workdir: ${MYMPD_WORK_DIR}")
message("Cachedir: ${MYMPD_CACHE_DIR}")

# create assets and set doc root
set(ENV{MYMPD_BUILDDIR} "${CMAKE_CURRENT_BINARY_DIR}")

if(MYMPD_EMBEDDED_ASSETS)
message("Embedding assets in binary")
set(MYMPD_DOC_ROOT "${MYMPD_WORK_DIR}/empty")
set(MYMPD_LUALIBS_PATH "")
set(ENV{MYMPD_BUILDDIR} "${CMAKE_CURRENT_BINARY_DIR}")
execute_process(COMMAND "${PROJECT_SOURCE_DIR}/build.sh" createassets)
execute_process(COMMAND "${PROJECT_SOURCE_DIR}/build.sh" createassets RESULT_VARIABLE RC_CREATE_ASSETS)
# remove object files with embedded assets
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/src/CMakeFiles/mympd.dir/web_server/utility.c.o")
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/src/CMakeFiles/mympd.dir/mympd_api/scripts.c.o")
else()
message("Serving assets from filesystem")
set(MYMPD_DOC_ROOT "${PROJECT_SOURCE_DIR}/htdocs")
set(MYMPD_LUALIBS_PATH "${PROJECT_SOURCE_DIR}/contrib/lualibs")
set(ENV{MYMPD_BUILDDIR} "${CMAKE_CURRENT_BINARY_DIR}")
execute_process(COMMAND "${PROJECT_SOURCE_DIR}/build.sh" copyassets)
execute_process(COMMAND "${PROJECT_SOURCE_DIR}/build.sh" copyassets RESULT_VARIABLE RC_CREATE_ASSETS)
endif()

if(RC_CREATE_ASSETS GREATER 0)
message(FATAL_ERROR "Creating assets failed")
endif()

message("Document root: ${MYMPD_DOC_ROOT}")

# required dependencies
find_package(Threads REQUIRED)
find_package(PCRE2 REQUIRED)
find_library(MATH_LIB m REQUIRED)
find_package(OpenSSL REQUIRED)

# optional dependencies
if(MYMPD_ENABLE_SSL)
message("Searching for openssl")
find_package(OpenSSL)
if(OPENSSL_FOUND)
if(NOT OPENSSL_VERSION VERSION_GREATER_EQUAL "1.1.0")
message("OpenSSL is disabled because a version lower than 1.1.0 was found")
set(MYMPD_ENABLE_SSL "OFF")
endif()
else()
message("OpenSSL is disabled because it was not found")
set(MYMPD_ENABLE_SSL "OFF")
endif()
else()
message("OpenSSL is disabled by user")
# check dependencies versions
if(OPENSSL_VERSION VERSION_LESS "1.1.0")
message(FATAL_ERROR "myMPD requires an OpenSSL version greater or equal 1.1.0")
endif()

# optional dependencies
if(MYMPD_ENABLE_LIBID3TAG)
message("Searching for libid3tag")
find_package(LIBID3TAG)
Expand Down Expand Up @@ -275,7 +270,7 @@ if(CMAKE_BUILD_TYPE MATCHES "(Release|Debug)")
endforeach()

if(NOT MYMPD_ENABLE_LIBASAN)
#incompatible with libasan
# incompatible with libasan
add_compile_options("-D_FORTIFY_SOURCE=2")
endif()
else()
Expand Down Expand Up @@ -373,16 +368,13 @@ target_link_libraries(mympd
mongoose
rax
sds
tinymt
${CMAKE_THREAD_LIBS_INIT}
${MATH_LIB}
${PCRE2_LIBRARIES}
${OPENSSL_LIBRARIES}
)

# link optional dependencies
if(OPENSSL_FOUND)
target_link_libraries(mympd ${OPENSSL_LIBRARIES})
endif()
if(LIBID3TAG_FOUND)
target_link_libraries(mympd ${LIBID3TAG_LIBRARIES})
endif()
Expand All @@ -396,3 +388,9 @@ endif()
# install
install(TARGETS mympd DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/cmake/CopyConfig.cmake)

# test
if(MYMPD_BUILD_TESTING)
include(CTest)
add_subdirectory(test)
endif()
28 changes: 24 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CLANG_TIDY_CHECKS="$CLANG_TIDY_CHECKS,-readability-identifier-length"
CLANG_TIDY_CHECKS="$CLANG_TIDY_CHECKS,-readability-function-cognitive-complexity,-google-readability-function-size,-readability-function-size"
CLANG_TIDY_CHECKS="$CLANG_TIDY_CHECKS,-readability-magic-numbers"
CLANG_TIDY_CHECKS="$CLANG_TIDY_CHECKS,-readability-non-const-parameter"
CLANG_TIDY_CHECKS="$CLANG_TIDY_CHECKS,-google-readability-todo"

#save script path and change to it
STARTPATH=$(dirname "$(realpath "$0")")
Expand Down Expand Up @@ -199,6 +200,7 @@ createassets() {
install -d "$MYMPD_BUILDDIR/htdocs/assets/i18n"

#Create translation phrases file
check_phrases
createi18n "$MYMPD_BUILDDIR" 2>/dev/null
minify js "$MYMPD_BUILDDIR/htdocs/js/i18n.js" "$MYMPD_BUILDDIR/htdocs/js/i18n.min.js"

Expand Down Expand Up @@ -362,6 +364,7 @@ copyassets() {
cp -v "$STARTPATH/dist/material-icons/MaterialIcons-Regular.woff2" "$STARTPATH/htdocs/assets/MaterialIcons-Regular.woff2"
cp -v "$STARTPATH/dist/material-icons/ligatures.json" "$STARTPATH/htdocs/assets/ligatures.json"
#translation files
check_phrases
createi18n "$MYMPD_BUILDDIR"
cp -v "$MYMPD_BUILDDIR/htdocs/js/i18n.js" "$STARTPATH/htdocs/js/i18n.js"
rm -fr "$STARTPATH/htdocs/assets/i18n/"
Expand Down Expand Up @@ -393,9 +396,11 @@ builddebug() {

buildtest() {
echo "Compiling and running unit tests"
cmake -B test/build -S test -DCMAKE_BUILD_TYPE=Debug
make -C test/build VERBOSE=1
./test/build/test
cmake -B debug -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=Debug \
-DMYMPD_ENABLE_LIBASAN=ON -DMYMPD_BUILD_TESTING=ON \
.
make -C debug
make -C debug test
}

cleanup() {
Expand Down Expand Up @@ -514,6 +519,7 @@ check_file() {
}

check() {
check_phrases
if ! check_docs
then
return 1
Expand Down Expand Up @@ -997,6 +1003,19 @@ purge() {
fi
}

check_phrases() {
check_cmd jq
echo "Validating translation phrases"
for F in "src/i18n/json/"*.json
do
if ! jq "." "$F" > /dev/null
then
echo "Invalid json: $F"
exit 1
fi
done
}

createi18n() {
MYMPD_BUILD_DIR="$1"
check_cmd perl
Expand Down Expand Up @@ -1458,7 +1477,8 @@ case "$ACTION" in
echo " serves assets from htdocs"
echo " memcheck: builds debug files in directory debug"
echo " linked with libasan3 and serves assets from htdocs"
echo " test: builds and runs the unit tests in test/build"
echo " test: builds and runs the unit tests in directory debug"
echo " linked with libasan3"
echo " installdeps: installs build and runtime dependencies"
echo " createassets: creates the minfied and compressed dist files"
echo " following environment variables are respected"
Expand Down
11 changes: 7 additions & 4 deletions cli_tools/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ void set_loglevel(int level) {
else if (level < 0) {
level = 0;
}
MYMPD_LOG_NOTICE("Setting loglevel to %d", level);
MYMPD_LOG_NOTICE(NULL, "Setting loglevel to %d", level);
loglevel = level;
}

void mympd_log_errno(const char *file, int line, int errnum) {
void mympd_log_errno(const char *file, int line, const char *partition, int errnum) {
char err_text[256];
int rc = strerror_r(errnum, err_text, 256);
const char *err_str = rc == 0 ? err_text : "Unknown error";
mympd_log(LOG_ERR, file, line, "%s", err_str);
mympd_log(LOG_ERR, file, line, partition, "%s", err_str);
}

void mympd_log(int level, const char *file, int line, const char *fmt, ...) {
void mympd_log(int level, const char *file, int line, const char *partition, const char *fmt, ...) {
if (level > loglevel) {
return;
}
Expand All @@ -54,6 +54,9 @@ void mympd_log(int level, const char *file, int line, const char *fmt, ...) {
(void)file;
(void)line;
#endif
if (partition != NULL) {
logline = sdscatfmt(logline, "\"%s\": ", partition);
}

va_list args;
va_start(args, fmt);
Expand Down
10 changes: 5 additions & 5 deletions cli_tools/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define MYMPD_LOG_NOTICE(...) mympd_log(LOG_NOTICE, __FILE__, __LINE__, __VA_ARGS__)
#define MYMPD_LOG_INFO(...) mympd_log(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__)
#define MYMPD_LOG_DEBUG(...) mympd_log(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
#define MYMPD_LOG_ERRNO(ERRNUM) mympd_log_errno(__FILE__, __LINE__, ERRNUM)
#define MYMPD_LOG_ERRNO(PART, ERRNUM) mympd_log_errno(__FILE__, __LINE__, PART, ERRNUM)
#else
//release build should have no references to build dir
#define MYMPD_LOG_EMERG(...) mympd_log(LOG_EMERG, "", __LINE__, __VA_ARGS__)
Expand All @@ -30,15 +30,15 @@
#define MYMPD_LOG_NOTICE(...) mympd_log(LOG_NOTICE, "", __LINE__, __VA_ARGS__)
#define MYMPD_LOG_INFO(...) mympd_log(LOG_INFO, "", __LINE__, __VA_ARGS__)
#define MYMPD_LOG_DEBUG(...) mympd_log(LOG_DEBUG, "", __LINE__, __VA_ARGS__)
#define MYMPD_LOG_ERRNO(ERRNUM) mympd_log_errno("", __LINE__, ERRNUM)
#define MYMPD_LOG_ERRNO(PART, ERRNUM) mympd_log_errno("", __LINE__, PART, ERRNUM)
#endif

extern int loglevel;
extern bool log_on_tty;

void mympd_log_errno(const char *file, int line, int errnum);
void mympd_log(int level, const char *file, int line, const char *fmt, ...)
__attribute__ ((format (printf, 4, 5))); /* Flawfinder: ignore */
void mympd_log_errno(const char *file, int line, const char *partition, int errnum);
void mympd_log(int level, const char *file, int line, const char *partition, const char *fmt, ...)
__attribute__ ((format (printf, 5, 6))); /* Flawfinder: ignore */

void set_loglevel(int level);

Expand Down
5 changes: 1 addition & 4 deletions cli_tools/mympd-script/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ target_sources(mympd-script
target_link_libraries(mympd-script
sds
mongoose
${OPENSSL_LIBRARIES}
)

if(OPENSSL_FOUND)
target_link_libraries(mympd-script ${OPENSSL_LIBRARIES})
endif()

install(TARGETS mympd-script DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
2 changes: 1 addition & 1 deletion contrib/man/mympd-script.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Manpage for mympd-script.
.\" Contact <[email protected]> to correct errors or typos.
.TH man 1 "02 Jun 2023" "10.3.3" "mympd-script man page"
.TH man 1 "18 Jul 2023" "11.0.0" "mympd-script man page"

.SH NAME
mympd-script \- mympd command line tool to execute scripts
Expand Down
Loading

0 comments on commit eb25db2

Please sign in to comment.