aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Diagnostics/IProcessManager.cs28
-rw-r--r--MediaBrowser.Controller/Drawing/IImageProcessor.cs6
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs15
-rw-r--r--MediaBrowser.Controller/Library/IMediaSourceManager.cs18
-rw-r--r--MediaBrowser.Controller/Library/IUserManager.cs1
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj3
-rw-r--r--MediaBrowser.Controller/Net/StaticResultOptions.cs5
-rw-r--r--MediaBrowser.Controller/Sync/ICloudSyncProvider.cs35
-rw-r--r--MediaBrowser.Controller/Sync/IServerSyncProvider.cs61
-rw-r--r--MediaBrowser.Controller/Sync/ISyncDataProvider.cs41
-rw-r--r--MediaBrowser.Controller/Sync/ISyncProvider.cs12
12 files changed, 154 insertions, 73 deletions
diff --git a/MediaBrowser.Controller/Diagnostics/IProcessManager.cs b/MediaBrowser.Controller/Diagnostics/IProcessManager.cs
new file mode 100644
index 0000000000..2e076bd882
--- /dev/null
+++ b/MediaBrowser.Controller/Diagnostics/IProcessManager.cs
@@ -0,0 +1,28 @@
+using System.Diagnostics;
+
+namespace MediaBrowser.Controller.Diagnostics
+{
+ /// <summary>
+ /// Interface IProcessManager
+ /// </summary>
+ public interface IProcessManager
+ {
+ /// <summary>
+ /// Gets a value indicating whether [supports suspension].
+ /// </summary>
+ /// <value><c>true</c> if [supports suspension]; otherwise, <c>false</c>.</value>
+ bool SupportsSuspension { get; }
+
+ /// <summary>
+ /// Suspends the process.
+ /// </summary>
+ /// <param name="process">The process.</param>
+ void SuspendProcess(Process process);
+
+ /// <summary>
+ /// Resumes the process.
+ /// </summary>
+ /// <param name="process">The process.</param>
+ void ResumeProcess(Process process);
+ }
+}
diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
index 8ac7d56d29..6fafc2b464 100644
--- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs
+++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
@@ -2,7 +2,6 @@
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
-using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
@@ -30,10 +29,9 @@ namespace MediaBrowser.Controller.Drawing
/// <summary>
/// Gets the size of the image.
/// </summary>
- /// <param name="path">The path.</param>
- /// <param name="imageDateModified">The image date modified.</param>
+ /// <param name="info">The information.</param>
/// <returns>ImageSize.</returns>
- ImageSize GetImageSize(string path, DateTime imageDateModified);
+ ImageSize GetImageSize(ItemImageInfo info);
/// <summary>
/// Adds the parts.
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 9024479999..d868227d95 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -239,7 +239,7 @@ namespace MediaBrowser.Controller.Entities.Audio
{
Id = i.Id.ToString("N"),
Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
- MediaStreams = MediaSourceManager.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList(),
+ MediaStreams = MediaSourceManager.GetMediaStreams(i.Id).ToList(),
Name = i.Name,
Path = enablePathSubstituion ? GetMappedPath(i.Path, locationType) : i.Path,
RunTimeTicks = i.RunTimeTicks,
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index d4507bc337..a0c3a6cf98 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -420,12 +420,17 @@ namespace MediaBrowser.Controller.Entities
return base.GetDeletePaths();
}
- public virtual IEnumerable<MediaStream> GetMediaStreams()
+ public IEnumerable<MediaStream> GetMediaStreams()
{
- return MediaSourceManager.GetMediaStreams(new MediaStreamQuery
+ var mediaSource = GetMediaSources(false)
+ .FirstOrDefault();
+
+ if (mediaSource == null)
{
- ItemId = Id
- });
+ return new List<MediaStream>();
+ }
+
+ return mediaSource.MediaStreams;
}
public virtual MediaStream GetDefaultVideoStream()
@@ -474,7 +479,7 @@ namespace MediaBrowser.Controller.Entities
private static MediaSourceInfo GetVersionInfo(bool enablePathSubstitution, Video i, MediaSourceType type)
{
- var mediaStreams = MediaSourceManager.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id })
+ var mediaStreams = MediaSourceManager.GetMediaStreams(i.Id)
.ToList();
var locationType = i.LocationType;
diff --git a/MediaBrowser.Controller/Library/IMediaSourceManager.cs b/MediaBrowser.Controller/Library/IMediaSourceManager.cs
index 4378bc85d9..5d79f613db 100644
--- a/MediaBrowser.Controller/Library/IMediaSourceManager.cs
+++ b/MediaBrowser.Controller/Library/IMediaSourceManager.cs
@@ -1,11 +1,29 @@
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
+using System;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Library
{
public interface IMediaSourceManager
{
+ /// <summary>
+ /// Gets the media streams.
+ /// </summary>
+ /// <param name="itemId">The item identifier.</param>
+ /// <returns>IEnumerable&lt;MediaStream&gt;.</returns>
+ IEnumerable<MediaStream> GetMediaStreams(Guid itemId);
+ /// <summary>
+ /// Gets the media streams.
+ /// </summary>
+ /// <param name="mediaSourceId">The media source identifier.</param>
+ /// <returns>IEnumerable&lt;MediaStream&gt;.</returns>
+ IEnumerable<MediaStream> GetMediaStreams(string mediaSourceId);
+ /// <summary>
+ /// Gets the media streams.
+ /// </summary>
+ /// <param name="query">The query.</param>
+ /// <returns>IEnumerable&lt;MediaStream&gt;.</returns>
IEnumerable<MediaStream> GetMediaStreams(MediaStreamQuery query);
}
}
diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs
index 8119e5afbb..a167cdbed0 100644
--- a/MediaBrowser.Controller/Library/IUserManager.cs
+++ b/MediaBrowser.Controller/Library/IUserManager.cs
@@ -34,6 +34,7 @@ namespace MediaBrowser.Controller.Library
event EventHandler<GenericEventArgs<User>> UserCreated;
event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;
event EventHandler<GenericEventArgs<User>> UserPasswordChanged;
+ event EventHandler<GenericEventArgs<User>> UserLockedOut;
/// <summary>
/// Gets a User by Id
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index e9531e0571..36809c5d38 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -104,6 +104,7 @@
<Compile Include="Devices\CameraImageUploadInfo.cs" />
<Compile Include="Devices\IDeviceManager.cs" />
<Compile Include="Devices\IDeviceRepository.cs" />
+ <Compile Include="Diagnostics\IProcessManager.cs" />
<Compile Include="Dlna\ControlRequest.cs" />
<Compile Include="Dlna\ControlResponse.cs" />
<Compile Include="Dlna\EventSubscriptionResponse.cs" />
@@ -341,8 +342,8 @@
<Compile Include="Subtitles\SubtitleDownloadEventArgs.cs" />
<Compile Include="Subtitles\SubtitleResponse.cs" />
<Compile Include="Subtitles\SubtitleSearchRequest.cs" />
- <Compile Include="Sync\ICloudSyncProvider.cs" />
<Compile Include="Sync\IServerSyncProvider.cs" />
+ <Compile Include="Sync\ISyncDataProvider.cs" />
<Compile Include="Sync\ISyncManager.cs" />
<Compile Include="Sync\ISyncProvider.cs" />
<Compile Include="Sync\ISyncRepository.cs" />
diff --git a/MediaBrowser.Controller/Net/StaticResultOptions.cs b/MediaBrowser.Controller/Net/StaticResultOptions.cs
index 5bb2c9a5c3..6a104554af 100644
--- a/MediaBrowser.Controller/Net/StaticResultOptions.cs
+++ b/MediaBrowser.Controller/Net/StaticResultOptions.cs
@@ -18,11 +18,6 @@ namespace MediaBrowser.Controller.Net
public IDictionary<string, string> ResponseHeaders { get; set; }
- public bool Throttle { get; set; }
- public long ThrottleLimit { get; set; }
- public long MinThrottlePosition { get; set; }
- public Func<long, long, long> ThrottleCallback { get; set; }
-
public Action OnComplete { get; set; }
public StaticResultOptions()
diff --git a/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs b/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs
deleted file mode 100644
index dd7fda2c5a..0000000000
--- a/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using MediaBrowser.Model.Sync;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Controller.Sync
-{
- public interface ICloudSyncProvider
- {
- /// <summary>
- /// Gets the name.
- /// </summary>
- /// <value>The name.</value>
- string Name { get; }
-
- /// <summary>
- /// Gets the synchronize targets.
- /// </summary>
- /// <param name="userId">The user identifier.</param>
- /// <returns>IEnumerable&lt;SyncTarget&gt;.</returns>
- IEnumerable<SyncTarget> GetSyncTargets(string userId);
-
- /// <summary>
- /// Transfers the item file.
- /// </summary>
- /// <param name="serverId">The server identifier.</param>
- /// <param name="itemId">The item identifier.</param>
- /// <param name="inputFile">The input file.</param>
- /// <param name="pathParts">The path parts.</param>
- /// <param name="target">The target.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task TransferItemFile(string serverId, string itemId, string inputFile, string[] pathParts, SyncTarget target, CancellationToken cancellationToken);
- }
-}
diff --git a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
index d11dd9d732..775a3648d2 100644
--- a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
+++ b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
@@ -1,5 +1,7 @@
using MediaBrowser.Model.Sync;
+using System;
using System.Collections.Generic;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -8,34 +10,63 @@ namespace MediaBrowser.Controller.Sync
public interface IServerSyncProvider : ISyncProvider
{
/// <summary>
- /// Gets the server item ids.
+ /// Transfers the file.
/// </summary>
- /// <param name="serverId">The server identifier.</param>
+ /// <param name="inputFile">The input file.</param>
+ /// <param name="path">The path.</param>
/// <param name="target">The target.</param>
+ /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task&lt;List&lt;System.String&gt;&gt;.</returns>
- Task<List<string>> GetServerItemIds(string serverId, SyncTarget target, CancellationToken cancellationToken);
+ /// <returns>Task.</returns>
+ Task SendFile(string inputFile, string path, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
/// <summary>
- /// Removes the item.
+ /// Deletes the file.
/// </summary>
- /// <param name="serverId">The server identifier.</param>
- /// <param name="itemId">The item identifier.</param>
+ /// <param name="path">The path.</param>
/// <param name="target">The target.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task DeleteItem(string serverId, string itemId, SyncTarget target, CancellationToken cancellationToken);
+ Task DeleteFile(string path, SyncTarget target, CancellationToken cancellationToken);
/// <summary>
- /// Transfers the file.
+ /// Gets the file.
/// </summary>
- /// <param name="serverId">The server identifier.</param>
- /// <param name="itemId">The item identifier.</param>
- /// <param name="inputFile">The input file.</param>
- /// <param name="pathParts">The path parts.</param>
+ /// <param name="path">The path.</param>
/// <param name="target">The target.</param>
+ /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task TransferItemFile(string serverId, string itemId, string inputFile, string[] pathParts, SyncTarget target, CancellationToken cancellationToken);
+ /// <returns>Task&lt;Stream&gt;.</returns>
+ Task<Stream> GetFile(string path, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the full path.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="target">The target.</param>
+ /// <returns>System.String.</returns>
+ string GetFullPath(IEnumerable<string> path, SyncTarget target);
+
+ /// <summary>
+ /// Gets the parent directory path.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="target">The target.</param>
+ /// <returns>System.String.</returns>
+ string GetParentDirectoryPath(string path, SyncTarget target);
+
+ /// <summary>
+ /// Gets the file system entries.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="target">The target.</param>
+ /// <returns>Task&lt;List&lt;DeviceFileInfo&gt;&gt;.</returns>
+ Task<List<DeviceFileInfo>> GetFileSystemEntries(string path, SyncTarget target);
+
+ /// <summary>
+ /// Gets the data provider.
+ /// </summary>
+ /// <returns>ISyncDataProvider.</returns>
+ ISyncDataProvider GetDataProvider();
}
}
diff --git a/MediaBrowser.Controller/Sync/ISyncDataProvider.cs b/MediaBrowser.Controller/Sync/ISyncDataProvider.cs
new file mode 100644
index 0000000000..cf698dd3c0
--- /dev/null
+++ b/MediaBrowser.Controller/Sync/ISyncDataProvider.cs
@@ -0,0 +1,41 @@
+using MediaBrowser.Model.Sync;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Controller.Sync
+{
+ public interface ISyncDataProvider
+ {
+ /// <summary>
+ /// Gets the server item ids.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="serverId">The server identifier.</param>
+ /// <returns>Task&lt;List&lt;System.String&gt;&gt;.</returns>
+ Task<List<string>> GetServerItemIds(SyncTarget target, string serverId);
+
+ /// <summary>
+ /// Adds the or update.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="item">The item.</param>
+ /// <returns>Task.</returns>
+ Task AddOrUpdate(SyncTarget target, LocalItem item);
+
+ /// <summary>
+ /// Deletes the specified identifier.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="id">The identifier.</param>
+ /// <returns>Task.</returns>
+ Task Delete(SyncTarget target, string id);
+
+ /// <summary>
+ /// Gets the specified identifier.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="id">The identifier.</param>
+ /// <returns>Task&lt;LocalItem&gt;.</returns>
+ Task<LocalItem> Get(SyncTarget target, string id);
+ }
+}
diff --git a/MediaBrowser.Controller/Sync/ISyncProvider.cs b/MediaBrowser.Controller/Sync/ISyncProvider.cs
index 6f24eac1ae..ef34bfe692 100644
--- a/MediaBrowser.Controller/Sync/ISyncProvider.cs
+++ b/MediaBrowser.Controller/Sync/ISyncProvider.cs
@@ -1,5 +1,4 @@
-using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Sync;
+using MediaBrowser.Model.Sync;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Sync
@@ -18,13 +17,12 @@ namespace MediaBrowser.Controller.Sync
/// <param name="userId">The user identifier.</param>
/// <returns>IEnumerable&lt;SyncTarget&gt;.</returns>
IEnumerable<SyncTarget> GetSyncTargets(string userId);
-
+
/// <summary>
- /// Gets the device profile.
+ /// Gets all synchronize targets.
/// </summary>
- /// <param name="target">The target.</param>
- /// <returns>DeviceProfile.</returns>
- DeviceProfile GetDeviceProfile(SyncTarget target);
+ /// <returns>IEnumerable&lt;SyncTarget&gt;.</returns>
+ IEnumerable<SyncTarget> GetAllSyncTargets();
}
public interface IHasUniqueTargetIds