From eb02d95672914d7e08b7e4e33bed363b2a636d1d Mon Sep 17 00:00:00 2001 From: lachlan Date: Mon, 28 Aug 2023 17:11:48 +1000 Subject: [PATCH 1/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d584b961cd..6b21011f57 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ## News -Ampache6 is about to shake up the develop branch. Keep track using the [wiki](https://github.com/ampache/ampache/wiki/ampache6-details) +Ampache6 is [HERE!](https://github.com/ampache/ampache/releases/tag/6.0.0) ## Basics From 4959236339f6737af9e039c776fd7717135d704b Mon Sep 17 00:00:00 2001 From: lachlan Date: Mon, 28 Aug 2023 17:13:19 +1000 Subject: [PATCH 2/9] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b21011f57..e44bab5bfe 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,12 @@ presents an already organised collection in a useful way. It assumes that you know best how to manage your files and are capable of choosing a suitable method for doing so. -* Check out [Ampache 5 for Admins](https://github.com/ampache/ampache/wiki/Ampache-Next-Changes) -* As well as [Ampache 5 for Users](https://github.com/ampache/ampache/wiki/Ampache-5-for-users) +* Check out [Ampache 6 for Admins](https://github.com/ampache/ampache/wiki/ampache6-details) +* As well as [Ampache 6 for Users](https://github.com/ampache/ampache/wiki/ampache6-for-users) ## Recommended Version -The recommended and most stable version is the current stable [release5 branch](https://github.com/ampache/ampache/archive/release5.tar.gz). +The recommended and most stable version is the current stable [release6 branch](https://github.com/ampache/ampache/archive/release6.tar.gz). You get the latest version with recent changes and fixes but maybe in an unstable state from our [develop branch](https://github.com/ampache/ampache/archive/develop.tar.gz). [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ampache/ampache/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/ampache/ampache/?branch=develop) @@ -56,7 +56,7 @@ Please see [the wiki](https://github.com/ampache/ampache/wiki/Installation) and * PHP 8.1 (Ampache 5.5.0 and higher) * PHP 8.2 (Ampache 6.0.0 and higher) -**NOTE** That php7.4 will not be released for Ampache6 but can still be used. +**NOTE** That php7.4 will not be supported for Ampache6 but can still be used. * PHP modules: * PDO From 045da505594aa3daf124fa1b26412ce3f2172175 Mon Sep 17 00:00:00 2001 From: Nizhile <11645217+Nizhile@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:25:19 +0200 Subject: [PATCH 3/9] Avoid OGG ABR bitrate mode to be updated to VBR * During Catalog Check, bit rate mode for ogg ABR file must not be updated to VBR --- src/Repository/Model/Catalog.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Repository/Model/Catalog.php b/src/Repository/Model/Catalog.php index f779eedca3..74ebbfc736 100644 --- a/src/Repository/Model/Catalog.php +++ b/src/Repository/Model/Catalog.php @@ -2536,7 +2536,7 @@ public static function update_song_from_tags($results, Song $song) $new_song->title = self::check_length(self::check_title($results['title'], $new_song->file)); $new_song->bitrate = $results['bitrate']; $new_song->rate = $results['rate']; - $new_song->mode = ($results['mode'] == 'cbr') ? 'cbr' : 'vbr'; + $new_song->mode = (in_array($results['mode'], ['vbr', 'cbr', 'abr'])) ? $results['mode'] : 'vbr'; $new_song->channels = $results['channels']; $new_song->size = $results['size']; $new_song->time = (strlen((string)$results['time']) > 5) @@ -2973,7 +2973,7 @@ public static function update_podcast_episode_from_tags($results, Podcast_Episod $podcast_episode->time = $results['time']; $podcast_episode->bitrate = $results['bitrate']; $podcast_episode->rate = $results['rate']; - $podcast_episode->mode = ($results['mode'] == 'cbr') ? 'cbr' : 'vbr'; + $podcast_episode->mode = (in_array($results['mode'], ['vbr', 'cbr', 'abr'])) ? $results['mode'] : 'vbr'; $podcast_episode->channels = $results['channels']; $array = array(); From ba52aacf099f368918cd27c89423797e01995968 Mon Sep 17 00:00:00 2001 From: lachlan Date: Tue, 29 Aug 2023 08:50:36 +1000 Subject: [PATCH 4/9] User & SystemPreference JSON this shouldn't have an array --- src/Module/Api/Method/SystemPreferenceMethod.php | 2 +- src/Module/Api/Method/UserPreferenceMethod.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Module/Api/Method/SystemPreferenceMethod.php b/src/Module/Api/Method/SystemPreferenceMethod.php index 43d5beff1f..96a1f5d590 100644 --- a/src/Module/Api/Method/SystemPreferenceMethod.php +++ b/src/Module/Api/Method/SystemPreferenceMethod.php @@ -66,7 +66,7 @@ public static function system_preference(array $input, User $user): bool } switch ($input['api_format']) { case 'json': - echo json_encode($results, JSON_PRETTY_PRINT); + echo json_encode($results[0], JSON_PRETTY_PRINT); break; default: echo Xml_Data::object_array($results, 'preference'); diff --git a/src/Module/Api/Method/UserPreferenceMethod.php b/src/Module/Api/Method/UserPreferenceMethod.php index 852a7f6d2e..2fa3df1cd9 100644 --- a/src/Module/Api/Method/UserPreferenceMethod.php +++ b/src/Module/Api/Method/UserPreferenceMethod.php @@ -64,7 +64,7 @@ public static function user_preference(array $input, User $user): bool } switch ($input['api_format']) { case 'json': - echo json_encode($results, JSON_PRETTY_PRINT); + echo json_encode($results[0], JSON_PRETTY_PRINT); break; default: echo Xml_Data::object_array($results, 'preference'); From 96a64f98fe7771de9df0a68619b2d3c3779f18ae Mon Sep 17 00:00:00 2001 From: lachlan Date: Tue, 29 Aug 2023 09:02:47 +1000 Subject: [PATCH 5/9] pref create and edit returning array too --- src/Module/Api/Method/PreferenceCreateMethod.php | 2 +- src/Module/Api/Method/PreferenceEditMethod.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Module/Api/Method/PreferenceCreateMethod.php b/src/Module/Api/Method/PreferenceCreateMethod.php index f360db9c09..e0153c36c1 100644 --- a/src/Module/Api/Method/PreferenceCreateMethod.php +++ b/src/Module/Api/Method/PreferenceCreateMethod.php @@ -101,7 +101,7 @@ public static function preference_create(array $input, User $user): bool } switch ($input['api_format']) { case 'json': - echo json_encode($results, JSON_PRETTY_PRINT); + echo json_encode($results[0], JSON_PRETTY_PRINT); break; default: echo Xml_Data::object_array($results, 'preference'); diff --git a/src/Module/Api/Method/PreferenceEditMethod.php b/src/Module/Api/Method/PreferenceEditMethod.php index ee51431bac..98d21d804e 100644 --- a/src/Module/Api/Method/PreferenceEditMethod.php +++ b/src/Module/Api/Method/PreferenceEditMethod.php @@ -78,14 +78,13 @@ public static function preference_edit(array $input, User $user): bool return false; } - $preference = Preference::get($pref_name, $user->id); - $output_array = array('preference' => $preference); + $results = Preference::get($pref_name, $user->id); switch ($input['api_format']) { case 'json': - echo json_encode($output_array, JSON_PRETTY_PRINT); + echo json_encode($results[0], JSON_PRETTY_PRINT); break; default: - echo Xml_Data::object_array($output_array['preference'], 'preference'); + echo Xml_Data::object_array($results, 'preference'); } return true; From 4e380120a214528ada6090b149c77ed49fd0cc88 Mon Sep 17 00:00:00 2001 From: lachlan Date: Tue, 29 Aug 2023 10:49:59 +1000 Subject: [PATCH 6/9] Update GetSimilarMethod.php get songs for get_similar --- src/Module/Api/Method/GetSimilarMethod.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Module/Api/Method/GetSimilarMethod.php b/src/Module/Api/Method/GetSimilarMethod.php index 2fd76feec6..7371c7d5d3 100644 --- a/src/Module/Api/Method/GetSimilarMethod.php +++ b/src/Module/Api/Method/GetSimilarMethod.php @@ -90,12 +90,24 @@ public static function get_similar(array $input, User $user): bool case 'json': Json_Data::set_offset($input['offset'] ?? 0); Json_Data::set_limit($input['limit'] ?? 0); - echo Json_Data::indexes($results, $type, $user); + switch ($type) { + case 'artist': + echo Json_Data::artists($results, array(), $user); + break; + case 'song': + echo Json_Data::songs($results, $user); + } break; default: Xml_Data::set_offset($input['offset'] ?? 0); Xml_Data::set_limit($input['limit'] ?? 0); - echo Xml_Data::indexes($results, $type, $user); + switch ($type) { + case 'artist': + echo Xml_Data::artists($results, array(), $user); + break; + case 'song': + echo Xml_Data::songs($results, $user); + } } return true; From 9cf549b2a879376189339a7c661072cfcf87049a Mon Sep 17 00:00:00 2001 From: lachlan Date: Tue, 29 Aug 2023 11:01:40 +1000 Subject: [PATCH 7/9] regex check for duplicate ports and use the second one should stop people getting double ports eg.com:443:443 --- src/Module/Playback/Stream.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Module/Playback/Stream.php b/src/Module/Playback/Stream.php index 482970138b..ebb83f882c 100644 --- a/src/Module/Playback/Stream.php +++ b/src/Module/Playback/Stream.php @@ -761,6 +761,8 @@ public static function get_base_url($local = false, $streamToken = null) $web_path = str_replace(AmpConfig::get('http_host'), AmpConfig::get('http_host') . ':' . $http_port, (string)$web_path); } } + // check for dupe ports + $web_path = preg_replace('/(^.*?):([0-9]+)(:.*)?$/', '$1$3', $web_path); return $web_path . $base_url; } // get_base_url From d2aa04084566e473b051f8f3d3100d43660cb9a8 Mon Sep 17 00:00:00 2001 From: lachlan Date: Tue, 29 Aug 2023 11:03:38 +1000 Subject: [PATCH 8/9] put an if on it --- src/Module/Playback/Stream.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Module/Playback/Stream.php b/src/Module/Playback/Stream.php index ebb83f882c..2a23b4ab36 100644 --- a/src/Module/Playback/Stream.php +++ b/src/Module/Playback/Stream.php @@ -762,7 +762,9 @@ public static function get_base_url($local = false, $streamToken = null) } } // check for dupe ports - $web_path = preg_replace('/(^.*?):([0-9]+)(:.*)?$/', '$1$3', $web_path); + if (substr_count($web_path, ':') === 2) { + $web_path = preg_replace('/(^.*?):([0-9]+)(:.*)?$/', '$1$3', $web_path); + } return $web_path . $base_url; } // get_base_url From db9ccb5d5717cefecba7b98d746588498c990acf Mon Sep 17 00:00:00 2001 From: lachlan Date: Tue, 29 Aug 2023 11:14:02 +1000 Subject: [PATCH 9/9] prep for first bugfix --- docs/CHANGELOG.md | 22 +++++++++++++++++++ .../Init/InitializationHandlerConfig.php | 2 +- src/Module/Api/Api.php | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0f68bdf782..3de17082e8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,27 @@ # CHANGELOG +## Ampache 6.0.1 + +### Fixed + +* Check for duplicate ports in stream URL's +* Songs and podcast_episodes with ABR being overwritten with VBR + +## API 6.0.1 + +### Changed + +* API6 XML + * get_similar: return song objects to match json + +### Fixed + +* API6 + * user_preference: returned array instead of object + * system_preference: returned array instead of object + * preference_create: returned array instead of object + * preference_edit: returned array instead of object + ## Ampache 6.0.0 **NOTE** For database update 600005; please consider using the CLI update command (`php bin/cli admin:updateDatabase -e`) diff --git a/src/Config/Init/InitializationHandlerConfig.php b/src/Config/Init/InitializationHandlerConfig.php index 345f580839..35680ac32a 100644 --- a/src/Config/Init/InitializationHandlerConfig.php +++ b/src/Config/Init/InitializationHandlerConfig.php @@ -32,7 +32,7 @@ final class InitializationHandlerConfig implements InitializationHandlerInterface { - private const VERSION = '6.0.0'; // AMPACHE_VERSION + private const VERSION = '6.0.1'; // AMPACHE_VERSION private const CONFIG_VERSION = '67'; private const STRUCTURE = 'public'; // Project release is using either the public html folder or squashed structure diff --git a/src/Module/Api/Api.php b/src/Module/Api/Api.php index 50bd8deebd..4409a6b4b4 100644 --- a/src/Module/Api/Api.php +++ b/src/Module/Api/Api.php @@ -172,12 +172,12 @@ class Api /** * @var string $version */ - public static $version = '6.0.0'; // AMPACHE_VERSION + public static $version = '6.0.1'; // AMPACHE_VERSION /** * @var string $version_numeric */ - public static $version_numeric = '600000'; // AMPACHE_VERSION + public static $version_numeric = '601000'; // AMPACHE_VERSION /** * @var Browse $browse