diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs
index 3f248ea8f..92189c245 100644
--- a/MediaBrowser.Api/TvShowsService.cs
+++ b/MediaBrowser.Api/TvShowsService.cs
@@ -490,7 +490,7 @@ namespace MediaBrowser.Api
}
else
{
- episodes = series.GetEpisodes(user, season);
+ episodes = series.GetSeasonEpisodes(user, season);
}
}
else
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 23055690c..f8eb414b6 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -13,6 +13,7 @@ using System.Threading;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Controller.Channels;
+using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Channels;
@@ -1427,7 +1428,7 @@ namespace MediaBrowser.Controller.Entities
itemDto.RecursiveItemCount = allItemsQueryResult.TotalRecordCount;
}
- double recursiveItemCount = allItemsQueryResult.TotalRecordCount;
+ var recursiveItemCount = allItemsQueryResult.TotalRecordCount;
double unplayedCount = unplayedQueryResult.TotalRecordCount;
if (recursiveItemCount > 0)
@@ -1437,6 +1438,14 @@ namespace MediaBrowser.Controller.Entities
dto.Played = dto.PlayedPercentage.Value >= 100;
dto.UnplayedItemCount = unplayedQueryResult.TotalRecordCount;
}
+
+ if (itemDto != null)
+ {
+ if (this is Season || this is MusicAlbum)
+ {
+ itemDto.ChildCount = recursiveItemCount;
+ }
+ }
}
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index c64de399f..66fe1cc75 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -85,7 +85,11 @@ namespace MediaBrowser.Controller.Entities.TV
public override int GetChildCount(User user)
{
- return GetChildren(user, true).Count();
+ Logger.Debug("Season {0} getting child cound", (Path ?? Name));
+ var result = GetChildren(user, true).Count();
+ Logger.Debug("Season {0} child cound: ", result);
+
+ return result;
}
///
@@ -192,7 +196,7 @@ namespace MediaBrowser.Controller.Entities.TV
public IEnumerable GetEpisodes(Series series, User user, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes, IEnumerable allSeriesEpisodes)
{
- return series.GetEpisodes(user, this, includeMissingEpisodes, includeVirtualUnairedEpisodes, allSeriesEpisodes);
+ return series.GetSeasonEpisodes(user, this, includeMissingEpisodes, includeVirtualUnairedEpisodes, allSeriesEpisodes);
}
public IEnumerable GetEpisodes()
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 38ddb89ca..02ac42b2a 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -254,19 +254,16 @@ namespace MediaBrowser.Controller.Entities.TV
}).Cast().ToList();
- Logger.Debug("GetSeasons returned {0} items from database", seasons.Count);
if (!includeMissingSeasons)
{
seasons = seasons.Where(i => !(i.IsMissingSeason)).ToList();
}
- Logger.Debug("GetSeasons has {0} items after includeMissingSeasons filter", seasons.Count);
if (!includeVirtualUnaired)
{
seasons = seasons.Where(i => !i.IsVirtualUnaired).ToList();
}
- Logger.Debug("GetSeasons has {0} items after includeVirtualUnaired filter", seasons.Count);
return seasons;
}
@@ -280,14 +277,19 @@ namespace MediaBrowser.Controller.Entities.TV
public IEnumerable GetEpisodes(User user, bool includeMissing, bool includeVirtualUnaired)
{
+ var seriesKey = GetUniqueSeriesKey(this);
+ Logger.Debug("GetEpisodes seriesKey: {0}", seriesKey);
+
var allItems = LibraryManager.GetItemList(new InternalItemsQuery(user)
{
- AncestorWithPresentationUniqueKey = GetUniqueSeriesKey(this),
+ AncestorWithPresentationUniqueKey = seriesKey,
IncludeItemTypes = new[] { typeof(Episode).Name, typeof(Season).Name },
SortBy = new[] { ItemSortBy.SortName }
}).ToList();
+ Logger.Debug("GetEpisodes return {0} items from database", allItems.Count);
+
var allSeriesEpisodes = allItems.OfType().ToList();
var allEpisodes = allItems.OfType()
@@ -368,11 +370,11 @@ namespace MediaBrowser.Controller.Entities.TV
progress.Report(100);
}
- public IEnumerable GetEpisodes(User user, Season season)
+ public IEnumerable GetSeasonEpisodes(User user, Season season)
{
var config = user.Configuration;
- return GetEpisodes(user, season, config.DisplayMissingEpisodes, config.DisplayUnairedEpisodes);
+ return GetSeasonEpisodes(user, season, config.DisplayMissingEpisodes, config.DisplayUnairedEpisodes);
}
private IEnumerable GetAllEpisodes(User user)
@@ -386,20 +388,22 @@ namespace MediaBrowser.Controller.Entities.TV
}).Cast();
}
- public IEnumerable GetEpisodes(User user, Season parentSeason, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes)
+ public IEnumerable GetSeasonEpisodes(User user, Season parentSeason, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes)
{
IEnumerable episodes = GetAllEpisodes(user);
- return GetEpisodes(user, parentSeason, includeMissingEpisodes, includeVirtualUnairedEpisodes, episodes);
+ return GetSeasonEpisodes(user, parentSeason, includeMissingEpisodes, includeVirtualUnairedEpisodes, episodes);
}
- public IEnumerable GetEpisodes(User user, Season parentSeason, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes, IEnumerable allSeriesEpisodes)
+ public IEnumerable GetSeasonEpisodes(User user, Season parentSeason, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes, IEnumerable allSeriesEpisodes)
{
if (allSeriesEpisodes == null)
{
- return GetEpisodes(user, parentSeason, includeMissingEpisodes, includeVirtualUnairedEpisodes);
+ Logger.Debug("GetSeasonEpisodes allSeriesEpisodes is null");
+ return GetSeasonEpisodes(user, parentSeason, includeMissingEpisodes, includeVirtualUnairedEpisodes);
}
+ Logger.Debug("GetSeasonEpisodes FilterEpisodesBySeason");
var episodes = FilterEpisodesBySeason(allSeriesEpisodes, parentSeason, ConfigurationManager.Configuration.DisplaySpecialsWithinSeasons);
if (!includeMissingEpisodes)
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index 4f903a2c2..b646605ed 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -458,7 +458,7 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.UserData = await _userDataRepository.GetUserDataDto(item, dto, user).ConfigureAwait(false);
- if (item.SourceType == SourceType.Library)
+ if (!dto.ChildCount.HasValue && item.SourceType == SourceType.Library)
{
dto.ChildCount = GetChildCount(folder, user);
}
diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
index 8c2b927e3..dea0a978b 100644
--- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
+++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
@@ -38,7 +38,6 @@ namespace MediaBrowser.Server.Implementations.IO
///
private readonly IReadOnlyList _alwaysIgnoreFiles = new List
{
- "thumbs.db",
"small.jpg",
"albumart.jpg",
@@ -47,6 +46,15 @@ namespace MediaBrowser.Server.Implementations.IO
"TempSBE"
};
+ private readonly IReadOnlyList _alwaysIgnoreExtensions = new List
+ {
+ // thumbs.db
+ ".db",
+
+ // bts sync files
+ ".bts"
+ };
+
///
/// Add the path to our temporary ignore list. Use when writing to a path within our listening scope.
///
@@ -411,7 +419,9 @@ namespace MediaBrowser.Server.Implementations.IO
var filename = Path.GetFileName(path);
- var monitorPath = !(!string.IsNullOrEmpty(filename) && _alwaysIgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase));
+ var monitorPath = !string.IsNullOrEmpty(filename) &&
+ !_alwaysIgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase) &&
+ !_alwaysIgnoreExtensions.Contains(Path.GetExtension(path) ?? string.Empty, StringComparer.OrdinalIgnoreCase);
// Ignore certain files
var tempIgnorePaths = _tempIgnoredPaths.Keys.ToList();