Skip to content

Commit

Permalink
fix(jellyfin): Use correct id for tracking first-time seen media
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxMD committed Oct 14, 2024
1 parent e251da9 commit bb13210
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/backend/sources/JellyfinApiSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ export default class JellyfinApiSource extends MemorySource {
DeviceId,
DeviceName,
Client,
Id,
LastActivityDate,
PlayState: {
PositionTicks,
Expand All @@ -323,11 +322,6 @@ export default class JellyfinApiSource extends MemorySource {
const msDeviceId = combinePartsToString([shortDeviceId(DeviceId), DeviceName, Client]);
const playerPosition = PositionTicks !== undefined ? ticksToSeconds(PositionTicks) : undefined; // dayjs.duration(PositionTicks / 1000, 'ms').asSeconds() : undefined;

if(this.config.options.logPayload && !this.mediaIdsSeen.includes(Id)) {
this.logger.debug(`First time seeing media ${Id} on ${msDeviceId} (play position ${playerPosition}) => ${JSON.stringify(NowPlayingItem)}`);
this.mediaIdsSeen.push(Id);
}

let play: PlayObject | undefined;
if(NowPlayingItem !== undefined) {
const sessionPlay = JellyfinApiSource.formatPlayObj(NowPlayingItem);
Expand All @@ -342,6 +336,11 @@ export default class JellyfinApiSource extends MemorySource {
trackProgressPosition: playerPosition
}
}

if(this.config.options.logPayload && !this.mediaIdsSeen.includes(NowPlayingItem.Id)) {
this.logger.debug(`First time seeing media ${NowPlayingItem.Id} on ${msDeviceId} (play position ${playerPosition}) => ${JSON.stringify(NowPlayingItem)}`);
this.mediaIdsSeen.push(NowPlayingItem.Id);
}
}

let reportedStatus = REPORTED_PLAYER_STATUSES.stopped;
Expand Down

0 comments on commit bb13210

Please sign in to comment.