Removed guids from the model project

pull/702/head
Luke Pulverenti 10 years ago
parent 374dd8d441
commit f02c326027

@ -556,7 +556,7 @@ namespace MediaBrowser.Api.DefaultTheme
// Avoid implicitly captured closure // Avoid implicitly captured closure
var currentUserId1 = user.Id; var currentUserId1 = user.Id;
view.LatestMovies = movies view.LatestMovies = movies
.OrderByDescending(i => i.DateCreated) .OrderByDescending(i => i.DateCreated)
.Where(i => !_userDataManager.GetUserData(currentUserId1, i.GetUserDataKey()).Played) .Where(i => !_userDataManager.GetUserData(currentUserId1, i.GetUserDataKey()).Played)
@ -622,9 +622,9 @@ namespace MediaBrowser.Api.DefaultTheme
{ {
var tag = _imageProcessor.GetImageCacheTag(item, imageType); var tag = _imageProcessor.GetImageCacheTag(item, imageType);
if (tag.HasValue) if (tag != null)
{ {
stub.ImageTag = tag.Value; stub.ImageTag = tag;
} }
} }
catch (Exception ex) catch (Exception ex)

@ -9,7 +9,7 @@ namespace MediaBrowser.Api.DefaultTheme
{ {
public string Name { get; set; } public string Name { get; set; }
public string Id { get; set; } public string Id { get; set; }
public Guid ImageTag { get; set; } public string ImageTag { get; set; }
public ImageType ImageType { get; set; } public ImageType ImageType { get; set; }
} }

@ -77,15 +77,16 @@ namespace MediaBrowser.Api
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
public object Get(GetDisplayPreferences request) public object Get(GetDisplayPreferences request)
{ {
Guid displayPreferencesId; var result = _displayPreferencesManager.GetDisplayPreferences(request.Id, request.UserId, request.Client);
if (!Guid.TryParse(request.Id, out displayPreferencesId)) if (result == null)
{ {
displayPreferencesId = request.Id.GetMD5(); result = new DisplayPreferences
{
Id = request.Id
};
} }
var result = _displayPreferencesManager.GetDisplayPreferences(displayPreferencesId, request.UserId, request.Client);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }

@ -548,7 +548,7 @@ namespace MediaBrowser.Api.Images
var contentType = GetMimeType(request.Format, imageInfo.Path); var contentType = GetMimeType(request.Format, imageInfo.Path);
var cacheGuid = _imageProcessor.GetImageCacheTag(item, request.Type, imageInfo.Path, originalFileImageDateModified, supportedImageEnhancers); var cacheGuid = new Guid(_imageProcessor.GetImageCacheTag(item, request.Type, imageInfo.Path, originalFileImageDateModified, supportedImageEnhancers));
TimeSpan? cacheDuration = null; TimeSpan? cacheDuration = null;

@ -112,7 +112,7 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Installation Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] [ApiMember(Name = "Id", Description = "Installation Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public Guid Id { get; set; } public string Id { get; set; }
} }
/// <summary> /// <summary>
@ -221,7 +221,7 @@ namespace MediaBrowser.Api
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
public void Delete(CancelPackageInstallation request) public void Delete(CancelPackageInstallation request)
{ {
var info = _installationManager.CurrentInstallations.FirstOrDefault(i => i.Item1.Id == request.Id); var info = _installationManager.CurrentInstallations.FirstOrDefault(i => string.Equals(i.Item1.Id, request.Id));
if (info != null) if (info != null)
{ {

@ -171,9 +171,9 @@ namespace MediaBrowser.Api
var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary);
if (primaryImageTag.HasValue) if (primaryImageTag != null)
{ {
result.PrimaryImageTag = primaryImageTag.Value; result.PrimaryImageTag = primaryImageTag;
} }
SetThumbImageInfo(result, item); SetThumbImageInfo(result, item);
@ -250,9 +250,9 @@ namespace MediaBrowser.Api
{ {
var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Thumb); var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Thumb);
if (tag.HasValue) if (tag != null)
{ {
hint.ThumbImageTag = tag.Value; hint.ThumbImageTag = tag;
hint.ThumbImageItemId = itemWithImage.Id.ToString("N"); hint.ThumbImageItemId = itemWithImage.Id.ToString("N");
} }
} }
@ -271,9 +271,9 @@ namespace MediaBrowser.Api
{ {
var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Backdrop); var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Backdrop);
if (tag.HasValue) if (tag != null)
{ {
hint.BackdropImageTag = tag.Value; hint.BackdropImageTag = tag;
hint.BackdropImageItemId = itemWithImage.Id.ToString("N"); hint.BackdropImageItemId = itemWithImage.Id.ToString("N");
} }
} }

@ -1,5 +1,4 @@
using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
@ -8,7 +7,6 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session; using MediaBrowser.Model.Session;
using ServiceStack; using ServiceStack;
using System; using System;

@ -13,6 +13,7 @@ using MediaBrowser.Common.Progress;
using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Common.Security; using MediaBrowser.Common.Security;
using MediaBrowser.Common.Updates; using MediaBrowser.Common.Updates;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;

@ -531,7 +531,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
EndTimeUtc = endTime, EndTimeUtc = endTime,
Status = status, Status = status,
Name = Name, Name = Name,
Id = Id Id = Id.ToString("N")
}; };
if (ex != null) if (ex != null)

@ -1,6 +1,7 @@
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events; using MediaBrowser.Common.Events;
using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;

@ -5,6 +5,7 @@ using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Progress; using MediaBrowser.Common.Progress;
using MediaBrowser.Common.Security; using MediaBrowser.Common.Security;
using MediaBrowser.Common.Updates; using MediaBrowser.Common.Updates;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Updates; using MediaBrowser.Model.Updates;
@ -367,7 +368,7 @@ namespace MediaBrowser.Common.Implementations.Updates
var installationInfo = new InstallationInfo var installationInfo = new InstallationInfo
{ {
Id = Guid.NewGuid(), Id = Guid.NewGuid().ToString("N"),
Name = package.name, Name = package.name,
AssemblyGuid = package.guid, AssemblyGuid = package.guid,
UpdateClass = package.classification, UpdateClass = package.classification,
@ -510,13 +511,14 @@ namespace MediaBrowser.Common.Implementations.Updates
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
// Validate with a checksum // Validate with a checksum
if (package.checksum != Guid.Empty) // support for legacy uploads for now var packageChecksum = string.IsNullOrWhiteSpace(package.checksum) ? Guid.Empty : new Guid(package.checksum);
if (packageChecksum != Guid.Empty) // support for legacy uploads for now
{ {
using (var crypto = new MD5CryptoServiceProvider()) using (var crypto = new MD5CryptoServiceProvider())
using (var stream = new BufferedStream(File.OpenRead(tempFile), 100000)) using (var stream = new BufferedStream(File.OpenRead(tempFile), 100000))
{ {
var check = Guid.Parse(BitConverter.ToString(crypto.ComputeHash(stream)).Replace("-", String.Empty)); var check = Guid.Parse(BitConverter.ToString(crypto.ComputeHash(stream)).Replace("-", String.Empty));
if (check != package.checksum) if (check != packageChecksum)
{ {
throw new ApplicationException(string.Format("Download validation failed for {0}. Probably corrupted during transfer.", package.name)); throw new ApplicationException(string.Format("Download validation failed for {0}. Probably corrupted during transfer.", package.name));
} }

@ -1,5 +1,5 @@
using MediaBrowser.Common.Events; using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Plugins; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Updates; using MediaBrowser.Model.Updates;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

@ -59,7 +59,6 @@
<Compile Include="Constants\Constants.cs" /> <Compile Include="Constants\Constants.cs" />
<Compile Include="Events\EventHelper.cs" /> <Compile Include="Events\EventHelper.cs" />
<Compile Include="Extensions\BaseExtensions.cs" /> <Compile Include="Extensions\BaseExtensions.cs" />
<Compile Include="Events\GenericEventArgs.cs" />
<Compile Include="Extensions\ResourceNotFoundException.cs" /> <Compile Include="Extensions\ResourceNotFoundException.cs" />
<Compile Include="IO\FileSystemRepository.cs" /> <Compile Include="IO\FileSystemRepository.cs" />
<Compile Include="IO\IFileSystem.cs" /> <Compile Include="IO\IFileSystem.cs" />

@ -1,4 +1,4 @@
using MediaBrowser.Common.Events; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

@ -38,7 +38,7 @@ namespace MediaBrowser.Common.ScheduledTasks
Name = task.Name, Name = task.Name,
CurrentProgressPercentage = task.CurrentProgress, CurrentProgressPercentage = task.CurrentProgress,
State = task.State, State = task.State,
Id = task.Id, Id = task.Id.ToString("N"),
LastExecutionResult = task.LastExecutionResult, LastExecutionResult = task.LastExecutionResult,
Triggers = task.Triggers.Select(GetTriggerInfo).ToList(), Triggers = task.Triggers.Select(GetTriggerInfo).ToList(),
Description = task.Description, Description = task.Description,

@ -1,5 +1,5 @@
using MediaBrowser.Common.Events; using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Plugins; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Updates; using MediaBrowser.Model.Updates;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;

@ -1,6 +1,6 @@
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Events;
using System; using System;
namespace MediaBrowser.Controller.Configuration namespace MediaBrowser.Controller.Configuration

@ -55,7 +55,7 @@ namespace MediaBrowser.Controller.Drawing
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <param name="image">The image.</param> /// <param name="image">The image.</param>
/// <returns>Guid.</returns> /// <returns>Guid.</returns>
Guid GetImageCacheTag(IHasImages item, ItemImageInfo image); string GetImageCacheTag(IHasImages item, ItemImageInfo image);
/// <summary> /// <summary>
/// Gets the image cache tag. /// Gets the image cache tag.
@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.Drawing
/// <param name="dateModified">The date modified.</param> /// <param name="dateModified">The date modified.</param>
/// <param name="imageEnhancers">The image enhancers.</param> /// <param name="imageEnhancers">The image enhancers.</param>
/// <returns>Guid.</returns> /// <returns>Guid.</returns>
Guid GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, string GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified,
List<IImageEnhancer> imageEnhancers); List<IImageEnhancer> imageEnhancers);
/// <summary> /// <summary>
@ -89,12 +89,12 @@ namespace MediaBrowser.Controller.Drawing
public static class ImageProcessorExtensions public static class ImageProcessorExtensions
{ {
public static Guid? GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType) public static string GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType)
{ {
return processor.GetImageCacheTag(item, imageType, 0); return processor.GetImageCacheTag(item, imageType, 0);
} }
public static Guid? GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType, int imageIndex) public static string GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType, int imageIndex)
{ {
var imageInfo = item.GetImageInfo(imageType, imageIndex); var imageInfo = item.GetImageInfo(imageType, imageIndex);

@ -1,5 +1,5 @@
using MediaBrowser.Common.Events; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Events;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;

@ -34,6 +34,6 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="userId">The user id.</param> /// <param name="userId">The user id.</param>
/// <param name="client">The client.</param> /// <param name="client">The client.</param>
/// <returns>Task{DisplayPreferences}.</returns> /// <returns>Task{DisplayPreferences}.</returns>
DisplayPreferences GetDisplayPreferences(Guid displayPreferencesId, Guid userId, string client); DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client);
} }
} }

@ -19,14 +19,6 @@ namespace MediaBrowser.Controller.Session
/// <value><c>true</c> if this instance is session active; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is session active; otherwise, <c>false</c>.</value>
bool IsSessionActive { get; } bool IsSessionActive { get; }
/// <summary>
/// Sends the message command.
/// </summary>
/// <param name="command">The command.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Sends the play command. /// Sends the play command.
/// </summary> /// </summary>

@ -623,9 +623,7 @@ namespace MediaBrowser.Dlna.Didl
try try
{ {
var guid = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); tag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary);
tag = guid.HasValue ? guid.Value.ToString("N") : null;
} }
catch catch
{ {
@ -712,7 +710,7 @@ namespace MediaBrowser.Dlna.Didl
Height = height.Value, Height = height.Value,
Width = width.Value Width = width.Value
}, maxWidth: maxWidth, maxHeight: maxHeight); }, null, null, maxWidth, maxHeight);
width = Convert.ToInt32(newSize.Width); width = Convert.ToInt32(newSize.Width);
height = Convert.ToInt32(newSize.Height); height = Convert.ToInt32(newSize.Height);

@ -355,11 +355,6 @@ namespace MediaBrowser.Dlna.PlayTo
return Task.FromResult(true); return Task.FromResult(true);
} }
public Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken)
{
return Task.FromResult(true);
}
#endregion #endregion
#region Playlist #region Playlist

@ -278,6 +278,9 @@
<Compile Include="..\MediaBrowser.Model\Entities\VirtualFolderInfo.cs"> <Compile Include="..\MediaBrowser.Model\Entities\VirtualFolderInfo.cs">
<Link>Entities\VirtualFolderInfo.cs</Link> <Link>Entities\VirtualFolderInfo.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Events\GenericEventArgs.cs">
<Link>Events\GenericEventArgs.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\FileOrganization\FileOrganizationQuery.cs"> <Compile Include="..\MediaBrowser.Model\FileOrganization\FileOrganizationQuery.cs">
<Link>FileOrganization\FileOrganizationQuery.cs</Link> <Link>FileOrganization\FileOrganizationQuery.cs</Link>
</Compile> </Compile>

@ -265,6 +265,9 @@
<Compile Include="..\MediaBrowser.Model\Entities\VirtualFolderInfo.cs"> <Compile Include="..\MediaBrowser.Model\Entities\VirtualFolderInfo.cs">
<Link>Entities\VirtualFolderInfo.cs</Link> <Link>Entities\VirtualFolderInfo.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Events\GenericEventArgs.cs">
<Link>Events\GenericEventArgs.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\FileOrganization\FileOrganizationQuery.cs"> <Compile Include="..\MediaBrowser.Model\FileOrganization\FileOrganizationQuery.cs">
<Link>FileOrganization\FileOrganizationQuery.cs</Link> <Link>FileOrganization\FileOrganizationQuery.cs</Link>
</Compile> </Compile>

@ -138,7 +138,7 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="notificationIdList">The notification id list.</param> /// <param name="notificationIdList">The notification id list.</param>
/// <param name="isRead">if set to <c>true</c> [is read].</param> /// <param name="isRead">if set to <c>true</c> [is read].</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
Task MarkNotificationsRead(string userId, IEnumerable<Guid> notificationIdList, bool isRead); Task MarkNotificationsRead(string userId, IEnumerable<string> notificationIdList, bool isRead);
/// <summary> /// <summary>
/// Gets the notifications summary. /// Gets the notifications summary.
@ -447,7 +447,7 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="id">The id.</param> /// <param name="id">The id.</param>
/// <returns>Task{TaskInfo}.</returns> /// <returns>Task{TaskInfo}.</returns>
/// <exception cref="ArgumentNullException">id</exception> /// <exception cref="ArgumentNullException">id</exception>
Task<TaskInfo> GetScheduledTaskAsync(Guid id); Task<TaskInfo> GetScheduledTaskAsync(string id);
/// <summary> /// <summary>
/// Gets a user by id /// Gets a user by id
@ -581,6 +581,38 @@ namespace MediaBrowser.Model.ApiClient
/// <returns>Task.</returns> /// <returns>Task.</returns>
Task SendCommandAsync(string sessionId, GeneralCommand command); Task SendCommandAsync(string sessionId, GeneralCommand command);
/// <summary>
/// Sends the string.
/// </summary>
/// <param name="sessionId">The session identifier.</param>
/// <param name="text">The text.</param>
/// <returns>Task.</returns>
Task SendString(string sessionId, string text);
/// <summary>
/// Sets the volume.
/// </summary>
/// <param name="sessionId">The session identifier.</param>
/// <param name="volume">The volume.</param>
/// <returns>Task.</returns>
Task SetVolume(string sessionId, int volume);
/// <summary>
/// Sets the index of the audio stream.
/// </summary>
/// <param name="sessionId">The session identifier.</param>
/// <param name="volume">The volume.</param>
/// <returns>Task.</returns>
Task SetAudioStreamIndex(string sessionId, int? volume);
/// <summary>
/// Sets the index of the subtitle stream.
/// </summary>
/// <param name="sessionId">The session identifier.</param>
/// <param name="volume">The volume.</param>
/// <returns>Task.</returns>
Task SetSubtitleStreamIndex(string sessionId, int? volume);
/// <summary> /// <summary>
/// Instructs the client to display a message to the user /// Instructs the client to display a message to the user
/// </summary> /// </summary>
@ -632,7 +664,7 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="triggers">The triggers.</param> /// <param name="triggers">The triggers.</param>
/// <returns>Task{RequestResult}.</returns> /// <returns>Task{RequestResult}.</returns>
/// <exception cref="ArgumentNullException">id</exception> /// <exception cref="ArgumentNullException">id</exception>
Task UpdateScheduledTaskTriggersAsync(Guid id, TaskTriggerInfo[] triggers); Task UpdateScheduledTaskTriggersAsync(string id, TaskTriggerInfo[] triggers);
/// <summary> /// <summary>
/// Gets the display preferences. /// Gets the display preferences.

@ -1,4 +1,11 @@
using System; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Updates;
using System;
namespace MediaBrowser.Model.ApiClient namespace MediaBrowser.Model.ApiClient
{ {
@ -10,59 +17,59 @@ namespace MediaBrowser.Model.ApiClient
/// <summary> /// <summary>
/// Occurs when [user deleted]. /// Occurs when [user deleted].
/// </summary> /// </summary>
event EventHandler<UserDeletedEventArgs> UserDeleted; event EventHandler<GenericEventArgs<string>> UserDeleted;
/// <summary> /// <summary>
/// Occurs when [scheduled task started]. /// Occurs when [scheduled task started].
/// </summary> /// </summary>
event EventHandler<ScheduledTaskStartedEventArgs> ScheduledTaskStarted; event EventHandler<GenericEventArgs<string>> ScheduledTaskStarted;
/// <summary> /// <summary>
/// Occurs when [scheduled task ended]. /// Occurs when [scheduled task ended].
/// </summary> /// </summary>
event EventHandler<ScheduledTaskEndedEventArgs> ScheduledTaskEnded; event EventHandler<GenericEventArgs<TaskResult>> ScheduledTaskEnded;
/// <summary> /// <summary>
/// Occurs when [package installing]. /// Occurs when [package installing].
/// </summary> /// </summary>
event EventHandler<PackageInstallationEventArgs> PackageInstalling; event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstalling;
/// <summary> /// <summary>
/// Occurs when [package installation failed]. /// Occurs when [package installation failed].
/// </summary> /// </summary>
event EventHandler<PackageInstallationEventArgs> PackageInstallationFailed; event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationFailed;
/// <summary> /// <summary>
/// Occurs when [package installation completed]. /// Occurs when [package installation completed].
/// </summary> /// </summary>
event EventHandler<PackageInstallationEventArgs> PackageInstallationCompleted; event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationCompleted;
/// <summary> /// <summary>
/// Occurs when [package installation cancelled]. /// Occurs when [package installation cancelled].
/// </summary> /// </summary>
event EventHandler<PackageInstallationEventArgs> PackageInstallationCancelled; event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationCancelled;
/// <summary> /// <summary>
/// Occurs when [user updated]. /// Occurs when [user updated].
/// </summary> /// </summary>
event EventHandler<UserUpdatedEventArgs> UserUpdated; event EventHandler<GenericEventArgs<UserDto>> UserUpdated;
/// <summary> /// <summary>
/// Occurs when [plugin uninstalled]. /// Occurs when [plugin uninstalled].
/// </summary> /// </summary>
event EventHandler<PluginUninstallEventArgs> PluginUninstalled; event EventHandler<GenericEventArgs<PluginInfo>> PluginUninstalled;
/// <summary> /// <summary>
/// Occurs when [library changed]. /// Occurs when [library changed].
/// </summary> /// </summary>
event EventHandler<LibraryChangedEventArgs> LibraryChanged; event EventHandler<GenericEventArgs<LibraryUpdateInfo>> LibraryChanged;
/// <summary> /// <summary>
/// Occurs when [browse command]. /// Occurs when [browse command].
/// </summary> /// </summary>
event EventHandler<BrowseRequestEventArgs> BrowseCommand; event EventHandler<GenericEventArgs<BrowseRequest>> BrowseCommand;
/// <summary> /// <summary>
/// Occurs when [play command]. /// Occurs when [play command].
/// </summary> /// </summary>
event EventHandler<PlayRequestEventArgs> PlayCommand; event EventHandler<GenericEventArgs<PlayRequest>> PlayCommand;
/// <summary> /// <summary>
/// Occurs when [playstate command]. /// Occurs when [playstate command].
/// </summary> /// </summary>
event EventHandler<PlaystateRequestEventArgs> PlaystateCommand; event EventHandler<GenericEventArgs<PlaystateRequest>> PlaystateCommand;
/// <summary> /// <summary>
/// Occurs when [message command]. /// Occurs when [message command].
/// </summary> /// </summary>
event EventHandler<MessageCommandEventArgs> MessageCommand; event EventHandler<GenericEventArgs<MessageCommand>> MessageCommand;
/// <summary> /// <summary>
/// Occurs when [system command]. /// Occurs when [system command].
/// </summary> /// </summary>
@ -88,6 +95,22 @@ namespace MediaBrowser.Model.ApiClient
/// </summary> /// </summary>
event EventHandler<EventArgs> ServerShuttingDown; event EventHandler<EventArgs> ServerShuttingDown;
/// <summary> /// <summary>
/// Occurs when [send text command].
/// </summary>
event EventHandler<GenericEventArgs<string>> SendTextCommand;
/// <summary>
/// Occurs when [set volume command].
/// </summary>
event EventHandler<GenericEventArgs<int>> SetVolumeCommand;
/// <summary>
/// Occurs when [set audio stream index command].
/// </summary>
event EventHandler<GenericEventArgs<int>> SetAudioStreamIndexCommand;
/// <summary>
/// Occurs when [set video stream index command].
/// </summary>
event EventHandler<GenericEventArgs<int>> SetVideoStreamIndexCommand;
/// <summary>
/// Occurs when [sessions updated]. /// Occurs when [sessions updated].
/// </summary> /// </summary>
event EventHandler<SessionUpdatesEventArgs> SessionsUpdated; event EventHandler<SessionUpdatesEventArgs> SessionsUpdated;
@ -98,7 +121,7 @@ namespace MediaBrowser.Model.ApiClient
/// <summary> /// <summary>
/// Occurs when [user data changed]. /// Occurs when [user data changed].
/// </summary> /// </summary>
event EventHandler<UserDataChangedEventArgs> UserDataChanged; event EventHandler<GenericEventArgs<UserDataChangeInfo>> UserDataChanged;
/// <summary> /// <summary>
/// Occurs when [connected]. /// Occurs when [connected].
/// </summary> /// </summary>

@ -1,154 +1,8 @@
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Session;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Updates;
using System; using System;
namespace MediaBrowser.Model.ApiClient namespace MediaBrowser.Model.ApiClient
{ {
/// <summary>
/// Class UserDeletedEventArgs
/// </summary>
public class UserDeletedEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public string Id { get; set; }
}
public class UserDataChangedEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public UserDataChangeInfo ChangeInfo { get; set; }
}
/// <summary>
/// Class UserUpdatedEventArgs
/// </summary>
public class UserUpdatedEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public UserDto User { get; set; }
}
/// <summary>
/// Class ScheduledTaskStartedEventArgs
/// </summary>
public class ScheduledTaskStartedEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
}
/// <summary>
/// Class ScheduledTaskEndedEventArgs
/// </summary>
public class ScheduledTaskEndedEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the result.
/// </summary>
/// <value>The result.</value>
public TaskResult Result { get; set; }
}
/// <summary>
/// Class PackageInstallationEventArgs
/// </summary>
public class PackageInstallationEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the installation info.
/// </summary>
/// <value>The installation info.</value>
public InstallationInfo InstallationInfo { get; set; }
}
/// <summary>
/// Class PluginUninstallEventArgs
/// </summary>
public class PluginUninstallEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the plugin info.
/// </summary>
/// <value>The plugin info.</value>
public PluginInfo PluginInfo { get; set; }
}
/// <summary>
/// Class LibraryChangedEventArgs
/// </summary>
public class LibraryChangedEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the update info.
/// </summary>
/// <value>The update info.</value>
public LibraryUpdateInfo UpdateInfo { get; set; }
}
/// <summary>
/// Class BrowseRequestEventArgs
/// </summary>
public class BrowseRequestEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the request.
/// </summary>
/// <value>The request.</value>
public BrowseRequest Request { get; set; }
}
/// <summary>
/// Class PlayRequestEventArgs
/// </summary>
public class PlayRequestEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the request.
/// </summary>
/// <value>The request.</value>
public PlayRequest Request { get; set; }
}
/// <summary>
/// Class PlaystateRequestEventArgs
/// </summary>
public class PlaystateRequestEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the request.
/// </summary>
/// <value>The request.</value>
public PlaystateRequest Request { get; set; }
}
/// <summary>
/// Class MessageCommandEventArgs
/// </summary>
public class MessageCommandEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the request.
/// </summary>
/// <value>The request.</value>
public MessageCommand Request { get; set; }
}
/// <summary> /// <summary>
/// Class SystemCommandEventArgs /// Class SystemCommandEventArgs
/// </summary> /// </summary>

@ -30,7 +30,7 @@ namespace MediaBrowser.Model.Configuration
public MetadataOptions(int backdropLimit, int minBackdropWidth) public MetadataOptions(int backdropLimit, int minBackdropWidth)
{ {
var imageOptions = new List<ImageOption> List<ImageOption> imageOptions = new List<ImageOption>
{ {
new ImageOption new ImageOption
{ {
@ -52,14 +52,14 @@ namespace MediaBrowser.Model.Configuration
public int GetLimit(ImageType type) public int GetLimit(ImageType type)
{ {
var option = ImageOptions.FirstOrDefault(i => i.Type == type); ImageOption option = ImageOptions.FirstOrDefault(i => i.Type == type);
return option == null ? 1 : option.Limit; return option == null ? 1 : option.Limit;
} }
public int GetMinWidth(ImageType type) public int GetMinWidth(ImageType type)
{ {
var option = ImageOptions.FirstOrDefault(i => i.Type == type); ImageOption option = ImageOptions.FirstOrDefault(i => i.Type == type);
return option == null ? 0 : option.MinWidth; return option == null ? 0 : option.MinWidth;
} }

@ -1,7 +1,6 @@
using System; using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna namespace MediaBrowser.Model.Dlna
{ {

@ -16,22 +16,22 @@ namespace MediaBrowser.Model.Dlna
{ {
ValidateAudioInput(options); ValidateAudioInput(options);
var mediaSources = options.MediaSources; List<MediaSourceInfo> mediaSources = options.MediaSources;
// If the client wants a specific media soure, filter now // If the client wants a specific media soure, filter now
if (!string.IsNullOrEmpty(options.MediaSourceId)) if (!string.IsNullOrEmpty(options.MediaSourceId))
{ {
// Avoid implicitly captured closure // Avoid implicitly captured closure
var mediaSourceId = options.MediaSourceId; string mediaSourceId = options.MediaSourceId;
mediaSources = mediaSources mediaSources = mediaSources
.Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase)) .Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
.ToList(); .ToList();
} }
var streams = mediaSources.Select(i => BuildAudioItem(i, options)).ToList(); List<StreamInfo> streams = mediaSources.Select(i => BuildAudioItem(i, options)).ToList();
foreach (var stream in streams) foreach (StreamInfo stream in streams)
{ {
stream.DeviceId = options.DeviceId; stream.DeviceId = options.DeviceId;
stream.DeviceProfileId = options.Profile.Id; stream.DeviceProfileId = options.Profile.Id;
@ -44,22 +44,22 @@ namespace MediaBrowser.Model.Dlna
{ {
ValidateInput(options); ValidateInput(options);
var mediaSources = options.MediaSources; List<MediaSourceInfo> mediaSources = options.MediaSources;
// If the client wants a specific media soure, filter now // If the client wants a specific media soure, filter now
if (!string.IsNullOrEmpty(options.MediaSourceId)) if (!string.IsNullOrEmpty(options.MediaSourceId))
{ {
// Avoid implicitly captured closure // Avoid implicitly captured closure
var mediaSourceId = options.MediaSourceId; string mediaSourceId = options.MediaSourceId;
mediaSources = mediaSources mediaSources = mediaSources
.Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase)) .Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
.ToList(); .ToList();
} }
var streams = mediaSources.Select(i => BuildVideoItem(i, options)).ToList(); List<StreamInfo> streams = mediaSources.Select(i => BuildVideoItem(i, options)).ToList();
foreach (var stream in streams) foreach (StreamInfo stream in streams)
{ {
stream.DeviceId = options.DeviceId; stream.DeviceId = options.DeviceId;
stream.DeviceProfileId = options.Profile.Id; stream.DeviceProfileId = options.Profile.Id;
@ -78,7 +78,7 @@ namespace MediaBrowser.Model.Dlna
private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options) private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options)
{ {
var playlistItem = new StreamInfo StreamInfo playlistItem = new StreamInfo
{ {
ItemId = options.ItemId, ItemId = options.ItemId,
MediaType = DlnaProfileType.Audio, MediaType = DlnaProfileType.Audio,
@ -86,30 +86,30 @@ namespace MediaBrowser.Model.Dlna
RunTimeTicks = item.RunTimeTicks RunTimeTicks = item.RunTimeTicks
}; };
var maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate; int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
var audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); MediaStream audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
// Honor the max bitrate setting // Honor the max bitrate setting
if (IsAudioEligibleForDirectPlay(item, maxBitrateSetting)) if (IsAudioEligibleForDirectPlay(item, maxBitrateSetting))
{ {
var directPlay = options.Profile.DirectPlayProfiles DirectPlayProfile directPlay = options.Profile.DirectPlayProfiles
.FirstOrDefault(i => i.Type == playlistItem.MediaType && IsAudioDirectPlaySupported(i, item, audioStream)); .FirstOrDefault(i => i.Type == playlistItem.MediaType && IsAudioDirectPlaySupported(i, item, audioStream));
if (directPlay != null) if (directPlay != null)
{ {
var audioCodec = audioStream == null ? null : audioStream.Codec; string audioCodec = audioStream == null ? null : audioStream.Codec;
// Make sure audio codec profiles are satisfied // Make sure audio codec profiles are satisfied
if (!string.IsNullOrEmpty(audioCodec)) if (!string.IsNullOrEmpty(audioCodec))
{ {
var conditionProcessor = new ConditionProcessor(); ConditionProcessor conditionProcessor = new ConditionProcessor();
var conditions = options.Profile.CodecProfiles.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(audioCodec)) IEnumerable<ProfileCondition> conditions = options.Profile.CodecProfiles.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(audioCodec))
.SelectMany(i => i.Conditions); .SelectMany(i => i.Conditions);
var audioChannels = audioStream == null ? null : audioStream.Channels; int? audioChannels = audioStream.Channels;
var audioBitrate = audioStream == null ? null : audioStream.BitRate; int? audioBitrate = audioStream.BitRate;
if (conditions.All(c => conditionProcessor.IsAudioConditionSatisfied(c, audioChannels, audioBitrate))) if (conditions.All(c => conditionProcessor.IsAudioConditionSatisfied(c, audioChannels, audioBitrate)))
{ {
@ -122,7 +122,7 @@ namespace MediaBrowser.Model.Dlna
} }
} }
var transcodingProfile = options.Profile.TranscodingProfiles TranscodingProfile transcodingProfile = options.Profile.TranscodingProfiles
.FirstOrDefault(i => i.Type == playlistItem.MediaType); .FirstOrDefault(i => i.Type == playlistItem.MediaType);
if (transcodingProfile != null) if (transcodingProfile != null)
@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.AudioCodec = transcodingProfile.AudioCodec; playlistItem.AudioCodec = transcodingProfile.AudioCodec;
playlistItem.Protocol = transcodingProfile.Protocol; playlistItem.Protocol = transcodingProfile.Protocol;
var audioTranscodingConditions = options.Profile.CodecProfiles IEnumerable<ProfileCondition> audioTranscodingConditions = options.Profile.CodecProfiles
.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec)) .Where(i => i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec))
.Take(1) .Take(1)
.SelectMany(i => i.Conditions); .SelectMany(i => i.Conditions);
@ -144,7 +144,7 @@ namespace MediaBrowser.Model.Dlna
// Honor requested max channels // Honor requested max channels
if (options.MaxAudioChannels.HasValue) if (options.MaxAudioChannels.HasValue)
{ {
var currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value; int currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value;
playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue); playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
} }
@ -152,7 +152,7 @@ namespace MediaBrowser.Model.Dlna
// Honor requested max bitrate // Honor requested max bitrate
if (maxBitrateSetting.HasValue) if (maxBitrateSetting.HasValue)
{ {
var currentValue = playlistItem.AudioBitrate ?? maxBitrateSetting.Value; int currentValue = playlistItem.AudioBitrate ?? maxBitrateSetting.Value;
playlistItem.AudioBitrate = Math.Min(maxBitrateSetting.Value, currentValue); playlistItem.AudioBitrate = Math.Min(maxBitrateSetting.Value, currentValue);
} }
@ -163,7 +163,7 @@ namespace MediaBrowser.Model.Dlna
private StreamInfo BuildVideoItem(MediaSourceInfo item, VideoOptions options) private StreamInfo BuildVideoItem(MediaSourceInfo item, VideoOptions options)
{ {
var playlistItem = new StreamInfo StreamInfo playlistItem = new StreamInfo
{ {
ItemId = options.ItemId, ItemId = options.ItemId,
MediaType = DlnaProfileType.Video, MediaType = DlnaProfileType.Video,
@ -171,15 +171,15 @@ namespace MediaBrowser.Model.Dlna
RunTimeTicks = item.RunTimeTicks RunTimeTicks = item.RunTimeTicks
}; };
var audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); MediaStream audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
var videoStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video); MediaStream videoStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
var maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate; int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
if (IsEligibleForDirectPlay(item, options, maxBitrateSetting)) if (IsEligibleForDirectPlay(item, options, maxBitrateSetting))
{ {
// See if it can be direct played // See if it can be direct played
var directPlay = GetVideoDirectPlayProfile(options.Profile, item, videoStream, audioStream); DirectPlayProfile directPlay = GetVideoDirectPlayProfile(options.Profile, item, videoStream, audioStream);
if (directPlay != null) if (directPlay != null)
{ {
@ -191,7 +191,7 @@ namespace MediaBrowser.Model.Dlna
} }
// Can't direct play, find the transcoding profile // Can't direct play, find the transcoding profile
var transcodingProfile = options.Profile.TranscodingProfiles TranscodingProfile transcodingProfile = options.Profile.TranscodingProfiles
.FirstOrDefault(i => i.Type == playlistItem.MediaType); .FirstOrDefault(i => i.Type == playlistItem.MediaType);
if (transcodingProfile != null) if (transcodingProfile != null)
@ -206,14 +206,14 @@ namespace MediaBrowser.Model.Dlna
playlistItem.AudioStreamIndex = options.AudioStreamIndex; playlistItem.AudioStreamIndex = options.AudioStreamIndex;
playlistItem.SubtitleStreamIndex = options.SubtitleStreamIndex; playlistItem.SubtitleStreamIndex = options.SubtitleStreamIndex;
var videoTranscodingConditions = options.Profile.CodecProfiles IEnumerable<ProfileCondition> videoTranscodingConditions = options.Profile.CodecProfiles
.Where(i => i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec)) .Where(i => i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec))
.Take(1) .Take(1)
.SelectMany(i => i.Conditions); .SelectMany(i => i.Conditions);
ApplyTranscodingConditions(playlistItem, videoTranscodingConditions); ApplyTranscodingConditions(playlistItem, videoTranscodingConditions);
var audioTranscodingConditions = options.Profile.CodecProfiles IEnumerable<ProfileCondition> audioTranscodingConditions = options.Profile.CodecProfiles
.Where(i => i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec)) .Where(i => i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec))
.Take(1) .Take(1)
.SelectMany(i => i.Conditions); .SelectMany(i => i.Conditions);
@ -223,7 +223,7 @@ namespace MediaBrowser.Model.Dlna
// Honor requested max channels // Honor requested max channels
if (options.MaxAudioChannels.HasValue) if (options.MaxAudioChannels.HasValue)
{ {
var currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value; int currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value;
playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue); playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
} }
@ -231,7 +231,7 @@ namespace MediaBrowser.Model.Dlna
// Honor requested max bitrate // Honor requested max bitrate
if (options.MaxAudioTranscodingBitrate.HasValue) if (options.MaxAudioTranscodingBitrate.HasValue)
{ {
var currentValue = playlistItem.AudioBitrate ?? options.MaxAudioTranscodingBitrate.Value; int currentValue = playlistItem.AudioBitrate ?? options.MaxAudioTranscodingBitrate.Value;
playlistItem.AudioBitrate = Math.Min(options.MaxAudioTranscodingBitrate.Value, currentValue); playlistItem.AudioBitrate = Math.Min(options.MaxAudioTranscodingBitrate.Value, currentValue);
} }
@ -239,14 +239,14 @@ namespace MediaBrowser.Model.Dlna
// Honor max rate // Honor max rate
if (maxBitrateSetting.HasValue) if (maxBitrateSetting.HasValue)
{ {
var videoBitrate = maxBitrateSetting.Value; int videoBitrate = maxBitrateSetting.Value;
if (playlistItem.AudioBitrate.HasValue) if (playlistItem.AudioBitrate.HasValue)
{ {
videoBitrate -= playlistItem.AudioBitrate.Value; videoBitrate -= playlistItem.AudioBitrate.Value;
} }
var currentValue = playlistItem.VideoBitrate ?? videoBitrate; int currentValue = playlistItem.VideoBitrate ?? videoBitrate;
playlistItem.VideoBitrate = Math.Min(videoBitrate, currentValue); playlistItem.VideoBitrate = Math.Min(videoBitrate, currentValue);
} }
@ -261,7 +261,7 @@ namespace MediaBrowser.Model.Dlna
MediaStream audioStream) MediaStream audioStream)
{ {
// See if it can be direct played // See if it can be direct played
var directPlay = profile.DirectPlayProfiles DirectPlayProfile directPlay = profile.DirectPlayProfiles
.FirstOrDefault(i => i.Type == DlnaProfileType.Video && IsVideoDirectPlaySupported(i, mediaSource, videoStream, audioStream)); .FirstOrDefault(i => i.Type == DlnaProfileType.Video && IsVideoDirectPlaySupported(i, mediaSource, videoStream, audioStream));
if (directPlay == null) if (directPlay == null)
@ -269,28 +269,28 @@ namespace MediaBrowser.Model.Dlna
return null; return null;
} }
var container = mediaSource.Container; string container = mediaSource.Container;
var conditions = profile.ContainerProfiles IEnumerable<ProfileCondition> conditions = profile.ContainerProfiles
.Where(i => i.Type == DlnaProfileType.Video && i.GetContainers().Contains(container, StringComparer.OrdinalIgnoreCase)) .Where(i => i.Type == DlnaProfileType.Video && i.GetContainers().Contains(container, StringComparer.OrdinalIgnoreCase))
.SelectMany(i => i.Conditions); .SelectMany(i => i.Conditions);
var conditionProcessor = new ConditionProcessor(); ConditionProcessor conditionProcessor = new ConditionProcessor();
var width = videoStream == null ? null : videoStream.Width; int? width = videoStream == null ? null : videoStream.Width;
var height = videoStream == null ? null : videoStream.Height; int? height = videoStream == null ? null : videoStream.Height;
var bitDepth = videoStream == null ? null : videoStream.BitDepth; int? bitDepth = videoStream == null ? null : videoStream.BitDepth;
var videoBitrate = videoStream == null ? null : videoStream.BitRate; int? videoBitrate = videoStream == null ? null : videoStream.BitRate;
var videoLevel = videoStream == null ? null : videoStream.Level; double? videoLevel = videoStream == null ? null : videoStream.Level;
var videoProfile = videoStream == null ? null : videoStream.Profile; string videoProfile = videoStream == null ? null : videoStream.Profile;
var videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate;
var audioBitrate = audioStream == null ? null : audioStream.BitRate; int? audioBitrate = audioStream == null ? null : audioStream.BitRate;
var audioChannels = audioStream == null ? null : audioStream.Channels; int? audioChannels = audioStream == null ? null : audioStream.Channels;
var audioProfile = audioStream == null ? null : audioStream.Profile; string audioProfile = audioStream == null ? null : audioStream.Profile;
var timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp; TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp;
var packetLength = videoStream == null ? null : videoStream.PacketLength; int? packetLength = videoStream == null ? null : videoStream.PacketLength;
// Check container conditions // Check container conditions
if (!conditions.All(i => conditionProcessor.IsVideoConditionSatisfied(i, if (!conditions.All(i => conditionProcessor.IsVideoConditionSatisfied(i,
@ -309,7 +309,7 @@ namespace MediaBrowser.Model.Dlna
return null; return null;
} }
var videoCodec = videoStream == null ? null : videoStream.Codec; string videoCodec = videoStream == null ? null : videoStream.Codec;
if (string.IsNullOrEmpty(videoCodec)) if (string.IsNullOrEmpty(videoCodec))
{ {
@ -338,7 +338,7 @@ namespace MediaBrowser.Model.Dlna
if (audioStream != null) if (audioStream != null)
{ {
var audioCodec = audioStream.Codec; string audioCodec = audioStream.Codec;
if (string.IsNullOrEmpty(audioCodec)) if (string.IsNullOrEmpty(audioCodec))
{ {
@ -420,10 +420,10 @@ namespace MediaBrowser.Model.Dlna
private void ApplyTranscodingConditions(StreamInfo item, IEnumerable<ProfileCondition> conditions) private void ApplyTranscodingConditions(StreamInfo item, IEnumerable<ProfileCondition> conditions)
{ {
foreach (var condition in conditions foreach (ProfileCondition condition in conditions
.Where(i => !string.IsNullOrEmpty(i.Value))) .Where(i => !string.IsNullOrEmpty(i.Value)))
{ {
var value = condition.Value; string value = condition.Value;
switch (condition.Property) switch (condition.Property)
{ {
@ -515,7 +515,7 @@ namespace MediaBrowser.Model.Dlna
if (profile.Container.Length > 0) if (profile.Container.Length > 0)
{ {
// Check container type // Check container type
var mediaContainer = item.Container ?? string.Empty; string mediaContainer = item.Container ?? string.Empty;
if (!profile.GetContainers().Any(i => string.Equals(i, mediaContainer, StringComparison.OrdinalIgnoreCase))) if (!profile.GetContainers().Any(i => string.Equals(i, mediaContainer, StringComparison.OrdinalIgnoreCase)))
{ {
return false; return false;
@ -536,7 +536,7 @@ namespace MediaBrowser.Model.Dlna
if (profile.Container.Length > 0) if (profile.Container.Length > 0)
{ {
// Check container type // Check container type
var mediaContainer = item.Container ?? string.Empty; string mediaContainer = item.Container ?? string.Empty;
if (!profile.GetContainers().Any(i => string.Equals(i, mediaContainer, StringComparison.OrdinalIgnoreCase))) if (!profile.GetContainers().Any(i => string.Equals(i, mediaContainer, StringComparison.OrdinalIgnoreCase)))
{ {
return false; return false;
@ -544,21 +544,21 @@ namespace MediaBrowser.Model.Dlna
} }
// Check video codec // Check video codec
var videoCodecs = profile.GetVideoCodecs(); List<string> videoCodecs = profile.GetVideoCodecs();
if (videoCodecs.Count > 0) if (videoCodecs.Count > 0)
{ {
var videoCodec = videoStream == null ? null : videoStream.Codec; string videoCodec = videoStream == null ? null : videoStream.Codec;
if (string.IsNullOrEmpty(videoCodec) || !videoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase)) if (string.IsNullOrEmpty(videoCodec) || !videoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase))
{ {
return false; return false;
} }
} }
var audioCodecs = profile.GetAudioCodecs(); List<string> audioCodecs = profile.GetAudioCodecs();
if (audioCodecs.Count > 0) if (audioCodecs.Count > 0)
{ {
// Check audio codecs // Check audio codecs
var audioCodec = audioStream == null ? null : audioStream.Codec; string audioCodec = audioStream == null ? null : audioStream.Codec;
if (string.IsNullOrEmpty(audioCodec) || !audioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase)) if (string.IsNullOrEmpty(audioCodec) || !audioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase))
{ {
return false; return false;

@ -79,9 +79,9 @@ namespace MediaBrowser.Model.Dlna
throw new ArgumentNullException(baseUrl); throw new ArgumentNullException(baseUrl);
} }
var dlnaCommand = BuildDlnaParam(this); string dlnaCommand = BuildDlnaParam(this);
var extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container; string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container;
baseUrl = baseUrl.TrimEnd('/'); baseUrl = baseUrl.TrimEnd('/');
@ -98,11 +98,11 @@ namespace MediaBrowser.Model.Dlna
return string.Format("{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, dlnaCommand); return string.Format("{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, dlnaCommand);
} }
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
private static string BuildDlnaParam(StreamInfo item) private static string BuildDlnaParam(StreamInfo item)
{ {
var usCulture = new CultureInfo("en-US"); List<string> list = new List<string>
var list = new List<string>
{ {
item.DeviceProfileId ?? string.Empty, item.DeviceProfileId ?? string.Empty,
item.DeviceId ?? string.Empty, item.DeviceId ?? string.Empty,
@ -110,16 +110,16 @@ namespace MediaBrowser.Model.Dlna
(item.IsDirectStream).ToString().ToLower(), (item.IsDirectStream).ToString().ToLower(),
item.VideoCodec ?? string.Empty, item.VideoCodec ?? string.Empty,
item.AudioCodec ?? string.Empty, item.AudioCodec ?? string.Empty,
item.AudioStreamIndex.HasValue ? item.AudioStreamIndex.Value.ToString(usCulture) : string.Empty, item.AudioStreamIndex.HasValue ? item.AudioStreamIndex.Value.ToString(UsCulture) : string.Empty,
item.SubtitleStreamIndex.HasValue ? item.SubtitleStreamIndex.Value.ToString(usCulture) : string.Empty, item.SubtitleStreamIndex.HasValue ? item.SubtitleStreamIndex.Value.ToString(UsCulture) : string.Empty,
item.VideoBitrate.HasValue ? item.VideoBitrate.Value.ToString(usCulture) : string.Empty, item.VideoBitrate.HasValue ? item.VideoBitrate.Value.ToString(UsCulture) : string.Empty,
item.AudioBitrate.HasValue ? item.AudioBitrate.Value.ToString(usCulture) : string.Empty, item.AudioBitrate.HasValue ? item.AudioBitrate.Value.ToString(UsCulture) : string.Empty,
item.MaxAudioChannels.HasValue ? item.MaxAudioChannels.Value.ToString(usCulture) : string.Empty, item.MaxAudioChannels.HasValue ? item.MaxAudioChannels.Value.ToString(UsCulture) : string.Empty,
item.MaxFramerate.HasValue ? item.MaxFramerate.Value.ToString(usCulture) : string.Empty, item.MaxFramerate.HasValue ? item.MaxFramerate.Value.ToString(UsCulture) : string.Empty,
item.MaxWidth.HasValue ? item.MaxWidth.Value.ToString(usCulture) : string.Empty, item.MaxWidth.HasValue ? item.MaxWidth.Value.ToString(UsCulture) : string.Empty,
item.MaxHeight.HasValue ? item.MaxHeight.Value.ToString(usCulture) : string.Empty, item.MaxHeight.HasValue ? item.MaxHeight.Value.ToString(UsCulture) : string.Empty,
item.StartPositionTicks.ToString(usCulture), item.StartPositionTicks.ToString(UsCulture),
item.VideoLevel.HasValue ? item.VideoLevel.Value.ToString(usCulture) : string.Empty item.VideoLevel.HasValue ? item.VideoLevel.Value.ToString(UsCulture) : string.Empty
}; };
return string.Format("Params={0}", string.Join(";", list.ToArray())); return string.Format("Params={0}", string.Join(";", list.ToArray()));
@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dlna
{ {
if (MediaSource != null) if (MediaSource != null)
{ {
var audioStreams = MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio); IEnumerable<MediaStream> audioStreams = MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio);
if (AudioStreamIndex.HasValue) if (AudioStreamIndex.HasValue)
{ {
@ -172,7 +172,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetAudioStream; MediaStream stream = TargetAudioStream;
return stream == null ? null : stream.SampleRate; return stream == null ? null : stream.SampleRate;
} }
} }
@ -184,7 +184,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetVideoStream; MediaStream stream = TargetVideoStream;
return stream == null || !IsDirectStream ? null : stream.BitDepth; return stream == null || !IsDirectStream ? null : stream.BitDepth;
} }
} }
@ -196,7 +196,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetVideoStream; MediaStream stream = TargetVideoStream;
return MaxFramerate.HasValue && !IsDirectStream return MaxFramerate.HasValue && !IsDirectStream
? MaxFramerate ? MaxFramerate
: stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate; : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate;
@ -210,7 +210,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetVideoStream; MediaStream stream = TargetVideoStream;
return VideoLevel.HasValue && !IsDirectStream return VideoLevel.HasValue && !IsDirectStream
? VideoLevel ? VideoLevel
: stream == null ? null : stream.Level; : stream == null ? null : stream.Level;
@ -224,7 +224,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetVideoStream; MediaStream stream = TargetVideoStream;
return !IsDirectStream return !IsDirectStream
? null ? null
: stream == null ? null : stream.PacketLength; : stream == null ? null : stream.PacketLength;
@ -238,7 +238,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetVideoStream; MediaStream stream = TargetVideoStream;
return !string.IsNullOrEmpty(VideoProfile) && !IsDirectStream return !string.IsNullOrEmpty(VideoProfile) && !IsDirectStream
? VideoProfile ? VideoProfile
: stream == null ? null : stream.Profile; : stream == null ? null : stream.Profile;
@ -252,7 +252,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetAudioStream; MediaStream stream = TargetAudioStream;
return AudioBitrate.HasValue && !IsDirectStream return AudioBitrate.HasValue && !IsDirectStream
? AudioBitrate ? AudioBitrate
: stream == null ? null : stream.BitRate; : stream == null ? null : stream.BitRate;
@ -266,8 +266,8 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetAudioStream; MediaStream stream = TargetAudioStream;
var streamChannels = stream == null ? null : stream.Channels; int? streamChannels = stream == null ? null : stream.Channels;
return MaxAudioChannels.HasValue && !IsDirectStream return MaxAudioChannels.HasValue && !IsDirectStream
? (streamChannels.HasValue ? Math.Min(MaxAudioChannels.Value, streamChannels.Value) : MaxAudioChannels.Value) ? (streamChannels.HasValue ? Math.Min(MaxAudioChannels.Value, streamChannels.Value) : MaxAudioChannels.Value)
@ -282,7 +282,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetAudioStream; MediaStream stream = TargetAudioStream;
return IsDirectStream return IsDirectStream
? (stream == null ? null : stream.Codec) ? (stream == null ? null : stream.Codec)
@ -304,10 +304,10 @@ namespace MediaBrowser.Model.Dlna
if (RunTimeTicks.HasValue) if (RunTimeTicks.HasValue)
{ {
var totalBitrate = TargetTotalBitrate; int? totalBitrate = TargetTotalBitrate;
return totalBitrate.HasValue ? return totalBitrate.HasValue ?
Convert.ToInt64(totalBitrate * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds) : Convert.ToInt64(totalBitrate.Value * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds) :
(long?)null; (long?)null;
} }
@ -319,7 +319,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var stream = TargetVideoStream; MediaStream stream = TargetVideoStream;
return VideoBitrate.HasValue && !IsDirectStream return VideoBitrate.HasValue && !IsDirectStream
? VideoBitrate ? VideoBitrate
@ -331,7 +331,7 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase) TransportStreamTimestamp defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase)
? TransportStreamTimestamp.Valid ? TransportStreamTimestamp.Valid
: TransportStreamTimestamp.None; : TransportStreamTimestamp.None;
@ -353,17 +353,17 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var videoStream = TargetVideoStream; MediaStream videoStream = TargetVideoStream;
if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue)
{ {
var size = new ImageSize ImageSize size = new ImageSize
{ {
Width = videoStream.Width.Value, Width = videoStream.Width.Value,
Height = videoStream.Height.Value Height = videoStream.Height.Value
}; };
var newSize = DrawingUtils.Resize(size, ImageSize newSize = DrawingUtils.Resize(size,
null, null,
null, null,
MaxWidth, MaxWidth,
@ -380,17 +380,17 @@ namespace MediaBrowser.Model.Dlna
{ {
get get
{ {
var videoStream = TargetVideoStream; MediaStream videoStream = TargetVideoStream;
if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue)
{ {
var size = new ImageSize ImageSize size = new ImageSize
{ {
Width = videoStream.Width.Value, Width = videoStream.Width.Value,
Height = videoStream.Height.Value Height = videoStream.Height.Value
}; };
var newSize = DrawingUtils.Resize(size, ImageSize newSize = DrawingUtils.Resize(size,
null, null,
null, null,
MaxWidth, MaxWidth,

@ -16,7 +16,12 @@ namespace MediaBrowser.Model.Drawing
/// <returns>ImageSize.</returns> /// <returns>ImageSize.</returns>
public static ImageSize Scale(double currentWidth, double currentHeight, double scaleFactor) public static ImageSize Scale(double currentWidth, double currentHeight, double scaleFactor)
{ {
return Scale(new ImageSize { Width = currentWidth, Height = currentHeight }, scaleFactor); return Scale(new ImageSize
{
Width = currentWidth,
Height = currentHeight
}, scaleFactor);
} }
/// <summary> /// <summary>
@ -29,7 +34,7 @@ namespace MediaBrowser.Model.Drawing
{ {
var newWidth = size.Width * scaleFactor; var newWidth = size.Width * scaleFactor;
return Resize(size.Width, size.Height, newWidth); return Resize(size.Width, size.Height, newWidth, null, null, null);
} }
/// <summary> /// <summary>
@ -42,9 +47,19 @@ namespace MediaBrowser.Model.Drawing
/// <param name="maxWidth">A max fixed width, if desired</param> /// <param name="maxWidth">A max fixed width, if desired</param>
/// <param name="maxHeight">A max fixed height, if desired</param> /// <param name="maxHeight">A max fixed height, if desired</param>
/// <returns>ImageSize.</returns> /// <returns>ImageSize.</returns>
public static ImageSize Resize(double currentWidth, double currentHeight, double? width = null, double? height = null, double? maxWidth = null, double? maxHeight = null) public static ImageSize Resize(double currentWidth,
double currentHeight,
double? width,
double? height,
double? maxWidth,
double? maxHeight)
{ {
return Resize(new ImageSize { Width = currentWidth, Height = currentHeight }, width, height, maxWidth, maxHeight); return Resize(new ImageSize
{
Width = currentWidth,
Height = currentHeight
}, width, height, maxWidth, maxHeight);
} }
/// <summary> /// <summary>
@ -56,7 +71,11 @@ namespace MediaBrowser.Model.Drawing
/// <param name="maxWidth">A max fixed width, if desired</param> /// <param name="maxWidth">A max fixed width, if desired</param>
/// <param name="maxHeight">A max fixed height, if desired</param> /// <param name="maxHeight">A max fixed height, if desired</param>
/// <returns>A new size object</returns> /// <returns>A new size object</returns>
public static ImageSize Resize(ImageSize size, double? width = null, double? height = null, double? maxWidth = null, double? maxHeight = null) public static ImageSize Resize(ImageSize size,
double? width,
double? height,
double? maxWidth,
double? maxHeight)
{ {
double newWidth = size.Width; double newWidth = size.Width;
double newHeight = size.Height; double newHeight = size.Height;
@ -79,13 +98,13 @@ namespace MediaBrowser.Model.Drawing
newWidth = width.Value; newWidth = width.Value;
} }
if (maxHeight.HasValue && maxHeight < newHeight) if (maxHeight.HasValue && maxHeight.Value < newHeight)
{ {
newWidth = GetNewWidth(newHeight, newWidth, maxHeight.Value); newWidth = GetNewWidth(newHeight, newWidth, maxHeight.Value);
newHeight = maxHeight.Value; newHeight = maxHeight.Value;
} }
if (maxWidth.HasValue && maxWidth < newWidth) if (maxWidth.HasValue && maxWidth.Value < newWidth)
{ {
newHeight = GetNewHeight(newHeight, newWidth, maxWidth.Value); newHeight = GetNewHeight(newHeight, newWidth, maxWidth.Value);
newWidth = maxWidth.Value; newWidth = maxWidth.Value;
@ -186,7 +205,7 @@ namespace MediaBrowser.Model.Drawing
{ {
if (!string.IsNullOrEmpty(value)) if (!string.IsNullOrEmpty(value))
{ {
var parts = value.Split('-'); string[] parts = value.Split('-');
if (parts.Length == 2) if (parts.Length == 2)
{ {

@ -311,7 +311,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the parent backdrop image tags. /// Gets or sets the parent backdrop image tags.
/// </summary> /// </summary>
/// <value>The parent backdrop image tags.</value> /// <value>The parent backdrop image tags.</value>
public List<Guid> ParentBackdropImageTags { get; set; } public List<string> ParentBackdropImageTags { get; set; }
/// <summary> /// <summary>
/// Gets or sets the local trailer count. /// Gets or sets the local trailer count.
@ -466,13 +466,13 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the album image tag. /// Gets or sets the album image tag.
/// </summary> /// </summary>
/// <value>The album image tag.</value> /// <value>The album image tag.</value>
public Guid? AlbumPrimaryImageTag { get; set; } public string AlbumPrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the series primary image tag. /// Gets or sets the series primary image tag.
/// </summary> /// </summary>
/// <value>The series primary image tag.</value> /// <value>The series primary image tag.</value>
public Guid? SeriesPrimaryImageTag { get; set; } public string SeriesPrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the album artist. /// Gets or sets the album artist.
@ -529,25 +529,25 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the image tags. /// Gets or sets the image tags.
/// </summary> /// </summary>
/// <value>The image tags.</value> /// <value>The image tags.</value>
public Dictionary<ImageType, Guid> ImageTags { get; set; } public Dictionary<ImageType, string> ImageTags { get; set; }
/// <summary> /// <summary>
/// Gets or sets the backdrop image tags. /// Gets or sets the backdrop image tags.
/// </summary> /// </summary>
/// <value>The backdrop image tags.</value> /// <value>The backdrop image tags.</value>
public List<Guid> BackdropImageTags { get; set; } public List<string> BackdropImageTags { get; set; }
/// <summary> /// <summary>
/// Gets or sets the screenshot image tags. /// Gets or sets the screenshot image tags.
/// </summary> /// </summary>
/// <value>The screenshot image tags.</value> /// <value>The screenshot image tags.</value>
public List<Guid> ScreenshotImageTags { get; set; } public List<string> ScreenshotImageTags { get; set; }
/// <summary> /// <summary>
/// Gets or sets the parent logo image tag. /// Gets or sets the parent logo image tag.
/// </summary> /// </summary>
/// <value>The parent logo image tag.</value> /// <value>The parent logo image tag.</value>
public Guid? ParentLogoImageTag { get; set; } public string ParentLogoImageTag { get; set; }
/// <summary> /// <summary>
/// If the item does not have a art, this will hold the Id of the Parent that has one. /// If the item does not have a art, this will hold the Id of the Parent that has one.
@ -559,13 +559,13 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the parent art image tag. /// Gets or sets the parent art image tag.
/// </summary> /// </summary>
/// <value>The parent art image tag.</value> /// <value>The parent art image tag.</value>
public Guid? ParentArtImageTag { get; set; } public string ParentArtImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the series thumb image tag. /// Gets or sets the series thumb image tag.
/// </summary> /// </summary>
/// <value>The series thumb image tag.</value> /// <value>The series thumb image tag.</value>
public Guid? SeriesThumbImageTag { get; set; } public string SeriesThumbImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the series studio. /// Gets or sets the series studio.
@ -583,7 +583,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the parent thumb image tag. /// Gets or sets the parent thumb image tag.
/// </summary> /// </summary>
/// <value>The parent thumb image tag.</value> /// <value>The parent thumb image tag.</value>
public Guid? ParentThumbImageTag { get; set; } public string ParentThumbImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the chapters. /// Gets or sets the chapters.

@ -33,7 +33,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the primary image tag. /// Gets or sets the primary image tag.
/// </summary> /// </summary>
/// <value>The primary image tag.</value> /// <value>The primary image tag.</value>
public Guid? PrimaryImageTag { get; set; } public string PrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance has primary image. /// Gets a value indicating whether this instance has primary image.
@ -44,7 +44,7 @@ namespace MediaBrowser.Model.Dto
{ {
get get
{ {
return PrimaryImageTag.HasValue; return PrimaryImageTag != null;
} }
} }

@ -27,7 +27,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the image tag. /// Gets or sets the image tag.
/// </summary> /// </summary>
/// <value>The image tag.</value> /// <value>The image tag.</value>
public Guid? ImageTag { get; set; } public string ImageTag { get; set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance has image. /// Gets a value indicating whether this instance has image.
@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Dto
[IgnoreDataMember] [IgnoreDataMember]
public bool HasImage public bool HasImage
{ {
get { return ImageTag.HasValue; } get { return ImageTag != null; }
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

@ -23,7 +23,7 @@ namespace MediaBrowser.Model.Dto
/// <summary> /// <summary>
/// The image tag /// The image tag
/// </summary> /// </summary>
public Guid ImageTag; public string ImageTag;
/// <summary> /// <summary>
/// Gets or sets the path. /// Gets or sets the path.

@ -56,7 +56,7 @@ namespace MediaBrowser.Model.Dto
/// If set this will result in strong, unconditional response caching /// If set this will result in strong, unconditional response caching
/// </summary> /// </summary>
/// <value>The hash.</value> /// <value>The hash.</value>
public Guid? Tag { get; set; } public string Tag { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether [crop whitespace]. /// Gets or sets a value indicating whether [crop whitespace].

@ -7,7 +7,7 @@ namespace MediaBrowser.Model.Dto
/// </summary> /// </summary>
public class ItemByNameCounts public class ItemByNameCounts
{ {
public Guid UserId { get; set; } public string UserId { get; set; }
/// <summary> /// <summary>
/// Gets or sets the total count. /// Gets or sets the total count.

@ -21,7 +21,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the primary image tag. /// Gets or sets the primary image tag.
/// </summary> /// </summary>
/// <value>The primary image tag.</value> /// <value>The primary image tag.</value>
public Guid? PrimaryImageTag { get; set; } public string PrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance has primary image. /// Gets a value indicating whether this instance has primary image.
@ -32,7 +32,7 @@ namespace MediaBrowser.Model.Dto
{ {
get get
{ {
return PrimaryImageTag.HasValue; return PrimaryImageTag != null;
} }
} }

@ -28,7 +28,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the primary image tag. /// Gets or sets the primary image tag.
/// </summary> /// </summary>
/// <value>The primary image tag.</value> /// <value>The primary image tag.</value>
public Guid? PrimaryImageTag { get; set; } public string PrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this instance has password. /// Gets or sets a value indicating whether this instance has password.
@ -73,7 +73,7 @@ namespace MediaBrowser.Model.Dto
[IgnoreDataMember] [IgnoreDataMember]
public bool HasPrimaryImage public bool HasPrimaryImage
{ {
get { return PrimaryImageTag.HasValue; } get { return PrimaryImageTag != null; }
} }
/// <summary> /// <summary>

@ -46,7 +46,7 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the primary image tag. /// Gets or sets the primary image tag.
/// </summary> /// </summary>
/// <value>The primary image tag.</value> /// <value>The primary image tag.</value>
public Guid? PrimaryImageTag { get; set; } public string PrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the primary image item identifier. /// Gets or sets the primary image item identifier.
@ -58,7 +58,7 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the logo image tag. /// Gets or sets the logo image tag.
/// </summary> /// </summary>
/// <value>The logo image tag.</value> /// <value>The logo image tag.</value>
public Guid? LogoImageTag { get; set; } public string LogoImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the logo item identifier. /// Gets or sets the logo item identifier.
@ -70,7 +70,7 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the thumb image tag. /// Gets or sets the thumb image tag.
/// </summary> /// </summary>
/// <value>The thumb image tag.</value> /// <value>The thumb image tag.</value>
public Guid? ThumbImageTag { get; set; } public string ThumbImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the thumb item identifier. /// Gets or sets the thumb item identifier.
@ -82,7 +82,7 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the thumb image tag. /// Gets or sets the thumb image tag.
/// </summary> /// </summary>
/// <value>The thumb image tag.</value> /// <value>The thumb image tag.</value>
public Guid? BackdropImageTag { get; set; } public string BackdropImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the thumb item identifier. /// Gets or sets the thumb item identifier.
@ -163,7 +163,7 @@ namespace MediaBrowser.Model.Entities
[IgnoreDataMember] [IgnoreDataMember]
public bool HasPrimaryImage public bool HasPrimaryImage
{ {
get { return PrimaryImageTag.HasValue; } get { return PrimaryImageTag != null; }
} }
public BaseItemInfo() public BaseItemInfo()

@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the user id. /// Gets or sets the user id.
/// </summary> /// </summary>
/// <value>The user id.</value> /// <value>The user id.</value>
public Guid Id { get; set; } public string Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type of the view. /// Gets or sets the type of the view.
/// </summary> /// </summary>
@ -105,7 +105,7 @@ namespace MediaBrowser.Model.Entities
{ {
var newWidth = PrimaryImageWidth / ImageScale; var newWidth = PrimaryImageWidth / ImageScale;
var size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth); var size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth, null, null, null);
PrimaryImageWidth = Convert.ToInt32(size.Width); PrimaryImageWidth = Convert.ToInt32(size.Width);
PrimaryImageHeight = Convert.ToInt32(size.Height); PrimaryImageHeight = Convert.ToInt32(size.Height);

@ -12,41 +12,41 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the folders added to. /// Gets or sets the folders added to.
/// </summary> /// </summary>
/// <value>The folders added to.</value> /// <value>The folders added to.</value>
public List<Guid> FoldersAddedTo { get; set; } public List<string> FoldersAddedTo { get; set; }
/// <summary> /// <summary>
/// Gets or sets the folders removed from. /// Gets or sets the folders removed from.
/// </summary> /// </summary>
/// <value>The folders removed from.</value> /// <value>The folders removed from.</value>
public List<Guid> FoldersRemovedFrom { get; set; } public List<string> FoldersRemovedFrom { get; set; }
/// <summary> /// <summary>
/// Gets or sets the items added. /// Gets or sets the items added.
/// </summary> /// </summary>
/// <value>The items added.</value> /// <value>The items added.</value>
public List<Guid> ItemsAdded { get; set; } public List<string> ItemsAdded { get; set; }
/// <summary> /// <summary>
/// Gets or sets the items removed. /// Gets or sets the items removed.
/// </summary> /// </summary>
/// <value>The items removed.</value> /// <value>The items removed.</value>
public List<Guid> ItemsRemoved { get; set; } public List<string> ItemsRemoved { get; set; }
/// <summary> /// <summary>
/// Gets or sets the items updated. /// Gets or sets the items updated.
/// </summary> /// </summary>
/// <value>The items updated.</value> /// <value>The items updated.</value>
public List<Guid> ItemsUpdated { get; set; } public List<string> ItemsUpdated { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class. /// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class.
/// </summary> /// </summary>
public LibraryUpdateInfo() public LibraryUpdateInfo()
{ {
FoldersAddedTo = new List<Guid>(); FoldersAddedTo = new List<string>();
FoldersRemovedFrom = new List<Guid>(); FoldersRemovedFrom = new List<string>();
ItemsAdded = new List<Guid>(); ItemsAdded = new List<string>();
ItemsRemoved = new List<Guid>(); ItemsRemoved = new List<string>();
ItemsUpdated = new List<Guid>(); ItemsUpdated = new List<string>();
} }
} }
} }

@ -1,6 +1,6 @@
using System; using System;
namespace MediaBrowser.Common.Events namespace MediaBrowser.Model.Events
{ {
/// <summary> /// <summary>
/// Provides a generic EventArgs subclass that can hold any kind of object /// Provides a generic EventArgs subclass that can hold any kind of object

@ -39,7 +39,7 @@ namespace MediaBrowser.Model.LiveTv
/// Gets or sets the image tags. /// Gets or sets the image tags.
/// </summary> /// </summary>
/// <value>The image tags.</value> /// <value>The image tags.</value>
public Dictionary<ImageType, Guid> ImageTags { get; set; } public Dictionary<ImageType, string> ImageTags { get; set; }
/// <summary> /// <summary>
/// Gets or sets the number. /// Gets or sets the number.
@ -113,7 +113,7 @@ namespace MediaBrowser.Model.LiveTv
public ChannelInfoDto() public ChannelInfoDto()
{ {
ImageTags = new Dictionary<ImageType, Guid>(); ImageTags = new Dictionary<ImageType, string>();
MediaSources = new List<MediaSourceInfo>(); MediaSources = new List<MediaSourceInfo>();
} }

@ -45,7 +45,7 @@ namespace MediaBrowser.Model.LiveTv
/// Gets or sets the channel primary image tag. /// Gets or sets the channel primary image tag.
/// </summary> /// </summary>
/// <value>The channel primary image tag.</value> /// <value>The channel primary image tag.</value>
public Guid? ChannelPrimaryImageTag { get; set; } public string ChannelPrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the play access. /// Gets or sets the play access.
@ -136,7 +136,7 @@ namespace MediaBrowser.Model.LiveTv
/// Gets or sets the image tags. /// Gets or sets the image tags.
/// </summary> /// </summary>
/// <value>The image tags.</value> /// <value>The image tags.</value>
public Dictionary<ImageType, Guid> ImageTags { get; set; } public Dictionary<ImageType, string> ImageTags { get; set; }
/// <summary> /// <summary>
/// Gets or sets the user data. /// Gets or sets the user data.
@ -211,7 +211,7 @@ namespace MediaBrowser.Model.LiveTv
public ProgramInfoDto() public ProgramInfoDto()
{ {
Genres = new List<string>(); Genres = new List<string>();
ImageTags = new Dictionary<ImageType, Guid>(); ImageTags = new Dictionary<ImageType, string>();
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

@ -50,7 +50,7 @@ namespace MediaBrowser.Model.LiveTv
/// Gets or sets the channel primary image tag. /// Gets or sets the channel primary image tag.
/// </summary> /// </summary>
/// <value>The channel primary image tag.</value> /// <value>The channel primary image tag.</value>
public Guid? ChannelPrimaryImageTag { get; set; } public string ChannelPrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// ChannelName of the recording. /// ChannelName of the recording.
@ -224,7 +224,7 @@ namespace MediaBrowser.Model.LiveTv
/// Gets or sets the image tags. /// Gets or sets the image tags.
/// </summary> /// </summary>
/// <value>The image tags.</value> /// <value>The image tags.</value>
public Dictionary<ImageType, Guid> ImageTags { get; set; } public Dictionary<ImageType, string> ImageTags { get; set; }
/// <summary> /// <summary>
/// Gets or sets the user data. /// Gets or sets the user data.
@ -253,7 +253,7 @@ namespace MediaBrowser.Model.LiveTv
public RecordingInfoDto() public RecordingInfoDto()
{ {
Genres = new List<string>(); Genres = new List<string>();
ImageTags = new Dictionary<ImageType, Guid>(); ImageTags = new Dictionary<ImageType, string>();
MediaSources = new List<MediaSourceInfo>(); MediaSources = new List<MediaSourceInfo>();
} }

@ -43,7 +43,7 @@ namespace MediaBrowser.Model.LiveTv
/// Gets or sets the image tags. /// Gets or sets the image tags.
/// </summary> /// </summary>
/// <value>The image tags.</value> /// <value>The image tags.</value>
public Dictionary<ImageType, Guid> ImageTags { get; set; } public Dictionary<ImageType, string> ImageTags { get; set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance has primary image. /// Gets a value indicating whether this instance has primary image.
@ -57,7 +57,7 @@ namespace MediaBrowser.Model.LiveTv
public SeriesTimerInfoDto() public SeriesTimerInfoDto()
{ {
ImageTags = new Dictionary<ImageType, Guid>(); ImageTags = new Dictionary<ImageType, string>();
Days = new List<DayOfWeek>(); Days = new List<DayOfWeek>();
} }
} }

@ -97,6 +97,7 @@
<Compile Include="Dto\RecommendationDto.cs" /> <Compile Include="Dto\RecommendationDto.cs" />
<Compile Include="Dto\MediaVersionInfo.cs" /> <Compile Include="Dto\MediaVersionInfo.cs" />
<Compile Include="Entities\PackageReviewInfo.cs" /> <Compile Include="Entities\PackageReviewInfo.cs" />
<Compile Include="Events\GenericEventArgs.cs" />
<Compile Include="FileOrganization\FileOrganizationResult.cs" /> <Compile Include="FileOrganization\FileOrganizationResult.cs" />
<Compile Include="FileOrganization\FileOrganizationQuery.cs" /> <Compile Include="FileOrganization\FileOrganizationQuery.cs" />
<Compile Include="Library\PlayAccess.cs" /> <Compile Include="Library\PlayAccess.cs" />

@ -47,13 +47,13 @@ namespace MediaBrowser.Model.Search
/// Gets or sets the image tag. /// Gets or sets the image tag.
/// </summary> /// </summary>
/// <value>The image tag.</value> /// <value>The image tag.</value>
public Guid? PrimaryImageTag { get; set; } public string PrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the thumb image tag. /// Gets or sets the thumb image tag.
/// </summary> /// </summary>
/// <value>The thumb image tag.</value> /// <value>The thumb image tag.</value>
public Guid? ThumbImageTag { get; set; } public string ThumbImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the thumb image item identifier. /// Gets or sets the thumb image item identifier.
@ -65,7 +65,7 @@ namespace MediaBrowser.Model.Search
/// Gets or sets the backdrop image tag. /// Gets or sets the backdrop image tag.
/// </summary> /// </summary>
/// <value>The backdrop image tag.</value> /// <value>The backdrop image tag.</value>
public Guid? BackdropImageTag { get; set; } public string BackdropImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the backdrop image item identifier. /// Gets or sets the backdrop image item identifier.

@ -49,6 +49,7 @@ namespace MediaBrowser.Model.Session
SetSubtitleStreamIndex = 24, SetSubtitleStreamIndex = 24,
ToggleFullscreen = 25, ToggleFullscreen = 25,
DisplayContent = 26, DisplayContent = 26,
GoToSearch = 27 GoToSearch = 27,
DisplayMessage = 28
} }
} }

@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Session
/// Gets or sets the user primary image tag. /// Gets or sets the user primary image tag.
/// </summary> /// </summary>
/// <value>The user primary image tag.</value> /// <value>The user primary image tag.</value>
public Guid? UserPrimaryImageTag { get; set; } public string UserPrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the name of the user. /// Gets or sets the name of the user.

@ -30,7 +30,7 @@ namespace MediaBrowser.Model.Tasks
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
public Guid Id { get; set; } public string Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the last execution result. /// Gets or sets the last execution result.

@ -35,7 +35,7 @@ namespace MediaBrowser.Model.Tasks
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
public Guid Id { get; set; } public string Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the error message. /// Gets or sets the error message.

@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
public Guid Id { get; set; } public string Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.

@ -47,7 +47,7 @@ namespace MediaBrowser.Model.Updates
/// <param name="str">The STR.</param> /// <param name="str">The STR.</param>
/// <param name="def">The def.</param> /// <param name="def">The def.</param>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
private static string ValueOrDefault(string str, string def = "") private static string ValueOrDefault(string str, string def)
{ {
return string.IsNullOrEmpty(str) ? def : str; return string.IsNullOrEmpty(str) ? def : str;
} }
@ -80,7 +80,7 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the source URL. /// Gets or sets the source URL.
/// </summary> /// </summary>
/// <value>The source URL.</value> /// <value>The source URL.</value>
public Guid checksum { get; set; } public string checksum { get; set; }
/// <summary> /// <summary>
/// Gets or sets the target filename. /// Gets or sets the target filename.

@ -122,50 +122,6 @@ namespace MediaBrowser.Model.Web
} }
} }
/// <summary>
/// Adds the specified name.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
/// <exception cref="System.ArgumentNullException">value</exception>
public void Add(string name, Guid value)
{
if (value == Guid.Empty)
{
throw new ArgumentNullException("value");
}
Add(name, value.ToString());
}
/// <summary>
/// Adds if not empty.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
public void AddIfNotEmpty(string name, Guid value)
{
if (value != Guid.Empty)
{
Add(name, value);
}
Add(name, value);
}
/// <summary>
/// Adds if not null.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
public void AddIfNotNull(string name, Guid? value)
{
if (value.HasValue)
{
Add(name, value.Value);
}
}
/// <summary> /// <summary>
/// Adds the specified name. /// Adds the specified name.
/// </summary> /// </summary>

@ -91,9 +91,18 @@ namespace MediaBrowser.Providers.MediaInfo
return false; return false;
} }
var audioStreams = internalMediaStreams.Where(i => i.Type == MediaStreamType.Audio).ToList();
var defaultAudioStreams = audioStreams.Where(i => i.IsDefault).ToList();
// If none are marked as default, just take a guess
if (defaultAudioStreams.Count == 0)
{
defaultAudioStreams = audioStreams.Take(1).ToList();
}
// There's already a default audio stream for this language // There's already a default audio stream for this language
if (skipIfAudioTrackMatches && if (skipIfAudioTrackMatches &&
internalMediaStreams.Any(i => i.Type == MediaStreamType.Audio && i.IsDefault && string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase))) defaultAudioStreams.Any(i => string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase)))
{ {
return false; return false;
} }

@ -1,11 +1,11 @@
using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Security; using MediaBrowser.Controller.Security;
using MediaBrowser.Controller.Subtitles; using MediaBrowser.Controller.Subtitles;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Providers; using MediaBrowser.Model.Providers;
using OpenSubtitlesHandler; using OpenSubtitlesHandler;

@ -4,6 +4,7 @@ using MediaBrowser.Common.Implementations.Configuration;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;

@ -649,7 +649,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
/// <param name="image">The image.</param> /// <param name="image">The image.</param>
/// <returns>Guid.</returns> /// <returns>Guid.</returns>
/// <exception cref="System.ArgumentNullException">item</exception> /// <exception cref="System.ArgumentNullException">item</exception>
public Guid GetImageCacheTag(IHasImages item, ItemImageInfo image) public string GetImageCacheTag(IHasImages item, ItemImageInfo image)
{ {
if (item == null) if (item == null)
{ {
@ -676,7 +676,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
/// <param name="imageEnhancers">The image enhancers.</param> /// <param name="imageEnhancers">The image enhancers.</param>
/// <returns>Guid.</returns> /// <returns>Guid.</returns>
/// <exception cref="System.ArgumentNullException">item</exception> /// <exception cref="System.ArgumentNullException">item</exception>
public Guid GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, List<IImageEnhancer> imageEnhancers) public string GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, List<IImageEnhancer> imageEnhancers)
{ {
if (item == null) if (item == null)
{ {
@ -696,14 +696,14 @@ namespace MediaBrowser.Server.Implementations.Drawing
// Optimization // Optimization
if (imageEnhancers.Count == 0) if (imageEnhancers.Count == 0)
{ {
return (originalImagePath + dateModified.Ticks).GetMD5(); return (originalImagePath + dateModified.Ticks).GetMD5().ToString("N");
} }
// Cache name is created with supported enhancers combined with the last config change so we pick up new config changes // Cache name is created with supported enhancers combined with the last config change so we pick up new config changes
var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList(); var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList();
cacheKeys.Add(originalImagePath + dateModified.Ticks); cacheKeys.Add(originalImagePath + dateModified.Ticks);
return string.Join("|", cacheKeys.ToArray()).GetMD5(); return string.Join("|", cacheKeys.ToArray()).GetMD5().ToString("N");
} }
/// <summary> /// <summary>

@ -326,7 +326,7 @@ namespace MediaBrowser.Server.Implementations.Dto
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <returns>List{System.String}.</returns> /// <returns>List{System.String}.</returns>
private List<Guid> GetBackdropImageTags(BaseItem item) private List<string> GetBackdropImageTags(BaseItem item)
{ {
return GetCacheTags(item, ImageType.Backdrop).ToList(); return GetCacheTags(item, ImageType.Backdrop).ToList();
} }
@ -336,26 +336,25 @@ namespace MediaBrowser.Server.Implementations.Dto
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <returns>List{Guid}.</returns> /// <returns>List{Guid}.</returns>
private List<Guid> GetScreenshotImageTags(BaseItem item) private List<string> GetScreenshotImageTags(BaseItem item)
{ {
var hasScreenshots = item as IHasScreenshots; var hasScreenshots = item as IHasScreenshots;
if (hasScreenshots == null) if (hasScreenshots == null)
{ {
return new List<Guid>(); return new List<string>();
} }
return GetCacheTags(item, ImageType.Screenshot).ToList(); return GetCacheTags(item, ImageType.Screenshot).ToList();
} }
private IEnumerable<Guid> GetCacheTags(BaseItem item, ImageType type) private IEnumerable<string> GetCacheTags(BaseItem item, ImageType type)
{ {
return item.GetImages(type) return item.GetImages(type)
.Select(p => GetImageCacheTag(item, p)) .Select(p => GetImageCacheTag(item, p))
.Where(i => i.HasValue) .Where(i => i != null)
.Select(i => i.Value)
.ToList(); .ToList();
} }
private Guid? GetImageCacheTag(BaseItem item, ImageType type) private string GetImageCacheTag(BaseItem item, ImageType type)
{ {
try try
{ {
@ -368,7 +367,7 @@ namespace MediaBrowser.Server.Implementations.Dto
} }
} }
private Guid? GetImageCacheTag(BaseItem item, ItemImageInfo image) private string GetImageCacheTag(BaseItem item, ItemImageInfo image)
{ {
try try
{ {
@ -677,7 +676,7 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.Genres = item.Genres; dto.Genres = item.Genres;
} }
dto.ImageTags = new Dictionary<ImageType, Guid>(); dto.ImageTags = new Dictionary<ImageType, string>();
// Prevent implicitly captured closure // Prevent implicitly captured closure
var currentItem = item; var currentItem = item;
@ -685,9 +684,9 @@ namespace MediaBrowser.Server.Implementations.Dto
{ {
var tag = GetImageCacheTag(item, image); var tag = GetImageCacheTag(item, image);
if (tag.HasValue) if (tag != null)
{ {
dto.ImageTags[image.Type] = tag.Value; dto.ImageTags[image.Type] = tag;
} }
} }
@ -1216,7 +1215,7 @@ namespace MediaBrowser.Server.Implementations.Dto
} }
} }
var bitrate = i.TotalBitrate ?? var bitrate = i.TotalBitrate ??
info.MediaStreams.Where(m => m.Type != MediaStreamType.Subtitle && !string.Equals(m.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)) info.MediaStreams.Where(m => m.Type != MediaStreamType.Subtitle && !string.Equals(m.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase))
.Select(m => m.BitRate ?? 0) .Select(m => m.BitRate ?? 0)
.Sum(); .Sum();

@ -252,15 +252,15 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
return new LibraryUpdateInfo return new LibraryUpdateInfo
{ {
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id).Distinct().ToList(), ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id).Distinct().ToList(), ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren, true)).Select(i => i.Id).Distinct().ToList(), ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren, true)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id).Distinct().ToList(), FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id).Distinct().ToList() FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id.ToString("N")).Distinct().ToList()
}; };
} }

@ -11,6 +11,7 @@ using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Notifications; using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;

@ -9,6 +9,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;
using System; using System;
using System.Threading; using System.Threading;

@ -5,6 +5,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

@ -241,9 +241,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var imageTag = GetImageTag(recording); var imageTag = GetImageTag(recording);
if (imageTag.HasValue) if (imageTag != null)
{ {
dto.ImageTags[ImageType.Primary] = imageTag.Value; dto.ImageTags[ImageType.Primary] = imageTag;
} }
if (user != null) if (user != null)
@ -328,9 +328,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var imageTag = GetImageTag(info); var imageTag = GetImageTag(info);
if (imageTag.HasValue) if (imageTag != null)
{ {
dto.ImageTags[ImageType.Primary] = imageTag.Value; dto.ImageTags[ImageType.Primary] = imageTag;
} }
if (currentProgram != null) if (currentProgram != null)
@ -389,9 +389,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var imageTag = GetImageTag(item); var imageTag = GetImageTag(item);
if (imageTag.HasValue) if (imageTag != null)
{ {
dto.ImageTags[ImageType.Primary] = imageTag.Value; dto.ImageTags[ImageType.Primary] = imageTag;
} }
if (user != null) if (user != null)
@ -404,7 +404,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return dto; return dto;
} }
private Guid? GetImageTag(IHasImages info) private string GetImageTag(IHasImages info)
{ {
try try
{ {

@ -111,7 +111,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
{ {
throw new ArgumentNullException("displayPreferences"); throw new ArgumentNullException("displayPreferences");
} }
if (displayPreferences.Id == Guid.Empty) if (string.IsNullOrWhiteSpace(displayPreferences.Id))
{ {
throw new ArgumentNullException("displayPreferences.Id"); throw new ArgumentNullException("displayPreferences.Id");
} }
@ -132,7 +132,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
{ {
cmd.CommandText = "replace into userdisplaypreferences (id, userid, client, data) values (@1, @2, @3, @4)"; cmd.CommandText = "replace into userdisplaypreferences (id, userid, client, data) values (@1, @2, @3, @4)";
cmd.Parameters.Add(cmd, "@1", DbType.Guid).Value = displayPreferences.Id; cmd.Parameters.Add(cmd, "@1", DbType.Guid).Value = new Guid(displayPreferences.Id);
cmd.Parameters.Add(cmd, "@2", DbType.Guid).Value = userId; cmd.Parameters.Add(cmd, "@2", DbType.Guid).Value = userId;
cmd.Parameters.Add(cmd, "@3", DbType.String).Value = client; cmd.Parameters.Add(cmd, "@3", DbType.String).Value = client;
cmd.Parameters.Add(cmd, "@4", DbType.Binary).Value = serialized; cmd.Parameters.Add(cmd, "@4", DbType.Binary).Value = serialized;
@ -183,9 +183,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
/// <param name="client">The client.</param> /// <param name="client">The client.</param>
/// <returns>Task{DisplayPreferences}.</returns> /// <returns>Task{DisplayPreferences}.</returns>
/// <exception cref="System.ArgumentNullException">item</exception> /// <exception cref="System.ArgumentNullException">item</exception>
public DisplayPreferences GetDisplayPreferences(Guid displayPreferencesId, Guid userId, string client) public DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client)
{ {
if (displayPreferencesId == Guid.Empty) if (string.IsNullOrWhiteSpace(displayPreferencesId))
{ {
throw new ArgumentNullException("displayPreferencesId"); throw new ArgumentNullException("displayPreferencesId");
} }
@ -193,7 +193,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
var cmd = _connection.CreateCommand(); var cmd = _connection.CreateCommand();
cmd.CommandText = "select data from userdisplaypreferences where id = @id and userId=@userId and client=@client"; cmd.CommandText = "select data from userdisplaypreferences where id = @id and userId=@userId and client=@client";
cmd.Parameters.Add(cmd, "@id", DbType.Guid).Value = displayPreferencesId; cmd.Parameters.Add(cmd, "@id", DbType.Guid).Value = new Guid(displayPreferencesId);
cmd.Parameters.Add(cmd, "@userId", DbType.Guid).Value = userId; cmd.Parameters.Add(cmd, "@userId", DbType.Guid).Value = userId;
cmd.Parameters.Add(cmd, "@client", DbType.String).Value = client; cmd.Parameters.Add(cmd, "@client", DbType.String).Value = client;
@ -208,7 +208,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
} }
} }
return new DisplayPreferences { Id = displayPreferencesId }; return null;
} }
/// <summary> /// <summary>

@ -56,16 +56,6 @@ namespace MediaBrowser.Server.Implementations.Roku
return Task.FromResult(true); return Task.FromResult(true);
} }
public Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken)
{
return SendCommand(new WebSocketMessage<MessageCommand>
{
MessageType = "MessageCommand",
Data = command
}, cancellationToken);
}
public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken) public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken)
{ {
return SendCommand(new WebSocketMessage<PlayRequest> return SendCommand(new WebSocketMessage<PlayRequest>

@ -1,4 +1,5 @@
using MediaBrowser.Common.Events; using System.Globalization;
using MediaBrowser.Common.Events;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
@ -712,12 +713,20 @@ namespace MediaBrowser.Server.Implementations.Session
public Task SendMessageCommand(string controllingSessionId, string sessionId, MessageCommand command, CancellationToken cancellationToken) public Task SendMessageCommand(string controllingSessionId, string sessionId, MessageCommand command, CancellationToken cancellationToken)
{ {
var session = GetSessionForRemoteControl(sessionId); var generalCommand = new GeneralCommand
{
Name = GeneralCommandType.DisplayMessage.ToString()
};
var controllingSession = GetSession(controllingSessionId); generalCommand.Arguments["Header"] = command.Header;
AssertCanControl(session, controllingSession); generalCommand.Arguments["Text"] = command.Text;
return session.SessionController.SendMessageCommand(command, cancellationToken); if (command.TimeoutMs.HasValue)
{
generalCommand.Arguments["TimeoutMs"] = command.TimeoutMs.Value.ToString(CultureInfo.InvariantCulture);
}
return SendGeneralCommand(controllingSessionId, sessionId, generalCommand, cancellationToken);
} }
public Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken) public Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken)
@ -1199,7 +1208,7 @@ namespace MediaBrowser.Server.Implementations.Session
}; };
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary); info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
if (info.PrimaryImageTag.HasValue) if (info.PrimaryImageTag != null)
{ {
info.PrimaryImageItemId = GetDtoId(item); info.PrimaryImageItemId = GetDtoId(item);
} }
@ -1237,14 +1246,14 @@ namespace MediaBrowser.Server.Implementations.Session
info.Album = audio.Album; info.Album = audio.Album;
info.Artists = audio.Artists; info.Artists = audio.Artists;
if (!info.PrimaryImageTag.HasValue) if (info.PrimaryImageTag == null)
{ {
var album = audio.Parents.OfType<MusicAlbum>().FirstOrDefault(); var album = audio.Parents.OfType<MusicAlbum>().FirstOrDefault();
if (album != null && album.HasImage(ImageType.Primary)) if (album != null && album.HasImage(ImageType.Primary))
{ {
info.PrimaryImageTag = GetImageCacheTag(album, ImageType.Primary); info.PrimaryImageTag = GetImageCacheTag(album, ImageType.Primary);
if (info.PrimaryImageTag.HasValue) if (info.PrimaryImageTag != null)
{ {
info.PrimaryImageItemId = GetDtoId(album); info.PrimaryImageItemId = GetDtoId(album);
} }
@ -1345,7 +1354,7 @@ namespace MediaBrowser.Server.Implementations.Session
return info; return info;
} }
private Guid? GetImageCacheTag(BaseItem item, ImageType type) private string GetImageCacheTag(BaseItem item, ImageType type)
{ {
try try
{ {

@ -57,18 +57,6 @@ namespace MediaBrowser.Server.Implementations.Session
return socket; return socket;
} }
public Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken)
{
var socket = GetActiveSocket();
return socket.SendAsync(new WebSocketMessage<MessageCommand>
{
MessageType = "MessageCommand",
Data = command
}, cancellationToken);
}
public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken) public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken)
{ {
var socket = GetActiveSocket(); var socket = GetActiveSocket();

Loading…
Cancel
Save