From ce5fb17722cbc9978eaed2bcf6413b976154cb02 Mon Sep 17 00:00:00 2001 From: Tuukka Ojala Date: Sun, 2 Feb 2025 13:46:24 +0200 Subject: [PATCH 1/3] Add keyboard shortcuts for seeking - Seeks by 5 seconds back / forward - Note: Pressing these shortcuts quickly in succession while transcoding is active will throw an error since the previous request hasn't had time to finish before the next one. This bug also happens with the seek bar so might perhaps be best addressed in a separate pr / commit. --- README.md | 2 ++ docroot/js/mediaplayer.js | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a6dbca37..35cc1679 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ _LMS_ supports lyrics in `lrc` files, `txt` files, and embedded track metadata. * Next track: Ctrl + Right * Decrease volume: Ctrl + Down * Increase volume: Ctrl + Up +* Seek back by 5 seconds: Ctrl + Shift + Left +* Seek forward by 5 seconds: Ctrl + Shift + Right ## Installation diff --git a/docroot/js/mediaplayer.js b/docroot/js/mediaplayer.js index d926c5aa..f1857145 100644 --- a/docroot/js/mediaplayer.js +++ b/docroot/js/mediaplayer.js @@ -18,6 +18,9 @@ Object.freeze(Mode); // How much to increase / decrease volume when adjusting it with keyboard shortcuts const volumeStepAmount = 0.05; +// How much to seek back / forward (in seconds) with keyboard shortcuts +const seekAmount = 5; + LMS.mediaplayer = function () { let _root = {}; let _elems = {}; @@ -245,6 +248,18 @@ LMS.mediaplayer = function () { _updateMediaSessionState(); } + let _seekBack = function() { + let currentPosition = _offset + _elems.audio.currentTime; + let newPosition = currentPosition - seekAmount; + _seekTo(Math.max(newPosition, 0)); + } + + let _seekForward = function() { + let currentPosition = _offset + _elems.audio.currentTime; + let newPosition = currentPosition + seekAmount; + _seekTo(Math.min(newPosition, _duration)); + } + let _updateMediaSessionState = function() { if ("mediaSession" in navigator) { navigator.mediaSession.setPositionState({ @@ -346,11 +361,11 @@ LMS.mediaplayer = function () { _playPause(); handled = true; } - else if (event.ctrlKey && event.keyCode == 37) { + else if (event.ctrlKey && !event.shiftKey && event.keyCode == 37) { _playPrevious(); handled = true; } - else if (event.ctrlKey && event.keyCode == 39) { + else if (event.ctrlKey && !event.shiftKey && event.keyCode == 39) { _playNext(); handled = true; } @@ -362,6 +377,14 @@ LMS.mediaplayer = function () { _stepVolumeUp(); handled = true; } + else if (event.ctrlKey && event.shiftKey && event.keyCode == 37) { + _seekBack(); + handled = true; + } + else if (event.ctrlKey && event.shiftKey && event.keyCode == 39) { + _seekForward(); + handled = true; + } if (handled) event.preventDefault(); From 2e2cf2049a90f3186f7ac377316d5faf748f223d Mon Sep 17 00:00:00 2001 From: emeric Date: Mon, 27 Jan 2025 08:39:49 +0100 Subject: [PATCH 2/3] Added explicitStatus in docs --- SUBSONIC.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SUBSONIC.md b/SUBSONIC.md index 9948280e..0ef54e21 100644 --- a/SUBSONIC.md +++ b/SUBSONIC.md @@ -25,6 +25,7 @@ The following extra fields are implemented: * `artists` * `discTitles`: discs with no subtitle are omitted * `displayArtist` + * `explicitStatus` * `genres` * `isCompilation` * `played` @@ -44,6 +45,7 @@ The following extra fields are implemented: * `contributors` * `displayAlbumArtist` * `displayArtist` + * `explicitStatus` * `genres` * `mediaType` * `moods` From fdea16adb61fe10510a862ee6e13d6baaa6640d6 Mon Sep 17 00:00:00 2001 From: emeric Date: Sun, 2 Feb 2025 14:11:49 +0100 Subject: [PATCH 3/3] Removed useless dependency --- Dockerfile-release | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile-release b/Dockerfile-release index 1574ca2f..2b11fed7 100644 --- a/Dockerfile-release +++ b/Dockerfile-release @@ -80,7 +80,7 @@ RUN \ make distclean # WT -ARG WT_VERSION=4.11.1 +ARG WT_VERSION=4.11.2 RUN \ DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \ curl -sLO https://github.com/emweb/wt/archive/${WT_VERSION}.tar.gz && \ @@ -88,7 +88,7 @@ RUN \ RUN \ DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \ - cmake -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE -DSHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DBUILD_EXAMPLES=OFF -DENABLE_LIBWTTEST=OFF -DCONNECTOR_FCGI=OFF -DUSE_SYSTEM_SQLITE3=ON && \ + cmake -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE -DCMAKE_CXX_STANDARD=17 -DSHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DBUILD_EXAMPLES=OFF -DENABLE_LIBWTTEST=OFF -DCONNECTOR_FCGI=OFF -DUSE_SYSTEM_SQLITE3=ON && \ make -j$(nproc) && \ make install @@ -164,7 +164,6 @@ ARG RUNTIME_PACKAGES=" \ boost-filesystem \ boost-iostreams \ boost-program_options \ - boost-system \ boost-thread \ libarchive \ libconfig++ \