mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
update server sync
This commit is contained in:
parent
b7b28ffd31
commit
4309455c37
10 changed files with 45 additions and 32 deletions
|
@ -350,6 +350,7 @@
|
||||||
<Compile Include="Sync\ISyncManager.cs" />
|
<Compile Include="Sync\ISyncManager.cs" />
|
||||||
<Compile Include="Sync\ISyncProvider.cs" />
|
<Compile Include="Sync\ISyncProvider.cs" />
|
||||||
<Compile Include="Sync\ISyncRepository.cs" />
|
<Compile Include="Sync\ISyncRepository.cs" />
|
||||||
|
<Compile Include="Sync\SendFileResult.cs" />
|
||||||
<Compile Include="Themes\IAppThemeManager.cs" />
|
<Compile Include="Themes\IAppThemeManager.cs" />
|
||||||
<Compile Include="Themes\InternalThemeImage.cs" />
|
<Compile Include="Themes\InternalThemeImage.cs" />
|
||||||
<Compile Include="TV\ITVSeriesManager.cs" />
|
<Compile Include="TV\ITVSeriesManager.cs" />
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Sync
|
||||||
/// <param name="progress">The progress.</param>
|
/// <param name="progress">The progress.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SendFile(Stream stream, string remotePath, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
|
Task<SendFileResult> SendFile(Stream stream, string remotePath, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes the file.
|
/// Deletes the file.
|
||||||
|
|
18
MediaBrowser.Controller/Sync/SendFileResult.cs
Normal file
18
MediaBrowser.Controller/Sync/SendFileResult.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Sync
|
||||||
|
{
|
||||||
|
public class SendFileResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the path.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The path.</value>
|
||||||
|
public string Path { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the protocol.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The protocol.</value>
|
||||||
|
public MediaProtocol Protocol { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -152,7 +152,18 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await SendFile(provider, internalSyncJobItem.OutputPath, localItem, target, cancellationToken).ConfigureAwait(false);
|
var sendFileResult = await SendFile(provider, internalSyncJobItem.OutputPath, localItem, target, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (localItem.Item.MediaSources != null)
|
||||||
|
{
|
||||||
|
var mediaSource = localItem.Item.MediaSources.FirstOrDefault();
|
||||||
|
if (mediaSource != null)
|
||||||
|
{
|
||||||
|
mediaSource.Path = sendFileResult.Path;
|
||||||
|
mediaSource.Protocol = sendFileResult.Protocol;
|
||||||
|
mediaSource.SupportsTranscoding = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create db record
|
// Create db record
|
||||||
await dataProvider.AddOrUpdate(target, localItem).ConfigureAwait(false);
|
await dataProvider.AddOrUpdate(target, localItem).ConfigureAwait(false);
|
||||||
|
@ -203,11 +214,11 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SendFile(IServerSyncProvider provider, string inputPath, LocalItem item, SyncTarget target, CancellationToken cancellationToken)
|
private async Task<SendFileResult> SendFile(IServerSyncProvider provider, string inputPath, LocalItem item, SyncTarget target, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
using (var stream = _fileSystem.GetFileStream(inputPath, FileMode.Open, FileAccess.Read, FileShare.Read, true))
|
using (var stream = _fileSystem.GetFileStream(inputPath, FileMode.Open, FileAccess.Read, FileShare.Read, true))
|
||||||
{
|
{
|
||||||
await provider.SendFile(stream, item.LocalPath, target, new Progress<double>(), cancellationToken).ConfigureAwait(false);
|
return await provider.SendFile(stream, item.LocalPath, target, new Progress<double>(), cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -581,6 +581,8 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
jobItem.MediaSource = mediaSource;
|
jobItem.MediaSource = mediaSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jobItem.MediaSource.SupportsTranscoding = false;
|
||||||
|
|
||||||
if (externalSubs.Count > 0)
|
if (externalSubs.Count > 0)
|
||||||
{
|
{
|
||||||
// Save the job item now since conversion could take a while
|
// Save the job item now since conversion could take a while
|
||||||
|
@ -757,6 +759,8 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
jobItem.MediaSource = mediaSource;
|
jobItem.MediaSource = mediaSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jobItem.MediaSource.SupportsTranscoding = false;
|
||||||
|
|
||||||
jobItem.Progress = 50;
|
jobItem.Progress = 50;
|
||||||
jobItem.Status = SyncJobItemStatus.ReadyToTransfer;
|
jobItem.Status = SyncJobItemStatus.ReadyToTransfer;
|
||||||
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
|
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
|
||||||
|
|
|
@ -3,11 +3,9 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Sync;
|
using MediaBrowser.Controller.Sync;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
|
||||||
using MediaBrowser.Model.Sync;
|
using MediaBrowser.Model.Sync;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -58,7 +56,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
|
|
||||||
foreach (var localItem in localItems)
|
foreach (var localItem in localItems)
|
||||||
{
|
{
|
||||||
list.AddRange(GetPlayableMediaSources(localItem));
|
list.AddRange(localItem.Item.MediaSources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,24 +64,5 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<MediaSourceInfo> GetPlayableMediaSources(LocalItem item)
|
|
||||||
{
|
|
||||||
return item.Item.MediaSources
|
|
||||||
.Where(IsMediaSourcePlayable);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsMediaSourcePlayable(MediaSourceInfo mediaSource)
|
|
||||||
{
|
|
||||||
if (mediaSource.Protocol == MediaProtocol.File)
|
|
||||||
{
|
|
||||||
if (!File.Exists(mediaSource.Path))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.584</version>
|
<version>3.0.585</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.584" />
|
<dependency id="MediaBrowser.Common" version="3.0.585" />
|
||||||
<dependency id="NLog" version="3.2.0.0" />
|
<dependency id="NLog" version="3.2.0.0" />
|
||||||
<dependency id="SimpleInjector" version="2.7.0" />
|
<dependency id="SimpleInjector" version="2.7.0" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.584</version>
|
<version>3.0.585</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Model.Signed</id>
|
<id>MediaBrowser.Model.Signed</id>
|
||||||
<version>3.0.584</version>
|
<version>3.0.585</version>
|
||||||
<title>MediaBrowser.Model - Signed Edition</title>
|
<title>MediaBrowser.Model - Signed Edition</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.584</version>
|
<version>3.0.585</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.584" />
|
<dependency id="MediaBrowser.Common" version="3.0.585" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue