add new image params

This commit is contained in:
Luke Pulverenti
2014-11-30 14:01:33 -05:00
parent f9ba260a19
commit d7bdb744ca
44 changed files with 520 additions and 206 deletions

View File

@@ -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;
}
}
}
}

View File

@@ -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);
}
}

View File

@@ -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.
@@ -34,6 +35,16 @@ namespace MediaBrowser.Controller.Dto
/// <returns>Task{BaseItemDto}.</returns>
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>
@@ -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;
}
}

View File

@@ -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;
}
}
}
}

View File

@@ -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))

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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.

View File

@@ -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; }
}
}

View File

@@ -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" />