Skip to content

Commit 27a2ce9

Browse files
authored
10.10 (#296)
1 parent 3d36010 commit 27a2ce9

File tree

4 files changed

+51
-6
lines changed

4 files changed

+51
-6
lines changed

Jellyfin.Plugin.Webhook/Helpers/DataObjectHelpers.cs

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,60 @@ public static Dictionary<string, object> AddUserData(this Dictionary<string, obj
326326
/// <returns>The modified data object.</returns>
327327
public static Dictionary<string, object> AddSessionInfoData(this Dictionary<string, object> dataObject, SessionInfo sessionInfo)
328328
{
329-
dataObject[nameof(sessionInfo.Id)] = sessionInfo.Id;
329+
if (!string.IsNullOrEmpty(sessionInfo.Id))
330+
{
331+
dataObject[nameof(sessionInfo.Id)] = sessionInfo.Id;
332+
}
333+
330334
dataObject[nameof(sessionInfo.UserId)] = sessionInfo.UserId;
331335
dataObject["NotificationUsername"] = sessionInfo.UserName.Escape();
332336
dataObject[nameof(sessionInfo.Client)] = sessionInfo.Client.Escape();
333337
dataObject[nameof(sessionInfo.LastActivityDate)] = sessionInfo.LastActivityDate;
334338
dataObject[nameof(sessionInfo.LastPlaybackCheckIn)] = sessionInfo.LastPlaybackCheckIn;
335339
dataObject[nameof(sessionInfo.DeviceName)] = sessionInfo.DeviceName.Escape();
336-
dataObject[nameof(sessionInfo.DeviceId)] = sessionInfo.DeviceId;
337-
dataObject[nameof(sessionInfo.RemoteEndPoint)] = sessionInfo.RemoteEndPoint;
340+
341+
if (!string.IsNullOrEmpty(sessionInfo.DeviceId))
342+
{
343+
dataObject[nameof(sessionInfo.DeviceId)] = sessionInfo.DeviceId;
344+
}
345+
346+
if (!string.IsNullOrEmpty(sessionInfo.RemoteEndPoint))
347+
{
348+
dataObject[nameof(sessionInfo.RemoteEndPoint)] = sessionInfo.RemoteEndPoint;
349+
}
350+
351+
return dataObject;
352+
}
353+
354+
/// <summary>
355+
/// Add session info data.
356+
/// </summary>
357+
/// <param name="dataObject">The data object.</param>
358+
/// <param name="sessionInfo">The session info to add.</param>
359+
/// <returns>The modified data object.</returns>
360+
public static Dictionary<string, object> AddSessionInfoData(this Dictionary<string, object> dataObject, SessionInfoDto sessionInfo)
361+
{
362+
if (!string.IsNullOrEmpty(sessionInfo.Id))
363+
{
364+
dataObject[nameof(sessionInfo.Id)] = sessionInfo.Id;
365+
}
366+
367+
dataObject[nameof(sessionInfo.UserId)] = sessionInfo.UserId;
368+
dataObject["NotificationUsername"] = sessionInfo.UserName.Escape();
369+
dataObject[nameof(sessionInfo.Client)] = sessionInfo.Client.Escape();
370+
dataObject[nameof(sessionInfo.LastActivityDate)] = sessionInfo.LastActivityDate;
371+
dataObject[nameof(sessionInfo.LastPlaybackCheckIn)] = sessionInfo.LastPlaybackCheckIn;
372+
dataObject[nameof(sessionInfo.DeviceName)] = sessionInfo.DeviceName.Escape();
373+
374+
if (!string.IsNullOrEmpty(sessionInfo.DeviceId))
375+
{
376+
dataObject[nameof(sessionInfo.DeviceId)] = sessionInfo.DeviceId;
377+
}
378+
379+
if (!string.IsNullOrEmpty(sessionInfo.RemoteEndPoint))
380+
{
381+
dataObject[nameof(sessionInfo.RemoteEndPoint)] = sessionInfo.RemoteEndPoint;
382+
}
338383

339384
return dataObject;
340385
}

Jellyfin.Plugin.Webhook/Notifiers/ItemDeletedNotifier/IItemDeletedManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ public interface IItemDeletedManager
1919
/// </summary>
2020
/// <param name="item">The deleted item.</param>
2121
public void AddItem(BaseItem item);
22-
}
22+
}

Jellyfin.Plugin.Webhook/Notifiers/ItemDeletedNotifier/ItemDeletedNotifierEntryPoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ public Task StopAsync(CancellationToken cancellationToken)
5050
_libraryManager.ItemRemoved -= ItemDeletedHandler;
5151
return Task.CompletedTask;
5252
}
53-
}
53+
}

Jellyfin.Plugin.Webhook/Notifiers/ItemDeletedNotifier/ItemDeletedScheduledTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
6868
}
6969
};
7070
}
71-
}
71+
}

0 commit comments

Comments
 (0)