remove dead interface objects

This commit is contained in:
Luke Pulverenti 2016-10-17 12:35:29 -04:00
parent ba613d5671
commit bba0c564c7
33 changed files with 101 additions and 301 deletions

View File

@ -245,12 +245,8 @@ namespace MediaBrowser.Api
item.OriginalTitle = string.IsNullOrWhiteSpace(request.OriginalTitle) ? null : request.OriginalTitle;
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null)
{
hasCriticRating.CriticRating = request.CriticRating;
hasCriticRating.CriticRatingSummary = request.CriticRatingSummary;
}
item.CriticRating = request.CriticRating;
item.CriticRatingSummary = request.CriticRatingSummary;
item.DisplayMediaType = request.DisplayMediaType;
item.CommunityRating = request.CommunityRating;
@ -279,11 +275,7 @@ namespace MediaBrowser.Api
item.Tagline = request.Taglines.FirstOrDefault();
}
var hasShortOverview = item as IHasShortOverview;
if (hasShortOverview != null)
{
hasShortOverview.ShortOverview = request.ShortOverview;
}
item.ShortOverview = request.ShortOverview;
item.Keywords = request.Keywords;

View File

@ -127,7 +127,9 @@ namespace MediaBrowser.Common.Implementations.Logging
{
for (var i = 0; i < paramList.Length; i++)
{
message = message.Replace("{" + i + "}", paramList[i].ToString());
var obj = paramList[i];
message = message.Replace("{" + i + "}", (obj == null ? "null" : obj.ToString()));
}
}

View File

@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Class BaseItem
/// </summary>
public abstract class BaseItem : IHasProviderIds, ILibraryItem, IHasImages, IHasUserData, IHasMetadata, IHasLookupInfo<ItemLookupInfo>
public abstract class BaseItem : IHasProviderIds, IHasImages, IHasUserData, IHasMetadata, IHasLookupInfo<ItemLookupInfo>
{
protected BaseItem()
{

View File

@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.Entities
/// Plugins derive from and export this class to create a folder that will appear in the root along
/// with all the other actual physical folders in the system.
/// </summary>
public abstract class BasePluginFolder : Folder, ICollectionFolder, IByReferenceItem
public abstract class BasePluginFolder : Folder, ICollectionFolder
{
public virtual string CollectionType
{

View File

@ -1,12 +0,0 @@

namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// This is a marker class that tells us that a particular item type may be physically resolved
/// more than once within the library and we need to be sure to resolve them all to the same
/// instance of that item.
/// </summary>
public interface IByReferenceItem
{
}
}

View File

@ -1,20 +0,0 @@
namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// Interface IHasCriticRating
/// </summary>
public interface IHasCriticRating
{
/// <summary>
/// Gets or sets the critic rating.
/// </summary>
/// <value>The critic rating.</value>
float? CriticRating { get; set; }
/// <summary>
/// Gets or sets the critic rating summary.
/// </summary>
/// <value>The critic rating summary.</value>
string CriticRatingSummary { get; set; }
}
}

View File

@ -1,12 +0,0 @@

namespace MediaBrowser.Controller.Entities
{
public interface IHasShortOverview
{
/// <summary>
/// Gets or sets the short overview.
/// </summary>
/// <value>The short overview.</value>
string ShortOverview { get; set; }
}
}

View File

@ -1,28 +0,0 @@
using System;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// Interface ILibraryItem
/// </summary>
public interface ILibraryItem
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
/// <summary>
/// Gets the id.
/// </summary>
/// <value>The id.</value>
Guid Id { get; }
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
string Path { get; }
}
}

View File

@ -1,10 +0,0 @@
using System;
namespace MediaBrowser.Controller.Entities
{
public class ImageSourceInfo
{
public Guid ImagePathMD5 { get; set; }
public Guid ImageUrlMD5 { get; set; }
}
}

View File

@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <summary>
/// Class Movie
/// </summary>
public class Movie : Video, IHasCriticRating, IHasSpecialFeatures, IHasBudget, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping, IHasOriginalTitle
public class Movie : Video, IHasSpecialFeatures, IHasBudget, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping, IHasOriginalTitle
{
public List<Guid> SpecialFeatureIds { get; set; }

View File

@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
get
{
return true;
return false;
}
}

View File

@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Class Trailer
/// </summary>
public class Trailer : Video, IHasCriticRating, IHasBudget, IHasMetascore, IHasOriginalTitle, IHasLookupInfo<TrailerInfo>
public class Trailer : Video, IHasBudget, IHasMetascore, IHasOriginalTitle, IHasLookupInfo<TrailerInfo>
{
public Trailer()
{

View File

@ -1668,16 +1668,7 @@ namespace MediaBrowser.Controller.Entities
{
var val = query.MinCriticRating.Value;
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null)
{
if (!(hasCriticRating.CriticRating.HasValue && hasCriticRating.CriticRating >= val))
{
return false;
}
}
else
if (!(item.CriticRating.HasValue && item.CriticRating >= val))
{
return false;
}

View File

@ -24,7 +24,6 @@ namespace MediaBrowser.Controller.Entities
IHasAspectRatio,
ISupportsPlaceHolders,
IHasMediaSources,
IHasShortOverview,
IThemeMedia
{
[IgnoreDataMember]

View File

@ -78,14 +78,17 @@ namespace MediaBrowser.Controller.LiveTv
protected override string CreateSortName()
{
double number = 0;
if (!string.IsNullOrEmpty(Number))
{
double.TryParse(Number, NumberStyles.Any, CultureInfo.InvariantCulture, out number);
double number = 0;
if (double.TryParse(Number, NumberStyles.Any, CultureInfo.InvariantCulture, out number))
{
return number.ToString("00000-") + (Name ?? string.Empty);
}
}
return number.ToString("00000-") + (Name ?? string.Empty);
return Number + "-" + (Name ?? string.Empty);
}
[IgnoreDataMember]

View File

@ -132,10 +132,8 @@
<Compile Include="Entities\Game.cs" />
<Compile Include="Entities\GameGenre.cs" />
<Compile Include="Entities\GameSystem.cs" />
<Compile Include="Entities\IByReferenceItem.cs" />
<Compile Include="Entities\IHasAspectRatio.cs" />
<Compile Include="Entities\IHasBudget.cs" />
<Compile Include="Entities\IHasCriticRating.cs" />
<Compile Include="Entities\IHasDisplayOrder.cs" />
<Compile Include="Entities\IHasId.cs" />
<Compile Include="Entities\IHasImages.cs" />
@ -146,15 +144,12 @@
<Compile Include="Entities\IHasProgramAttributes.cs" />
<Compile Include="Entities\IHasScreenshots.cs" />
<Compile Include="Entities\IHasSeries.cs" />
<Compile Include="Entities\IHasShortOverview.cs" />
<Compile Include="Entities\IHasSpecialFeatures.cs" />
<Compile Include="Entities\IHasStartDate.cs" />
<Compile Include="Entities\IHasTrailers.cs" />
<Compile Include="Entities\IHasUserData.cs" />
<Compile Include="Entities\IHiddenFromDisplay.cs" />
<Compile Include="Entities\IItemByName.cs" />
<Compile Include="Entities\ILibraryItem.cs" />
<Compile Include="Entities\ImageSourceInfo.cs" />
<Compile Include="Entities\IMetadataContainer.cs" />
<Compile Include="Entities\InternalItemsQuery.cs" />
<Compile Include="Entities\InternalPeopleQuery.cs" />

View File

@ -185,14 +185,12 @@ namespace MediaBrowser.Controller.Providers
{
var text = reader.ReadElementContentAsString();
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null && !string.IsNullOrEmpty(text))
if (!string.IsNullOrEmpty(text))
{
float value;
if (float.TryParse(text, NumberStyles.Any, _usCulture, out value))
{
hasCriticRating.CriticRating = value;
item.CriticRating = value;
}
}
@ -292,12 +290,7 @@ namespace MediaBrowser.Controller.Providers
if (!string.IsNullOrWhiteSpace(val))
{
var hasShortOverview = item as IHasShortOverview;
if (hasShortOverview != null)
{
hasShortOverview.ShortOverview = val;
}
item.ShortOverview = val;
}
break;
@ -309,12 +302,7 @@ namespace MediaBrowser.Controller.Providers
if (!string.IsNullOrWhiteSpace(val))
{
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null)
{
hasCriticRating.CriticRatingSummary = val;
}
item.CriticRatingSummary = val;
}
break;

View File

@ -12,7 +12,6 @@ namespace MediaBrowser.Controller.Providers
public Stream Stream { get; set; }
public ImageFormat Format { get; set; }
public bool HasImage { get; set; }
public string InternalCacheKey { get; set; }
public void SetFormatFromMimeType(string mimeType)
{

View File

@ -69,28 +69,8 @@ namespace MediaBrowser.Controller.Providers
/// <summary>
/// Saves the image.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="source">The source.</param>
/// <param name="mimeType">Type of the MIME.</param>
/// <param name="type">The type.</param>
/// <param name="imageIndex">Index of the image.</param>
/// <param name="internalCacheKey">The internal cache key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SaveImage(IHasImages item, Stream source, string mimeType, ImageType type, int? imageIndex, string internalCacheKey, CancellationToken cancellationToken);
/// <summary>
/// Saves the image.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="source">The source.</param>
/// <param name="mimeType">Type of the MIME.</param>
/// <param name="type">The type.</param>
/// <param name="imageIndex">Index of the image.</param>
/// <param name="internalCacheKey">The internal cache key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SaveImage(IHasImages item, string source, string mimeType, ImageType type, int? imageIndex, string internalCacheKey, CancellationToken cancellationToken);
Task SaveImage(IHasImages item, string source, string mimeType, ImageType type, int? imageIndex, bool? saveLocallyWithMedia, CancellationToken cancellationToken);
/// <summary>
/// Adds the metadata providers.

View File

@ -585,10 +585,9 @@ namespace MediaBrowser.Dlna.Didl
{
var desc = item.Overview;
var hasShortOverview = item as IHasShortOverview;
if (hasShortOverview != null && !string.IsNullOrEmpty(hasShortOverview.ShortOverview))
if (!string.IsNullOrEmpty(item.ShortOverview))
{
desc = hasShortOverview.ShortOverview;
desc = item.ShortOverview;
}
if (!string.IsNullOrWhiteSpace(desc))

View File

@ -258,18 +258,14 @@ namespace MediaBrowser.LocalMetadata.Savers
builder.Append("<Type>" + SecurityElement.Escape(item.DisplayMediaType) + "</Type>");
}
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null)
if (item.CriticRating.HasValue)
{
if (hasCriticRating.CriticRating.HasValue)
{
builder.Append("<CriticRating>" + SecurityElement.Escape(hasCriticRating.CriticRating.Value.ToString(UsCulture)) + "</CriticRating>");
}
builder.Append("<CriticRating>" + SecurityElement.Escape(item.CriticRating.Value.ToString(UsCulture)) + "</CriticRating>");
}
if (!string.IsNullOrEmpty(hasCriticRating.CriticRatingSummary))
{
builder.Append("<CriticRatingSummary><![CDATA[" + hasCriticRating.CriticRatingSummary + "]]></CriticRatingSummary>");
}
if (!string.IsNullOrEmpty(item.CriticRatingSummary))
{
builder.Append("<CriticRatingSummary><![CDATA[" + item.CriticRatingSummary + "]]></CriticRatingSummary>");
}
if (!string.IsNullOrEmpty(item.Overview))
@ -285,14 +281,10 @@ namespace MediaBrowser.LocalMetadata.Savers
builder.Append("<OriginalTitle>" + SecurityElement.Escape(hasOriginalTitle.OriginalTitle) + "</OriginalTitle>");
}
}
var hasShortOverview = item as IHasShortOverview;
if (hasShortOverview != null)
if (!string.IsNullOrEmpty(item.ShortOverview))
{
if (!string.IsNullOrEmpty(hasShortOverview.ShortOverview))
{
builder.Append("<ShortOverview><![CDATA[" + hasShortOverview.ShortOverview + "]]></ShortOverview>");
}
builder.Append("<ShortOverview><![CDATA[" + item.ShortOverview + "]]></ShortOverview>");
}
if (!string.IsNullOrEmpty(item.CustomRating))

View File

@ -72,7 +72,7 @@ namespace MediaBrowser.Providers.Manager
return SaveImage(item, source, mimeType, type, imageIndex, null, cancellationToken);
}
public async Task SaveImage(IHasImages item, Stream source, string mimeType, ImageType type, int? imageIndex, string internalCacheKey, CancellationToken cancellationToken)
public async Task SaveImage(IHasImages item, Stream source, string mimeType, ImageType type, int? imageIndex, bool? saveLocallyWithMedia, CancellationToken cancellationToken)
{
if (string.IsNullOrEmpty(mimeType))
{
@ -109,9 +109,9 @@ namespace MediaBrowser.Providers.Manager
}
}
}
if (!string.IsNullOrEmpty(internalCacheKey))
if (saveLocallyWithMedia.HasValue && !saveLocallyWithMedia.Value)
{
saveLocally = false;
saveLocally = saveLocallyWithMedia.Value;
}
if (!imageIndex.HasValue && item.AllowsMultipleImages(type))

View File

@ -156,14 +156,14 @@ namespace MediaBrowser.Providers.Manager
var stream = _fileSystem.GetFileStream(response.Path, FileMode.Open, FileAccess.Read, FileShare.Read, true);
await _providerManager.SaveImage(item, stream, mimeType, imageType, null, response.InternalCacheKey, cancellationToken).ConfigureAwait(false);
await _providerManager.SaveImage(item, stream, mimeType, imageType, null, cancellationToken).ConfigureAwait(false);
}
}
else
{
var mimeType = "image/" + response.Format.ToString().ToLower();
await _providerManager.SaveImage(item, response.Stream, mimeType, imageType, null, response.InternalCacheKey, cancellationToken).ConfigureAwait(false);
await _providerManager.SaveImage(item, response.Stream, mimeType, imageType, null, cancellationToken).ConfigureAwait(false);
}
downloadedImages.Add(imageType);

View File

@ -353,19 +353,16 @@ namespace MediaBrowser.Providers.Manager
{
var updateType = ItemUpdateType.None;
if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
var folder = item as Folder;
if (folder != null && folder.SupportsDateLastMediaAdded)
{
var folder = item as Folder;
if (folder != null && folder.SupportsDateLastMediaAdded)
{
var items = folder.GetRecursiveChildren(i => !i.IsFolder).Select(i => i.DateCreated).ToList();
var date = items.Count == 0 ? (DateTime?)null : items.Max();
var items = folder.GetRecursiveChildren(i => !i.IsFolder).Select(i => i.DateCreated).ToList();
var date = items.Count == 0 ? (DateTime?)null : items.Max();
if ((!folder.DateLastMediaAdded.HasValue && date.HasValue) || folder.DateLastMediaAdded != date)
{
folder.DateLastMediaAdded = date;
updateType = ItemUpdateType.MetadataEdit;
}
if ((!folder.DateLastMediaAdded.HasValue && date.HasValue) || folder.DateLastMediaAdded != date)
{
folder.DateLastMediaAdded = date;
updateType = ItemUpdateType.MetadataImport;
}
}

View File

@ -140,12 +140,7 @@ namespace MediaBrowser.Providers.Manager
return new ImageSaver(ConfigurationManager, _libraryMonitor, _fileSystem, _logger, _memoryStreamProvider).SaveImage(item, source, mimeType, type, imageIndex, cancellationToken);
}
public Task SaveImage(IHasImages item, Stream source, string mimeType, ImageType type, int? imageIndex, string internalCacheKey, CancellationToken cancellationToken)
{
return new ImageSaver(ConfigurationManager, _libraryMonitor, _fileSystem, _logger, _memoryStreamProvider).SaveImage(item, source, mimeType, type, imageIndex, internalCacheKey, cancellationToken);
}
public Task SaveImage(IHasImages item, string source, string mimeType, ImageType type, int? imageIndex, string internalCacheKey, CancellationToken cancellationToken)
public Task SaveImage(IHasImages item, string source, string mimeType, ImageType type, int? imageIndex, bool? saveLocallyWithMedia, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(source))
{
@ -154,7 +149,7 @@ namespace MediaBrowser.Providers.Manager
var fileStream = _fileSystem.GetFileStream(source, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, true);
return new ImageSaver(ConfigurationManager, _libraryMonitor, _fileSystem, _logger, _memoryStreamProvider).SaveImage(item, fileStream, mimeType, type, imageIndex, internalCacheKey, cancellationToken);
return new ImageSaver(ConfigurationManager, _libraryMonitor, _fileSystem, _logger, _memoryStreamProvider).SaveImage(item, fileStream, mimeType, type, imageIndex, saveLocallyWithMedia, cancellationToken);
}
public async Task<IEnumerable<RemoteImageInfo>> GetAvailableRemoteImages(IHasImages item, RemoteImageQuery query, CancellationToken cancellationToken)

View File

@ -236,15 +236,9 @@ namespace MediaBrowser.Providers.Manager
private static void MergeShortOverview(BaseItem source, BaseItem target, List<MetadataFields> lockedFields, bool replaceData)
{
var sourceHasShortOverview = source as IHasShortOverview;
var targetHasShortOverview = target as IHasShortOverview;
if (sourceHasShortOverview != null && targetHasShortOverview != null)
if (replaceData || string.IsNullOrEmpty(target.ShortOverview))
{
if (replaceData || string.IsNullOrEmpty(targetHasShortOverview.ShortOverview))
{
targetHasShortOverview.ShortOverview = sourceHasShortOverview.ShortOverview;
}
target.ShortOverview = source.ShortOverview;
}
}
@ -311,20 +305,14 @@ namespace MediaBrowser.Providers.Manager
private static void MergeCriticRating(BaseItem source, BaseItem target, List<MetadataFields> lockedFields, bool replaceData)
{
var sourceCast = source as IHasCriticRating;
var targetCast = target as IHasCriticRating;
if (sourceCast != null && targetCast != null)
if (replaceData || !target.CriticRating.HasValue)
{
if (replaceData || !targetCast.CriticRating.HasValue)
{
targetCast.CriticRating = sourceCast.CriticRating;
}
target.CriticRating = source.CriticRating;
}
if (replaceData || string.IsNullOrEmpty(targetCast.CriticRatingSummary))
{
targetCast.CriticRatingSummary = sourceCast.CriticRatingSummary;
}
if (replaceData || string.IsNullOrEmpty(target.CriticRatingSummary))
{
target.CriticRatingSummary = source.CriticRatingSummary;
}
}

View File

@ -66,28 +66,24 @@ namespace MediaBrowser.Providers.Omdb
item.ProductionYear = year;
}
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null)
{
// Seeing some bogus RT data on omdb for series, so filter it out here
// RT doesn't even have tv series
int tomatoMeter;
// Seeing some bogus RT data on omdb for series, so filter it out here
// RT doesn't even have tv series
int tomatoMeter;
if (!string.IsNullOrEmpty(result.tomatoMeter)
&& int.TryParse(result.tomatoMeter, NumberStyles.Integer, _usCulture, out tomatoMeter)
&& tomatoMeter >= 0)
{
hasCriticRating.CriticRating = tomatoMeter;
}
if (!string.IsNullOrEmpty(result.tomatoMeter)
&& int.TryParse(result.tomatoMeter, NumberStyles.Integer, _usCulture, out tomatoMeter)
&& tomatoMeter >= 0)
{
item.CriticRating = tomatoMeter;
}
if (!string.IsNullOrEmpty(result.tomatoConsensus)
&& !string.Equals(result.tomatoConsensus, "No consensus yet.", StringComparison.OrdinalIgnoreCase))
{
hasCriticRating.CriticRatingSummary = WebUtility.HtmlDecode(result.tomatoConsensus);
}
}
if (!string.IsNullOrEmpty(result.tomatoConsensus)
&& !string.Equals(result.tomatoConsensus, "No consensus yet.", StringComparison.OrdinalIgnoreCase))
{
item.CriticRatingSummary = WebUtility.HtmlDecode(result.tomatoConsensus);
}
int voteCount;
int voteCount;
if (!string.IsNullOrEmpty(result.imdbVotes)
&& int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount)
@ -167,25 +163,21 @@ namespace MediaBrowser.Providers.Omdb
item.ProductionYear = year;
}
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null)
// Seeing some bogus RT data on omdb for series, so filter it out here
// RT doesn't even have tv series
int tomatoMeter;
if (!string.IsNullOrEmpty(result.tomatoMeter)
&& int.TryParse(result.tomatoMeter, NumberStyles.Integer, _usCulture, out tomatoMeter)
&& tomatoMeter >= 0)
{
// Seeing some bogus RT data on omdb for series, so filter it out here
// RT doesn't even have tv series
int tomatoMeter;
item.CriticRating = tomatoMeter;
}
if (!string.IsNullOrEmpty(result.tomatoMeter)
&& int.TryParse(result.tomatoMeter, NumberStyles.Integer, _usCulture, out tomatoMeter)
&& tomatoMeter >= 0)
{
hasCriticRating.CriticRating = tomatoMeter;
}
if (!string.IsNullOrEmpty(result.tomatoConsensus)
&& !string.Equals(result.tomatoConsensus, "No consensus yet.", StringComparison.OrdinalIgnoreCase))
{
hasCriticRating.CriticRatingSummary = WebUtility.HtmlDecode(result.tomatoConsensus);
}
if (!string.IsNullOrEmpty(result.tomatoConsensus)
&& !string.Equals(result.tomatoConsensus, "No consensus yet.", StringComparison.OrdinalIgnoreCase))
{
item.CriticRatingSummary = WebUtility.HtmlDecode(result.tomatoConsensus);
}
int voteCount;
@ -420,12 +412,8 @@ namespace MediaBrowser.Providers.Omdb
hasAwards.AwardSummary = WebUtility.HtmlDecode(result.Awards);
}
var hasShortOverview = item as IHasShortOverview;
if (hasShortOverview != null)
{
// Imdb plots are usually pretty short
hasShortOverview.ShortOverview = result.Plot;
}
// Imdb plots are usually pretty short
item.ShortOverview = result.Plot;
//if (!string.IsNullOrWhiteSpace(result.Director))
//{

View File

@ -2838,7 +2838,7 @@ namespace MediaBrowser.Server.Implementations.Library
private bool ValidateNetworkPath(string path)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT || !path.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase))
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
return Directory.Exists(path);
}

View File

@ -1854,23 +1854,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
ParentIndexNumber = program.SeasonNumber.Value,
IndexNumber = program.EpisodeNumber.Value,
AncestorIds = seriesIds,
ExcludeLocationTypes = new[] { LocationType.Virtual }
});
if (result.TotalRecordCount > 0)
{
return true;
}
}
if (!string.IsNullOrWhiteSpace(program.EpisodeTitle))
{
var result = _libraryManager.GetItemsResult(new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(Episode).Name },
Name = program.EpisodeTitle,
AncestorIds = seriesIds,
ExcludeLocationTypes = new[] { LocationType.Virtual }
IsVirtualItem = false
});
if (result.TotalRecordCount > 0)

View File

@ -72,7 +72,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{
dto.ProgramInfo = _dtoService.GetBaseItemDto(program, new DtoOptions());
dto.ProgramInfo.TimerId = dto.Id;
if (info.Status != RecordingStatus.Cancelled && info.Status != RecordingStatus.Error)
{
dto.ProgramInfo.TimerId = dto.Id;
dto.ProgramInfo.Status = info.Status.ToString();
}
dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId;
}

View File

@ -144,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.Photos
return ItemUpdateType.None;
}
await ProviderManager.SaveImage(item, outputPath, "image/png", imageType, null, Guid.NewGuid().ToString("N"), cancellationToken).ConfigureAwait(false);
await ProviderManager.SaveImage(item, outputPath, "image/png", imageType, null, false, cancellationToken).ConfigureAwait(false);
return ItemUpdateType.ImageUpdate;
}

View File

@ -22,9 +22,7 @@ namespace MediaBrowser.Server.Implementations.Sorting
private float GetValue(BaseItem x)
{
var hasCriticRating = x as IHasCriticRating;
return hasCriticRating == null ? 0 : hasCriticRating.CriticRating ?? 0;
return x.CriticRating ?? 0;
}
/// <summary>

View File

@ -294,14 +294,12 @@ namespace MediaBrowser.XbmcMetadata.Parsers
{
var text = reader.ReadElementContentAsString();
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null && !string.IsNullOrEmpty(text))
if (!string.IsNullOrEmpty(text))
{
float value;
if (float.TryParse(text, NumberStyles.Any, _usCulture, out value))
{
hasCriticRating.CriticRating = value;
item.CriticRating = value;
}
}
@ -388,12 +386,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
if (!string.IsNullOrWhiteSpace(val))
{
var hasShortOverview = item as IHasShortOverview;
if (hasShortOverview != null)
{
hasShortOverview.ShortOverview = val;
}
item.ShortOverview = val;
}
break;
}
@ -418,12 +411,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
if (!string.IsNullOrWhiteSpace(val))
{
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null)
{
hasCriticRating.CriticRatingSummary = val;
}
item.CriticRatingSummary = val;
}
break;