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:
@@ -241,25 +241,28 @@ sealed class CinemaMediaSourceManager : IMediaSourceManager
|
|||||||
// We need to directly inspect the video file and therefore need to know which
|
// 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
|
// 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.
|
// read files at random, for VIP accounts that would slow playback startup also.
|
||||||
Guid mediaSourceId;
|
|
||||||
if (ctx == null
|
|
||||||
|| !ctx.Items.TryGetValue(ContextItemsMediaSourceIdKey, out object? mediaSourceIdO)
|
|
||||||
|| mediaSourceIdO is not string mediaSourceIdS
|
|
||||||
|| (!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
|
// Warning: We assume GetVideoVersionsEnumerate keeps the order between its input and output collections
|
||||||
int idxVer = 0;
|
Video? videoVer;
|
||||||
Video? videoVer = null;
|
int idxVer;
|
||||||
foreach (Video i in items)
|
if (!sortByPrefs) {
|
||||||
if ((!sortByPrefs && i.Id == mediaSourceId)
|
Guid mediaSourceId;
|
||||||
|| (sortByPrefs && idxVer == bestIdx))
|
if (ctx == null
|
||||||
{
|
|| !ctx.Items.TryGetValue(ContextItemsMediaSourceIdKey, out object? mediaSourceIdO)
|
||||||
videoVer = i;
|
|| mediaSourceIdO is not string mediaSourceIdS
|
||||||
break;
|
|| (!Guid.TryParse(mediaSourceIdS, out mediaSourceId)))
|
||||||
}
|
throw new InvalidOperationException("For precise stream indexing knowing mediaSourceId is required.");
|
||||||
else
|
|
||||||
idxVer++;
|
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();
|
||||||
|
}
|
||||||
if (videoVer == null)
|
if (videoVer == null)
|
||||||
// Version not found, return empty set
|
// Version not found, return empty set
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -104,7 +104,9 @@ public class CinemaServiceRegistrator : IPluginServiceRegistrator
|
|||||||
// Fallback to the obsolete query argument
|
// Fallback to the obsolete query argument
|
||||||
if (!context.ActionArguments.TryGetValue("mediaSourceId", out object? mediaSourceIdO)
|
if (!context.ActionArguments.TryGetValue("mediaSourceId", out object? mediaSourceIdO)
|
||||||
|| (mediaSourceId = mediaSourceIdO as string) == null)
|
|| (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);
|
context.HttpContext.Items.Add(CinemaMediaSourceManager.ContextItemsMediaSourceIdKey, mediaSourceId);
|
||||||
|
|||||||
Reference in New Issue
Block a user