aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Dlna/DlnaIconResponse.cs22
-rw-r--r--MediaBrowser.Controller/Dlna/IDlnaManager.cs5
-rw-r--r--MediaBrowser.Controller/Dto/IDtoService.cs18
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs6
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs2
-rw-r--r--MediaBrowser.Controller/Entities/User.cs3
-rw-r--r--MediaBrowser.Controller/Library/ILibraryManager.cs8
-rw-r--r--MediaBrowser.Controller/Library/IUserManager.cs14
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvService.cs7
-rw-r--r--MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs20
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj2
11 files changed, 52 insertions, 55 deletions
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
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>DlnaIconResponse.</returns>
- 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
/// </summary>
/// <param name="dto">The dto.</param>
/// <param name="item">The item.</param>
- void AttachPrimaryImageAspectRatio(IItemDto dto, IHasImages item);
+ /// <param name="fields">The fields.</param>
+ void AttachPrimaryImageAspectRatio(IItemDto dto, IHasImages item, List<ItemFields> fields);
/// <summary>
/// Gets the base item dto.
@@ -35,6 +36,16 @@ namespace MediaBrowser.Controller.Dto
BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null);
/// <summary>
+ /// Gets the base item dto.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ /// <param name="options">The options.</param>
+ /// <param name="user">The user.</param>
+ /// <param name="owner">The owner.</param>
+ /// <returns>BaseItemDto.</returns>
+ BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null);
+
+ /// <summary>
/// Gets the chapter information dto.
/// </summary>
/// <param name="item">The item.</param>
@@ -51,12 +62,13 @@ namespace MediaBrowser.Controller.Dto
/// <summary>
/// Gets the item by name dto.
/// </summary>
+ /// <typeparam name="T"></typeparam>
/// <param name="item">The item.</param>
- /// <param name="fields">The fields.</param>
+ /// <param name="options">The options.</param>
/// <param name="taggedItems">The tagged items.</param>
/// <param name="user">The user.</param>
/// <returns>BaseItemDto.</returns>
- BaseItemDto GetItemByNameDto<T>(T item, List<ItemFields> fields, List<BaseItem> taggedItems, User user = null)
+ BaseItemDto GetItemByNameDto<T>(T item, DtoOptions options, List<BaseItem> 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<FileSystemInfo> GetAdditionalParts(string file,
VideoType type,
IEnumerable<FileSystemInfo> files);
+
+ /// <summary>
+ /// Gets the new item identifier.
+ /// </summary>
+ /// <param name="key">The key.</param>
+ /// <param name="type">The type.</param>
+ /// <returns>Guid.</returns>
+ 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
/// <param name="pin">The pin.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
Task<PinRedeemResult> RedeemPasswordResetPin(string pin);
+
+ /// <summary>
+ /// Gets the user policy.
+ /// </summary>
+ /// <param name="userId">The user identifier.</param>
+ /// <returns>UserPolicy.</returns>
+ UserPolicy GetUserPolicy(string userId);
+
+ /// <summary>
+ /// Updates the user policy.
+ /// </summary>
+ /// <param name="userId">The user identifier.</param>
+ /// <param name="userPolicy">The user policy.</param>
+ 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
/// <param name="channelId">The channel identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
- Task<StreamResponseInfo> GetChannelImageAsync(string channelId, CancellationToken cancellationToken);
+ Task<ImageStream> GetChannelImageAsync(string channelId, CancellationToken cancellationToken);
/// <summary>
/// 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
/// <param name="recordingId">The recording identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{ImageResponseInfo}.</returns>
- Task<StreamResponseInfo> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken);
+ Task<ImageStream> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken);
/// <summary>
/// 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
/// <param name="channelId">The channel identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{ImageResponseInfo}.</returns>
- Task<StreamResponseInfo> GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken);
+ Task<ImageStream> GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken);
/// <summary>
/// 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
- {
- /// <summary>
- /// Gets or sets the stream.
- /// </summary>
- /// <value>The stream.</value>
- public Stream Stream { get; set; }
-
- /// <summary>
- /// Gets or sets the type of the MIME.
- /// </summary>
- /// <value>The type of the MIME.</value>
- 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 @@
<Compile Include="Devices\IDeviceRepository.cs" />
<Compile Include="Dlna\ControlRequest.cs" />
<Compile Include="Dlna\ControlResponse.cs" />
- <Compile Include="Dlna\DlnaIconResponse.cs" />
<Compile Include="Dlna\EventSubscriptionResponse.cs" />
<Compile Include="Dlna\IConnectionManager.cs" />
<Compile Include="Dlna\IContentDirectory.cs" />
@@ -191,7 +190,6 @@
<Compile Include="LiveTv\LiveTvException.cs" />
<Compile Include="LiveTv\LiveTvServiceStatusInfo.cs" />
<Compile Include="LiveTv\LiveTvTunerInfo.cs" />
- <Compile Include="LiveTv\StreamResponseInfo.cs" />
<Compile Include="LiveTv\LiveTvProgram.cs" />
<Compile Include="LiveTv\LiveTvVideoRecording.cs" />
<Compile Include="LiveTv\ProgramInfo.cs" />