diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 7f945ce483..f480125e86 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -405,7 +405,7 @@ namespace MediaBrowser.Api.Images
/// System.Object.
public object Get(GetUserImage request)
{
- var item = _userManager.Users.First(i => i.Id == request.Id);
+ var item = _userManager.GetUserById(request.Id);
return GetImage(request, item, false);
}
@@ -441,7 +441,7 @@ namespace MediaBrowser.Api.Images
request.Type = (ImageType)Enum.Parse(typeof(ImageType), pathInfo.GetArgumentValue(3), true);
- var item = _userManager.Users.First(i => i.Id == id);
+ var item = _userManager.GetUserById(id);
var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType);
@@ -472,7 +472,7 @@ namespace MediaBrowser.Api.Images
/// The request.
public void Delete(DeleteUserImage request)
{
- var item = _userManager.Users.First(i => i.Id == request.Id);
+ var item = _userManager.GetUserById(request.Id);
var task = item.DeleteImage(request.Type, request.Index ?? 0);
diff --git a/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs b/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs
index 4364153c90..cec6249b34 100644
--- a/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs
+++ b/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs
@@ -33,6 +33,14 @@ namespace MediaBrowser.Common.ScheduledTasks
{
key = hasKey.Key;
}
+
+ var triggers = task.Triggers
+ .Select(GetTriggerInfo)
+ .OrderBy(i => i.Type)
+ .ThenBy(i => i.DayOfWeek ?? DayOfWeek.Sunday)
+ .ThenBy(i => i.TimeOfDayTicks ?? 0)
+ .ToList();
+
return new TaskInfo
{
Name = task.Name,
@@ -40,7 +48,9 @@ namespace MediaBrowser.Common.ScheduledTasks
State = task.State,
Id = task.Id,
LastExecutionResult = task.LastExecutionResult,
- Triggers = task.Triggers.Select(GetTriggerInfo).ToList(),
+
+ Triggers = triggers,
+
Description = task.Description,
Category = task.Category,
IsHidden = isHidden,
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs
index 602918b19a..d52ad99bc7 100644
--- a/MediaBrowser.Controller/Channels/Channel.cs
+++ b/MediaBrowser.Controller/Channels/Channel.cs
@@ -47,5 +47,10 @@ namespace MediaBrowser.Controller.Channels
};
}
}
+
+ protected override string GetInternalMetadataPath(string basePath)
+ {
+ return System.IO.Path.Combine(basePath, "channels", Id.ToString("N"), "metadata");
+ }
}
}
diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
index 8afaa73aca..6d505aecb4 100644
--- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
@@ -12,6 +12,7 @@ namespace MediaBrowser.Controller.Channels
public string ExternalId { get; set; }
public string ChannelId { get; set; }
+ public string DataVersion { get; set; }
public ChannelItemType ChannelItemType { get; set; }
@@ -41,6 +42,11 @@ namespace MediaBrowser.Controller.Channels
}
}
+ public override bool IsSaveLocalMetadataEnabled()
+ {
+ return false;
+ }
+
public ChannelAudioItem()
{
ChannelMediaSources = new List();
@@ -58,5 +64,10 @@ namespace MediaBrowser.Controller.Channels
return base.LocationType;
}
}
+
+ protected override string GetInternalMetadataPath(string basePath)
+ {
+ return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
+ }
}
}
diff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
index a7cc80104a..db54a0c4ab 100644
--- a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
@@ -12,6 +12,7 @@ namespace MediaBrowser.Controller.Channels
public string ExternalId { get; set; }
public string ChannelId { get; set; }
+ public string DataVersion { get; set; }
public ChannelItemType ChannelItemType { get; set; }
public ChannelFolderType ChannelFolderType { get; set; }
@@ -32,6 +33,11 @@ namespace MediaBrowser.Controller.Channels
}
}
+ public override bool IsSaveLocalMetadataEnabled()
+ {
+ return false;
+ }
+
public override string GetUserDataKey()
{
return ExternalId;
@@ -63,5 +69,10 @@ namespace MediaBrowser.Controller.Channels
};
}
}
+
+ protected override string GetInternalMetadataPath(string basePath)
+ {
+ return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
+ }
}
}
diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs
index 3c7df91c1c..a0fbd9245e 100644
--- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs
+++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs
@@ -36,6 +36,8 @@ namespace MediaBrowser.Controller.Channels
public ChannelFolderType FolderType { get; set; }
public ChannelMediaContentType ContentType { get; set; }
+ public ExtraType ExtraType { get; set; }
+ public TrailerType TrailerType { get; set; }
public Dictionary ProviderIds { get; set; }
diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
index 5d133c9834..1ee0bbe4a3 100644
--- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
@@ -15,6 +15,7 @@ namespace MediaBrowser.Controller.Channels
public string ExternalId { get; set; }
public string ChannelId { get; set; }
+ public string DataVersion { get; set; }
public ChannelItemType ChannelItemType { get; set; }
@@ -28,13 +29,13 @@ namespace MediaBrowser.Controller.Channels
public override string GetUserDataKey()
{
- if (ContentType == ChannelMediaContentType.Trailer)
+ if (ContentType == ChannelMediaContentType.MovieExtra)
{
var key = this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tvcom);
if (!string.IsNullOrWhiteSpace(key))
{
- key = key + "-trailer";
+ key = key + "-" + ExtraType.ToString().ToLower();
// Make sure different trailers have their own data.
if (RunTimeTicks.HasValue)
@@ -62,6 +63,11 @@ namespace MediaBrowser.Controller.Channels
}
}
+ public override bool IsSaveLocalMetadataEnabled()
+ {
+ return false;
+ }
+
public ChannelVideoItem()
{
ChannelMediaSources = new List();
@@ -94,8 +100,14 @@ namespace MediaBrowser.Controller.Channels
var info = GetItemLookupInfo();
info.ContentType = ContentType;
+ info.ExtraType = ExtraType;
return info;
}
+
+ protected override string GetInternalMetadataPath(string basePath)
+ {
+ return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
+ }
}
}
diff --git a/MediaBrowser.Controller/Channels/IChannelItem.cs b/MediaBrowser.Controller/Channels/IChannelItem.cs
index 8b97701138..7eb865b5bd 100644
--- a/MediaBrowser.Controller/Channels/IChannelItem.cs
+++ b/MediaBrowser.Controller/Channels/IChannelItem.cs
@@ -11,5 +11,7 @@ namespace MediaBrowser.Controller.Channels
ChannelItemType ChannelItemType { get; set; }
string OriginalImageUrl { get; set; }
+
+ string DataVersion { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
index e39d98e134..50df07e72b 100644
--- a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
+++ b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
@@ -1,5 +1,6 @@
-using System.Collections.Generic;
-using MediaBrowser.Model.Channels;
+using MediaBrowser.Model.Channels;
+using MediaBrowser.Model.Entities;
+using System.Collections.Generic;
namespace MediaBrowser.Controller.Channels
{
@@ -10,6 +11,8 @@ namespace MediaBrowser.Controller.Channels
ChannelMediaContentType ContentType { get; set; }
+ ExtraType ExtraType { get; set; }
+
List ChannelMediaSources { get; set; }
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs
index 814c565779..bcc6791598 100644
--- a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs
+++ b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs
@@ -32,6 +32,11 @@ namespace MediaBrowser.Controller.Channels
/// Indicates if a sort ascending/descending toggle is supported or not.
///
public bool SupportsSortOrderToggle { get; set; }
+ ///
+ /// Gets or sets the automatic refresh levels.
+ ///
+ /// The automatic refresh levels.
+ public int? AutoRefreshLevels { get; set; }
public InternalChannelFeatures()
{
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 0d13fd9434..4a4ff17a05 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -351,6 +351,18 @@ namespace MediaBrowser.Controller.Entities
}
}
+ public string GetInternalMetadataPath()
+ {
+ return GetInternalMetadataPath(ConfigurationManager.ApplicationPaths.InternalMetadataPath);
+ }
+
+ protected virtual string GetInternalMetadataPath(string basePath)
+ {
+ var idString = Id.ToString("N");
+
+ return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);
+ }
+
///
/// Creates the name of the sort.
///
diff --git a/MediaBrowser.Controller/Entities/IHasImages.cs b/MediaBrowser.Controller/Entities/IHasImages.cs
index 67acc1cae6..66d3fbb2ef 100644
--- a/MediaBrowser.Controller/Entities/IHasImages.cs
+++ b/MediaBrowser.Controller/Entities/IHasImages.cs
@@ -160,6 +160,12 @@ namespace MediaBrowser.Controller.Entities
///
/// true if [supports remote image downloading]; otherwise, false.
bool SupportsRemoteImageDownloading { get; }
+
+ ///
+ /// Gets the internal metadata path.
+ ///
+ /// System.String.
+ string GetInternalMetadataPath();
}
public static class HasImagesExtensions
diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs
index 05f6815979..34137088fd 100644
--- a/MediaBrowser.Controller/IServerApplicationPaths.cs
+++ b/MediaBrowser.Controller/IServerApplicationPaths.cs
@@ -1,5 +1,4 @@
-using System;
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
namespace MediaBrowser.Controller
{
@@ -106,12 +105,5 @@ namespace MediaBrowser.Controller
///
/// The internal metadata path.
string InternalMetadataPath { get; }
-
- ///
- /// Gets the internal metadata path.
- ///
- /// The identifier.
- /// System.String.
- string GetInternalMetadataPath(Guid id);
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Controller/Providers/ItemLookupInfo.cs b/MediaBrowser.Controller/Providers/ItemLookupInfo.cs
index 56f285e4d2..43b9210923 100644
--- a/MediaBrowser.Controller/Providers/ItemLookupInfo.cs
+++ b/MediaBrowser.Controller/Providers/ItemLookupInfo.cs
@@ -241,5 +241,6 @@ namespace MediaBrowser.Controller.Providers
public class ChannelItemLookupInfo : ItemLookupInfo
{
public ChannelMediaContentType ContentType { get; set; }
+ public ExtraType ExtraType { get; set; }
}
}
diff --git a/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs b/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs
index c126af884b..46f7c7f624 100644
--- a/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs
+++ b/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs
@@ -1,4 +1,5 @@
using MediaBrowser.Common.IO;
+using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@@ -56,7 +57,12 @@ namespace MediaBrowser.LocalMetadata.Images
public List GetImages(IHasImages item, IDirectoryService directoryService)
{
- var path = _config.ApplicationPaths.GetInternalMetadataPath(item.Id);
+ var path = item.GetInternalMetadataPath();
+
+ if (item is IChannelItem)
+ {
+ var b = true;
+ }
try
{
diff --git a/MediaBrowser.Model/Channels/ChannelFeatures.cs b/MediaBrowser.Model/Channels/ChannelFeatures.cs
index 0a919f222d..ef9ef67f2d 100644
--- a/MediaBrowser.Model/Channels/ChannelFeatures.cs
+++ b/MediaBrowser.Model/Channels/ChannelFeatures.cs
@@ -39,6 +39,12 @@ namespace MediaBrowser.Model.Channels
///
public int? MaxPageSize { get; set; }
+ ///
+ /// Gets or sets the automatic refresh levels.
+ ///
+ /// The automatic refresh levels.
+ public int? AutoRefreshLevels { get; set; }
+
///
/// Gets or sets the default sort orders.
///
diff --git a/MediaBrowser.Model/Channels/ChannelMediaContentType.cs b/MediaBrowser.Model/Channels/ChannelMediaContentType.cs
index cb9f440704..efb5021c01 100644
--- a/MediaBrowser.Model/Channels/ChannelMediaContentType.cs
+++ b/MediaBrowser.Model/Channels/ChannelMediaContentType.cs
@@ -12,6 +12,12 @@
Episode = 4,
- Song = 5
+ Song = 5,
+
+ MovieExtra = 6,
+
+ TvExtra = 7,
+
+ GameExtra = 8
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Model/Channels/ChannelQuery.cs b/MediaBrowser.Model/Channels/ChannelQuery.cs
index f7ed368530..d1bf46433f 100644
--- a/MediaBrowser.Model/Channels/ChannelQuery.cs
+++ b/MediaBrowser.Model/Channels/ChannelQuery.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Model.Querying;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Querying;
using System.Collections.Generic;
namespace MediaBrowser.Model.Channels
@@ -68,11 +69,18 @@ namespace MediaBrowser.Model.Channels
/// The content types.
public ChannelMediaContentType[] ContentTypes { get; set; }
+ ///
+ /// Gets or sets the extra types.
+ ///
+ /// The extra types.
+ public ExtraType[] ExtraTypes { get; set; }
+
public AllChannelMediaQuery()
{
ChannelIds = new string[] { };
ContentTypes = new ChannelMediaContentType[] { };
+ ExtraTypes = new ExtraType[] { };
Filters = new ItemFilter[] { };
Fields = new List();
diff --git a/MediaBrowser.Model/Entities/ExtraType.cs b/MediaBrowser.Model/Entities/ExtraType.cs
index ab8da58c07..92fb00731e 100644
--- a/MediaBrowser.Model/Entities/ExtraType.cs
+++ b/MediaBrowser.Model/Entities/ExtraType.cs
@@ -13,4 +13,12 @@ namespace MediaBrowser.Model.Entities
ThemeSong = 8,
ThemeVideo = 9
}
+
+ public enum TrailerType
+ {
+ ComingSoonToTheaters = 1,
+ ComingSoonToDvd = 2,
+ ComingSoonToStreaming = 3,
+ Archive = 4
+ }
}
diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs
index 1acc1738c6..f8bcd81dcb 100644
--- a/MediaBrowser.Providers/Manager/ImageSaver.cs
+++ b/MediaBrowser.Providers/Manager/ImageSaver.cs
@@ -362,7 +362,7 @@ namespace MediaBrowser.Providers.Manager
{
filename = "folder";
}
- path = Path.Combine(_config.ApplicationPaths.GetInternalMetadataPath(item.Id), filename + extension);
+ path = Path.Combine(item.GetInternalMetadataPath(), filename + extension);
}
return path;
diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs
index af1e69c1a9..00ffb4190a 100644
--- a/MediaBrowser.Providers/Manager/MetadataService.cs
+++ b/MediaBrowser.Providers/Manager/MetadataService.cs
@@ -1,5 +1,4 @@
-using System.IO;
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs
index 6cdfef1433..0b73d90190 100644
--- a/MediaBrowser.Providers/Manager/ProviderManager.cs
+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs
@@ -357,11 +357,6 @@ namespace MediaBrowser.Providers.Manager
}
}
- if (!item.SupportsLocalMetadata && provider is ILocalImageProvider)
- {
- return false;
- }
-
try
{
return provider.Supports(item);
diff --git a/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs b/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs
index afecf78f55..129e418226 100644
--- a/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs
@@ -49,17 +49,28 @@ namespace MediaBrowser.Providers.Movies
var channelItem = item as ChannelVideoItem;
- if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.Trailer)
+ if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.MovieExtra && channelItem.ExtraType == ExtraType.Trailer)
{
return true;
}
-
+
// Don't support local trailers
return item is Movie || item is MusicVideo;
}
public IEnumerable GetSupportedImages(IHasImages item)
{
+ var channelItem = item as ChannelVideoItem;
+
+ if (channelItem != null)
+ {
+ // Too many channel items to allow backdrops here
+ return new List
+ {
+ ImageType.Primary
+ };
+ }
+
return new List
{
ImageType.Primary,
@@ -82,30 +93,38 @@ namespace MediaBrowser.Providers.Movies
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
- list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo
+ var supportedImages = GetSupportedImages(item).ToList();
+
+ if (supportedImages.Contains(ImageType.Primary))
{
- Url = tmdbImageUrl + i.file_path,
- CommunityRating = i.vote_average,
- VoteCount = i.vote_count,
- Width = i.width,
- Height = i.height,
- Language = i.iso_639_1,
- ProviderName = Name,
- Type = ImageType.Primary,
- RatingType = RatingType.Score
- }));
-
- list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo
+ list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo
+ {
+ Url = tmdbImageUrl + i.file_path,
+ CommunityRating = i.vote_average,
+ VoteCount = i.vote_count,
+ Width = i.width,
+ Height = i.height,
+ Language = i.iso_639_1,
+ ProviderName = Name,
+ Type = ImageType.Primary,
+ RatingType = RatingType.Score
+ }));
+ }
+
+ if (supportedImages.Contains(ImageType.Backdrop))
{
- Url = tmdbImageUrl + i.file_path,
- CommunityRating = i.vote_average,
- VoteCount = i.vote_count,
- Width = i.width,
- Height = i.height,
- ProviderName = Name,
- Type = ImageType.Backdrop,
- RatingType = RatingType.Score
- }));
+ list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo
+ {
+ Url = tmdbImageUrl + i.file_path,
+ CommunityRating = i.vote_average,
+ VoteCount = i.vote_count,
+ Width = i.width,
+ Height = i.height,
+ ProviderName = Name,
+ Type = ImageType.Backdrop,
+ RatingType = RatingType.Score
+ }));
+ }
var language = item.GetPreferredMetadataLanguage();
diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
index b43dd4540f..c2c07d0491 100644
--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
@@ -344,8 +344,7 @@ namespace MediaBrowser.Providers.Movies
try
{
- // Limit to three requests per second
- var diff = 340 - (DateTime.Now - _lastRequestDate).TotalMilliseconds;
+ var diff = 100 - (DateTime.Now - _lastRequestDate).TotalMilliseconds;
if (diff > 0)
{
diff --git a/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs b/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs
index 3676e6d61b..b3bb200c60 100644
--- a/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Channels;
+using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
using System;
using System.Collections.Generic;
@@ -32,7 +33,7 @@ namespace MediaBrowser.Providers.Movies
public Task> GetMetadata(ChannelItemLookupInfo info, CancellationToken cancellationToken)
{
- if (info.ContentType != Model.Channels.ChannelMediaContentType.Trailer)
+ if (info.ContentType != ChannelMediaContentType.MovieExtra || info.ExtraType != ExtraType.Trailer)
{
return Task.FromResult(new MetadataResult());
}
@@ -40,14 +41,14 @@ namespace MediaBrowser.Providers.Movies
return MovieDbProvider.Current.GetItemMetadata(info, cancellationToken);
}
- public Task> GetSearchResults(ChannelItemLookupInfo searchInfo, CancellationToken cancellationToken)
+ public Task> GetSearchResults(ChannelItemLookupInfo info, CancellationToken cancellationToken)
{
- if (searchInfo.ContentType != ChannelMediaContentType.Trailer)
+ if (info.ContentType != ChannelMediaContentType.MovieExtra || info.ExtraType != ExtraType.Trailer)
{
return Task.FromResult>(new List());
}
-
- return MovieDbProvider.Current.GetMovieSearchResults(searchInfo, cancellationToken);
+
+ return MovieDbProvider.Current.GetMovieSearchResults(info, cancellationToken);
}
public string Name
diff --git a/MediaBrowser.Providers/Movies/MovieExternalIds.cs b/MediaBrowser.Providers/Movies/MovieExternalIds.cs
index 6ed30cdc9e..f993069e2a 100644
--- a/MediaBrowser.Providers/Movies/MovieExternalIds.cs
+++ b/MediaBrowser.Providers/Movies/MovieExternalIds.cs
@@ -29,7 +29,7 @@ namespace MediaBrowser.Providers.Movies
{
var channelItem = item as ChannelVideoItem;
- if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.Trailer)
+ if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.MovieExtra && channelItem.ExtraType == ExtraType.Trailer)
{
return true;
}
@@ -151,7 +151,7 @@ namespace MediaBrowser.Providers.Movies
{
var channelItem = item as ChannelVideoItem;
- if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.Trailer)
+ if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.MovieExtra && channelItem.ExtraType == ExtraType.Trailer)
{
return true;
}
diff --git a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs
index 4e8d7686c4..1f8824c9a6 100644
--- a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs
+++ b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs
@@ -49,7 +49,7 @@ namespace MediaBrowser.Providers.Omdb
public Task> GetMetadata(ChannelItemLookupInfo info, CancellationToken cancellationToken)
{
- if (info.ContentType != ChannelMediaContentType.Trailer)
+ if (info.ContentType != ChannelMediaContentType.MovieExtra || info.ExtraType != ExtraType.Trailer)
{
return Task.FromResult(new MetadataResult());
}
diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs
index 12aa670b38..23c1522b58 100644
--- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs
+++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs
@@ -547,7 +547,8 @@ namespace MediaBrowser.Server.Implementations.Channels
SupportsLatestMedia = supportsLatest,
Name = channel.Name,
Id = channel.Id.ToString("N"),
- SupportsContentDownloading = isIndexable || supportsLatest
+ SupportsContentDownloading = isIndexable || supportsLatest,
+ AutoRefreshLevels = features.AutoRefreshLevels
};
}
@@ -627,6 +628,13 @@ namespace MediaBrowser.Server.Implementations.Channels
items = items.Where(i => contentTypes.Contains(i.Item2.ContentType));
}
+ if (query.ExtraTypes.Length > 0)
+ {
+ // Avoid implicitly captured closure
+ var contentTypes = query.ExtraTypes;
+
+ items = items.Where(i => contentTypes.Contains(i.Item2.ExtraType));
+ }
// Avoid implicitly captured closure
var token = cancellationToken;
@@ -776,6 +784,13 @@ namespace MediaBrowser.Server.Implementations.Channels
items = items.Where(i => contentTypes.Contains(i.Item2.ContentType));
}
+ if (query.ExtraTypes.Length > 0)
+ {
+ // Avoid implicitly captured closure
+ var contentTypes = query.ExtraTypes;
+
+ items = items.Where(i => contentTypes.Contains(i.Item2.ExtraType));
+ }
if (query.StartIndex.HasValue)
{
@@ -806,7 +821,7 @@ namespace MediaBrowser.Server.Implementations.Channels
Items = returnItemArray
};
}
-
+
public async Task> GetAllMedia(AllChannelMediaQuery query, CancellationToken cancellationToken)
{
var user = string.IsNullOrWhiteSpace(query.UserId)
@@ -1161,60 +1176,62 @@ namespace MediaBrowser.Server.Implementations.Channels
};
}
- private string GetIdToHash(string externalId, IChannel channelProvider)
+ private string GetIdToHash(string externalId, string channelName)
{
// Increment this as needed to force new downloads
// Incorporate Name because it's being used to convert channel entity to provider
- return externalId + (channelProvider.DataVersion ?? string.Empty) +
- (channelProvider.Name ?? string.Empty) + "16";
+ return externalId + (channelName ?? string.Empty) + "16";
}
- private async Task GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Guid internalChannelId, CancellationToken cancellationToken)
+ private T GetItemById(string idString, string channelName, string channnelDataVersion, out bool isNew)
+ where T : BaseItem, IChannelItem, new()
{
- BaseItem item;
- Guid id;
- var isNew = false;
+ var id = GetIdToHash(idString, channelName).GetMBId(typeof(T));
- var idToHash = GetIdToHash(info.Id, channelProvider);
+ T item = null;
- if (info.Type == ChannelItemType.Folder)
+ try
{
- id = idToHash.GetMBId(typeof(ChannelFolderItem));
-
- item = _libraryManager.GetItemById(id) as ChannelFolderItem;
-
- if (item == null)
- {
- isNew = true;
- item = new ChannelFolderItem();
- }
+ item = _libraryManager.GetItemById(id) as T;
}
- else if (info.MediaType == ChannelMediaType.Audio)
+ catch (Exception ex)
{
- id = idToHash.GetMBId(typeof(ChannelAudioItem));
-
- item = _libraryManager.GetItemById(id) as ChannelAudioItem;
+ _logger.ErrorException("Error retrieving channel item from database", ex);
+ }
- if (item == null)
- {
- isNew = true;
- item = new ChannelAudioItem();
- }
+ if (item == null || !string.Equals(item.DataVersion, channnelDataVersion, StringComparison.Ordinal))
+ {
+ item = new T();
+ isNew = true;
}
else
{
- id = idToHash.GetMBId(typeof(ChannelVideoItem));
+ isNew = false;
+ }
- item = _libraryManager.GetItemById(id) as ChannelVideoItem;
+ item.DataVersion = channnelDataVersion;
+ item.Id = id;
+ return item;
+ }
- if (item == null)
- {
- isNew = true;
- item = new ChannelVideoItem();
- }
+ private async Task GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Guid internalChannelId, CancellationToken cancellationToken)
+ {
+ BaseItem item;
+ bool isNew;
+
+ if (info.Type == ChannelItemType.Folder)
+ {
+ item = GetItemById(info.Id, channelProvider.Name, channelProvider.DataVersion, out isNew);
+ }
+ else if (info.MediaType == ChannelMediaType.Audio)
+ {
+ item = GetItemById(info.Id, channelProvider.Name, channelProvider.DataVersion, out isNew);
+ }
+ else
+ {
+ item = GetItemById(info.Id, channelProvider.Name, channelProvider.DataVersion, out isNew);
}
- item.Id = id;
item.RunTimeTicks = info.RunTimeTicks;
if (isNew)
@@ -1254,6 +1271,7 @@ namespace MediaBrowser.Server.Implementations.Channels
if (channelMediaItem != null)
{
channelMediaItem.ContentType = info.ContentType;
+ channelMediaItem.ExtraType = info.ExtraType;
channelMediaItem.ChannelMediaSources = info.MediaSources;
var mediaSource = info.MediaSources.FirstOrDefault();
diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs b/MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs
index b067271c5e..9806aab4a8 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();
@@ -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)
{
diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
index 97129368e1..1e10621611 100644
--- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
+++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
@@ -99,7 +99,8 @@ namespace MediaBrowser.Server.Implementations.Intros
{
var channelTrailers = await _channelManager.GetAllMediaInternal(new AllChannelMediaQuery
{
- ContentTypes = new[] { ChannelMediaContentType.Trailer },
+ ContentTypes = new[] { ChannelMediaContentType.MovieExtra },
+ ExtraTypes = new[] { ExtraType.Trailer },
UserId = user.Id.ToString("N")
}, CancellationToken.None);
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index dc3a0d45fe..4362145c1b 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -449,10 +449,10 @@ namespace MediaBrowser.Server.Implementations.Library
{
var list = new List
{
- ConfigurationManager.ApplicationPaths.GetInternalMetadataPath(item.Id)
+ item.GetInternalMetadataPath()
};
- list.AddRange(children.Select(i => ConfigurationManager.ApplicationPaths.GetInternalMetadataPath(i.Id)));
+ list.AddRange(children.Select(i => i.GetInternalMetadataPath()));
return list;
}
diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs
index d35282e55c..a0b6046453 100644
--- a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs
+++ b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs
@@ -1,12 +1,9 @@
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Common.IO;
+using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Chapters;
-using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
@@ -22,20 +19,17 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
{
public class EncodingManager : IEncodingManager
{
- private readonly IServerConfigurationManager _config;
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
private readonly IFileSystem _fileSystem;
private readonly ILogger _logger;
private readonly IMediaEncoder _encoder;
private readonly IChapterManager _chapterManager;
- public EncodingManager(IServerConfigurationManager config,
- IFileSystem fileSystem,
+ public EncodingManager(IFileSystem fileSystem,
ILogger logger,
IMediaEncoder encoder,
IChapterManager chapterManager)
{
- _config = config;
_fileSystem = fileSystem;
_logger = logger;
_encoder = encoder;
@@ -46,9 +40,9 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
/// Gets the chapter images data path.
///
/// The chapter images data path.
- private string GetChapterImagesPath(Guid itemId)
+ private string GetChapterImagesPath(IHasImages item)
{
- return Path.Combine(_config.ApplicationPaths.GetInternalMetadataPath(itemId), "chapters");
+ return Path.Combine(item.GetInternalMetadataPath(), "chapters");
}
///
@@ -190,12 +184,12 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
{
var filename = video.DateModified.Ticks.ToString(_usCulture) + "_" + chapterPositionTicks.ToString(_usCulture) + ".jpg";
- return Path.Combine(GetChapterImagesPath(video.Id), filename);
+ return Path.Combine(GetChapterImagesPath(video), filename);
}
private List GetSavedChapterImages(Video video)
{
- var path = GetChapterImagesPath(video.Id);
+ var path = GetChapterImagesPath(video);
try
{
diff --git a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
index df2a5f83c2..b775580d97 100644
--- a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
+++ b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
@@ -251,13 +251,5 @@ namespace MediaBrowser.Server.Implementations
_internalMetadataPath = value;
}
}
-
-
- public string GetInternalMetadataPath(Guid id)
- {
- var idString = id.ToString("N");
-
- return Path.Combine(InternalMetadataPath, idString.Substring(0, 2), idString);
- }
}
}
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index 8db1035ced..471bc1a221 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -508,7 +508,7 @@ namespace MediaBrowser.ServerApplication
ChapterManager = new ChapterManager(LibraryManager, LogManager.GetLogger("ChapterManager"), ServerConfigurationManager, ItemRepository);
RegisterSingleInstance(ChapterManager);
- EncodingManager = new EncodingManager(ServerConfigurationManager, FileSystemManager, Logger,
+ EncodingManager = new EncodingManager(FileSystemManager, Logger,
MediaEncoder, ChapterManager);
RegisterSingleInstance(EncodingManager);
diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec
index 54ebe6731b..7d4985c252 100644
--- a/Nuget/MediaBrowser.Common.Internal.nuspec
+++ b/Nuget/MediaBrowser.Common.Internal.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common.Internal
- 3.0.438
+ 3.0.443
MediaBrowser.Common.Internal
Luke
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.
Copyright © Media Browser 2013
-
+
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
index c43995dd81..c5576d9cd9 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common
- 3.0.438
+ 3.0.443
MediaBrowser.Common
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec
index d6f8e6ab9c..77edd0e979 100644
--- a/Nuget/MediaBrowser.Model.Signed.nuspec
+++ b/Nuget/MediaBrowser.Model.Signed.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Model.Signed
- 3.0.438
+ 3.0.443
MediaBrowser.Model - Signed Edition
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index 4118f95a26..585e089ac4 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Server.Core
- 3.0.438
+ 3.0.443
Media Browser.Server.Core
Media Browser Team
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains core components required to build plugins for Media Browser Server.
Copyright © Media Browser 2013
-
+