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

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

@ -77,15 +77,16 @@ namespace MediaBrowser.Api
/// <param name="request">The request.</param>
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);
}

@ -548,7 +548,7 @@ namespace MediaBrowser.Api.Images
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;

@ -112,7 +112,7 @@ namespace MediaBrowser.Api
/// </summary>
/// <value>The id.</value>
[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>
@ -221,7 +221,7 @@ namespace MediaBrowser.Api
/// <param name="request">The request.</param>
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)
{

@ -171,9 +171,9 @@ namespace MediaBrowser.Api
var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary);
if (primaryImageTag.HasValue)
if (primaryImageTag != null)
{
result.PrimaryImageTag = primaryImageTag.Value;
result.PrimaryImageTag = primaryImageTag;
}
SetThumbImageInfo(result, item);
@ -250,9 +250,9 @@ namespace MediaBrowser.Api
{
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");
}
}
@ -271,9 +271,9 @@ namespace MediaBrowser.Api
{
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");
}
}

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

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

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

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

@ -5,6 +5,7 @@ using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Progress;
using MediaBrowser.Common.Security;
using MediaBrowser.Common.Updates;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Updates;
@ -367,7 +368,7 @@ namespace MediaBrowser.Common.Implementations.Updates
var installationInfo = new InstallationInfo
{
Id = Guid.NewGuid(),
Id = Guid.NewGuid().ToString("N"),
Name = package.name,
AssemblyGuid = package.guid,
UpdateClass = package.classification,
@ -510,13 +511,14 @@ namespace MediaBrowser.Common.Implementations.Updates
cancellationToken.ThrowIfCancellationRequested();
// 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 stream = new BufferedStream(File.OpenRead(tempFile), 100000))
{
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));
}

@ -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 System;
using System.Collections.Generic;

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

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

@ -38,7 +38,7 @@ namespace MediaBrowser.Common.ScheduledTasks
Name = task.Name,
CurrentProgressPercentage = task.CurrentProgress,
State = task.State,
Id = task.Id,
Id = task.Id.ToString("N"),
LastExecutionResult = task.LastExecutionResult,
Triggers = task.Triggers.Select(GetTriggerInfo).ToList(),
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 System;
using System.Collections.Concurrent;

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

@ -55,7 +55,7 @@ namespace MediaBrowser.Controller.Drawing
/// <param name="item">The item.</param>
/// <param name="image">The image.</param>
/// <returns>Guid.</returns>
Guid GetImageCacheTag(IHasImages item, ItemImageInfo image);
string GetImageCacheTag(IHasImages item, ItemImageInfo image);
/// <summary>
/// Gets the image cache tag.
@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.Drawing
/// <param name="dateModified">The date modified.</param>
/// <param name="imageEnhancers">The image enhancers.</param>
/// <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);
/// <summary>
@ -89,12 +89,12 @@ namespace MediaBrowser.Controller.Drawing
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);
}
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);

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

@ -34,6 +34,6 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="userId">The user id.</param>
/// <param name="client">The client.</param>
/// <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>
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>
/// Sends the play command.
/// </summary>

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

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

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

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

@ -138,7 +138,7 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="notificationIdList">The notification id list.</param>
/// <param name="isRead">if set to <c>true</c> [is read].</param>
/// <returns>Task.</returns>
Task MarkNotificationsRead(string userId, IEnumerable<Guid> notificationIdList, bool isRead);
Task MarkNotificationsRead(string userId, IEnumerable<string> notificationIdList, bool isRead);
/// <summary>
/// Gets the notifications summary.
@ -447,7 +447,7 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="id">The id.</param>
/// <returns>Task{TaskInfo}.</returns>
/// <exception cref="ArgumentNullException">id</exception>
Task<TaskInfo> GetScheduledTaskAsync(Guid id);
Task<TaskInfo> GetScheduledTaskAsync(string id);
/// <summary>
/// Gets a user by id
@ -581,6 +581,38 @@ namespace MediaBrowser.Model.ApiClient
/// <returns>Task.</returns>
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>
/// Instructs the client to display a message to the user
/// </summary>
@ -632,7 +664,7 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="triggers">The triggers.</param>
/// <returns>Task{RequestResult}.</returns>
/// <exception cref="ArgumentNullException">id</exception>
Task UpdateScheduledTaskTriggersAsync(Guid id, TaskTriggerInfo[] triggers);
Task UpdateScheduledTaskTriggersAsync(string id, TaskTriggerInfo[] triggers);
/// <summary>
/// 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
{
@ -10,59 +17,59 @@ namespace MediaBrowser.Model.ApiClient
/// <summary>
/// Occurs when [user deleted].
/// </summary>
event EventHandler<UserDeletedEventArgs> UserDeleted;
event EventHandler<GenericEventArgs<string>> UserDeleted;
/// <summary>
/// Occurs when [scheduled task started].
/// </summary>
event EventHandler<ScheduledTaskStartedEventArgs> ScheduledTaskStarted;
event EventHandler<GenericEventArgs<string>> ScheduledTaskStarted;
/// <summary>
/// Occurs when [scheduled task ended].
/// </summary>
event EventHandler<ScheduledTaskEndedEventArgs> ScheduledTaskEnded;
event EventHandler<GenericEventArgs<TaskResult>> ScheduledTaskEnded;
/// <summary>
/// Occurs when [package installing].
/// </summary>
event EventHandler<PackageInstallationEventArgs> PackageInstalling;
event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstalling;
/// <summary>
/// Occurs when [package installation failed].
/// </summary>
event EventHandler<PackageInstallationEventArgs> PackageInstallationFailed;
event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationFailed;
/// <summary>
/// Occurs when [package installation completed].
/// </summary>
event EventHandler<PackageInstallationEventArgs> PackageInstallationCompleted;
event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationCompleted;
/// <summary>
/// Occurs when [package installation cancelled].
/// </summary>
event EventHandler<PackageInstallationEventArgs> PackageInstallationCancelled;
event EventHandler<GenericEventArgs<InstallationInfo>> PackageInstallationCancelled;
/// <summary>
/// Occurs when [user updated].
/// </summary>
event EventHandler<UserUpdatedEventArgs> UserUpdated;
event EventHandler<GenericEventArgs<UserDto>> UserUpdated;
/// <summary>
/// Occurs when [plugin uninstalled].
/// </summary>
event EventHandler<PluginUninstallEventArgs> PluginUninstalled;
event EventHandler<GenericEventArgs<PluginInfo>> PluginUninstalled;
/// <summary>
/// Occurs when [library changed].
/// </summary>
event EventHandler<LibraryChangedEventArgs> LibraryChanged;
event EventHandler<GenericEventArgs<LibraryUpdateInfo>> LibraryChanged;
/// <summary>
/// Occurs when [browse command].
/// </summary>
event EventHandler<BrowseRequestEventArgs> BrowseCommand;
event EventHandler<GenericEventArgs<BrowseRequest>> BrowseCommand;
/// <summary>
/// Occurs when [play command].
/// </summary>
event EventHandler<PlayRequestEventArgs> PlayCommand;
event EventHandler<GenericEventArgs<PlayRequest>> PlayCommand;
/// <summary>
/// Occurs when [playstate command].
/// </summary>
event EventHandler<PlaystateRequestEventArgs> PlaystateCommand;
event EventHandler<GenericEventArgs<PlaystateRequest>> PlaystateCommand;
/// <summary>
/// Occurs when [message command].
/// </summary>
event EventHandler<MessageCommandEventArgs> MessageCommand;
event EventHandler<GenericEventArgs<MessageCommand>> MessageCommand;
/// <summary>
/// Occurs when [system command].
/// </summary>
@ -88,6 +95,22 @@ namespace MediaBrowser.Model.ApiClient
/// </summary>
event EventHandler<EventArgs> ServerShuttingDown;
/// <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].
/// </summary>
event EventHandler<SessionUpdatesEventArgs> SessionsUpdated;
@ -98,7 +121,7 @@ namespace MediaBrowser.Model.ApiClient
/// <summary>
/// Occurs when [user data changed].
/// </summary>
event EventHandler<UserDataChangedEventArgs> UserDataChanged;
event EventHandler<GenericEventArgs<UserDataChangeInfo>> UserDataChanged;
/// <summary>
/// Occurs when [connected].
/// </summary>

@ -1,154 +1,8 @@
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Updates;
using MediaBrowser.Model.Session;
using System;
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>
/// Class SystemCommandEventArgs
/// </summary>

@ -30,7 +30,7 @@ namespace MediaBrowser.Model.Configuration
public MetadataOptions(int backdropLimit, int minBackdropWidth)
{
var imageOptions = new List<ImageOption>
List<ImageOption> imageOptions = new List<ImageOption>
{
new ImageOption
{
@ -52,14 +52,14 @@ namespace MediaBrowser.Model.Configuration
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;
}
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;
}

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

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

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

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

@ -311,7 +311,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the parent backdrop image tags.
/// </summary>
/// <value>The parent backdrop image tags.</value>
public List<Guid> ParentBackdropImageTags { get; set; }
public List<string> ParentBackdropImageTags { get; set; }
/// <summary>
/// Gets or sets the local trailer count.
@ -466,13 +466,13 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the album image tag.
/// </summary>
/// <value>The album image tag.</value>
public Guid? AlbumPrimaryImageTag { get; set; }
public string AlbumPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the series primary image tag.
/// </summary>
/// <value>The series primary image tag.</value>
public Guid? SeriesPrimaryImageTag { get; set; }
public string SeriesPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the album artist.
@ -529,25 +529,25 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the image tags.
/// </summary>
/// <value>The image tags.</value>
public Dictionary<ImageType, Guid> ImageTags { get; set; }
public Dictionary<ImageType, string> ImageTags { get; set; }
/// <summary>
/// Gets or sets the backdrop image tags.
/// </summary>
/// <value>The backdrop image tags.</value>
public List<Guid> BackdropImageTags { get; set; }
public List<string> BackdropImageTags { get; set; }
/// <summary>
/// Gets or sets the screenshot image tags.
/// </summary>
/// <value>The screenshot image tags.</value>
public List<Guid> ScreenshotImageTags { get; set; }
public List<string> ScreenshotImageTags { get; set; }
/// <summary>
/// Gets or sets the parent logo image tag.
/// </summary>
/// <value>The parent logo image tag.</value>
public Guid? ParentLogoImageTag { get; set; }
public string ParentLogoImageTag { get; set; }
/// <summary>
/// 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.
/// </summary>
/// <value>The parent art image tag.</value>
public Guid? ParentArtImageTag { get; set; }
public string ParentArtImageTag { get; set; }
/// <summary>
/// Gets or sets the series thumb image tag.
/// </summary>
/// <value>The series thumb image tag.</value>
public Guid? SeriesThumbImageTag { get; set; }
public string SeriesThumbImageTag { get; set; }
/// <summary>
/// Gets or sets the series studio.
@ -583,7 +583,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the parent thumb image tag.
/// </summary>
/// <value>The parent thumb image tag.</value>
public Guid? ParentThumbImageTag { get; set; }
public string ParentThumbImageTag { get; set; }
/// <summary>
/// Gets or sets the chapters.

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

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

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

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

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

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

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

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

@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the user id.
/// </summary>
/// <value>The user id.</value>
public Guid Id { get; set; }
public string Id { get; set; }
/// <summary>
/// Gets or sets the type of the view.
/// </summary>
@ -105,7 +105,7 @@ namespace MediaBrowser.Model.Entities
{
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);
PrimaryImageHeight = Convert.ToInt32(size.Height);

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

@ -1,6 +1,6 @@
using System;
namespace MediaBrowser.Common.Events
namespace MediaBrowser.Model.Events
{
/// <summary>
/// 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.
/// </summary>
/// <value>The image tags.</value>
public Dictionary<ImageType, Guid> ImageTags { get; set; }
public Dictionary<ImageType, string> ImageTags { get; set; }
/// <summary>
/// Gets or sets the number.
@ -113,7 +113,7 @@ namespace MediaBrowser.Model.LiveTv
public ChannelInfoDto()
{
ImageTags = new Dictionary<ImageType, Guid>();
ImageTags = new Dictionary<ImageType, string>();
MediaSources = new List<MediaSourceInfo>();
}

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

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

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

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

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

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

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

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

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

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

@ -47,7 +47,7 @@ namespace MediaBrowser.Model.Updates
/// <param name="str">The STR.</param>
/// <param name="def">The def.</param>
/// <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;
}
@ -80,7 +80,7 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the source URL.
/// </summary>
/// <value>The source URL.</value>
public Guid checksum { get; set; }
public string checksum { get; set; }
/// <summary>
/// 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>
/// Adds the specified name.
/// </summary>

@ -91,9 +91,18 @@ namespace MediaBrowser.Providers.MediaInfo
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
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;
}

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

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

@ -649,7 +649,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
/// <param name="image">The image.</param>
/// <returns>Guid.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
public Guid GetImageCacheTag(IHasImages item, ItemImageInfo image)
public string GetImageCacheTag(IHasImages item, ItemImageInfo image)
{
if (item == null)
{
@ -676,7 +676,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
/// <param name="imageEnhancers">The image enhancers.</param>
/// <returns>Guid.</returns>
/// <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)
{
@ -696,14 +696,14 @@ namespace MediaBrowser.Server.Implementations.Drawing
// Optimization
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
var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList();
cacheKeys.Add(originalImagePath + dateModified.Ticks);
return string.Join("|", cacheKeys.ToArray()).GetMD5();
return string.Join("|", cacheKeys.ToArray()).GetMD5().ToString("N");
}
/// <summary>

@ -326,7 +326,7 @@ namespace MediaBrowser.Server.Implementations.Dto
/// </summary>
/// <param name="item">The item.</param>
/// <returns>List{System.String}.</returns>
private List<Guid> GetBackdropImageTags(BaseItem item)
private List<string> GetBackdropImageTags(BaseItem item)
{
return GetCacheTags(item, ImageType.Backdrop).ToList();
}
@ -336,26 +336,25 @@ namespace MediaBrowser.Server.Implementations.Dto
/// </summary>
/// <param name="item">The item.</param>
/// <returns>List{Guid}.</returns>
private List<Guid> GetScreenshotImageTags(BaseItem item)
private List<string> GetScreenshotImageTags(BaseItem item)
{
var hasScreenshots = item as IHasScreenshots;
if (hasScreenshots == null)
{
return new List<Guid>();
return new List<string>();
}
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)
.Select(p => GetImageCacheTag(item, p))
.Where(i => i.HasValue)
.Select(i => i.Value)
.Where(i => i != null)
.ToList();
}
private Guid? GetImageCacheTag(BaseItem item, ImageType type)
private string GetImageCacheTag(BaseItem item, ImageType type)
{
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
{
@ -677,7 +676,7 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.Genres = item.Genres;
}
dto.ImageTags = new Dictionary<ImageType, Guid>();
dto.ImageTags = new Dictionary<ImageType, string>();
// Prevent implicitly captured closure
var currentItem = item;
@ -685,9 +684,9 @@ namespace MediaBrowser.Server.Implementations.Dto
{
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))
.Select(m => m.BitRate ?? 0)
.Sum();

@ -252,15 +252,15 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
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.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Tasks;

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

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

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

@ -111,7 +111,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
throw new ArgumentNullException("displayPreferences");
}
if (displayPreferences.Id == Guid.Empty)
if (string.IsNullOrWhiteSpace(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.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, "@3", DbType.String).Value = client;
cmd.Parameters.Add(cmd, "@4", DbType.Binary).Value = serialized;
@ -183,9 +183,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
/// <param name="client">The client.</param>
/// <returns>Task{DisplayPreferences}.</returns>
/// <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");
}
@ -193,7 +193,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
var cmd = _connection.CreateCommand();
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, "@client", DbType.String).Value = client;
@ -208,7 +208,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
}
return new DisplayPreferences { Id = displayPreferencesId };
return null;
}
/// <summary>

@ -56,16 +56,6 @@ namespace MediaBrowser.Server.Implementations.Roku
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)
{
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.Controller.Configuration;
using MediaBrowser.Controller.Drawing;
@ -712,12 +713,20 @@ namespace MediaBrowser.Server.Implementations.Session
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);
AssertCanControl(session, controllingSession);
generalCommand.Arguments["Header"] = command.Header;
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)
@ -1199,7 +1208,7 @@ namespace MediaBrowser.Server.Implementations.Session
};
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
if (info.PrimaryImageTag.HasValue)
if (info.PrimaryImageTag != null)
{
info.PrimaryImageItemId = GetDtoId(item);
}
@ -1237,14 +1246,14 @@ namespace MediaBrowser.Server.Implementations.Session
info.Album = audio.Album;
info.Artists = audio.Artists;
if (!info.PrimaryImageTag.HasValue)
if (info.PrimaryImageTag == null)
{
var album = audio.Parents.OfType<MusicAlbum>().FirstOrDefault();
if (album != null && album.HasImage(ImageType.Primary))
{
info.PrimaryImageTag = GetImageCacheTag(album, ImageType.Primary);
if (info.PrimaryImageTag.HasValue)
if (info.PrimaryImageTag != null)
{
info.PrimaryImageItemId = GetDtoId(album);
}
@ -1345,7 +1354,7 @@ namespace MediaBrowser.Server.Implementations.Session
return info;
}
private Guid? GetImageCacheTag(BaseItem item, ImageType type)
private string GetImageCacheTag(BaseItem item, ImageType type)
{
try
{

@ -57,18 +57,6 @@ namespace MediaBrowser.Server.Implementations.Session
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)
{
var socket = GetActiveSocket();

Loading…
Cancel
Save