aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Dto/DtoService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Dto/DtoService.cs')
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs92
1 files changed, 36 insertions, 56 deletions
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 9c50ad5da..4ee3df7f5 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -360,7 +360,6 @@ namespace Emby.Server.Implementations.Dto
var collectionFolder = item as ICollectionFolder;
if (collectionFolder != null)
{
- dto.OriginalCollectionType = collectionFolder.CollectionType;
dto.CollectionType = collectionFolder.CollectionType;
}
@@ -492,7 +491,10 @@ namespace Emby.Server.Implementations.Dto
}
}
- dto.PlayAccess = item.GetPlayAccess(user);
+ //if (!(item is LiveTvProgram))
+ {
+ dto.PlayAccess = item.GetPlayAccess(user);
+ }
if (fields.Contains(ItemFields.BasicSyncInfo) || fields.Contains(ItemFields.SyncInfo))
{
@@ -502,33 +504,6 @@ namespace Emby.Server.Implementations.Dto
dto.SupportsSync = true;
}
}
-
- if (fields.Contains(ItemFields.SeasonUserData))
- {
- var episode = item as Episode;
-
- if (episode != null)
- {
- var season = episode.Season;
-
- if (season != null)
- {
- dto.SeasonUserData = await _userDataRepository.GetUserDataDto(season, user).ConfigureAwait(false);
- }
- }
- }
-
- var userView = item as UserView;
- if (userView != null)
- {
- dto.HasDynamicCategories = userView.ContainsDynamicCategories(user);
- }
-
- var collectionFolder = item as ICollectionFolder;
- if (collectionFolder != null)
- {
- dto.HasDynamicCategories = false;
- }
}
private int GetChildCount(Folder folder, User user)
@@ -879,20 +854,6 @@ namespace Emby.Server.Implementations.Dto
}
dto.Container = item.Container;
- var hasBudget = item as IHasBudget;
- if (hasBudget != null)
- {
- if (fields.Contains(ItemFields.Budget))
- {
- dto.Budget = hasBudget.Budget;
- }
-
- if (fields.Contains(ItemFields.Revenue))
- {
- dto.Revenue = hasBudget.Revenue;
- }
- }
-
dto.EndDate = item.EndDate;
if (fields.Contains(ItemFields.HomePageUrl))
@@ -994,7 +955,12 @@ namespace Emby.Server.Implementations.Dto
}
dto.MediaType = item.MediaType;
- dto.LocationType = item.LocationType;
+
+ if (!(item is LiveTvProgram))
+ {
+ dto.LocationType = item.LocationType;
+ }
+
if (item.IsHD.HasValue && item.IsHD.Value)
{
dto.IsHD = item.IsHD;
@@ -1065,7 +1031,7 @@ namespace Emby.Server.Implementations.Dto
if (fields.Contains(ItemFields.Path))
{
- dto.Path = GetMappedPath(item);
+ dto.Path = GetMappedPath(item, owner);
}
dto.PremiereDate = item.PremiereDate;
@@ -1102,7 +1068,10 @@ namespace Emby.Server.Implementations.Dto
}
dto.Type = item.GetClientTypeName();
- dto.CommunityRating = item.CommunityRating;
+ if ((item.CommunityRating ?? 0) > 0)
+ {
+ dto.CommunityRating = item.CommunityRating;
+ }
if (fields.Contains(ItemFields.VoteCount))
{
@@ -1396,7 +1365,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
-
+
}
}
}
@@ -1409,9 +1378,7 @@ namespace Emby.Server.Implementations.Dto
{
dto.AirDays = series.AirDays;
dto.AirTime = series.AirTime;
- dto.SeriesStatus = series.Status;
-
- dto.AnimeSeriesIndex = series.AnimeSeriesIndex;
+ dto.Status = series.Status.HasValue ? series.Status.Value.ToString() : null;
}
// Add SeasonInfo
@@ -1473,9 +1440,12 @@ namespace Emby.Server.Implementations.Dto
SetBookProperties(dto, book);
}
- if (item.ProductionLocations.Count > 0 || item is Movie)
+ if (fields.Contains(ItemFields.ProductionLocations))
{
- dto.ProductionLocations = item.ProductionLocations.ToArray();
+ if (item.ProductionLocations.Count > 0 || item is Movie)
+ {
+ dto.ProductionLocations = item.ProductionLocations.ToArray();
+ }
}
var photo = item as Photo;
@@ -1596,7 +1566,7 @@ namespace Emby.Server.Implementations.Dto
}
}
- private string GetMappedPath(BaseItem item)
+ private string GetMappedPath(BaseItem item, BaseItem ownerItem)
{
var path = item.Path;
@@ -1604,7 +1574,7 @@ namespace Emby.Server.Implementations.Dto
if (locationType == LocationType.FileSystem || locationType == LocationType.Offline)
{
- path = _libraryManager.GetPathAfterNetworkSubstitution(path, item);
+ path = _libraryManager.GetPathAfterNetworkSubstitution(path, ownerItem ?? item);
}
return path;
@@ -1630,8 +1600,20 @@ namespace Emby.Server.Implementations.Dto
return null;
}
+ var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary).ToList();
+
ImageSize size;
+ if (supportedEnhancers.Count == 0)
+ {
+ var defaultAspectRatio = item.GetDefaultPrimaryImageAspectRatio();
+
+ if (defaultAspectRatio.HasValue)
+ {
+ return defaultAspectRatio.Value;
+ }
+ }
+
try
{
size = _imageProcessor.GetImageSize(imageInfo);
@@ -1642,8 +1624,6 @@ namespace Emby.Server.Implementations.Dto
return null;
}
- var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary).ToList();
-
foreach (var enhancer in supportedEnhancers)
{
try