3.0.5768.1
This commit is contained in:
parent
317a487229
commit
034c0b95b2
|
@ -416,6 +416,8 @@ namespace MediaBrowser.Common.Implementations
|
|||
/// </summary>
|
||||
protected virtual void FindParts()
|
||||
{
|
||||
RegisterModules();
|
||||
|
||||
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
|
||||
Plugins = GetExports<IPlugin>();
|
||||
}
|
||||
|
@ -481,7 +483,6 @@ namespace MediaBrowser.Common.Implementations
|
|||
IsoManager = new IsoManager();
|
||||
RegisterSingleInstance(IsoManager);
|
||||
|
||||
RegisterModules();
|
||||
return Task.FromResult (true);
|
||||
}
|
||||
|
||||
|
@ -524,6 +525,14 @@ namespace MediaBrowser.Common.Implementations
|
|||
}
|
||||
catch (ReflectionTypeLoadException ex)
|
||||
{
|
||||
if (ex.LoaderExceptions != null)
|
||||
{
|
||||
foreach (var loaderException in ex.LoaderExceptions)
|
||||
{
|
||||
Logger.Error("LoaderException: " + loaderException.Message);
|
||||
}
|
||||
}
|
||||
|
||||
// If it fails we can still get a list of the Types it was able to resolve
|
||||
return ex.Types.Where(t => t != null);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Configuration
|
||||
{
|
||||
|
@ -33,7 +34,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
|||
/// Occurs when [configuration updating].
|
||||
/// </summary>
|
||||
public event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdating;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [named configuration updated].
|
||||
/// </summary>
|
||||
|
@ -89,8 +90,8 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
|||
}
|
||||
}
|
||||
|
||||
private ConfigurationStore[] _configurationStores = {};
|
||||
private IConfigurationFactory[] _configurationFactories = {};
|
||||
private ConfigurationStore[] _configurationStores = { };
|
||||
private IConfigurationFactory[] _configurationFactories = { };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseConfigurationManager" /> class.
|
||||
|
@ -228,9 +229,15 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
|||
{
|
||||
var file = GetConfigurationFile(key);
|
||||
|
||||
var configurationType = _configurationStores
|
||||
.First(i => string.Equals(i.Key, key, StringComparison.OrdinalIgnoreCase))
|
||||
.ConfigurationType;
|
||||
var configurationInfo = _configurationStores
|
||||
.FirstOrDefault(i => string.Equals(i.Key, key, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (configurationInfo == null)
|
||||
{
|
||||
throw new ResourceNotFoundException("Configuration with key " + key + " not found.");
|
||||
}
|
||||
|
||||
var configurationType = configurationInfo.ConfigurationType;
|
||||
|
||||
lock (_configurationSyncLock)
|
||||
{
|
||||
|
@ -285,7 +292,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
|||
NewConfiguration = configuration
|
||||
|
||||
}, Logger);
|
||||
|
||||
|
||||
_configurations.AddOrUpdate(key, configuration, (k, v) => configuration);
|
||||
|
||||
var path = GetConfigurationFile(key);
|
||||
|
|
|
@ -465,6 +465,13 @@ namespace MediaBrowser.Providers.Manager
|
|||
|
||||
var url = image.Url;
|
||||
|
||||
if (EnableImageStub(item, type))
|
||||
{
|
||||
SaveImageStub(item, type, url);
|
||||
result.UpdateType = result.UpdateType | ItemUpdateType.ImageUpdate;
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var response = await provider.GetImageResponse(url, cancellationToken).ConfigureAwait(false);
|
||||
|
@ -488,6 +495,28 @@ namespace MediaBrowser.Providers.Manager
|
|||
return false;
|
||||
}
|
||||
|
||||
private bool EnableImageStub(IHasImages item, ImageType type)
|
||||
{
|
||||
if (item.LocationType == LocationType.Remote || item.LocationType == LocationType.Virtual)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SaveImageStub(IHasImages item, ImageType imageType, string url)
|
||||
{
|
||||
var newIndex = item.AllowsMultipleImages(imageType) ? item.GetImages(imageType).Count() : 0;
|
||||
|
||||
item.SetImage(new ItemImageInfo
|
||||
{
|
||||
Path = url,
|
||||
Type = imageType
|
||||
|
||||
}, newIndex);
|
||||
}
|
||||
|
||||
private async Task DownloadBackdrops(IHasImages item, ImageType imageType, int limit, IRemoteImageProvider provider, RefreshResult result, IEnumerable<RemoteImageInfo> images, int minWidth, CancellationToken cancellationToken)
|
||||
{
|
||||
foreach (var image in images.Where(i => i.Type == imageType))
|
||||
|
@ -504,6 +533,13 @@ namespace MediaBrowser.Providers.Manager
|
|||
|
||||
var url = image.Url;
|
||||
|
||||
if (EnableImageStub(item, imageType))
|
||||
{
|
||||
SaveImageStub(item, imageType, url);
|
||||
result.UpdateType = result.UpdateType | ItemUpdateType.ImageUpdate;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var response = await provider.GetImageResponse(url, cancellationToken).ConfigureAwait(false);
|
||||
|
|
|
@ -20,6 +20,9 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Providers.TV;
|
||||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
|
@ -59,6 +62,30 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
public bool Supports(IHasImages item)
|
||||
{
|
||||
//var channelItem = item as IChannelMediaItem;
|
||||
|
||||
//if (channelItem != null)
|
||||
//{
|
||||
// if (channelItem.ContentType == ChannelMediaContentType.Movie)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// if (channelItem.ContentType == ChannelMediaContentType.MovieExtra)
|
||||
// {
|
||||
// if (channelItem.ExtraType == ExtraType.Trailer)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
// Supports images for tv movies
|
||||
//var tvProgram = item as LiveTvProgram;
|
||||
//if (tvProgram != null && tvProgram.IsMovie)
|
||||
//{
|
||||
// return true;
|
||||
//}
|
||||
|
||||
return item is Movie || item is BoxSet || item is MusicVideo;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,15 +71,6 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
public IEnumerable<ImageType> GetSupportedImages(IHasImages item)
|
||||
{
|
||||
if (item is ChannelVideoItem || item is LiveTvProgram)
|
||||
{
|
||||
// Too many channel items to allow backdrops here
|
||||
return new List<ImageType>
|
||||
{
|
||||
ImageType.Primary
|
||||
};
|
||||
}
|
||||
|
||||
return new List<ImageType>
|
||||
{
|
||||
ImageType.Primary,
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IProviderManager _providerManager;
|
||||
|
||||
private readonly ILocalizationManager _localization;
|
||||
private readonly ConcurrentDictionary<Guid, bool> _refreshedItems = new ConcurrentDictionary<Guid, bool>();
|
||||
|
@ -51,7 +52,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
private Timer _refreshTimer;
|
||||
private Timer _clearDownloadCountsTimer;
|
||||
|
||||
public ChannelManager(IUserManager userManager, IDtoService dtoService, ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem, IUserDataManager userDataManager, IJsonSerializer jsonSerializer, ILocalizationManager localization, IHttpClient httpClient)
|
||||
public ChannelManager(IUserManager userManager, IDtoService dtoService, ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem, IUserDataManager userDataManager, IJsonSerializer jsonSerializer, ILocalizationManager localization, IHttpClient httpClient, IProviderManager providerManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_dtoService = dtoService;
|
||||
|
@ -63,6 +64,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
_jsonSerializer = jsonSerializer;
|
||||
_localization = localization;
|
||||
_httpClient = httpClient;
|
||||
_providerManager = providerManager;
|
||||
|
||||
_refreshTimer = new Timer(s => _refreshedItems.Clear(), null, TimeSpan.FromHours(3), TimeSpan.FromHours(3));
|
||||
_clearDownloadCountsTimer = new Timer(s => _downloadCounts.Clear(), null, TimeSpan.FromHours(24), TimeSpan.FromHours(24));
|
||||
|
@ -649,7 +651,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
var internalItems = await Task.WhenAll(itemTasks).ConfigureAwait(false);
|
||||
|
||||
internalItems = ApplyFilters(internalItems, query.Filters, user).ToArray();
|
||||
await RefreshIfNeeded(internalItems, new Progress<double>(), cancellationToken).ConfigureAwait(false);
|
||||
RefreshIfNeeded(internalItems);
|
||||
|
||||
if (query.StartIndex.HasValue)
|
||||
{
|
||||
|
@ -814,7 +816,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
|
||||
var internalResult = await GetAllMediaInternal(query, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await RefreshIfNeeded(internalResult.Items, new Progress<double>(), cancellationToken).ConfigureAwait(false);
|
||||
RefreshIfNeeded(internalResult.Items);
|
||||
|
||||
var dtoOptions = new DtoOptions();
|
||||
|
||||
|
@ -954,7 +956,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
}
|
||||
}
|
||||
|
||||
return await GetReturnItems(internalItems, providerTotalRecordCount, user, query, progress, cancellationToken).ConfigureAwait(false);
|
||||
return await GetReturnItems(internalItems, providerTotalRecordCount, user, query).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<QueryResult<BaseItemDto>> GetChannelItems(ChannelItemQuery query, CancellationToken cancellationToken)
|
||||
|
@ -1123,9 +1125,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
private async Task<QueryResult<BaseItem>> GetReturnItems(IEnumerable<BaseItem> items,
|
||||
int? totalCountFromProvider,
|
||||
User user,
|
||||
ChannelItemQuery query,
|
||||
IProgress<double> progress,
|
||||
CancellationToken cancellationToken)
|
||||
ChannelItemQuery query)
|
||||
{
|
||||
items = ApplyFilters(items, query.Filters, user);
|
||||
|
||||
|
@ -1148,7 +1148,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
}
|
||||
|
||||
var returnItemArray = all.ToArray();
|
||||
await RefreshIfNeeded(returnItemArray, progress, cancellationToken).ConfigureAwait(false);
|
||||
RefreshIfNeeded(returnItemArray);
|
||||
|
||||
return new QueryResult<BaseItem>
|
||||
{
|
||||
|
@ -1272,32 +1272,22 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
return item;
|
||||
}
|
||||
|
||||
private async Task RefreshIfNeeded(BaseItem[] programs, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
private void RefreshIfNeeded(BaseItem[] programs)
|
||||
{
|
||||
var numComplete = 0;
|
||||
var numItems = programs.Length;
|
||||
|
||||
foreach (var program in programs)
|
||||
{
|
||||
await RefreshIfNeeded(program, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
numComplete++;
|
||||
double percent = numComplete;
|
||||
percent /= numItems;
|
||||
progress.Report(percent * 100);
|
||||
RefreshIfNeeded(program);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Task _cachedTask = Task.FromResult(true);
|
||||
private Task RefreshIfNeeded(BaseItem program, CancellationToken cancellationToken)
|
||||
private void RefreshIfNeeded(BaseItem program)
|
||||
{
|
||||
if (!_refreshedItems.ContainsKey(program.Id))
|
||||
{
|
||||
_refreshedItems.TryAdd(program.Id, true);
|
||||
return program.RefreshMetadata(cancellationToken);
|
||||
_providerManager.QueueRefresh(program.Id, new MetadataRefreshOptions(_fileSystem));
|
||||
}
|
||||
|
||||
return _cachedTask;
|
||||
}
|
||||
|
||||
internal IChannel GetChannelProvider(Channel channel)
|
||||
|
|
|
@ -225,19 +225,18 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
var columns = string.Join(",", _mediaStreamSaveColumns);
|
||||
|
||||
string[] queries = {
|
||||
"INSERT INTO mediastreams("+columns+") SELECT "+columns+" FROM MediaInfoOld.mediastreams;"
|
||||
"REPLACE INTO mediastreams("+columns+") SELECT "+columns+" FROM MediaInfoOld.mediastreams;"
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
_connection.RunQueries(queries, _logger);
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
_logger.ErrorException("Error migrating media info database", ex);
|
||||
}
|
||||
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
private void MigrateChapters(string file)
|
||||
|
@ -247,19 +246,18 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
SqliteExtensions.Attach(_connection, backupFile, "ChaptersOld");
|
||||
|
||||
string[] queries = {
|
||||
"INSERT INTO "+ChaptersTableName+"(ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) SELECT ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath FROM ChaptersOld.Chapters;"
|
||||
"REPLACE INTO "+ChaptersTableName+"(ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) SELECT ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath FROM ChaptersOld.Chapters;"
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
_connection.RunQueries(queries, _logger);
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
_logger.ErrorException("Error migrating chapter database", ex);
|
||||
}
|
||||
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -8,7 +8,6 @@ using MediaBrowser.Common.Events;
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Implementations;
|
||||
using MediaBrowser.Common.Implementations.ScheduledTasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller;
|
||||
|
@ -477,7 +476,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
|
||||
progress.Report(15);
|
||||
|
||||
ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LogManager.GetLogger("ChannelManager"), ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient);
|
||||
ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LogManager.GetLogger("ChannelManager"), ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
|
||||
RegisterSingleInstance(ChannelManager);
|
||||
|
||||
MediaSourceManager = new MediaSourceManager(ItemRepository, UserManager, LibraryManager, LogManager.GetLogger("MediaSourceManager"), JsonSerializer, FileSystemManager);
|
||||
|
@ -524,8 +523,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
await RegisterMediaEncoder(innerProgress).ConfigureAwait(false);
|
||||
progress.Report(90);
|
||||
|
||||
EncodingManager = new EncodingManager(FileSystemManager, Logger,
|
||||
MediaEncoder, ChapterManager);
|
||||
EncodingManager = new EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager);
|
||||
RegisterSingleInstance(EncodingManager);
|
||||
|
||||
var sharingRepo = new SharingRepository(LogManager, ApplicationPaths);
|
||||
|
|
|
@ -20,9 +20,9 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||
_taskManager = taskManager;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
public async void Run()
|
||||
{
|
||||
var name = "5767";
|
||||
var name = "5767.1";
|
||||
|
||||
if (_config.Configuration.Migrations.Contains(name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -38,6 +38,9 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||
_taskManager.QueueScheduledTask<RefreshMediaLibraryTask>();
|
||||
});
|
||||
|
||||
// Wait a few minutes before marking this as done. Make sure the server doesn't get restarted.
|
||||
await Task.Delay(300000).ConfigureAwait(false);
|
||||
|
||||
var list = _config.Configuration.Migrations.ToList();
|
||||
list.Add(name);
|
||||
_config.Configuration.Migrations = list.ToArray();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Reflection;
|
||||
|
||||
//[assembly: AssemblyVersion("3.0.*")]
|
||||
[assembly: AssemblyVersion("3.0.5768.0")]
|
||||
[assembly: AssemblyVersion("3.0.5768.1")]
|
||||
|
|
Loading…
Reference in New Issue
Block a user