From ad14c2c1cb34b7680a32a3f5a295245b3a0feeb4 Mon Sep 17 00:00:00 2001 From: Manuel <30572287+manuel-rw@users.noreply.github.com> Date: Sun, 6 Aug 2023 19:37:58 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Max=20search=20item=20length=20(?= =?UTF-8?q?#210)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/search/AlbumSearchHint.ts | 7 ++++++- src/models/search/PlaylistSearchHint.ts | 3 ++- src/models/search/SearchHint.ts | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/models/search/AlbumSearchHint.ts b/src/models/search/AlbumSearchHint.ts index b51a57e..6465185 100644 --- a/src/models/search/AlbumSearchHint.ts +++ b/src/models/search/AlbumSearchHint.ts @@ -4,6 +4,7 @@ import { Track } from '../shared/Track'; import { JellyfinSearchService } from '../../clients/jellyfin/jellyfin.search.service'; import { SearchHint } from './SearchHint'; +import { trimStringToFixedLength } from 'src/utils/stringUtils/stringUtils'; export class AlbumSearchHint extends SearchHint { override toString(): string { @@ -17,7 +18,11 @@ export class AlbumSearchHint extends SearchHint { ); } - return new AlbumSearchHint(hint.Id, hint.Name, hint.RunTimeTicks / 10000); + return new AlbumSearchHint( + hint.Id, + trimStringToFixedLength(hint.Name, 50), + hint.RunTimeTicks / 10000, + ); } override async toTracks( diff --git a/src/models/search/PlaylistSearchHint.ts b/src/models/search/PlaylistSearchHint.ts index b1099f9..519e7d1 100644 --- a/src/models/search/PlaylistSearchHint.ts +++ b/src/models/search/PlaylistSearchHint.ts @@ -5,6 +5,7 @@ import { JellyfinSearchService } from '../../clients/jellyfin/jellyfin.search.se import { SearchHint } from './SearchHint'; import { convertToTracks } from 'src/utils/trackConverter'; +import { trimStringToFixedLength } from 'src/utils/stringUtils/stringUtils'; export class PlaylistSearchHint extends SearchHint { override toString(): string { @@ -20,7 +21,7 @@ export class PlaylistSearchHint extends SearchHint { return new PlaylistSearchHint( hint.Id, - hint.Name, + trimStringToFixedLength(hint.Name, 50), hint.RunTimeTicks / 10000, ); } diff --git a/src/models/search/SearchHint.ts b/src/models/search/SearchHint.ts index 09a382e..64d3fdb 100644 --- a/src/models/search/SearchHint.ts +++ b/src/models/search/SearchHint.ts @@ -6,6 +6,7 @@ import { z } from 'zod'; import { JellyfinSearchService } from '../../clients/jellyfin/jellyfin.search.service'; import { Track } from '../shared/Track'; +import { trimStringToFixedLength } from 'src/utils/stringUtils/stringUtils'; export class SearchHint { constructor( @@ -45,7 +46,7 @@ export class SearchHint { return new SearchHint( result.data.Id, - result.data.Name, + trimStringToFixedLength(result.data.Name, 50), result.data.RunTimeTicks / 10000, ); } @@ -58,7 +59,7 @@ export class SearchHint { } return new SearchHint( baseItem.Id, - baseItem.Name, + trimStringToFixedLength(baseItem.Name, 50), baseItem.RunTimeTicks / 10000, ); }