channel improvements
This commit is contained in:
parent
eab030df7f
commit
3be25f8bfb
|
@ -405,7 +405,7 @@ namespace MediaBrowser.Api.Images
|
|||
/// <returns>System.Object.</returns>
|
||||
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<string>(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
|
|||
/// <param name="request">The request.</param>
|
||||
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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<ChannelMediaInfo>();
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<string, string> ProviderIds { get; set; }
|
||||
|
||||
|
|
|
@ -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<ChannelMediaInfo>();
|
||||
|
@ -94,8 +100,14 @@ namespace MediaBrowser.Controller.Channels
|
|||
var info = GetItemLookupInfo<ChannelItemLookupInfo>();
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,5 +11,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
ChannelItemType ChannelItemType { get; set; }
|
||||
|
||||
string OriginalImageUrl { get; set; }
|
||||
|
||||
string DataVersion { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
||||
}
|
||||
}
|
|
@ -32,6 +32,11 @@ namespace MediaBrowser.Controller.Channels
|
|||
/// Indicates if a sort ascending/descending toggle is supported or not.
|
||||
/// </summary>
|
||||
public bool SupportsSortOrderToggle { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the automatic refresh levels.
|
||||
/// </summary>
|
||||
/// <value>The automatic refresh levels.</value>
|
||||
public int? AutoRefreshLevels { get; set; }
|
||||
|
||||
public InternalChannelFeatures()
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the name of the sort.
|
||||
/// </summary>
|
||||
|
|
|
@ -160,6 +160,12 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// </summary>
|
||||
/// <value><c>true</c> if [supports remote image downloading]; otherwise, <c>false</c>.</value>
|
||||
bool SupportsRemoteImageDownloading { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the internal metadata path.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetInternalMetadataPath();
|
||||
}
|
||||
|
||||
public static class HasImagesExtensions
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller
|
||||
{
|
||||
|
@ -106,12 +105,5 @@ namespace MediaBrowser.Controller
|
|||
/// </summary>
|
||||
/// <value>The internal metadata path.</value>
|
||||
string InternalMetadataPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the internal metadata path.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetInternalMetadataPath(Guid id);
|
||||
}
|
||||
}
|
|
@ -241,5 +241,6 @@ namespace MediaBrowser.Controller.Providers
|
|||
public class ChannelItemLookupInfo : ItemLookupInfo
|
||||
{
|
||||
public ChannelMediaContentType ContentType { get; set; }
|
||||
public ExtraType ExtraType { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<LocalImageInfo> GetImages(IHasImages item, IDirectoryService directoryService)
|
||||
{
|
||||
var path = _config.ApplicationPaths.GetInternalMetadataPath(item.Id);
|
||||
var path = item.GetInternalMetadataPath();
|
||||
|
||||
if (item is IChannelItem)
|
||||
{
|
||||
var b = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -39,6 +39,12 @@ namespace MediaBrowser.Model.Channels
|
|||
/// </summary>
|
||||
public int? MaxPageSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the automatic refresh levels.
|
||||
/// </summary>
|
||||
/// <value>The automatic refresh levels.</value>
|
||||
public int? AutoRefreshLevels { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default sort orders.
|
||||
/// </summary>
|
||||
|
|
|
@ -12,6 +12,12 @@
|
|||
|
||||
Episode = 4,
|
||||
|
||||
Song = 5
|
||||
Song = 5,
|
||||
|
||||
MovieExtra = 6,
|
||||
|
||||
TvExtra = 7,
|
||||
|
||||
GameExtra = 8
|
||||
}
|
||||
}
|
|
@ -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
|
|||
/// <value>The content types.</value>
|
||||
public ChannelMediaContentType[] ContentTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the extra types.
|
||||
/// </summary>
|
||||
/// <value>The extra types.</value>
|
||||
public ExtraType[] ExtraTypes { get; set; }
|
||||
|
||||
public AllChannelMediaQuery()
|
||||
{
|
||||
ChannelIds = new string[] { };
|
||||
|
||||
ContentTypes = new ChannelMediaContentType[] { };
|
||||
ExtraTypes = new ExtraType[] { };
|
||||
|
||||
Filters = new ItemFilter[] { };
|
||||
Fields = new List<ItemFields>();
|
||||
|
|
|
@ -13,4 +13,12 @@ namespace MediaBrowser.Model.Entities
|
|||
ThemeSong = 8,
|
||||
ThemeVideo = 9
|
||||
}
|
||||
|
||||
public enum TrailerType
|
||||
{
|
||||
ComingSoonToTheaters = 1,
|
||||
ComingSoonToDvd = 2,
|
||||
ComingSoonToStreaming = 3,
|
||||
Archive = 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -357,11 +357,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
}
|
||||
}
|
||||
|
||||
if (!item.SupportsLocalMetadata && provider is ILocalImageProvider)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return provider.Supports(item);
|
||||
|
|
|
@ -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<ImageType> GetSupportedImages(IHasImages item)
|
||||
{
|
||||
var channelItem = item as ChannelVideoItem;
|
||||
|
||||
if (channelItem != null)
|
||||
{
|
||||
// Too many channel items to allow backdrops here
|
||||
return new List<ImageType>
|
||||
{
|
||||
ImageType.Primary
|
||||
};
|
||||
}
|
||||
|
||||
return new List<ImageType>
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
}));
|
||||
var supportedImages = GetSupportedImages(item).ToList();
|
||||
|
||||
list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo
|
||||
if (supportedImages.Contains(ImageType.Primary))
|
||||
{
|
||||
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(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))
|
||||
{
|
||||
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();
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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<MetadataResult<ChannelVideoItem>> 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<ChannelVideoItem>());
|
||||
}
|
||||
|
@ -40,14 +41,14 @@ namespace MediaBrowser.Providers.Movies
|
|||
return MovieDbProvider.Current.GetItemMetadata<ChannelVideoItem>(info, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(ChannelItemLookupInfo searchInfo, CancellationToken cancellationToken)
|
||||
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(ChannelItemLookupInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
if (searchInfo.ContentType != ChannelMediaContentType.Trailer)
|
||||
if (info.ContentType != ChannelMediaContentType.MovieExtra || info.ExtraType != ExtraType.Trailer)
|
||||
{
|
||||
return Task.FromResult<IEnumerable<RemoteSearchResult>>(new List<RemoteSearchResult>());
|
||||
}
|
||||
|
||||
return MovieDbProvider.Current.GetMovieSearchResults(searchInfo, cancellationToken);
|
||||
|
||||
return MovieDbProvider.Current.GetMovieSearchResults(info, cancellationToken);
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MediaBrowser.Providers.Omdb
|
|||
|
||||
public Task<MetadataResult<ChannelVideoItem>> GetMetadata(ChannelItemLookupInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
if (info.ContentType != ChannelMediaContentType.Trailer)
|
||||
if (info.ContentType != ChannelMediaContentType.MovieExtra || info.ExtraType != ExtraType.Trailer)
|
||||
{
|
||||
return Task.FromResult(new MetadataResult<ChannelVideoItem>());
|
||||
}
|
||||
|
|
|
@ -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<QueryResult<BaseItemDto>> 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 T GetItemById<T>(string idString, string channelName, string channnelDataVersion, out bool isNew)
|
||||
where T : BaseItem, IChannelItem, new()
|
||||
{
|
||||
var id = GetIdToHash(idString, channelName).GetMBId(typeof(T));
|
||||
|
||||
T item = null;
|
||||
|
||||
try
|
||||
{
|
||||
item = _libraryManager.GetItemById(id) as T;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error retrieving channel item from database", ex);
|
||||
}
|
||||
|
||||
if (item == null || !string.Equals(item.DataVersion, channnelDataVersion, StringComparison.Ordinal))
|
||||
{
|
||||
item = new T();
|
||||
isNew = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isNew = false;
|
||||
}
|
||||
|
||||
item.DataVersion = channnelDataVersion;
|
||||
item.Id = id;
|
||||
return item;
|
||||
}
|
||||
|
||||
private async Task<BaseItem> GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Guid internalChannelId, CancellationToken cancellationToken)
|
||||
{
|
||||
BaseItem item;
|
||||
Guid id;
|
||||
var isNew = false;
|
||||
|
||||
var idToHash = GetIdToHash(info.Id, channelProvider);
|
||||
bool isNew;
|
||||
|
||||
if (info.Type == ChannelItemType.Folder)
|
||||
{
|
||||
id = idToHash.GetMBId(typeof(ChannelFolderItem));
|
||||
|
||||
item = _libraryManager.GetItemById(id) as ChannelFolderItem;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
isNew = true;
|
||||
item = new ChannelFolderItem();
|
||||
}
|
||||
item = GetItemById<ChannelFolderItem>(info.Id, channelProvider.Name, channelProvider.DataVersion, out isNew);
|
||||
}
|
||||
else if (info.MediaType == ChannelMediaType.Audio)
|
||||
{
|
||||
id = idToHash.GetMBId(typeof(ChannelAudioItem));
|
||||
|
||||
item = _libraryManager.GetItemById(id) as ChannelAudioItem;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
isNew = true;
|
||||
item = new ChannelAudioItem();
|
||||
}
|
||||
item = GetItemById<ChannelAudioItem>(info.Id, channelProvider.Name, channelProvider.DataVersion, out isNew);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = idToHash.GetMBId(typeof(ChannelVideoItem));
|
||||
|
||||
item = _libraryManager.GetItemById(id) as ChannelVideoItem;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
isNew = true;
|
||||
item = new ChannelVideoItem();
|
||||
}
|
||||
item = GetItemById<ChannelVideoItem>(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();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -449,10 +449,10 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
{
|
||||
var list = new List<string>
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
/// </summary>
|
||||
/// <value>The chapter images data path.</value>
|
||||
private string GetChapterImagesPath(Guid itemId)
|
||||
private string GetChapterImagesPath(IHasImages item)
|
||||
{
|
||||
return Path.Combine(_config.ApplicationPaths.GetInternalMetadataPath(itemId), "chapters");
|
||||
return Path.Combine(item.GetInternalMetadataPath(), "chapters");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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<string> GetSavedChapterImages(Video video)
|
||||
{
|
||||
var path = GetChapterImagesPath(video.Id);
|
||||
var path = GetChapterImagesPath(video);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.438</version>
|
||||
<version>3.0.443</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.438" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.443" />
|
||||
<dependency id="NLog" version="3.1.0.0" />
|
||||
<dependency id="SimpleInjector" version="2.5.2" />
|
||||
<dependency id="sharpcompress" version="0.10.2" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.438</version>
|
||||
<version>3.0.443</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Model.Signed</id>
|
||||
<version>3.0.438</version>
|
||||
<version>3.0.443</version>
|
||||
<title>MediaBrowser.Model - Signed Edition</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.438</version>
|
||||
<version>3.0.443</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.438" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.443" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user