mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-24 18:41:57 +01:00
🐛 Max search item length (#210)
This commit is contained in:
parent
996a1d0f5d
commit
ad14c2c1cb
@ -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(
|
||||
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user