From 4cf80298effde2fc96792146bcb6c3f8aeb0258f Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Fri, 4 Apr 2025 16:37:53 -0700 Subject: [PATCH] fix(artist-import.php): parse dates that are not simply YYYY --- api/artist-import.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/artist-import.php b/api/artist-import.php index f019edb..b3141a5 100644 --- a/api/artist-import.php +++ b/api/artist-import.php @@ -144,7 +144,13 @@ class ArtistImportHandler extends ApiHandler foreach ($navidromeAlbums as $album) { $albumName = $album["name"]; - $releaseYear = $album["date"]; + $releaseYearRaw = $album["date"] ?? null; + $releaseYear = null; + + if ($releaseYearRaw) { + if (preg_match('/^\d{4}/', $releaseYearRaw, $matches)) $releaseYear = (int)$matches[0]; + } + $artistKey = sanitizeMediaString($artistName); $albumKey = $artistKey . "-" . sanitizeMediaString($albumName);