From 2485b5c22df66f81bc58a4b18c90da6b38c835f9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 15 Mar 2015 00:17:35 -0400 Subject: [PATCH] sync updates --- MediaBrowser.Controller/Sync/ISyncManager.cs | 2 +- .../MediaBrowser.Model.Portable.csproj | 4 +- .../MediaBrowser.Model.net35.csproj | 4 +- MediaBrowser.Model/MediaBrowser.Model.csproj | 2 +- MediaBrowser.Model/Sync/SyncDialogOptions.cs | 4 +- MediaBrowser.Model/Sync/SyncJobRequest.cs | 5 ++ MediaBrowser.Model/Sync/SyncProfileOption.cs | 37 ++++++++++++ MediaBrowser.Model/Sync/SyncQuality.cs | 25 --------- MediaBrowser.Model/Sync/SyncQualityOption.cs | 5 ++ .../Library/UserManager.cs | 9 ++- .../Localization/JavaScript/javascript.json | 9 +-- .../Sync/AppSyncProvider.cs | 21 +++---- .../Sync/IHasSyncQuality.cs | 2 +- .../Sync/SyncManager.cs | 56 ++++++++++++------- 14 files changed, 114 insertions(+), 71 deletions(-) create mode 100644 MediaBrowser.Model/Sync/SyncProfileOption.cs delete mode 100644 MediaBrowser.Model/Sync/SyncQuality.cs diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.cs index 69548ea3bb..c51c8c1ba9 100644 --- a/MediaBrowser.Controller/Sync/ISyncManager.cs +++ b/MediaBrowser.Controller/Sync/ISyncManager.cs @@ -172,6 +172,6 @@ namespace MediaBrowser.Controller.Sync /// /// The target identifier. /// IEnumerable<SyncQualityOption>. - IEnumerable GetProfileOptions(string targetId); + IEnumerable GetProfileOptions(string targetId); } } diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 74f927c7e2..f60f227d7f 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -1133,8 +1133,8 @@ Sync\SyncParameter.cs - - Sync\SyncQuality.cs + + Sync\SyncProfileOption.cs Sync\SyncQualityOption.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index a732494d1a..1685d5f7b7 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -1092,8 +1092,8 @@ Sync\SyncParameter.cs - - Sync\SyncQuality.cs + + Sync\SyncProfileOption.cs Sync\SyncQualityOption.cs diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 9d4192b17d..c546958aa5 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -398,7 +398,7 @@ - + diff --git a/MediaBrowser.Model/Sync/SyncDialogOptions.cs b/MediaBrowser.Model/Sync/SyncDialogOptions.cs index 2b8672d76e..a987a6cd69 100644 --- a/MediaBrowser.Model/Sync/SyncDialogOptions.cs +++ b/MediaBrowser.Model/Sync/SyncDialogOptions.cs @@ -23,14 +23,14 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the profile options. /// /// The profile options. - public List ProfileOptions { get; set; } + public List ProfileOptions { get; set; } public SyncDialogOptions() { Targets = new List(); Options = new List(); QualityOptions = new List(); - ProfileOptions = new List(); + ProfileOptions = new List(); } } } diff --git a/MediaBrowser.Model/Sync/SyncJobRequest.cs b/MediaBrowser.Model/Sync/SyncJobRequest.cs index 2af4283839..8f9d9520c3 100644 --- a/MediaBrowser.Model/Sync/SyncJobRequest.cs +++ b/MediaBrowser.Model/Sync/SyncJobRequest.cs @@ -30,6 +30,11 @@ namespace MediaBrowser.Model.Sync /// The quality. public string Quality { get; set; } /// + /// Gets or sets the profile. + /// + /// The profile. + public string Profile { get; set; } + /// /// Gets or sets the name. /// /// The name. diff --git a/MediaBrowser.Model/Sync/SyncProfileOption.cs b/MediaBrowser.Model/Sync/SyncProfileOption.cs new file mode 100644 index 0000000000..605af6b25c --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncProfileOption.cs @@ -0,0 +1,37 @@ + +namespace MediaBrowser.Model.Sync +{ + public class SyncProfileOption + { + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + /// + /// Gets or sets the description. + /// + /// The description. + public string Description { get; set; } + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public string Id { get; set; } + /// + /// Gets or sets a value indicating whether this instance is default. + /// + /// true if this instance is default; otherwise, false. + public bool IsDefault { get; set; } + /// + /// Gets or sets a value indicating whether [enable quality options]. + /// + /// true if [enable quality options]; otherwise, false. + public bool EnableQualityOptions { get; set; } + + public SyncProfileOption() + { + EnableQualityOptions = true; + } + } +} diff --git a/MediaBrowser.Model/Sync/SyncQuality.cs b/MediaBrowser.Model/Sync/SyncQuality.cs deleted file mode 100644 index 27ee756a32..0000000000 --- a/MediaBrowser.Model/Sync/SyncQuality.cs +++ /dev/null @@ -1,25 +0,0 @@ - -namespace MediaBrowser.Model.Sync -{ - public enum SyncQuality - { - /// - /// The good - /// - Low = 0, - - /// - /// The better - /// - Medium = 1, - - /// - /// The best - /// - High = 2, - /// - /// The original - /// - Original = 3 - } -} diff --git a/MediaBrowser.Model/Sync/SyncQualityOption.cs b/MediaBrowser.Model/Sync/SyncQualityOption.cs index 1945613c06..597b987270 100644 --- a/MediaBrowser.Model/Sync/SyncQualityOption.cs +++ b/MediaBrowser.Model/Sync/SyncQualityOption.cs @@ -9,6 +9,11 @@ namespace MediaBrowser.Model.Sync /// The name. public string Name { get; set; } /// + /// Gets or sets the description. + /// + /// The description. + public string Description { get; set; } + /// /// Gets or sets the identifier. /// /// The identifier. diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 6e6e23a5ae..b101f6ae1a 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -1,5 +1,4 @@ -using System.Net.NetworkInformation; -using MediaBrowser.Common.Events; +using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; @@ -849,6 +848,12 @@ namespace MediaBrowser.Server.Implementations.Library foreach (var user in users) { await ResetPassword(user).ConfigureAwait(false); + + if (user.Policy.IsDisabled) + { + user.Policy.IsDisabled = false; + await UpdateUserPolicy(user, user.Policy, true).ConfigureAwait(false); + } usersReset.Add(user.Name); } } diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index 1aa18e6c82..d3693840a2 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -117,7 +117,6 @@ "HeaderSelectSubtitles": "Select Subtitles", "ButtonMarkForRemoval": "Remove from device", "ButtonUnmarkForRemoval": "Cancel removal from device", - "LabelSyncQualityHelp": "Select the desired quality. Original quality will sync the original file, regardless of whether the device is capable of playing it or not.", "LabelDefaultStream": "(Default)", "LabelForcedStream": "(Forced)", "LabelDefaultForcedStream": "(Default/Forced)", @@ -731,10 +730,6 @@ "LabelSyncTo": "Sync to:", "LabelSyncJobName": "Sync job name:", "LabelQuality": "Quality:", - "OptionOriginal": "Original", - "OptionHigh": "High", - "OptionMedium": "Medium", - "OptionLow": "Low", "HeaderSettings": "Settings", "OptionAutomaticallySyncNewContent": "Automatically sync new content", "OptionAutomaticallySyncNewContentHelp": "New content added to this category will be automatically synced to the device.", @@ -751,5 +746,7 @@ "SyncJobItemStatusSynced": "Synced", "SyncJobItemStatusFailed": "Failed", "SyncJobItemStatusRemovedFromDevice": "Removed from device", - "SyncJobItemStatusCancelled": "Cancelled" + "SyncJobItemStatusCancelled": "Cancelled", + "LabelProfile": "Profile:", + "LabelBitrateMbps": "Bitrate (Mbps):" } diff --git a/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs b/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs index e4361ed1a5..ff43816b0f 100644 --- a/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs +++ b/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs @@ -80,31 +80,32 @@ namespace MediaBrowser.Server.Implementations.Sync { new SyncQualityOption { - Name = SyncQuality.Original.ToString(), - Id = SyncQuality.Original.ToString() + 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 = SyncQuality.High.ToString(), - Id = SyncQuality.High.ToString(), + Name = "High", + Id = "high", IsDefault = true }, new SyncQualityOption { - Name = SyncQuality.Medium.ToString(), - Id = SyncQuality.Medium.ToString() + Name = "Medium", + Id = "medium" }, new SyncQualityOption { - Name = SyncQuality.Low.ToString(), - Id = SyncQuality.Low.ToString() + Name = "Low", + Id = "low" } }; } - public IEnumerable GetProfileOptions(SyncTarget target) + public IEnumerable GetProfileOptions(SyncTarget target) { - return new List(); + return new List(); } } } diff --git a/MediaBrowser.Server.Implementations/Sync/IHasSyncQuality.cs b/MediaBrowser.Server.Implementations/Sync/IHasSyncQuality.cs index cefce4d179..06ff3f9aa6 100644 --- a/MediaBrowser.Server.Implementations/Sync/IHasSyncQuality.cs +++ b/MediaBrowser.Server.Implementations/Sync/IHasSyncQuality.cs @@ -27,6 +27,6 @@ namespace MediaBrowser.Server.Implementations.Sync /// /// The target. /// IEnumerable<SyncQualityOption>. - IEnumerable GetProfileOptions(SyncTarget target); + IEnumerable GetProfileOptions(SyncTarget target); } } diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index b75f6e7618..e8331e87e8 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -159,7 +159,8 @@ namespace MediaBrowser.Server.Implementations.Sync ItemCount = items.Count, Category = request.Category, ParentId = request.ParentId, - Quality = request.Quality + Quality = request.Quality, + Profile = request.Profile }; if (!request.Category.HasValue && request.ItemIds != null) @@ -1079,29 +1080,29 @@ namespace MediaBrowser.Server.Implementations.Sync { new SyncQualityOption { - Name = SyncQuality.Original.ToString(), - Id = SyncQuality.Original.ToString() - }, - new SyncQualityOption - { - Name = SyncQuality.High.ToString(), - Id = SyncQuality.High.ToString(), + Name = "High", + Id = "high", IsDefault = true }, new SyncQualityOption { - Name = SyncQuality.Medium.ToString(), - Id = SyncQuality.Medium.ToString() + Name = "Medium", + Id = "medium" }, new SyncQualityOption { - Name = SyncQuality.Low.ToString(), - Id = SyncQuality.Low.ToString() + Name = "Low", + Id = "low" + }, + new SyncQualityOption + { + Name = "Custom", + Id = "custom" } }; } - public IEnumerable GetProfileOptions(string targetId) + public IEnumerable GetProfileOptions(string targetId) { foreach (var provider in _providers) { @@ -1114,10 +1115,10 @@ namespace MediaBrowser.Server.Implementations.Sync } } - return new List(); + return new List(); } - private IEnumerable GetProfileOptions(ISyncProvider provider, SyncTarget target) + private IEnumerable GetProfileOptions(ISyncProvider provider, SyncTarget target) { var hasQuality = provider as IHasSyncQuality; if (hasQuality != null) @@ -1125,12 +1126,29 @@ namespace MediaBrowser.Server.Implementations.Sync return hasQuality.GetProfileOptions(target); } - var list = new List(); + var list = new List(); - list.Add(new SyncQualityOption + list.Add(new SyncProfileOption { - Name = SyncQuality.Low.ToString(), - Id = SyncQuality.Low.ToString() + Name = "Original", + Id = "Original", + Description = "Syncs original files as-is.", + EnableQualityOptions = false + }); + + list.Add(new SyncProfileOption + { + Name = "Web - H264/AAC, MP3", + Id = "mobile", + Description = "Designed for compatibility with all devices, including web browsers." + }); + + list.Add(new SyncProfileOption + { + Name = "General - H264/AAC/AC3, MP3", + Id = "general", + Description = "Designed for compatibility with Chromecast, Roku, Smart TV's, and other similar devices.", + IsDefault = true }); return list;