mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-08-11 09:13:54 -04:00
Fix OnPlaybackStopped task erroring out (#13226)
This commit is contained in:
parent
aabaf1a656
commit
350983e03c
@ -782,9 +782,13 @@ namespace Emby.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
ArgumentException.ThrowIfNullOrEmpty(id);
|
ArgumentException.ThrowIfNullOrEmpty(id);
|
||||||
|
|
||||||
// TODO probably shouldn't throw here but it is kept for "backwards compatibility"
|
var info = GetLiveStreamInfo(id);
|
||||||
var info = GetLiveStreamInfo(id) ?? throw new ResourceNotFoundException();
|
if (info is null)
|
||||||
return Task.FromResult(new Tuple<MediaSourceInfo, IDirectStreamProvider>(info.MediaSource, info as IDirectStreamProvider));
|
{
|
||||||
|
return Task.FromResult<Tuple<MediaSourceInfo, IDirectStreamProvider>>(new Tuple<MediaSourceInfo, IDirectStreamProvider>(null, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.FromResult<Tuple<MediaSourceInfo, IDirectStreamProvider>>(new Tuple<MediaSourceInfo, IDirectStreamProvider>(info.MediaSource, info as IDirectStreamProvider));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILiveStream GetLiveStreamInfo(string id)
|
public ILiveStream GetLiveStreamInfo(string id)
|
||||||
|
@ -343,6 +343,11 @@ namespace Emby.Server.Implementations.Session
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task UpdateNowPlayingItem(SessionInfo session, PlaybackProgressInfo info, BaseItem libraryItem, bool updateLastCheckInTime)
|
private async Task UpdateNowPlayingItem(SessionInfo session, PlaybackProgressInfo info, BaseItem libraryItem, bool updateLastCheckInTime)
|
||||||
{
|
{
|
||||||
|
if (session is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(info.MediaSourceId))
|
if (string.IsNullOrEmpty(info.MediaSourceId))
|
||||||
{
|
{
|
||||||
info.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);
|
info.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);
|
||||||
@ -675,6 +680,11 @@ namespace Emby.Server.Implementations.Session
|
|||||||
|
|
||||||
private BaseItem GetNowPlayingItem(SessionInfo session, Guid itemId)
|
private BaseItem GetNowPlayingItem(SessionInfo session, Guid itemId)
|
||||||
{
|
{
|
||||||
|
if (session is null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var item = session.FullNowPlayingItem;
|
var item = session.FullNowPlayingItem;
|
||||||
if (item is not null && item.Id.Equals(itemId))
|
if (item is not null && item.Id.Equals(itemId))
|
||||||
{
|
{
|
||||||
@ -794,7 +804,11 @@ namespace Emby.Server.Implementations.Session
|
|||||||
|
|
||||||
ArgumentNullException.ThrowIfNull(info);
|
ArgumentNullException.ThrowIfNull(info);
|
||||||
|
|
||||||
var session = GetSession(info.SessionId);
|
var session = GetSession(info.SessionId, false);
|
||||||
|
if (session is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var libraryItem = info.ItemId.IsEmpty()
|
var libraryItem = info.ItemId.IsEmpty()
|
||||||
? null
|
? null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user