Skip to content

Commit

Permalink
Merge branch 'devel' into v19.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Nov 17, 2024
2 parents 1901eec + 8999bfc commit 5bb790d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 22 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ This is a small maintenance release.

***

## myMPD v18.2.2 (not yet released)

This is a small bug fix release.

### Changelog

- Fix: Parse hh:mm:ss timestamps #1370
- Fix: Pause streams with known duration #1371

***

## myMPD v18.2.1 (2024-11-15)

This is a small bug fix release.
Expand Down
2 changes: 1 addition & 1 deletion contrib/packaging/debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ mympd (19.0.0-1) unstable; urgency=medium

* Release from master

-- Juergen Mang <[email protected]> Sun, 17 Nov 2024 13:11:21 +0100
-- Juergen Mang <[email protected]> Sun, 17 Nov 2024 13:11:01 +0100
5 changes: 1 addition & 4 deletions htdocs/js/clickActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,7 @@ function seekRelative(offset) {
function clickPlay() {
switch(currentState.state) {
case 'play':
if (settings.webuiSettings.footerPlaybackControls === 'stop' ||
isStreamUri(currentSongObj.uri) === true)
{
//always stop streams
if (settings.webuiSettings.footerPlaybackControls === 'stop') {
sendAPI("MYMPD_API_PLAYER_STOP", {}, null, false);
}
else {
Expand Down
6 changes: 3 additions & 3 deletions htdocs/js/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,15 @@ function getMyMPDuri(proto) {

/**
* Parses a string to seconds
* @param {string} value [hh:]mm:ss value to parse
* @param {string} value [hh:][mm:]ss value to parse
* @returns {number} value in seconds
*/
function parseToSeconds(value) {
let match = value.match(/(\d+):(\d+):(\d+)/);
if (match) {
return Number(match[1]) * 60 * 60 +
Number(match[1]) * 60 +
Number(match[2]);
Number(match[2]) * 60 +
Number(match[3]);
}
match = value.match(/(\d+):(\d+)/);
if (match) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/js/version.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const myMPDversion = '19.0.0';
const myMPDbuild = '7dfde8348eba03b177de2595369fafa7f22fc254';
const myMPDbuild = '1901eec73a309801c57453bcce6d3d0c8fea974b';
32 changes: 19 additions & 13 deletions src/mympd_api/mympd_api_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,26 @@ void mympd_api_handler(struct t_mympd_state *mympd_state, struct t_partition_sta
mpd_run_clearerror(partition_state->conn);
response->data = mympd_respond_with_error_or_ok(partition_state, response->data, request->cmd_id, request->id, "mpd_run_clearerror", &rc);
break;
case MYMPD_API_PLAYER_PLAY:
if (mympd_api_status_clear_error(partition_state, &response->data, request->cmd_id, request->id) == false) {
break;
}
mpd_run_play(partition_state->conn);
response->data = mympd_respond_with_error_or_ok(partition_state, response->data, request->cmd_id, request->id, "mpd_run_play", &rc);
break;
case MYMPD_API_PLAYER_PAUSE:
mpd_run_pause(partition_state->conn, true);
response->data = mympd_respond_with_error_or_ok(partition_state, response->data, request->cmd_id, request->id, "mpd_run_pause", &rc);
case MYMPD_API_PLAYER_STOP:
if (request->cmd_id == MYMPD_API_PLAYER_STOP ||
partition_state->song_duration <= 0)
{
// do not pause streams with unknown duration
mpd_run_stop(partition_state->conn);
response->data = mympd_respond_with_error_or_ok(partition_state, response->data, request->cmd_id, request->id, "mpd_run_stop", &rc);
}
else {
mpd_run_pause(partition_state->conn, true);
response->data = mympd_respond_with_error_or_ok(partition_state, response->data, request->cmd_id, request->id, "mpd_run_pause", &rc);
}
break;
case MYMPD_API_PLAYER_RESUME:
if (mympd_api_status_clear_error(partition_state, &response->data, request->cmd_id, request->id) == false) {
Expand All @@ -758,17 +775,6 @@ void mympd_api_handler(struct t_mympd_state *mympd_state, struct t_partition_sta
mpd_run_next(partition_state->conn);
response->data = mympd_respond_with_error_or_ok(partition_state, response->data, request->cmd_id, request->id, "mpd_run_next", &rc);
break;
case MYMPD_API_PLAYER_PLAY:
if (mympd_api_status_clear_error(partition_state, &response->data, request->cmd_id, request->id) == false) {
break;
}
mpd_run_play(partition_state->conn);
response->data = mympd_respond_with_error_or_ok(partition_state, response->data, request->cmd_id, request->id, "mpd_run_play", &rc);
break;
case MYMPD_API_PLAYER_STOP:
mpd_run_stop(partition_state->conn);
response->data = mympd_respond_with_error_or_ok(partition_state, response->data, request->cmd_id, request->id, "mpd_run_stop", &rc);
break;
case MYMPD_API_PLAYER_PLAY_SONG:
if (json_get_uint_max(request->data, "$.params.songId", &uint_buf1, &parse_error) == true) {
mpd_run_play_id(partition_state->conn, uint_buf1);
Expand Down

0 comments on commit 5bb790d

Please sign in to comment.