From 434ee94548f7fc4902fee2796b65eda07754724c Mon Sep 17 00:00:00 2001
From: Jim Mason
Date: Mon, 8 Jan 2024 15:34:29 +0000
Subject: [PATCH 01/11] updated to prevent special handling of '??' in playlist
editor entry
See http://bugs.jquery.com/ticket/12326/
fixes #429
---
js/playlists.track.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/js/playlists.track.js b/js/playlists.track.js
index 2af34f4f..f9b59b96 100644
--- a/js/playlists.track.js
+++ b/js/playlists.track.js
@@ -523,7 +523,8 @@ $().ready(function(){
type: "POST",
// use API v1.1 or later for correct auto timestamp semantics
url: "api/v1.1/playlist/" + playlistId + "/events",
- dataType : 'json',
+ dataType: 'json',
+ contentType: "application/json; charset=utf-8",
accept: "application/json; charset=utf-8",
data: JSON.stringify(postData),
success: function(respObj) {
@@ -891,6 +892,7 @@ $().ready(function(){
$.ajax({
dataType : 'json',
type: 'PATCH',
+ contentType: "application/json; charset=utf-8",
accept: "application/json; charset=utf-8",
url: "api/v1/playlist/" + playlistId + "/events",
data: JSON.stringify(postData),
From 8e5cfbb9f2348eab277cc71d7ca27c6f1000ebd1 Mon Sep 17 00:00:00 2001
From: Jim Mason
Date: Tue, 9 Jan 2024 14:24:36 +0000
Subject: [PATCH 02/11] rewrote procedural array iteration (non-semantic
change)
---
ui/UICommon.php | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/ui/UICommon.php b/ui/UICommon.php
index 15fb941e..f47d502a 100644
--- a/ui/UICommon.php
+++ b/ui/UICommon.php
@@ -3,7 +3,7 @@
* Zookeeper Online
*
* @author Jim Mason
- * @copyright Copyright (C) 1997-2023 Jim Mason
+ * @copyright Copyright (C) 1997-2024 Jim Mason
* @link https://zookeeper.ibinx.com/
* @license GPL-3.0
*
@@ -288,12 +288,12 @@ public static function deLatin1ify($string,
* @return best available locale from the header
*/
public static function acceptFromHttp($header) {
- $locales = [];
- foreach(explode(',', $header) as $locale) {
- $parts = explode(';', $locale);
- $weight = count($parts) == 2 ? explode('=', $parts[1])[1] : 1;
- $locales[] = [ $parts[0], $weight ];
- }
+ $locales = array_map(function($locale) {
+ // parse /(.+)(;.+=(.+))?/
+ $lang = strtok($locale, ';');
+ $weight = strtok('=') ? (strtok('') ?: 1) : 1;
+ return [ $lang, $weight ];
+ }, explode(',', $header));
usort($locales, function($a, $b) {
return $b[1] <=> $a[1];
From 2d996334f5ebc05a4d460d9e803f55f2114f4a42 Mon Sep 17 00:00:00 2001
From: Jim Mason
Date: Mon, 15 Jan 2024 14:41:30 +0000
Subject: [PATCH 03/11] suppress 'Post Review to Slack' option if Slack is not
configured
---
ui/Reviews.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/ui/Reviews.php b/ui/Reviews.php
index c0ce23bd..fb492198 100644
--- a/ui/Reviews.php
+++ b/ui/Reviews.php
@@ -3,7 +3,7 @@
* Zookeeper Online
*
* @author Jim Mason
- * @copyright Copyright (C) 1997-2023 Jim Mason
+ * @copyright Copyright (C) 1997-2024 Jim Mason
* @link https://zookeeper.ibinx.com/
* @license GPL-3.0
*
@@ -443,6 +443,9 @@ public function editReview() {
$airnames[] = $row['airname'];
$airnames[] = $self;
+ $slack = Engine::param('slack');
+ $export = $slack && $slack['token'] && $slack['review_channel'];
+
$this->template = "review.edit.html";
$this->addVar("id", $id ?? 0);
$this->addVar("album", $albums[0]);
@@ -452,7 +455,7 @@ public function editReview() {
$this->addVar("self", $self);
$this->addVar("review", $review);
$this->addVar("private", $_REQUEST["private"] ?? 0);
- $this->addVar("exported", isset($exportid));
+ $this->addVar("exported", !$export || isset($exportid));
$this->addVar("MAX_AIRNAME_LENGTH", IDJ::MAX_AIRNAME_LENGTH);
$this->addVar("MAX_REVIEW_LENGTH", IReview::MAX_REVIEW_LENGTH);
}
From 8dddc909758517e08a370545b7496431cc5957e7 Mon Sep 17 00:00:00 2001
From: Jim Mason
Date: Mon, 15 Jan 2024 15:05:09 +0000
Subject: [PATCH 04/11] added logo block to topnav
---
ui/templates/default/topnav.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ui/templates/default/topnav.html b/ui/templates/default/topnav.html
index bd5104c3..afa02c6a 100644
--- a/ui/templates/default/topnav.html
+++ b/ui/templates/default/topnav.html
@@ -24,7 +24,9 @@
+{% block logo %}
{{ app.station_title }}
+{% endblock %}
No Discogs tracks for
- with media type
- found.
-
If you believe the album is in Discogs, please check that you
- have specified the correct media type.
+ found.
Artist" : "";
From 47f4339267d5ce3c96c0d68873128caa71db1918 Mon Sep 17 00:00:00 2001
From: Jim Mason
Date: Mon, 12 Feb 2024 22:35:57 +0000
Subject: [PATCH 11/11] finessed previous revision to preference exact match
only if not Promo or Special Edition
---
ui/Editor.php | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/ui/Editor.php b/ui/Editor.php
index 7ae2f5ea..aa68da85 100644
--- a/ui/Editor.php
+++ b/ui/Editor.php
@@ -274,10 +274,9 @@ private function prefillTracks() {
if($json->results && ($result = $json->results[0])) {
foreach($json->results as $r) {
// exact medium match is definitive
- // use if current best is Promo or Limited/Special Edition
+ // if not Promo or Limited/Special Edition
if(in_array($format, $r->format) &&
- (!in_array($format, $result->format) ||
- self::isSpecialEdition($result->format))) {
+ !self::isSpecialEdition($r->format)) {
$result = $r;
break;
}