aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-09-28 11:27:26 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-09-28 11:27:26 -0400
commit3be25f8bfbe6286d47ab5cf400fac7673e284d61 (patch)
treef4b61c5d1082f673ebe00e117502091e41a88bd3 /MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs
parenteab030df7ff0f3a78b1aa01f06eb30f71df5a391 (diff)
channel improvements
Diffstat (limited to 'MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs b/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs
index b067271c5..9806aab4a 100644
--- a/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs
+++ b/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs
@@ -64,9 +64,16 @@ namespace MediaBrowser.Server.Implementations.Channels
foreach (var channel in channels.Items)
{
+ var channelId = channel.Id.ToString("N");
+
+ var features = _channelManager.GetChannelFeatures(channelId);
+
+ const int currentRefreshLevel = 1;
+ var maxRefreshLevel = features.AutoRefreshLevels ?? 1;
+
try
{
- await GetAllItems(user, channel.Id.ToString("N"), null, false, cancellationToken).ConfigureAwait(false);
+ await GetAllItems(user, channelId, null, currentRefreshLevel, maxRefreshLevel, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -83,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.Channels
}
- private async Task GetAllItems(string user, string channelId, string folderId, bool recursive, CancellationToken cancellationToken)
+ private async Task GetAllItems(string user, string channelId, string folderId, int currentRefreshLevel, int maxRefreshLevel, CancellationToken cancellationToken)
{
var folderItems = new List<string>();
@@ -117,13 +124,13 @@ namespace MediaBrowser.Server.Implementations.Channels
totalCount = result.TotalRecordCount;
}
- if (recursive)
+ if (currentRefreshLevel < maxRefreshLevel)
{
foreach (var folder in folderItems)
{
try
{
- await GetAllItems(user, channelId, folder, false, cancellationToken).ConfigureAwait(false);
+ await GetAllItems(user, channelId, folder, currentRefreshLevel + 1, maxRefreshLevel, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{