diff options
Diffstat (limited to 'MediaBrowser.Model')
| -rw-r--r-- | MediaBrowser.Model/Activity/IActivityManager.cs | 9 | ||||
| -rw-r--r-- | MediaBrowser.Model/Activity/IActivityRepository.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamInfo.cs | 34 | ||||
| -rw-r--r-- | MediaBrowser.Model/Drawing/DrawingUtils.cs | 42 | ||||
| -rw-r--r-- | MediaBrowser.Model/Drawing/ImageSize.cs | 63 | ||||
| -rw-r--r-- | MediaBrowser.Model/System/ISystemEvents.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/ITaskManager.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/SystemEvent.cs | 13 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/TaskTriggerInfo.cs | 6 |
9 files changed, 37 insertions, 152 deletions
diff --git a/MediaBrowser.Model/Activity/IActivityManager.cs b/MediaBrowser.Model/Activity/IActivityManager.cs index bbd7b6f2d..897d93d79 100644 --- a/MediaBrowser.Model/Activity/IActivityManager.cs +++ b/MediaBrowser.Model/Activity/IActivityManager.cs @@ -1,7 +1,6 @@ using System; -using System.Collections.Generic; -using System.Threading.Tasks; using MediaBrowser.Model.Events; +using MediaBrowser.Model.Querying; namespace MediaBrowser.Model.Activity { @@ -9,8 +8,10 @@ namespace MediaBrowser.Model.Activity { event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated; - Task CreateAsync(ActivityLogEntry entry); + void Create(ActivityLogEntry entry); - IEnumerable<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? x, int? y); + QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit); + + QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? x, int? y); } } diff --git a/MediaBrowser.Model/Activity/IActivityRepository.cs b/MediaBrowser.Model/Activity/IActivityRepository.cs index 3ed6175ce..f0e3b902c 100644 --- a/MediaBrowser.Model/Activity/IActivityRepository.cs +++ b/MediaBrowser.Model/Activity/IActivityRepository.cs @@ -1,12 +1,12 @@ -using System.Linq; -using System.Threading.Tasks; +using System; +using MediaBrowser.Model.Querying; namespace MediaBrowser.Model.Activity { public interface IActivityRepository { - Task CreateAsync(ActivityLogEntry entry); + void Create(ActivityLogEntry entry); - IQueryable<ActivityLogEntry> GetActivityLogEntries(); + QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? z, int? startIndex, int? limit); } } diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 522c10980..6d03a03b0 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -953,22 +953,11 @@ namespace MediaBrowser.Model.Dlna if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) { - var size = new ImageSize - { - Width = videoStream.Width.Value, - Height = videoStream.Height.Value - }; - - double? maxWidth = MaxWidth.HasValue ? (double)MaxWidth.Value : (double?)null; - double? maxHeight = MaxHeight.HasValue ? (double)MaxHeight.Value : (double?)null; + ImageDimensions size = new ImageDimensions(videoStream.Width.Value, videoStream.Height.Value); - var newSize = DrawingUtils.Resize(size, - 0, - 0, - maxWidth ?? 0, - maxHeight ?? 0); + size = DrawingUtils.Resize(size, 0, 0, MaxWidth ?? 0, MaxHeight ?? 0); - return Convert.ToInt32(newSize.Width); + return size.Width; } return MaxWidth; @@ -983,22 +972,11 @@ namespace MediaBrowser.Model.Dlna if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) { - var size = new ImageSize - { - Width = videoStream.Width.Value, - Height = videoStream.Height.Value - }; - - double? maxWidth = MaxWidth.HasValue ? (double)MaxWidth.Value : (double?)null; - double? maxHeight = MaxHeight.HasValue ? (double)MaxHeight.Value : (double?)null; + ImageDimensions size = new ImageDimensions(videoStream.Width.Value, videoStream.Height.Value); - var newSize = DrawingUtils.Resize(size, - 0, - 0, - maxWidth ?? 0, - maxHeight ?? 0); + size = DrawingUtils.Resize(size, 0, 0, MaxWidth ?? 0, MaxHeight ?? 0); - return Convert.ToInt32(newSize.Height); + return size.Height; } return MaxHeight; diff --git a/MediaBrowser.Model/Drawing/DrawingUtils.cs b/MediaBrowser.Model/Drawing/DrawingUtils.cs index fbd074218..9fe85512f 100644 --- a/MediaBrowser.Model/Drawing/DrawingUtils.cs +++ b/MediaBrowser.Model/Drawing/DrawingUtils.cs @@ -1,3 +1,5 @@ +using System; + namespace MediaBrowser.Model.Drawing { /// <summary> @@ -14,27 +16,25 @@ namespace MediaBrowser.Model.Drawing /// <param name="maxWidth">A max fixed width, if desired</param> /// <param name="maxHeight">A max fixed height, if desired</param> /// <returns>A new size object</returns> - public static ImageSize Resize(ImageSize size, - double width, - double height, - double maxWidth, - double maxHeight) + public static ImageDimensions Resize(ImageDimensions size, + int width, + int height, + int maxWidth, + int maxHeight) { - double newWidth = size.Width; - double newHeight = size.Height; + int newWidth = size.Width; + int newHeight = size.Height; if (width > 0 && height > 0) { newWidth = width; newHeight = height; } - else if (height > 0) { newWidth = GetNewWidth(newHeight, newWidth, height); newHeight = height; } - else if (width > 0) { newHeight = GetNewHeight(newHeight, newWidth, width); @@ -53,7 +53,7 @@ namespace MediaBrowser.Model.Drawing newWidth = maxWidth; } - return new ImageSize { Width = newWidth, Height = newHeight }; + return new ImageDimensions(newWidth, newHeight); } /// <summary> @@ -62,15 +62,9 @@ namespace MediaBrowser.Model.Drawing /// <param name="currentHeight">Height of the current.</param> /// <param name="currentWidth">Width of the current.</param> /// <param name="newHeight">The new height.</param> - /// <returns>System.Double.</returns> - private static double GetNewWidth(double currentHeight, double currentWidth, double newHeight) - { - double scaleFactor = newHeight; - scaleFactor /= currentHeight; - scaleFactor *= currentWidth; - - return scaleFactor; - } + /// <returns>the new width</returns> + private static int GetNewWidth(int currentHeight, int currentWidth, int newHeight) + => Convert.ToInt32((double)newHeight / currentHeight * currentWidth); /// <summary> /// Gets the new height. @@ -79,13 +73,7 @@ namespace MediaBrowser.Model.Drawing /// <param name="currentWidth">Width of the current.</param> /// <param name="newWidth">The new width.</param> /// <returns>System.Double.</returns> - private static double GetNewHeight(double currentHeight, double currentWidth, double newWidth) - { - double scaleFactor = newWidth; - scaleFactor /= currentWidth; - scaleFactor *= currentHeight; - - return scaleFactor; - } + private static int GetNewHeight(int currentHeight, int currentWidth, int newWidth) + => Convert.ToInt32((double)newWidth / currentWidth * currentHeight); } } diff --git a/MediaBrowser.Model/Drawing/ImageSize.cs b/MediaBrowser.Model/Drawing/ImageSize.cs index 87764bbf4..75591d83d 100644 --- a/MediaBrowser.Model/Drawing/ImageSize.cs +++ b/MediaBrowser.Model/Drawing/ImageSize.cs @@ -1,36 +1,23 @@ -using System.Globalization; - namespace MediaBrowser.Model.Drawing { /// <summary> /// Struct ImageSize /// </summary> - public struct ImageSize + public struct ImageDimensions { - private double _height; - private double _width; - /// <summary> /// Gets or sets the height. /// </summary> /// <value>The height.</value> - public double Height - { - get => _height; - set => _height = value; - } + public int Height { get; set; } /// <summary> /// Gets or sets the width. /// </summary> /// <value>The width.</value> - public double Width - { - get => _width; - set => _width = value; - } + public int Width { get; set; } - public bool Equals(ImageSize size) + public bool Equals(ImageDimensions size) { return Width.Equals(size.Width) && Height.Equals(size.Height); } @@ -40,46 +27,10 @@ namespace MediaBrowser.Model.Drawing return string.Format("{0}-{1}", Width, Height); } - public ImageSize(string value) + public ImageDimensions(int width, int height) { - _width = 0; - - _height = 0; - - ParseValue(value); - } - - public ImageSize(int width, int height) - { - _width = width; - _height = height; - } - - public ImageSize(double width, double height) - { - _width = width; - _height = height; - } - - private void ParseValue(string value) - { - if (!string.IsNullOrEmpty(value)) - { - string[] parts = value.Split('-'); - - if (parts.Length == 2) - { - if (double.TryParse(parts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out var val)) - { - _width = val; - } - - if (double.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out val)) - { - _height = val; - } - } - } + Width = width; + Height = height; } } } diff --git a/MediaBrowser.Model/System/ISystemEvents.cs b/MediaBrowser.Model/System/ISystemEvents.cs deleted file mode 100644 index 8c47d6fbf..000000000 --- a/MediaBrowser.Model/System/ISystemEvents.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace MediaBrowser.Model.System -{ - public interface ISystemEvents - { - event EventHandler Resume; - event EventHandler Suspend; - event EventHandler SessionLogoff; - event EventHandler SystemShutdown; - } -} diff --git a/MediaBrowser.Model/Tasks/ITaskManager.cs b/MediaBrowser.Model/Tasks/ITaskManager.cs index a7c2f6d86..57b8d1af8 100644 --- a/MediaBrowser.Model/Tasks/ITaskManager.cs +++ b/MediaBrowser.Model/Tasks/ITaskManager.cs @@ -72,7 +72,5 @@ namespace MediaBrowser.Model.Tasks event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting; event EventHandler<TaskCompletionEventArgs> TaskCompleted; - - void RunTaskOnNextStartup(string key); } } diff --git a/MediaBrowser.Model/Tasks/SystemEvent.cs b/MediaBrowser.Model/Tasks/SystemEvent.cs deleted file mode 100644 index 5a3d8a8eb..000000000 --- a/MediaBrowser.Model/Tasks/SystemEvent.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Enum SystemEvent - /// </summary> - public enum SystemEvent - { - /// <summary> - /// The wake from sleep - /// </summary> - WakeFromSleep = 0 - } -} diff --git a/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs b/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs index 80101ec48..714f11872 100644 --- a/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs +++ b/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs @@ -26,12 +26,6 @@ namespace MediaBrowser.Model.Tasks public long? IntervalTicks { get; set; } /// <summary> - /// Gets or sets the system event. - /// </summary> - /// <value>The system event.</value> - public SystemEvent? SystemEvent { get; set; } - - /// <summary> /// Gets or sets the day of week. /// </summary> /// <value>The day of week.</value> |
