Skip to content

Commit aa95604

Browse files
committed
Use splat args for media identification on plex/tautulli debug
1 parent f981f9e commit aa95604

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

sources/PlexSource.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,28 @@ export default class PlexSource {
5959
}
6060

6161
isValidEvent = (playObj) => {
62-
const {meta: {mediaType, title, event, user}} = playObj;
62+
const {
63+
meta: {
64+
mediaType, event, user
65+
},
66+
data: {
67+
artist,
68+
track,
69+
} = {}
70+
} = playObj;
6371

6472
if (this.users !== undefined && user !== undefined && !this.users.includes(user)) {
65-
this.logger.debug(`Will not scrobble webhook event because author was not an allowed user: ${user}`)
73+
this.logger.debug(`Will not scrobble webhook event because author was not an allowed user: ${user}`, artist, track)
6674
return false;
6775
}
6876

6977
if (event !== 'media.scrobble') {
70-
this.logger.debug(`Will not scrobble webhook event because it is not media.scrobble (${event})`)
78+
this.logger.debug(`Will not scrobble webhook event because it is not media.scrobble (${event})`, artist, track)
7179
return false;
7280
}
7381

7482
if (mediaType !== 'track') {
75-
this.logger.debug(`Will not scrobble webhook event because media type was not a track (${mediaType}). Item: ${title}`);
83+
this.logger.debug(`Will not scrobble webhook event because media type was not a track (${mediaType})`, artist, track);
7684
return false;
7785
}
7886

sources/TautulliSource.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,22 @@ export default class TautulliSource extends PlexSource {
4343
}
4444

4545
isValidEvent = (playObj) => {
46-
const {meta: {mediaType, title, user}} = playObj;
46+
const {
47+
meta: {
48+
mediaType, user
49+
},
50+
data: {
51+
artist,
52+
track,
53+
} = {}
54+
} = playObj;
4755

4856
if (this.users !== undefined && user !== undefined && !this.users.includes(user)) {
49-
this.logger.debug(`Will not scrobble webhook event because author was not an allowed user: ${user}`)
57+
this.logger.debug(`Will not scrobble webhook event because author was not an allowed user: ${user}`, artist, track)
5058
return false;
5159
}
5260
if (mediaType !== 'track') {
53-
this.logger.debug(`Will not scrobble webhook event because media type was not a track (${mediaType}). Item: ${title}`);
61+
this.logger.debug(`Will not scrobble webhook event because media type was not a track (${mediaType})`, artist, track);
5462
return false;
5563
}
5664
return true;

0 commit comments

Comments
 (0)