From d7bdb744ca9d4b3955071dfe3c38ed631dbafbfd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 30 Nov 2014 14:01:33 -0500 Subject: add new image params --- MediaBrowser.Controller/Dlna/DlnaIconResponse.cs | 22 ---------------------- MediaBrowser.Controller/Dlna/IDlnaManager.cs | 5 +++-- MediaBrowser.Controller/Dto/IDtoService.cs | 18 +++++++++++++++--- MediaBrowser.Controller/Entities/BaseItem.cs | 6 +++++- MediaBrowser.Controller/Entities/Folder.cs | 2 +- MediaBrowser.Controller/Entities/User.cs | 3 ++- MediaBrowser.Controller/Library/ILibraryManager.cs | 8 ++++++++ MediaBrowser.Controller/Library/IUserManager.cs | 14 ++++++++++++++ MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 7 ++++--- .../LiveTv/StreamResponseInfo.cs | 20 -------------------- .../MediaBrowser.Controller.csproj | 2 -- 11 files changed, 52 insertions(+), 55 deletions(-) delete mode 100644 MediaBrowser.Controller/Dlna/DlnaIconResponse.cs delete mode 100644 MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Dlna/DlnaIconResponse.cs b/MediaBrowser.Controller/Dlna/DlnaIconResponse.cs deleted file mode 100644 index 5ae92082d..000000000 --- a/MediaBrowser.Controller/Dlna/DlnaIconResponse.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.IO; -using MediaBrowser.Model.Drawing; - -namespace MediaBrowser.Controller.Dlna -{ - public class DlnaIconResponse : IDisposable - { - public Stream Stream { get; set; } - - public ImageFormat Format { get; set; } - - public void Dispose() - { - if (Stream != null) - { - Stream.Dispose(); - Stream = null; - } - } - } -} diff --git a/MediaBrowser.Controller/Dlna/IDlnaManager.cs b/MediaBrowser.Controller/Dlna/IDlnaManager.cs index b7a06b368..34464f6a2 100644 --- a/MediaBrowser.Controller/Dlna/IDlnaManager.cs +++ b/MediaBrowser.Controller/Dlna/IDlnaManager.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.Dlna; +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Model.Dlna; using System.Collections.Generic; namespace MediaBrowser.Controller.Dlna @@ -69,6 +70,6 @@ namespace MediaBrowser.Controller.Dlna /// /// The filename. /// DlnaIconResponse. - DlnaIconResponse GetIcon(string filename); + ImageStream GetIcon(string filename); } } diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs index 61b2caec0..7c7ec56d5 100644 --- a/MediaBrowser.Controller/Dto/IDtoService.cs +++ b/MediaBrowser.Controller/Dto/IDtoService.cs @@ -22,7 +22,8 @@ namespace MediaBrowser.Controller.Dto /// /// The dto. /// The item. - void AttachPrimaryImageAspectRatio(IItemDto dto, IHasImages item); + /// The fields. + void AttachPrimaryImageAspectRatio(IItemDto dto, IHasImages item, List fields); /// /// Gets the base item dto. @@ -34,6 +35,16 @@ namespace MediaBrowser.Controller.Dto /// Task{BaseItemDto}. BaseItemDto GetBaseItemDto(BaseItem item, List fields, User user = null, BaseItem owner = null); + /// + /// Gets the base item dto. + /// + /// The item. + /// The options. + /// The user. + /// The owner. + /// BaseItemDto. + BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null); + /// /// Gets the chapter information dto. /// @@ -51,12 +62,13 @@ namespace MediaBrowser.Controller.Dto /// /// Gets the item by name dto. /// + /// /// The item. - /// The fields. + /// The options. /// The tagged items. /// The user. /// BaseItemDto. - BaseItemDto GetItemByNameDto(T item, List fields, List taggedItems, User user = null) + BaseItemDto GetItemByNameDto(T item, DtoOptions options, List taggedItems, User user = null) where T : BaseItem, IItemByName; } } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 990ea49f6..ea615f023 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1820,7 +1820,11 @@ namespace MediaBrowser.Controller.Entities if (pct > 0) { pct = userData.PlaybackPositionTicks / pct; - dto.PlayedPercentage = 100 * pct; + + if (pct > 0) + { + dto.PlayedPercentage = 100 * pct; + } } } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 34f52aac5..0e712dc45 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -103,7 +103,7 @@ namespace MediaBrowser.Controller.Entities if (item.Id == Guid.Empty) { - item.Id = item.Path.GetMBId(item.GetType()); + item.Id = LibraryManager.GetNewItemId(item.Path, item.GetType()); } if (ActualChildren.Any(i => i.Id == item.Id)) diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 0bbd2eeca..3fa0a0435 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -4,6 +4,7 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Connect; using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Users; using System; using System.IO; using System.Linq; @@ -287,7 +288,7 @@ namespace MediaBrowser.Controller.Entities var localTime = date.ToLocalTime(); - return DayOfWeekHelper.GetDaysOfWeek(schedule.DayOfWeek).Contains(localTime.DayOfWeek) && + return DayOfWeekHelper.GetDaysOfWeek(schedule.DayOfWeek).Contains(localTime.DayOfWeek) && IsWithinTime(schedule, localTime); } diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 3367f98e4..10fee05a9 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -414,5 +414,13 @@ namespace MediaBrowser.Controller.Library IEnumerable GetAdditionalParts(string file, VideoType type, IEnumerable files); + + /// + /// Gets the new item identifier. + /// + /// The key. + /// The type. + /// Guid. + Guid GetNewItemId(string key, Type type); } } \ No newline at end of file diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs index bd44f786f..debdafe4d 100644 --- a/MediaBrowser.Controller/Library/IUserManager.cs +++ b/MediaBrowser.Controller/Library/IUserManager.cs @@ -164,5 +164,19 @@ namespace MediaBrowser.Controller.Library /// The pin. /// true if XXXX, false otherwise. Task RedeemPasswordResetPin(string pin); + + /// + /// Gets the user policy. + /// + /// The user identifier. + /// UserPolicy. + UserPolicy GetUserPolicy(string userId); + + /// + /// Updates the user policy. + /// + /// The user identifier. + /// The user policy. + Task UpdateUserPolicy(string userId, UserPolicy userPolicy); } } diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index eda69b164..993db0004 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Channels; +using MediaBrowser.Controller.Drawing; namespace MediaBrowser.Controller.LiveTv { @@ -109,7 +110,7 @@ namespace MediaBrowser.Controller.LiveTv /// The channel identifier. /// The cancellation token. /// Task{Stream}. - Task GetChannelImageAsync(string channelId, CancellationToken cancellationToken); + Task GetChannelImageAsync(string channelId, CancellationToken cancellationToken); /// /// Gets the recording image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to RecordingInfo @@ -117,7 +118,7 @@ namespace MediaBrowser.Controller.LiveTv /// The recording identifier. /// The cancellation token. /// Task{ImageResponseInfo}. - Task GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken); + Task GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken); /// /// Gets the program image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to ProgramInfo @@ -126,7 +127,7 @@ namespace MediaBrowser.Controller.LiveTv /// The channel identifier. /// The cancellation token. /// Task{ImageResponseInfo}. - Task GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken); + Task GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken); /// /// Gets the recordings asynchronous. diff --git a/MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs b/MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs deleted file mode 100644 index cb6aa22d2..000000000 --- a/MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.IO; -using MediaBrowser.Model.Drawing; - -namespace MediaBrowser.Controller.LiveTv -{ - public class StreamResponseInfo - { - /// - /// Gets or sets the stream. - /// - /// The stream. - public Stream Stream { get; set; } - - /// - /// Gets or sets the type of the MIME. - /// - /// The type of the MIME. - public ImageFormat Format { get; set; } - } -} diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 931bc51d1..dbff88fd8 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -105,7 +105,6 @@ - @@ -191,7 +190,6 @@ - -- cgit v1.2.3