🐛 Max search item length (#210)

This commit is contained in:
Manuel 2023-08-06 19:37:58 +02:00 committed by GitHub
parent 996a1d0f5d
commit ad14c2c1cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import { Track } from '../shared/Track';
import { JellyfinSearchService } from '../../clients/jellyfin/jellyfin.search.service'; import { JellyfinSearchService } from '../../clients/jellyfin/jellyfin.search.service';
import { SearchHint } from './SearchHint'; import { SearchHint } from './SearchHint';
import { trimStringToFixedLength } from 'src/utils/stringUtils/stringUtils';
export class AlbumSearchHint extends SearchHint { export class AlbumSearchHint extends SearchHint {
override toString(): string { 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( override async toTracks(

View File

@ -5,6 +5,7 @@ import { JellyfinSearchService } from '../../clients/jellyfin/jellyfin.search.se
import { SearchHint } from './SearchHint'; import { SearchHint } from './SearchHint';
import { convertToTracks } from 'src/utils/trackConverter'; import { convertToTracks } from 'src/utils/trackConverter';
import { trimStringToFixedLength } from 'src/utils/stringUtils/stringUtils';
export class PlaylistSearchHint extends SearchHint { export class PlaylistSearchHint extends SearchHint {
override toString(): string { override toString(): string {
@ -20,7 +21,7 @@ export class PlaylistSearchHint extends SearchHint {
return new PlaylistSearchHint( return new PlaylistSearchHint(
hint.Id, hint.Id,
hint.Name, trimStringToFixedLength(hint.Name, 50),
hint.RunTimeTicks / 10000, hint.RunTimeTicks / 10000,
); );
} }

View File

@ -6,6 +6,7 @@ import { z } from 'zod';
import { JellyfinSearchService } from '../../clients/jellyfin/jellyfin.search.service'; import { JellyfinSearchService } from '../../clients/jellyfin/jellyfin.search.service';
import { Track } from '../shared/Track'; import { Track } from '../shared/Track';
import { trimStringToFixedLength } from 'src/utils/stringUtils/stringUtils';
export class SearchHint { export class SearchHint {
constructor( constructor(
@ -45,7 +46,7 @@ export class SearchHint {
return new SearchHint( return new SearchHint(
result.data.Id, result.data.Id,
result.data.Name, trimStringToFixedLength(result.data.Name, 50),
result.data.RunTimeTicks / 10000, result.data.RunTimeTicks / 10000,
); );
} }
@ -58,7 +59,7 @@ export class SearchHint {
} }
return new SearchHint( return new SearchHint(
baseItem.Id, baseItem.Id,
baseItem.Name, trimStringToFixedLength(baseItem.Name, 50),
baseItem.RunTimeTicks / 10000, baseItem.RunTimeTicks / 10000,
); );
} }