diff --git a/ChangeLog.md b/ChangeLog.md index da6ebbcb..328cd487 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,7 +3,8 @@ - Fix ignoring of "clientConfigDir" setting ### DeaDBeeF - Provide universal .deb package to match `deadbeef-static_*.deb` -- Fix deadlock with streamer +- Fix deadlock with streamer code +- Fix playOrPause command behavior under v1.10 # Changes in v0.10 (released 2025-02-28) - Add ability to configure output device diff --git a/ci/install.cmd b/ci/install.cmd index fbf52066..de359d81 100644 --- a/ci/install.cmd +++ b/ci/install.cmd @@ -10,6 +10,9 @@ if "%BUILD_ARCH%" == "x64" ( cmd /c scripts\install\foobar2000.cmd v2.1-x64 @if errorlevel 1 goto :end + + cmd /c scripts\install\foobar2000.cmd v2.24-x64 + @if errorlevel 1 goto :end ) else ( cmd /c scripts\install\foobar2000.cmd v1.6 @if errorlevel 1 goto :end @@ -19,6 +22,9 @@ if "%BUILD_ARCH%" == "x64" ( cmd /c scripts\install\foobar2000.cmd v2.1 @if errorlevel 1 goto :end + + cmd /c scripts\install\foobar2000.cmd v2.24 + @if errorlevel 1 goto :end ) :end diff --git a/ci/install.sh b/ci/install.sh index ba50af1d..a8a3509b 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -4,8 +4,11 @@ set -e function main { - scripts/install/deadbeef.sh v1.8 - scripts/install/deadbeef.sh v1.9 + cd scripts/install + + ./deadbeef.sh v1.8 + ./deadbeef.sh v1.9 + ./deadbeef.sh v1.10 } source "$(dirname $0)/run_in_docker.sh" diff --git a/ci/test.cmd b/ci/test.cmd index 33d21479..5ae66435 100644 --- a/ci/test.cmd +++ b/ci/test.cmd @@ -28,6 +28,13 @@ set API_TEST_ERROR=0 set BEEFWEB_TEST_FOOBAR2000_VERSION=v2.1-x64 cmd /c yarn test @if errorlevel 1 set API_TEST_ERROR=1 + + @echo. + @echo === Running API tests on foobar2000 v2.24-x64 === + @echo. + set BEEFWEB_TEST_FOOBAR2000_VERSION=v2.24-x64 + cmd /c yarn test + @if errorlevel 1 set API_TEST_ERROR=1 ) else ( @echo. @echo === Running API tests on foobar2000 v1.6 === @@ -49,6 +56,13 @@ set API_TEST_ERROR=0 set BEEFWEB_TEST_FOOBAR2000_VERSION=v2.1 cmd /c yarn test @if errorlevel 1 set API_TEST_ERROR=1 + + @echo. + @echo === Running API tests on foobar2000 v2.24 === + @echo. + set BEEFWEB_TEST_FOOBAR2000_VERSION=v2.24 + cmd /c yarn test + @if errorlevel 1 set API_TEST_ERROR=1 ) @popd diff --git a/ci/test.sh b/ci/test.sh index 41d867ae..4c3ac46a 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -35,6 +35,7 @@ function main run_server_tests run_api_tests v1.8 run_api_tests v1.9 + run_api_tests v1.10 } source "$(dirname $0)/run_in_docker.sh" diff --git a/cpp/server/deadbeef/player.hpp b/cpp/server/deadbeef/player.hpp index fcc9b7db..4bb51c14 100644 --- a/cpp/server/deadbeef/player.hpp +++ b/cpp/server/deadbeef/player.hpp @@ -134,6 +134,17 @@ class PlayerImpl final : public Player bool playNextBy(const std::string& expression, PlaylistItemSelector selector); PlaylistInfo getPlaylistInfo(ddb_playlist_t* playlist, int index, bool isCurrent); + bool isStopped() + { + if (ddbApi->get_output()->state() == OUTPUT_STATE_STOPPED) + { + PlaylistItemPtr activeItem(ddbApi->streamer_get_playing_track()); + return !activeItem; + } + + return false; + } + PlaylistMutex playlistMutex_; ConfigMutex configMutex_; PlaylistMapping playlists_; diff --git a/cpp/server/deadbeef/player_control.cpp b/cpp/server/deadbeef/player_control.cpp index 45b78e84..9c1b1ac4 100644 --- a/cpp/server/deadbeef/player_control.cpp +++ b/cpp/server/deadbeef/player_control.cpp @@ -211,22 +211,23 @@ void PlayerImpl::pause() ddbApi->sendmessage(DB_EV_PAUSE, 0, 0, 0); } +// DeaDBeeF behavior: +// < v1.10: DB_EV_TOGGLE_PAUSE acts like playOrPause +// >= v1.10: DB_EV_TOGGLE_PAUSE acts like togglePause +// Check playback state manually to support all versions + void PlayerImpl::togglePause() { - if (ddbApi->get_output()->state() == OUTPUT_STATE_STOPPED) - { - PlaylistItemPtr activeItem(ddbApi->streamer_get_playing_track()); - - if (!activeItem) - return; - } - - ddbApi->sendmessage(DB_EV_TOGGLE_PAUSE, 0, 0, 0); + if (!isStopped()) + ddbApi->sendmessage(DB_EV_TOGGLE_PAUSE, 0, 0, 0); } void PlayerImpl::playOrPause() { - ddbApi->sendmessage(DB_EV_TOGGLE_PAUSE, 0, 0, 0); + if (isStopped()) + ddbApi->sendmessage(DB_EV_PLAY_CURRENT, 0, 0, 0); + else + ddbApi->sendmessage(DB_EV_TOGGLE_PAUSE, 0, 0, 0); } void PlayerImpl::setMuted(Switch value) diff --git a/docs/building.md b/docs/building.md index 0bfd6f8a..bb5194ab 100644 --- a/docs/building.md +++ b/docs/building.md @@ -84,7 +84,7 @@ Alternatively you can build from console: And create package: ``` -> cpack +> cpack -C Release ``` `foo_beefweb-*.zip` will be created in `build\Release` directory. @@ -150,10 +150,12 @@ This command supports `--env buildType` and `--env outputDir` with the same defa Full build needs to be performed before running API tests. -Additionally player binaries have to be installed: +`curl` should be available in `PATH`. + +Additionally player binaries should be installed: ``` -> scripts\install\foobar2000.cmd v2.1-x64 +> scripts\install\foobar2000.cmd v2.24-x64 ``` or @@ -173,7 +175,7 @@ This command supports various parameters via environment variables: `BEEFWEB_TEST_BUILD_TYPE` - which build type to use (defaults to `Debug`) -`BEEFWEB_TEST_FOOBAR2000_VERSION` - foobar2000 version to use (defaults to `v2.1-x64`) +`BEEFWEB_TEST_FOOBAR2000_VERSION` - foobar2000 version to use (defaults to `v2.24-x64`) `BEEFWEB_TEST_DEADBEEF_VERSION` - DeaDBeeF version to use (defaults to `v1.9`) diff --git a/js/api_tests/src/foobar2000/test_context.js b/js/api_tests/src/foobar2000/test_context.js index ef467435..566a35ad 100644 --- a/js/api_tests/src/foobar2000/test_context.js +++ b/js/api_tests/src/foobar2000/test_context.js @@ -11,7 +11,7 @@ export class Foobar2000TestContextFactory extends TestContextFactory config.playerId = 'foobar2000'; const { BEEFWEB_TEST_FOOBAR2000_VERSION } = process.env; - config.playerVersion = BEEFWEB_TEST_FOOBAR2000_VERSION || 'v2.1-x64'; + config.playerVersion = BEEFWEB_TEST_FOOBAR2000_VERSION || 'v2.24-x64'; config.playerDir = path.join(config.appsDir, 'foobar2000', config.playerVersion); config.pluginBuildDir = path.join( diff --git a/scripts/install/deadbeef.sh b/scripts/install/deadbeef.sh index 8ee8934f..e566bd92 100755 --- a/scripts/install/deadbeef.sh +++ b/scripts/install/deadbeef.sh @@ -15,6 +15,11 @@ case "$version" in hash='aa17741053f63a7fceace003bf269bd4c4c9e55e42ee14286d9fbf34fbc8e014' ;; + 'v1.10') + url='https://sourceforge.net/projects/deadbeef/files/travis/linux/1.10/deadbeef-static_1.10.0-rc1-1_x86_64.tar.bz2' + hash='3226f09f4ee4e4fb3e3db79971402e55d9ae38dee0ca9e4761ba007e85f62764' + ;; + *) echo "usage: $(basename $0) " exit 1 diff --git a/scripts/install/foobar2000.cmd b/scripts/install/foobar2000.cmd index bae02429..1ebd0333 100644 --- a/scripts/install/foobar2000.cmd +++ b/scripts/install/foobar2000.cmd @@ -1,7 +1,7 @@ @setlocal @if "%1" == "v1.6" ( - @set pkg_file=foobar2000_v1.6.14.exe + @set pkg_file=foobar2000_v1.6.17.exe @goto :install ) @@ -16,17 +16,27 @@ ) @if "%1" == "v2.1" ( - @set pkg_file=foobar2000_v2.1.5.exe + @set pkg_file=foobar2000_v2.1.6.exe @goto :install ) @if "%1" == "v2.1-x64" ( - @set pkg_file=foobar2000-x64_v2.1.5.exe + @set pkg_file=foobar2000-x64_v2.1.6.exe + @goto :install +) + +@if "%1" == "v2.24" ( + @set pkg_file=foobar2000_v2.24.2.exe + @goto :install +) + +@if "%1" == "v2.24-x64" ( + @set pkg_file=foobar2000-x64_v2.24.2.exe @goto :install ) @echo Usage: %~nx0 version -@echo Supported versions: v1.6 v2.0 v2.0-x64 v2.1 v2.1-x64 +@echo Supported versions: v1.6 v2.0 v2.0-x64 v2.1 v2.1-x64 v2.24 v2.24-x64 @cmd /c exit 1 @goto :end diff --git a/scripts/install/foobar2000/v2.24-x64/profile/config.sqlite b/scripts/install/foobar2000/v2.24-x64/profile/config.sqlite new file mode 100644 index 00000000..4032bb72 Binary files /dev/null and b/scripts/install/foobar2000/v2.24-x64/profile/config.sqlite differ diff --git a/scripts/install/foobar2000/v2.24-x64/profile/theme.fth b/scripts/install/foobar2000/v2.24-x64/profile/theme.fth new file mode 100644 index 00000000..97e11af2 Binary files /dev/null and b/scripts/install/foobar2000/v2.24-x64/profile/theme.fth differ diff --git a/scripts/install/foobar2000/v2.24/profile/config.sqlite b/scripts/install/foobar2000/v2.24/profile/config.sqlite new file mode 100644 index 00000000..bfb629b3 Binary files /dev/null and b/scripts/install/foobar2000/v2.24/profile/config.sqlite differ diff --git a/scripts/install/foobar2000/v2.24/profile/theme.fth b/scripts/install/foobar2000/v2.24/profile/theme.fth new file mode 100644 index 00000000..97e11af2 Binary files /dev/null and b/scripts/install/foobar2000/v2.24/profile/theme.fth differ