sync updates

This commit is contained in:
Luke Pulverenti 2015-02-04 14:13:00 -05:00
parent 6c3209e3f9
commit f2c3e014b7
14 changed files with 61 additions and 23 deletions

View file

@ -1,5 +1,4 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Querying;
@ -15,6 +14,7 @@ namespace MediaBrowser.Controller.Sync
{
event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated;
event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled;
event EventHandler<GenericEventArgs<SyncJob>> SyncJobUpdated;
/// <summary>
/// Creates the job.

View file

@ -515,7 +515,7 @@ namespace MediaBrowser.Dlna
public void Run()
{
DumpProfiles();
//DumpProfiles();
}
private void DumpProfiles()

View file

@ -135,5 +135,9 @@ namespace MediaBrowser.Model.ApiClient
/// Occurs when [synchronize job created].
/// </summary>
event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated;
/// <summary>
/// Occurs when [synchronize job cancelled].
/// </summary>
event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled;
}
}

View file

@ -4,8 +4,11 @@ namespace MediaBrowser.Model.Sync
public enum SyncJobStatus
{
Queued = 0,
InProgress = 1,
Completed = 2,
CompletedWithError = 3
Converting = 1,
Transferring = 2,
Completed = 3,
CompletedWithError = 4,
Failed = 5,
Cancelled = 6
}
}

View file

@ -38,6 +38,12 @@ namespace MediaBrowser.Model.System
/// <value><c>true</c> if this instance has pending restart; otherwise, <c>false</c>.</value>
public bool HasPendingRestart { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports synchronize].
/// </summary>
/// <value><c>true</c> if [supports synchronize]; otherwise, <c>false</c>.</value>
public bool SupportsSync { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is network deployed.
/// </summary>

View file

@ -75,6 +75,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
_syncManager.SyncJobCreated += _syncManager_SyncJobCreated;
_syncManager.SyncJobCancelled += _syncManager_SyncJobCancelled;
}
void _syncManager_SyncJobCancelled(object sender, GenericEventArgs<SyncJob> e)
{
_sessionManager.SendMessageToUserDeviceSessions(e.Argument.TargetId, "SyncJobCancelled", e.Argument, CancellationToken.None);
}
void _syncManager_SyncJobCreated(object sender, GenericEventArgs<SyncJobCreationResult> e)
@ -189,6 +195,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_appHost.HasPendingRestartChanged -= kernel_HasPendingRestartChanged;
_syncManager.SyncJobCreated -= _syncManager_SyncJobCreated;
_syncManager.SyncJobCancelled -= _syncManager_SyncJobCancelled;
}
}
}

View file

@ -19,7 +19,7 @@
"PinCodeResetComplete": "The pin code has been reset.",
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
"PinCodeResetConfirmation": "Are you sure you wish to reset the pin code?",
"HeaderPinCodeReset": "Reset Pin Code",
"HeaderPinCodeReset": "Reset Pin Code",
"PasswordSaved": "Password saved.",
"PasswordMatchError": "Password and password confirmation must match.",
"OptionRelease": "Official Release",
@ -48,10 +48,13 @@
"LabelFailed": "(failed)",
"ButtonHelp": "Help",
"ButtonSave": "Save",
"SyncJobStatusQueued": "Queued",
"SyncJobStatusInProgress": "In-Progress",
"SyncJobStatusCompleted": "Synced",
"SyncJobStatusCompletedWithError": "Synced with errors",
"SyncJobStatusQueued": "Queued",
"SyncJobStatusConverting": "Converting",
"SyncJobStatusFailed": "Failed",
"SyncJobStatusCancelled": "Cancelled",
"SyncJobStatusCompleted": "Synced",
"SyncJobStatusTransferring": "Transferring",
"SyncJobStatusCompletedWithError": "Synced with errors",
"LabelCollection": "Collection",
"HeaderAddToCollection": "Add to Collection",
"NewCollectionNameExample": "Example: Star Wars Collection",
@ -91,6 +94,7 @@
"HeaderSelectSubtitles": "Select Subtitles",
"ButtonMarkForRemoval": "Remove from device",
"ButtonUnmarkForRemoval": "Cancel removal from device",
"LabelSyncQualityHelp": "Use high quality for the maximum supported quality by the device. Medium and Low reduce the allowed bitrate.",
"LabelDefaultStream": "(Default)",
"LabelForcedStream": "(Forced)",
"LabelDefaultForcedStream": "(Default/Forced)",

View file

@ -172,7 +172,23 @@ namespace MediaBrowser.Server.Implementations.Sync
job.Progress = null;
}
if (pct >= 100)
if (jobItems.All(i => i.Status == SyncJobItemStatus.Queued))
{
job.Status = SyncJobStatus.Queued;
}
else if (jobItems.All(i => i.Status == SyncJobItemStatus.Failed))
{
job.Status = SyncJobStatus.Failed;
}
else if (jobItems.All(i => i.Status == SyncJobItemStatus.Cancelled))
{
job.Status = SyncJobStatus.Cancelled;
}
else if (jobItems.Any(i => i.Status == SyncJobItemStatus.Converting))
{
job.Status = SyncJobStatus.Converting;
}
else if (pct >= 100)
{
if (jobItems.Any(i => i.Status == SyncJobItemStatus.Failed))
{
@ -183,13 +199,9 @@ namespace MediaBrowser.Server.Implementations.Sync
job.Status = SyncJobStatus.Completed;
}
}
else if (pct.Equals(0) && jobItems.All(i => i.Status == SyncJobItemStatus.Queued))
{
job.Status = SyncJobStatus.Queued;
}
else
{
job.Status = SyncJobStatus.InProgress;
job.Status = SyncJobStatus.Transferring;
}
return _syncRepo.Update(job);

View file

@ -51,6 +51,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated;
public event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled;
public event EventHandler<GenericEventArgs<SyncJob>> SyncJobUpdated;
public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager, Func<IDtoService> dtoService, IApplicationHost appHost, ITVSeriesManager tvSeriesManager, Func<IMediaEncoder> mediaEncoder, IFileSystem fileSystem, Func<ISubtitleEncoder> subtitleEncoder, IConfigurationManager config)
{

View file

@ -1023,7 +1023,8 @@ namespace MediaBrowser.Server.Startup.Common
IsRunningAsService = IsRunningAsService,
SupportsRunningAsService = SupportsRunningAsService,
ServerName = FriendlyName,
LocalAddress = LocalApiUrl
LocalAddress = LocalApiUrl,
SupportsSync = true
};
}

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.554</version>
<version>3.0.556</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<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>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.554" />
<dependency id="MediaBrowser.Common" version="3.0.556" />
<dependency id="NLog" version="3.1.0.0" />
<dependency id="SimpleInjector" version="2.6.1" />
</dependencies>

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.554</version>
<version>3.0.556</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Model.Signed</id>
<version>3.0.554</version>
<version>3.0.556</version>
<title>MediaBrowser.Model - Signed Edition</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.554</version>
<version>3.0.556</version>
<title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.554" />
<dependency id="MediaBrowser.Common" version="3.0.556" />
</dependencies>
</metadata>
<files>