sync updates
This commit is contained in:
parent
66ea0b2566
commit
5474215141
|
@ -119,12 +119,16 @@ namespace MediaBrowser.Api.Playback
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(result.MediaSource.TranscodingUrl))
|
||||
else
|
||||
{
|
||||
result.MediaSource.TranscodingUrl += "&LiveStreamId=" + result.MediaSource.LiveStreamId;
|
||||
if (!string.IsNullOrWhiteSpace(result.MediaSource.TranscodingUrl))
|
||||
{
|
||||
result.MediaSource.TranscodingUrl += "&LiveStreamId=" + result.MediaSource.LiveStreamId;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(mediaSource.LiveStreamId))
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("{0} returned null LiveStreamId", provider.GetType().Name));
|
||||
}
|
||||
|
||||
SetKeyProperties(provider, mediaSource);
|
||||
|
||||
var info = new LiveStreamInfo
|
||||
|
@ -368,6 +373,13 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
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);
|
||||
|
||||
try
|
||||
|
|
|
@ -371,7 +371,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
|
||||
if (item.IsType("episode"))
|
||||
{
|
||||
parts.Add("TV");
|
||||
//parts.Add("TV");
|
||||
if (!string.IsNullOrWhiteSpace(item.SeriesName))
|
||||
{
|
||||
parts.Add(item.SeriesName);
|
||||
|
@ -379,12 +379,12 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
}
|
||||
else if (item.IsVideo)
|
||||
{
|
||||
parts.Add("Videos");
|
||||
//parts.Add("Videos");
|
||||
parts.Add(item.Name);
|
||||
}
|
||||
else if (item.IsAudio)
|
||||
{
|
||||
parts.Add("Music");
|
||||
//parts.Add("Music");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(item.AlbumArtist))
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
}
|
||||
else if (string.Equals(item.MediaType, MediaType.Photo, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
parts.Add("Photos");
|
||||
//parts.Add("Photos");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(item.Album))
|
||||
{
|
||||
|
|
|
@ -721,7 +721,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
var jobItemResult = GetJobItems(new SyncJobItemQuery
|
||||
{
|
||||
TargetId = targetId,
|
||||
Statuses = new SyncJobItemStatus[]
|
||||
Statuses = new[]
|
||||
{
|
||||
SyncJobItemStatus.ReadyToTransfer
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
keyList.Add(item.Id);
|
||||
mediaSource.OpenToken = string.Join("|", keyList.ToArray());
|
||||
}
|
||||
|
||||
list.Add(mediaSource);
|
||||
}
|
||||
|
||||
public async Task<MediaSourceInfo> OpenMediaSource(string openToken, CancellationToken cancellationToken)
|
||||
|
@ -111,13 +113,16 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
var dynamicInfo = await requiresDynamicAccess.GetSyncedFileInfo(localItem.LocalPath, target, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var mediaSource = localItem.Item.MediaSources.First();
|
||||
mediaSource.LiveStreamId = Guid.NewGuid().ToString();
|
||||
SetStaticMediaSourceInfo(localItem, mediaSource);
|
||||
|
||||
foreach (var stream in mediaSource.MediaStreams)
|
||||
{
|
||||
var dynamicStreamInfo = await requiresDynamicAccess.GetSyncedFileInfo(stream.ExternalId, target, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
stream.Path = dynamicStreamInfo.Path;
|
||||
if (!string.IsNullOrWhiteSpace(stream.ExternalId))
|
||||
{
|
||||
var dynamicStreamInfo = await requiresDynamicAccess.GetSyncedFileInfo(stream.ExternalId, target, cancellationToken).ConfigureAwait(false);
|
||||
stream.Path = dynamicStreamInfo.Path;
|
||||
}
|
||||
}
|
||||
|
||||
mediaSource.Path = dynamicInfo.Path;
|
||||
|
|
Loading…
Reference in New Issue
Block a user