[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.

fix(plex): Strict comparison of libnrary names #326

* Fixes libraries containing partial allow/disallow names from being able to pass filter
* Fix not checking valid library types

FoxxMD (Jul 14, 2025, 1:43 PM UTC) e64854eb 333f70bd

+15 -6
+6 -6
src/backend/sources/PlexApiSource.ts
··· 232 232 233 233 if(state.play !== undefined) { 234 234 const allowedLibraries = this.getAllowedLibraries(); 235 - if(allowedLibraries.length > 0 && !allowedLibraries.some(x => state.play.meta.library.toLocaleLowerCase().includes(x.name.toLocaleLowerCase()))) { 235 + if(allowedLibraries.length > 0 && !allowedLibraries.some(x => state.play.meta.library.toLocaleLowerCase() === x.name.toLocaleLowerCase())) { 236 236 return `media not included in librariesAllow`; 237 237 } 238 238 239 239 if(allowedLibraries.length === 0) { 240 240 const blockedLibraries = this.getBlockedLibraries(); 241 241 if(blockedLibraries.length > 0) { 242 - const blockedLibrary = blockedLibraries.find(x => state.play.meta.library.toLocaleLowerCase().includes(x.name.toLocaleLowerCase())); 242 + const blockedLibrary = blockedLibraries.find(x => state.play.meta.library.toLocaleLowerCase() === x.name.toLocaleLowerCase()); 243 243 if(blockedLibrary !== undefined) { 244 244 return `media included in librariesBlock '${blockedLibrary.name}'`; 245 245 } 246 246 } 247 - 248 - if(!this.getValidLibraries().some(x => state.play.meta.library === x.name)) { 249 - return `media not included in a valid library`; 250 - } 247 + } 248 + 249 + if(!this.getValidLibraries().some(x => state.play.meta.library === x.name)) { 250 + return `media not included in a valid library`; 251 251 } 252 252 } 253 253
+9
src/backend/tests/plex/plex.test.ts
··· 134 134 135 135 it('Should allow activity based on libraries allow', async function () { 136 136 const s = await createSource({...defaultCreds, librariesAllow: ['music']}); 137 + s.libraries.push({name: 'SomeOtherLibrary', collectionType: 'artist', uuid: '43543'}); 138 + s.libraries.push({name: 'Study Music', collectionType: 'artist', uuid: '435437'}); 139 + s.libraries.push({name: 'Music', collectionType: 'artist', uuid: '4354378'}); 137 140 138 141 expect(s.isActivityValid(validPlayerState, validSession)).to.be.true; 139 142 expect(s.isActivityValid(playWithMeta({library: 'SomeOtherLibrary'}), nowPlayingSession({librarySectionTitle: 'SomeOtherLibrary'}))).to.not.be.true; 143 + expect(s.isActivityValid(playWithMeta({library: 'Study Music'}), nowPlayingSession({librarySectionTitle: 'Study Music'}))).to.not.be.true; 144 + expect(s.isActivityValid(playWithMeta({library: 'Music'}), nowPlayingSession({librarySectionTitle: 'Music'}))).to.be.true; 140 145 await s.destroy(); 141 146 }); 142 147 143 148 it('Should disallow activity based on libraries block', async function () { 144 149 const s = await createSource({...defaultCreds, librariesBlock: ['music']}); 145 150 s.libraries.push({name: 'CoolVideos', collectionType: 'artist', uuid: '43543'}); 151 + s.libraries.push({name: 'Study Music', collectionType: 'artist', uuid: '435437'}); 152 + s.libraries.push({name: 'Music', collectionType: 'artist', uuid: '4354378'}); 146 153 147 154 expect(s.isActivityValid(validPlayerState, validSession)).to.not.be.true; 148 155 expect(s.isActivityValid(playWithMeta({library: 'CoolVideos'}), nowPlayingSession({librarySectionTitle: 'CoolVideos'}))).to.be.true; 156 + expect(s.isActivityValid(playWithMeta({library: 'Study Music'}), nowPlayingSession({librarySectionTitle: 'Study Music'}))).to.be.true; 157 + expect(s.isActivityValid(playWithMeta({library: 'Music'}), nowPlayingSession({librarySectionTitle: 'Music'}))).to.not.be.true; 149 158 await s.destroy(); 150 159 }); 151 160