Skip to content

Commit

Permalink
Removed guids from the model project
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed May 8, 2014
1 parent b367416 commit c742f34
Show file tree
Hide file tree
Showing 77 changed files with 425 additions and 548 deletions.
6 changes: 3 additions & 3 deletions MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public object Get(GetMovieView request)

// Avoid implicitly captured closure
var currentUserId1 = user.Id;

view.LatestMovies = movies
.OrderByDescending(i => i.DateCreated)
.Where(i => !_userDataManager.GetUserData(currentUserId1, i.GetUserDataKey()).Played)
Expand Down Expand Up @@ -622,9 +622,9 @@ private ItemStub GetItemStub(BaseItem item, ImageType imageType)
{
var tag = _imageProcessor.GetImageCacheTag(item, imageType);

if (tag.HasValue)
if (tag != null)
{
stub.ImageTag = tag.Value;
stub.ImageTag = tag;
}
}
catch (Exception ex)
Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.Api/DefaultTheme/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ItemStub
{
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; }
}

Expand Down
11 changes: 6 additions & 5 deletions MediaBrowser.Api/DisplayPreferencesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ public DisplayPreferencesService(IJsonSerializer jsonSerializer, IDisplayPrefere
/// <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);
}

Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.Api/Images/ImageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public object GetImage(ImageRequest request, IHasImages item)

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;

Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Api/PackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class CancelPackageInstallation : IReturnVoid
/// </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>
Expand Down Expand Up @@ -221,7 +221,7 @@ public void Post(InstallPackage request)
/// <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)
{
Expand Down
12 changes: 6 additions & 6 deletions MediaBrowser.Api/SearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ private SearchHint GetSearchHintResult(SearchHintInfo hintInfo)

var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary);

if (primaryImageTag.HasValue)
if (primaryImageTag != null)
{
result.PrimaryImageTag = primaryImageTag.Value;
result.PrimaryImageTag = primaryImageTag;
}

SetThumbImageInfo(result, item);
Expand Down Expand Up @@ -250,9 +250,9 @@ private void SetThumbImageInfo(SearchHint hint, BaseItem item)
{
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");
}
}
Expand All @@ -271,9 +271,9 @@ private void SetBackdropImageInfo(SearchHint hint, BaseItem item)
{
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");
}
}
Expand Down
4 changes: 1 addition & 3 deletions MediaBrowser.Api/UserLibrary/UserLibraryService.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -8,7 +7,6 @@
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
using ServiceStack;
using System;
Expand Down
1 change: 1 addition & 0 deletions MediaBrowser.Common.Implementations/BaseApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ private void OnTaskCompleted(DateTime startTime, DateTime endTime, TaskCompletio
EndTimeUtc = endTime,
Status = status,
Name = Name,
Id = Id
Id = Id.ToString("N")
};

if (ex != null)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;
Expand Down Expand Up @@ -367,7 +368,7 @@ public async Task InstallPackage(PackageVersionInfo package, IProgress<double> p

var installationInfo = new InstallationInfo
{
Id = Guid.NewGuid(),
Id = Guid.NewGuid().ToString("N"),
Name = package.name,
AssemblyGuid = package.guid,
UpdateClass = package.classification,
Expand Down Expand Up @@ -510,13 +511,14 @@ private async Task PerformPackageInstallation(IProgress<double> progress, Packag
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));
}
Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Common/IApplicationHost.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion MediaBrowser.Common/MediaBrowser.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.Common/ScheduledTasks/ITaskManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MediaBrowser.Common.Events;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Tasks;
using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static TaskInfo GetTaskInfo(IScheduledTaskWorker task)
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,
Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Common/Updates/IInstallationManager.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions MediaBrowser.Controller/Drawing/IImageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public interface IImageProcessor
/// <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.
Expand All @@ -66,7 +66,7 @@ public interface IImageProcessor
/// <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>
Expand All @@ -89,12 +89,12 @@ Guid GetImageCacheTag(IHasImages item, ImageType imageType, string originalImage

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

Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Controller/Library/IUserManager.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ Task SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId,
/// <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);
}
}
8 changes: 0 additions & 8 deletions MediaBrowser.Controller/Session/ISessionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ public interface ISessionController
/// <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>
Expand Down
6 changes: 2 additions & 4 deletions MediaBrowser.Dlna/Didl/DidlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,7 @@ private ImageDownloadInfo GetImageInfo(BaseItem item, ImageType type)

try
{
var guid = _imageProcessor.GetImageCacheTag(item, ImageType.Primary);

tag = guid.HasValue ? guid.Value.ToString("N") : null;
tag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary);
}
catch
{
Expand Down Expand Up @@ -712,7 +710,7 @@ private ImageUrlInfo GetImageUrl(ImageDownloadInfo info, int? maxWidth, int? max
Height = height.Value,
Width = width.Value

}, maxWidth: maxWidth, maxHeight: maxHeight);
}, null, null, maxWidth, maxHeight);

width = Convert.ToInt32(newSize.Width);
height = Convert.ToInt32(newSize.Height);
Expand Down
5 changes: 0 additions & 5 deletions MediaBrowser.Dlna/PlayTo/DlnaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,6 @@ public Task SendLibraryUpdateInfo(LibraryUpdateInfo info, CancellationToken canc
return Task.FromResult(true);
}

public Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken)
{
return Task.FromResult(true);
}

#endregion

#region Playlist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading

0 comments on commit c742f34

Please sign in to comment.