[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: Update string normalization with granular options

FoxxMD (Jul 16, 2026, 3:49 PM UTC) 3e82e035 e804ce33

+37 -7
+37 -7
src/backend/utils/StringUtils.ts
··· 23 23 } 24 24 return acc; 25 25 }, []) 26 - // https://stackoverflow.com/a/37511463/1469797 27 - export const normalizeStr = (str: string, options?: {keepSingleWhitespace?: boolean}): string => { 28 - const {keepSingleWhitespace = false} = options || {}; 29 - const normal = str.normalize('NFD').replace(/[\u0300-\u036f]/g, ""); 30 - if(!keepSingleWhitespace) { 31 - return normal.replace(SYMBOLS_WHITESPACE_REGEX, '').toLocaleLowerCase(); 26 + export interface StringNormalizationOptions { 27 + keepSingleWhitespace?: boolean 28 + removeWhitespace?: boolean 29 + charCase?: 'lower' | 'upper' | false 30 + removeSymbols?: boolean 31 + normalizeUnicode?: boolean 32 + removeDiacritics?: boolean 33 + } 34 + export const normalizeStr = (str: string, options: StringNormalizationOptions = {}): string => { 35 + const { 36 + keepSingleWhitespace = false, 37 + removeWhitespace = true, 38 + charCase = 'lower', 39 + normalizeUnicode = true, 40 + removeSymbols = true, 41 + removeDiacritics = true 42 + } = options 43 + let normal: string = str; 44 + 45 + // https://stackoverflow.com/a/37511463/1469797 46 + if(normalizeUnicode) { 47 + normal = normal.normalize('NFD'); 32 48 } 33 - return normal.replace(SYMBOLS_REGEX, '').replace(MULTI_WHITESPACE_REGEX, ' ').toLocaleLowerCase().trim(); 49 + // https://stackoverflow.com/a/37511463/1469797 50 + if(removeDiacritics) { 51 + normal = normal.replace(/[\u0300-\u036f]/g, ""); 52 + } 53 + if(removeSymbols) { 54 + normal = normal.replace(SYMBOLS_REGEX, ''); 55 + } 56 + if(removeWhitespace) { 57 + normal = keepSingleWhitespace ? normal.replace(MULTI_WHITESPACE_REGEX, ' ') : normal.replace(/\s/g, '') 58 + } 59 + if(charCase !== false) { 60 + normal = charCase === 'lower' ? normal.toLocaleLowerCase() : normal.toLocaleUpperCase() 61 + } 62 + 63 + return normal.trim(); 34 64 } 35 65 36 66 export interface PlayCredits {