aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2015-03-19 13:21:35 -0400
committerLuke <luke.pulverenti@gmail.com>2015-03-19 13:21:35 -0400
commit9926be0d9de688c04065c916e44ada4177b38a80 (patch)
tree15338144a143948ffbee316641757e81489a7354 /MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs
parentb756e677d733992c2033bdd369980a37e17609e4 (diff)
parent0564d454e5ad4f59702aa9022af6bb8fd064a9ff (diff)
Merge pull request #1043 from MediaBrowser/dev
3.0.5557.0
Diffstat (limited to 'MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs68
1 files changed, 65 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs b/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs
index d35ff8fc46..99d7582333 100644
--- a/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs
+++ b/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs
@@ -3,12 +3,13 @@ using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Sync;
+using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Server.Implementations.Sync
{
- public class AppSyncProvider : ISyncProvider, IHasUniqueTargetIds
+ public class AppSyncProvider : ISyncProvider, IHasUniqueTargetIds, IHasSyncQuality
{
private readonly IDeviceManager _deviceManager;
@@ -31,16 +32,77 @@ namespace MediaBrowser.Server.Implementations.Sync
});
}
- public DeviceProfile GetDeviceProfile(SyncTarget target)
+ public DeviceProfile GetDeviceProfile(SyncTarget target, string profile, string quality)
{
var caps = _deviceManager.GetCapabilities(target.Id);
- return caps == null || caps.DeviceProfile == null ? new DeviceProfile() : caps.DeviceProfile;
+ var deviceProfile = caps == null || caps.DeviceProfile == null ? new DeviceProfile() : caps.DeviceProfile;
+ deviceProfile.MaxStaticBitrate = SyncHelper.AdjustBitrate(deviceProfile.MaxStaticBitrate, quality);
+
+ return deviceProfile;
}
public string Name
{
get { return "App Sync"; }
}
+
+ public IEnumerable<SyncTarget> GetAllSyncTargets()
+ {
+ return _deviceManager.GetDevices(new DeviceQuery
+ {
+ SupportsSync = true
+
+ }).Items.Select(i => new SyncTarget
+ {
+ Id = i.Id,
+ Name = i.Name
+ });
+ }
+
+ public IEnumerable<SyncQualityOption> GetQualityOptions(SyncTarget target)
+ {
+ return new List<SyncQualityOption>
+ {
+ new SyncQualityOption
+ {
+ Name = "Original",
+ Id = "original",
+ Description = "Syncs original files as-is, regardless of whether the device is capable of playing them or not."
+ },
+ new SyncQualityOption
+ {
+ Name = "High",
+ Id = "high",
+ IsDefault = true
+ },
+ new SyncQualityOption
+ {
+ Name = "Medium",
+ Id = "medium"
+ },
+ new SyncQualityOption
+ {
+ Name = "Low",
+ Id = "low"
+ }
+ };
+ }
+
+ public IEnumerable<SyncProfileOption> GetProfileOptions(SyncTarget target)
+ {
+ return new List<SyncProfileOption>();
+ }
+
+ public SyncJobOptions GetSyncJobOptions(SyncTarget target, string profile, string quality)
+ {
+ var isConverting = !string.Equals(quality, "original", StringComparison.OrdinalIgnoreCase);
+
+ return new SyncJobOptions
+ {
+ DeviceProfile = GetDeviceProfile(target, profile, quality),
+ IsConverting = isConverting
+ };
+ }
}
}