aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Api/ApiEntryPoint.cs16
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs2
-rw-r--r--MediaBrowser.Controller/Dto/DtoBuilder.cs13
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs41
-rw-r--r--MediaBrowser.Providers/ImageFromMediaLocationProvider.cs5
-rw-r--r--MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs21
6 files changed, 27 insertions, 71 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index a2ed1d772..431b6d615 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -82,7 +82,9 @@ namespace MediaBrowser.Api
/// <param name="path">The path.</param>
/// <param name="type">The type.</param>
/// <param name="process">The process.</param>
- public void OnTranscodeBeginning(string path, TranscodingJobType type, Process process)
+ /// <param name="isVideo">if set to <c>true</c> [is video].</param>
+ /// <param name="startTimeTicks">The start time ticks.</param>
+ public void OnTranscodeBeginning(string path, TranscodingJobType type, Process process, bool isVideo, long? startTimeTicks)
{
lock (_activeTranscodingJobs)
{
@@ -91,7 +93,9 @@ namespace MediaBrowser.Api
Type = type,
Path = path,
Process = process,
- ActiveRequestCount = 1
+ ActiveRequestCount = 1,
+ IsVideo = isVideo,
+ StartTimeTicks = startTimeTicks
});
}
}
@@ -262,7 +266,7 @@ namespace MediaBrowser.Api
}
catch (InvalidOperationException)
{
-
+
}
catch (NotSupportedException)
{
@@ -273,7 +277,8 @@ namespace MediaBrowser.Api
process.Dispose();
// If it didn't complete successfully cleanup the partial files
- if (!hasExitedSuccessfully)
+ // Also don't cache output from resume points
+ if (!hasExitedSuccessfully || job.StartTimeTicks.HasValue)
{
Logger.Info("Deleting partial stream file(s) {0}", job.Path);
@@ -364,6 +369,9 @@ namespace MediaBrowser.Api
/// </summary>
/// <value>The kill timer.</value>
public Timer KillTimer { get; set; }
+
+ public bool IsVideo { get; set; }
+ public long? StartTimeTicks { get; set; }
}
/// <summary>
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 4886af916..1c1b569d7 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -598,7 +598,7 @@ namespace MediaBrowser.Api.Playback
EnableRaisingEvents = true
};
- ApiEntryPoint.Instance.OnTranscodeBeginning(outputPath, TranscodingJobType, process);
+ ApiEntryPoint.Instance.OnTranscodeBeginning(outputPath, TranscodingJobType, process, video != null, state.Request.StartTimeTicks);
Logger.Info(process.StartInfo.FileName + " " + process.StartInfo.Arguments);
diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs
index 981c2e5b4..2543d7037 100644
--- a/MediaBrowser.Controller/Dto/DtoBuilder.cs
+++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs
@@ -280,16 +280,13 @@ namespace MediaBrowser.Controller.Dto
dto.Genres = item.Genres;
}
- if (item.Images != null)
- {
- dto.ImageTags = new Dictionary<ImageType, Guid>();
+ dto.ImageTags = new Dictionary<ImageType, Guid>();
- foreach (var image in item.Images)
- {
- var type = image.Key;
+ foreach (var image in item.Images)
+ {
+ var type = image.Key;
- dto.ImageTags[type] = Kernel.Instance.ImageManager.GetImageCacheTag(item, type, image.Value);
- }
+ dto.ImageTags[type] = Kernel.Instance.ImageManager.GetImageCacheTag(item, type, image.Value);
}
dto.Id = GetClientItemId(item);
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 2852843ef..3a2879313 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -1004,31 +1004,6 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Clear out all metadata properties. Extend for sub-classes.
- /// </summary>
- public virtual void ClearMetaValues()
- {
- Images.Clear();
- ForcedSortName = null;
- PremiereDate = null;
- BackdropImagePaths.Clear();
- OfficialRating = null;
- CustomRating = null;
- Overview = null;
- Taglines.Clear();
- Language = null;
- Studios.Clear();
- Genres.Clear();
- CommunityRating = null;
- RunTimeTicks = null;
- AspectRatio = null;
- ProductionYear = null;
- ProviderIds.Clear();
- DisplayMediaType = GetType().Name;
- ResolveArgs = null;
- }
-
- /// <summary>
/// Gets or sets the trailer URL.
/// </summary>
/// <value>The trailer URL.</value>
@@ -1102,9 +1077,9 @@ namespace MediaBrowser.Controller.Entities
var rating = CustomRating ?? OfficialRating;
- if (user.Configuration.BlockNotRated && string.IsNullOrEmpty(rating))
+ if (string.IsNullOrEmpty(rating))
{
- return false;
+ return !user.Configuration.BlockNotRated;
}
var value = localizationManager.GetRatingLevel(rating);
@@ -1450,11 +1425,6 @@ namespace MediaBrowser.Controller.Entities
throw new ArgumentException("Screenshots should be accessed using Item.Screenshots");
}
- if (Images == null)
- {
- return null;
- }
-
string val;
Images.TryGetValue(type, out val);
return val;
@@ -1502,12 +1472,9 @@ namespace MediaBrowser.Controller.Entities
// If it's null remove the key from the dictionary
if (string.IsNullOrEmpty(path))
{
- if (Images != null)
+ if (Images.ContainsKey(typeKey))
{
- if (Images.ContainsKey(typeKey))
- {
- Images.Remove(typeKey);
- }
+ Images.Remove(typeKey);
}
}
else
diff --git a/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs b/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs
index 49dd1bddd..160c171e3 100644
--- a/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs
+++ b/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs
@@ -86,11 +86,6 @@ namespace MediaBrowser.Providers
/// <param name="item">The item.</param>
private void ValidateImages(BaseItem item)
{
- if (item.Images == null)
- {
- return;
- }
-
// Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below
var deletedKeys = item.Images.ToList().Where(image =>
{
diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs
index 0e78824c1..058789665 100644
--- a/MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs
+++ b/MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs
@@ -125,22 +125,11 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// <returns>IEnumerable{System.String}.</returns>
private IEnumerable<string> GetPathsInUse(BaseItem item)
{
- IEnumerable<string> images = new List<string>();
+ IEnumerable<string> images = item.Images.Values.ToList();
- if (item.Images != null)
- {
- images = images.Concat(item.Images.Values);
- }
+ images = images.Concat(item.BackdropImagePaths);
- if (item.BackdropImagePaths != null)
- {
- images = images.Concat(item.BackdropImagePaths);
- }
-
- if (item.ScreenshotImagePaths != null)
- {
- images = images.Concat(item.ScreenshotImagePaths);
- }
+ images = images.Concat(item.ScreenshotImagePaths);
var localTrailers = _itemRepo.GetItems(item.LocalTrailerIds).ToList();
images = localTrailers.Aggregate(images, (current, subItem) => current.Concat(GetPathsInUse(subItem)));
@@ -162,8 +151,8 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
if (movie != null)
{
- var specialFeattures = _itemRepo.GetItems(movie.SpecialFeatureIds).ToList();
- images = specialFeattures.Aggregate(images, (current, subItem) => current.Concat(GetPathsInUse(subItem)));
+ var specialFeatures = _itemRepo.GetItems(movie.SpecialFeatureIds).ToList();
+ images = specialFeatures.Aggregate(images, (current, subItem) => current.Concat(GetPathsInUse(subItem)));
}
return images;