diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index 53989943b5..68170884c5 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -149,13 +149,18 @@ namespace MediaBrowser.Controller.Entities.TV
[IgnoreDataMember]
public bool IsMissingSeason
{
- get { return (IsVirtualItem ?? false) && !IsUnaired; }
+ get { return (IsVirtualItem ?? DetectIsVirtualItem()) && !IsUnaired; }
}
[IgnoreDataMember]
public bool IsVirtualUnaired
{
- get { return (IsVirtualItem ?? false) && IsUnaired; }
+ get { return (IsVirtualItem ?? DetectIsVirtualItem()) && IsUnaired; }
+ }
+
+ private bool DetectIsVirtualItem()
+ {
+ return LocationType == LocationType.Virtual && GetEpisodes().All(i => i.LocationType == LocationType.Virtual);
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs
index a0c6bd889a..7184302f19 100644
--- a/MediaBrowser.Providers/Manager/MetadataService.cs
+++ b/MediaBrowser.Providers/Manager/MetadataService.cs
@@ -145,11 +145,15 @@ namespace MediaBrowser.Providers.Manager
bool hasRefreshedMetadata = true;
bool hasRefreshedImages = true;
+ var requiresRefresh = false;
// Next run metadata providers
if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None)
{
- var providers = GetProviders(item, refreshResult, refreshOptions)
+ // TODO: If this returns true, should we instead just change metadata refresh mode to Full?
+ requiresRefresh = item.RequiresRefresh();
+
+ var providers = GetProviders(item, refreshResult, refreshOptions, requiresRefresh)
.ToList();
var dateLastRefresh = EnableDateLastRefreshed(item)
@@ -217,11 +221,11 @@ namespace MediaBrowser.Providers.Manager
var isFirstRefresh = GetLastRefreshDate(item) == default(DateTime);
- var beforeSaveResult = await BeforeSave(itemOfType, isFirstRefresh || refreshOptions.ReplaceAllMetadata || refreshOptions.MetadataRefreshMode == MetadataRefreshMode.FullRefresh, updateType).ConfigureAwait(false);
+ var beforeSaveResult = await BeforeSave(itemOfType, isFirstRefresh || refreshOptions.ReplaceAllMetadata || refreshOptions.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || requiresRefresh, updateType).ConfigureAwait(false);
updateType = updateType | beforeSaveResult;
// Save if changes were made, or it's never been saved before
- if (refreshOptions.ForceSave || updateType > ItemUpdateType.None || isFirstRefresh || refreshOptions.ReplaceAllMetadata)
+ if (refreshOptions.ForceSave || updateType > ItemUpdateType.None || isFirstRefresh || refreshOptions.ReplaceAllMetadata || requiresRefresh)
{
// If any of these properties are set then make sure the updateType is not None, just to force everything to save
if (refreshOptions.ForceSave || refreshOptions.ReplaceAllMetadata)
@@ -461,11 +465,8 @@ namespace MediaBrowser.Providers.Manager
///
/// Gets the providers.
///
- /// The item.
- /// The status.
- /// The options.
/// IEnumerable{`0}.
- protected IEnumerable GetProviders(IHasMetadata item, MetadataStatus status, MetadataRefreshOptions options)
+ protected IEnumerable GetProviders(IHasMetadata item, MetadataStatus status, MetadataRefreshOptions options, bool requiresRefresh)
{
// Get providers to refresh
var providers = ((ProviderManager)ProviderManager).GetMetadataProviders(item).ToList();
@@ -475,7 +476,7 @@ namespace MediaBrowser.Providers.Manager
: status.DateLastMetadataRefresh ?? default(DateTime);
// Run all if either of these flags are true
- var runAllProviders = options.ReplaceAllMetadata || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || dateLastRefresh == default(DateTime) || item.RequiresRefresh();
+ var runAllProviders = options.ReplaceAllMetadata || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || dateLastRefresh == default(DateTime) || requiresRefresh;
if (!runAllProviders)
{
@@ -668,12 +669,6 @@ namespace MediaBrowser.Providers.Manager
// If a local provider fails, consider that a failure
refreshResult.ErrorMessage = ex.Message;
-
- if (options.MetadataRefreshMode != MetadataRefreshMode.FullRefresh)
- {
- // If the local provider fails don't continue with remote providers because the user's saved metadata could be lost
- //return refreshResult;
- }
}
}