TV Series playback from episode list does not require mediaSourceId
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -247,6 +247,10 @@ sealed class CinemaMediaSourceManager : IMediaSourceManager
|
||||
// We need to directly inspect the video file and therefore need to know which
|
||||
// version to specifically return. For free accounts it is not possible to just
|
||||
// read files at random, for VIP accounts that would slow playback startup also.
|
||||
// Warning: We assume GetVideoVersionsEnumerate keeps the order between its input and output collections
|
||||
Video? videoVer;
|
||||
int idxVer;
|
||||
if (!sortByPrefs) {
|
||||
Guid mediaSourceId;
|
||||
if (ctx == null
|
||||
|| !ctx.Items.TryGetValue(ContextItemsMediaSourceIdKey, out object? mediaSourceIdO)
|
||||
@@ -254,18 +258,17 @@ sealed class CinemaMediaSourceManager : IMediaSourceManager
|
||||
|| (!Guid.TryParse(mediaSourceIdS, out mediaSourceId)))
|
||||
throw new InvalidOperationException("For precise stream indexing knowing mediaSourceId is required.");
|
||||
|
||||
// Warning: We assume GetVideoVersionsEnumerate keeps the order between its input and output collections
|
||||
int idxVer = 0;
|
||||
Video? videoVer = null;
|
||||
foreach (Video i in items)
|
||||
if ((!sortByPrefs && i.Id == mediaSourceId)
|
||||
|| (sortByPrefs && idxVer == bestIdx))
|
||||
{
|
||||
videoVer = i;
|
||||
break;
|
||||
idxVer = -1;
|
||||
videoVer = items.Where((x, idx) => {
|
||||
bool isMatch = x.Id == mediaSourceId;
|
||||
if (isMatch)
|
||||
idxVer = idx;
|
||||
return isMatch;
|
||||
}).FirstOrDefault();
|
||||
} else {
|
||||
idxVer = bestIdx;
|
||||
videoVer = items.Skip(bestIdx).FirstOrDefault();
|
||||
}
|
||||
else
|
||||
idxVer++;
|
||||
if (videoVer == null)
|
||||
// Version not found, return empty set
|
||||
break;
|
||||
|
||||
@@ -104,7 +104,9 @@ public class CinemaServiceRegistrator : IPluginServiceRegistrator
|
||||
// Fallback to the obsolete query argument
|
||||
if (!context.ActionArguments.TryGetValue("mediaSourceId", out object? mediaSourceIdO)
|
||||
|| (mediaSourceId = mediaSourceIdO as string) == null)
|
||||
throw new InvalidOperationException("Cannot extract MediaSourceId from the Jellyfin's action MediaInfo.GetPostedPlaybackInfo.");
|
||||
// It is optional in certain situations
|
||||
return;
|
||||
//throw new InvalidOperationException("Cannot extract MediaSourceId from the Jellyfin's action MediaInfo.GetPostedPlaybackInfo.");
|
||||
}
|
||||
|
||||
context.HttpContext.Items.Add(CinemaMediaSourceManager.ContextItemsMediaSourceIdKey, mediaSourceId);
|
||||
|
||||
Reference in New Issue
Block a user