mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-31 14:33:54 -04:00
sync updates
This commit is contained in:
parent
66ea0b2566
commit
5474215141
@ -119,13 +119,17 @@ namespace MediaBrowser.Api.Playback
|
|||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(request.ItemId);
|
var item = _libraryManager.GetItemById(request.ItemId);
|
||||||
|
|
||||||
SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate, request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex, request.SubtitleStreamIndex);
|
SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate,
|
||||||
|
request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex,
|
||||||
|
request.SubtitleStreamIndex);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(result.MediaSource.TranscodingUrl))
|
if (!string.IsNullOrWhiteSpace(result.MediaSource.TranscodingUrl))
|
||||||
{
|
{
|
||||||
result.MediaSource.TranscodingUrl += "&LiveStreamId=" + result.MediaSource.LiveStreamId;
|
result.MediaSource.TranscodingUrl += "&LiveStreamId=" + result.MediaSource.LiveStreamId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return GetStaticMediaSources(item, enablePathSubstitution).FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
|
return GetStaticMediaSources(item, enablePathSubstitution).FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<string, LiveStreamInfo> _openStreams = new ConcurrentDictionary<string, LiveStreamInfo>();
|
private readonly ConcurrentDictionary<string, LiveStreamInfo> _openStreams = new ConcurrentDictionary<string, LiveStreamInfo>(StringComparer.OrdinalIgnoreCase);
|
||||||
private readonly SemaphoreSlim _liveStreamSemaphore = new SemaphoreSlim(1, 1);
|
private readonly SemaphoreSlim _liveStreamSemaphore = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
public async Task<LiveStreamResponse> OpenLiveStream(LiveStreamRequest request, bool enableAutoClose, CancellationToken cancellationToken)
|
public async Task<LiveStreamResponse> OpenLiveStream(LiveStreamRequest request, bool enableAutoClose, CancellationToken cancellationToken)
|
||||||
@ -330,6 +330,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
var mediaSource = await provider.OpenMediaSource(tuple.Item2, cancellationToken).ConfigureAwait(false);
|
var mediaSource = await provider.OpenMediaSource(tuple.Item2, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(mediaSource.LiveStreamId))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(string.Format("{0} returned null LiveStreamId", provider.GetType().Name));
|
||||||
|
}
|
||||||
|
|
||||||
SetKeyProperties(provider, mediaSource);
|
SetKeyProperties(provider, mediaSource);
|
||||||
|
|
||||||
var info = new LiveStreamInfo
|
var info = new LiveStreamInfo
|
||||||
@ -368,6 +373,13 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
public async Task<MediaSourceInfo> GetLiveStream(string id, CancellationToken cancellationToken)
|
public async Task<MediaSourceInfo> GetLiveStream(string id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(id))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.Debug("Getting live stream {0}", id);
|
||||||
|
|
||||||
await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -371,7 +371,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
|
|
||||||
if (item.IsType("episode"))
|
if (item.IsType("episode"))
|
||||||
{
|
{
|
||||||
parts.Add("TV");
|
//parts.Add("TV");
|
||||||
if (!string.IsNullOrWhiteSpace(item.SeriesName))
|
if (!string.IsNullOrWhiteSpace(item.SeriesName))
|
||||||
{
|
{
|
||||||
parts.Add(item.SeriesName);
|
parts.Add(item.SeriesName);
|
||||||
@ -379,12 +379,12 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
}
|
}
|
||||||
else if (item.IsVideo)
|
else if (item.IsVideo)
|
||||||
{
|
{
|
||||||
parts.Add("Videos");
|
//parts.Add("Videos");
|
||||||
parts.Add(item.Name);
|
parts.Add(item.Name);
|
||||||
}
|
}
|
||||||
else if (item.IsAudio)
|
else if (item.IsAudio)
|
||||||
{
|
{
|
||||||
parts.Add("Music");
|
//parts.Add("Music");
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(item.AlbumArtist))
|
if (!string.IsNullOrWhiteSpace(item.AlbumArtist))
|
||||||
{
|
{
|
||||||
@ -398,7 +398,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
}
|
}
|
||||||
else if (string.Equals(item.MediaType, MediaType.Photo, StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.MediaType, MediaType.Photo, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
parts.Add("Photos");
|
//parts.Add("Photos");
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(item.Album))
|
if (!string.IsNullOrWhiteSpace(item.Album))
|
||||||
{
|
{
|
||||||
|
@ -721,7 +721,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
var jobItemResult = GetJobItems(new SyncJobItemQuery
|
var jobItemResult = GetJobItems(new SyncJobItemQuery
|
||||||
{
|
{
|
||||||
TargetId = targetId,
|
TargetId = targetId,
|
||||||
Statuses = new SyncJobItemStatus[]
|
Statuses = new[]
|
||||||
{
|
{
|
||||||
SyncJobItemStatus.ReadyToTransfer
|
SyncJobItemStatus.ReadyToTransfer
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,8 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
keyList.Add(item.Id);
|
keyList.Add(item.Id);
|
||||||
mediaSource.OpenToken = string.Join("|", keyList.ToArray());
|
mediaSource.OpenToken = string.Join("|", keyList.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.Add(mediaSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<MediaSourceInfo> OpenMediaSource(string openToken, CancellationToken cancellationToken)
|
public async Task<MediaSourceInfo> OpenMediaSource(string openToken, CancellationToken cancellationToken)
|
||||||
@ -111,14 +113,17 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
var dynamicInfo = await requiresDynamicAccess.GetSyncedFileInfo(localItem.LocalPath, target, cancellationToken).ConfigureAwait(false);
|
var dynamicInfo = await requiresDynamicAccess.GetSyncedFileInfo(localItem.LocalPath, target, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var mediaSource = localItem.Item.MediaSources.First();
|
var mediaSource = localItem.Item.MediaSources.First();
|
||||||
|
mediaSource.LiveStreamId = Guid.NewGuid().ToString();
|
||||||
SetStaticMediaSourceInfo(localItem, mediaSource);
|
SetStaticMediaSourceInfo(localItem, mediaSource);
|
||||||
|
|
||||||
foreach (var stream in mediaSource.MediaStreams)
|
foreach (var stream in mediaSource.MediaStreams)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(stream.ExternalId))
|
||||||
{
|
{
|
||||||
var dynamicStreamInfo = await requiresDynamicAccess.GetSyncedFileInfo(stream.ExternalId, target, cancellationToken).ConfigureAwait(false);
|
var dynamicStreamInfo = await requiresDynamicAccess.GetSyncedFileInfo(stream.ExternalId, target, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
stream.Path = dynamicStreamInfo.Path;
|
stream.Path = dynamicStreamInfo.Path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mediaSource.Path = dynamicInfo.Path;
|
mediaSource.Path = dynamicInfo.Path;
|
||||||
mediaSource.Protocol = dynamicInfo.Protocol;
|
mediaSource.Protocol = dynamicInfo.Protocol;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user