mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
commit
99ad574bb8
@ -559,13 +559,13 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
//Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
//Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
||||||
|
|
||||||
DeletePartialStreamFiles(path, jobType, retryCount + 1, 500);
|
DeletePartialStreamFiles(path, jobType, retryCount + 1, 500);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
//Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
//Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using MediaBrowser.Controller.Providers;
|
|||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api
|
namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
@ -39,12 +40,14 @@ namespace MediaBrowser.Api
|
|||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public ItemRefreshService(ILibraryManager libraryManager, IProviderManager providerManager, IFileSystem fileSystem)
|
public ItemRefreshService(ILibraryManager libraryManager, IProviderManager providerManager, IFileSystem fileSystem, ILogger logger)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -69,7 +72,7 @@ namespace MediaBrowser.Api
|
|||||||
|
|
||||||
private MetadataRefreshOptions GetRefreshOptions(BaseRefreshRequest request)
|
private MetadataRefreshOptions GetRefreshOptions(BaseRefreshRequest request)
|
||||||
{
|
{
|
||||||
return new MetadataRefreshOptions(new DirectoryService(_fileSystem))
|
return new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||||
{
|
{
|
||||||
MetadataRefreshMode = request.MetadataRefreshMode,
|
MetadataRefreshMode = request.MetadataRefreshMode,
|
||||||
ImageRefreshMode = request.ImageRefreshMode,
|
ImageRefreshMode = request.ImageRefreshMode,
|
||||||
|
@ -1093,7 +1093,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
//process.BeginOutputReadLine();
|
//process.BeginOutputReadLine();
|
||||||
|
|
||||||
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
|
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
|
||||||
Task.Run(() => StartStreamingLog(transcodingJob, state, process.StandardError.BaseStream, state.LogFileStream));
|
var task = Task.Run(() => StartStreamingLog(transcodingJob, state, process.StandardError.BaseStream, state.LogFileStream));
|
||||||
|
|
||||||
// Wait for the file to exist before proceeeding
|
// Wait for the file to exist before proceeeding
|
||||||
while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
|
while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
|
||||||
|
@ -227,7 +227,7 @@ namespace MediaBrowser.Api
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
//Logger.ErrorException("Error getting plugin list", ex);
|
//Logger.ErrorException("Error getting plugin list", ex);
|
||||||
// Play it safe here
|
// Play it safe here
|
||||||
|
@ -11,6 +11,7 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
|
using MediaBrowser.Model.Dto;
|
||||||
|
|
||||||
namespace MediaBrowser.Api
|
namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
@ -81,11 +82,18 @@ namespace MediaBrowser.Api
|
|||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
var video = (Video)item;
|
var video = item as Video;
|
||||||
|
BaseItemDto[] items;
|
||||||
var items = video.GetAdditionalParts()
|
if (video != null)
|
||||||
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, video))
|
{
|
||||||
.ToArray();
|
items = video.GetAdditionalParts()
|
||||||
|
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, video))
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
items = new BaseItemDto[] { };
|
||||||
|
}
|
||||||
|
|
||||||
var result = new ItemsResult
|
var result = new ItemsResult
|
||||||
{
|
{
|
||||||
|
@ -211,7 +211,7 @@ namespace MediaBrowser.Common.Plugins
|
|||||||
{
|
{
|
||||||
return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
var locations = PhysicalLocations.ToList();
|
var locations = PhysicalLocations.ToList();
|
||||||
|
|
||||||
var newLocations = CreateResolveArgs(new DirectoryService(BaseItem.FileSystem), false).PhysicalLocations.ToList();
|
var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList();
|
||||||
|
|
||||||
if (!locations.SequenceEqual(newLocations))
|
if (!locations.SequenceEqual(newLocations))
|
||||||
{
|
{
|
||||||
|
@ -1003,7 +1003,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
public Task RefreshMetadata(CancellationToken cancellationToken)
|
public Task RefreshMetadata(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(FileSystem)), cancellationToken);
|
return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem)), cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
var locations = PhysicalLocations.ToList();
|
var locations = PhysicalLocations.ToList();
|
||||||
|
|
||||||
var newLocations = CreateResolveArgs(new DirectoryService(BaseItem.FileSystem), false).PhysicalLocations.ToList();
|
var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList();
|
||||||
|
|
||||||
if (!locations.SequenceEqual(newLocations))
|
if (!locations.SequenceEqual(newLocations))
|
||||||
{
|
{
|
||||||
|
@ -278,7 +278,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken)
|
public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return ValidateChildren(progress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(FileSystem)));
|
return ValidateChildren(progress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -213,7 +213,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
Name = newName;
|
Name = newName;
|
||||||
|
|
||||||
return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(FileSystem))
|
return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem))
|
||||||
{
|
{
|
||||||
ReplaceAllMetadata = true,
|
ReplaceAllMetadata = true,
|
||||||
ImageRefreshMode = ImageRefreshMode.FullRefresh,
|
ImageRefreshMode = ImageRefreshMode.FullRefresh,
|
||||||
|
@ -562,5 +562,6 @@ namespace MediaBrowser.Controller.Library
|
|||||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query);
|
QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query);
|
||||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query);
|
QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query);
|
||||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query);
|
QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query);
|
||||||
|
QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -169,6 +169,7 @@ namespace MediaBrowser.Controller.Persistence
|
|||||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query);
|
QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query);
|
||||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query);
|
QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query);
|
||||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query);
|
QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query);
|
||||||
|
QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DirectoryService(IFileSystem fileSystem)
|
public DirectoryService(IFileSystem fileSystem)
|
||||||
: this(new NullLogger(), fileSystem)
|
: this(new NullLogger(), fileSystem)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -108,12 +108,20 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dict = GetFileSystemDictionary(directory, false);
|
try
|
||||||
|
{
|
||||||
|
var dict = GetFileSystemDictionary(directory, false);
|
||||||
|
|
||||||
FileSystemMetadata entry;
|
FileSystemMetadata entry;
|
||||||
dict.TryGetValue(path, out entry);
|
dict.TryGetValue(path, out entry);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error in GetFileSystemDictionary. Directory: :{0}. Original path: {1}", ex, directory, path);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<FileSystemMetadata> GetDirectories(string path)
|
public IEnumerable<FileSystemMetadata> GetDirectories(string path)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
namespace MediaBrowser.Controller.Providers
|
||||||
@ -19,7 +20,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
public bool ForceSave { get; set; }
|
public bool ForceSave { get; set; }
|
||||||
|
|
||||||
public MetadataRefreshOptions(IFileSystem fileSystem)
|
public MetadataRefreshOptions(IFileSystem fileSystem)
|
||||||
: this(new DirectoryService(fileSystem))
|
: this(new DirectoryService(new NullLogger(), fileSystem))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ namespace MediaBrowser.LocalMetadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
public virtual int Order
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
return directoryService.GetFile(Path.Combine(info.Path, "series.xml"));
|
return directoryService.GetFile(Path.Combine(info.Path, "series.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
public override int Order
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Kick this off, but no need to wait on it
|
// Kick this off, but no need to wait on it
|
||||||
Task.Run(async () =>
|
var task = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await DownloadFontFile(fontsDirectory, fontFilename, new Progress<double>()).ConfigureAwait(false);
|
await DownloadFontFile(fontsDirectory, fontFilename, new Progress<double>()).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -398,7 +398,8 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
// These are mp4 chapters
|
// These are mp4 chapters
|
||||||
if (string.Equals(streamInfo.codec_name, "mov_text", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(streamInfo.codec_name, "mov_text", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return null;
|
// Edit: but these are also sometimes subtitles?
|
||||||
|
//return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var stream = new MediaStream
|
var stream = new MediaStream
|
||||||
|
@ -298,7 +298,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
{
|
{
|
||||||
var options = GetMetadataOptions(item);
|
var options = GetMetadataOptions(item);
|
||||||
|
|
||||||
return GetImageProviders(item, options, new ImageRefreshOptions(new DirectoryService(_fileSystem)), includeDisabled).OfType<IRemoteImageProvider>();
|
return GetImageProviders(item, options, new ImageRefreshOptions(new DirectoryService(_logger, _fileSystem)), includeDisabled).OfType<IRemoteImageProvider>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanRefresh(IMetadataProvider provider, IHasMetadata item, MetadataOptions options, bool includeDisabled, bool checkIsOwnedItem)
|
private bool CanRefresh(IMetadataProvider provider, IHasMetadata item, MetadataOptions options, bool includeDisabled, bool checkIsOwnedItem)
|
||||||
@ -488,7 +488,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
ItemType = typeof(T).Name
|
ItemType = typeof(T).Name
|
||||||
};
|
};
|
||||||
|
|
||||||
var imageProviders = GetImageProviders(dummy, options, new ImageRefreshOptions(new DirectoryService(_fileSystem)), true).ToList();
|
var imageProviders = GetImageProviders(dummy, options, new ImageRefreshOptions(new DirectoryService(_logger, _fileSystem)), true).ToList();
|
||||||
|
|
||||||
AddMetadataPlugins(summary.Plugins, dummy, options);
|
AddMetadataPlugins(summary.Plugins, dummy, options);
|
||||||
AddImagePlugins(summary.Plugins, dummy, imageProviders);
|
AddImagePlugins(summary.Plugins, dummy, imageProviders);
|
||||||
|
@ -254,7 +254,7 @@ namespace MediaBrowser.Providers.Subtitles
|
|||||||
_monitor.ReportFileSystemChangeComplete(path, false);
|
_monitor.ReportFileSystemChangeComplete(path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _libraryManager.GetItemById(itemId).RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_fileSystem))
|
return _libraryManager.GetItemById(itemId).RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||||
{
|
{
|
||||||
ImageRefreshMode = ImageRefreshMode.ValidationOnly,
|
ImageRefreshMode = ImageRefreshMode.ValidationOnly,
|
||||||
MetadataRefreshMode = MetadataRefreshMode.ValidationOnly
|
MetadataRefreshMode = MetadataRefreshMode.ValidationOnly
|
||||||
|
@ -133,7 +133,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
{
|
{
|
||||||
foreach (var series in group)
|
foreach (var series in group)
|
||||||
{
|
{
|
||||||
var directoryService = new DirectoryService(_fileSystem);
|
var directoryService = new DirectoryService(_logger, _fileSystem);
|
||||||
|
|
||||||
await series.RefreshMetadata(new MetadataRefreshOptions(directoryService), cancellationToken).ConfigureAwait(false);
|
await series.RefreshMetadata(new MetadataRefreshOptions(directoryService), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|||||||
{
|
{
|
||||||
DiscoveredWanIpAddress = address;
|
DiscoveredWanIpAddress = address;
|
||||||
|
|
||||||
UpdateConnectInfo();
|
var task = UpdateConnectInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateConnectInfo()
|
private async Task UpdateConnectInfo()
|
||||||
|
@ -1620,7 +1620,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
{
|
{
|
||||||
size = _imageProcessor.GetImageSize(imageInfo);
|
size = _imageProcessor.GetImageSize(imageInfo);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
//_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path);
|
//_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path);
|
||||||
return null;
|
return null;
|
||||||
|
@ -29,7 +29,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
private readonly IInstallationManager _installationManager;
|
private readonly IInstallationManager _installationManager;
|
||||||
|
|
||||||
//private readonly ILogManager _logManager;
|
//private readonly ILogManager _logManager;
|
||||||
private readonly ILogger _logger;
|
//private readonly ILogger _logger;
|
||||||
private readonly ISessionManager _sessionManager;
|
private readonly ISessionManager _sessionManager;
|
||||||
private readonly ITaskManager _taskManager;
|
private readonly ITaskManager _taskManager;
|
||||||
private readonly IActivityManager _activityManager;
|
private readonly IActivityManager _activityManager;
|
||||||
|
@ -165,7 +165,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
|
|
||||||
CreateRules(device);
|
CreateRules(device);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
// I think it could be a good idea to log the exception because
|
// I think it could be a good idea to log the exception because
|
||||||
// you are using permanent portmapping here (never expire) and that means that next time
|
// you are using permanent portmapping here (never expire) and that means that next time
|
||||||
|
@ -92,7 +92,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
var changes = _changedItems.ToList();
|
var changes = _changedItems.ToList();
|
||||||
_changedItems.Clear();
|
_changedItems.Clear();
|
||||||
|
|
||||||
SendNotifications(changes, CancellationToken.None);
|
var task = SendNotifications(changes, CancellationToken.None);
|
||||||
|
|
||||||
if (UpdateTimer != null)
|
if (UpdateTimer != null)
|
||||||
{
|
{
|
||||||
|
@ -251,7 +251,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
|
|
||||||
httpRes.Close();
|
httpRes.Close();
|
||||||
}
|
}
|
||||||
catch (Exception errorEx)
|
catch
|
||||||
{
|
{
|
||||||
//_logger.ErrorException("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx);
|
//_logger.ErrorException("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -1385,6 +1385,17 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return ItemRepository.GetMusicGenres(query);
|
return ItemRepository.GetMusicGenres(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query)
|
||||||
|
{
|
||||||
|
if (query.User != null)
|
||||||
|
{
|
||||||
|
AddUserToQuery(query, query.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTopParentOrAncestorIds(query);
|
||||||
|
return ItemRepository.GetAllArtists(query);
|
||||||
|
}
|
||||||
|
|
||||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query)
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
if (query.User != null)
|
if (query.User != null)
|
||||||
|
@ -6,6 +6,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
{
|
{
|
||||||
@ -43,36 +44,39 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var allSongs = _libraryManager.RootFolder
|
var items = _libraryManager.GetAllArtists(new InternalItemsQuery())
|
||||||
.GetRecursiveChildren(i => !i.IsFolder && i is IHasArtist)
|
.Items
|
||||||
.Cast<IHasArtist>()
|
.Select(i => i.Item1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var allArtists = _libraryManager.GetArtists(allSongs).ToList();
|
|
||||||
|
|
||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
var numArtists = allArtists.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
foreach (var artistItem in allArtists)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await artistItem.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error validating Artist {0}", ex, artistItem.Name);
|
// Don't clutter the log
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update progress
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
double percent = numComplete;
|
double percent = numComplete;
|
||||||
percent /= numArtists;
|
percent /= count;
|
||||||
|
percent *= 100;
|
||||||
|
|
||||||
progress.Report(100 * percent);
|
progress.Report(percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,21 +34,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var items = _libraryManager.RootFolder.GetRecursiveChildren(i => i is Game)
|
var items = _libraryManager.GetGameGenres(new InternalItemsQuery
|
||||||
.SelectMany(i => i.Genres)
|
{
|
||||||
.DistinctNames()
|
IncludeItemTypes = new[] { typeof(Game).Name }
|
||||||
|
})
|
||||||
|
.Items
|
||||||
|
.Select(i => i.Item1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
var count = items.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
foreach (var name in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var itemByName = _libraryManager.GetGameGenre(name);
|
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
@ -57,7 +58,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error refreshing {0}", ex, name);
|
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
|
@ -35,21 +35,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var items = _libraryManager.RootFolder.GetRecursiveChildren(i => !(i is IHasMusicGenres) && !(i is Game))
|
var items = _libraryManager.GetGenres(new InternalItemsQuery
|
||||||
.SelectMany(i => i.Genres)
|
{
|
||||||
.DistinctNames()
|
ExcludeItemTypes = new[] { typeof(Audio).Name, typeof(MusicArtist).Name, typeof(MusicAlbum).Name, typeof(MusicVideo).Name, typeof(Game).Name }
|
||||||
|
})
|
||||||
|
.Items
|
||||||
|
.Select(i => i.Item1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
var count = items.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
foreach (var name in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var itemByName = _libraryManager.GetGenre(name);
|
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
@ -58,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error refreshing {0}", ex, name);
|
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
{
|
{
|
||||||
@ -34,21 +35,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var items = _libraryManager.RootFolder.GetRecursiveChildren(i => i is IHasMusicGenres)
|
var items = _libraryManager.GetMusicGenres(new InternalItemsQuery
|
||||||
.SelectMany(i => i.Genres)
|
{
|
||||||
.DistinctNames()
|
IncludeItemTypes = new[] { typeof(Audio).Name, typeof(MusicArtist).Name, typeof(MusicAlbum).Name, typeof(MusicVideo).Name }
|
||||||
|
})
|
||||||
|
.Items
|
||||||
|
.Select(i => i.Item1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
var count = items.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
foreach (var name in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var itemByName = _libraryManager.GetMusicGenre(name);
|
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
@ -57,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error refreshing {0}", ex, name);
|
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
{
|
{
|
||||||
@ -34,21 +34,19 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var items = _libraryManager.RootFolder.GetRecursiveChildren(i => true)
|
var items = _libraryManager.GetStudios(new InternalItemsQuery())
|
||||||
.SelectMany(i => i.Studios)
|
.Items
|
||||||
.DistinctNames()
|
.Select(i => i.Item1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
var count = items.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
foreach (var name in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var itemByName = _libraryManager.GetStudio(name);
|
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
@ -57,7 +55,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error refreshing {0}", ex, name);
|
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
|
@ -55,8 +55,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||||||
|
|
||||||
public static EmbyTV Current;
|
public static EmbyTV Current;
|
||||||
|
|
||||||
public event EventHandler DataSourceChanged;
|
public event EventHandler DataSourceChanged { add { } remove { } }
|
||||||
public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged;
|
public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged { add { } remove { } }
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<string, ActiveRecordingInfo> _activeRecordings =
|
private readonly ConcurrentDictionary<string, ActiveRecordingInfo> _activeRecordings =
|
||||||
new ConcurrentDictionary<string, ActiveRecordingInfo>(StringComparer.OrdinalIgnoreCase);
|
new ConcurrentDictionary<string, ActiveRecordingInfo>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
@ -52,7 +52,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
catch (DirectoryNotFoundException ex)
|
catch (DirectoryNotFoundException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
|
@ -133,7 +133,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
|
|
||||||
void service_DataSourceChanged(object sender, EventArgs e)
|
void service_DataSourceChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
|
if (!_isDisposed)
|
||||||
|
{
|
||||||
|
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<QueryResult<LiveTvChannel>> GetInternalChannels(LiveTvChannelQuery query, CancellationToken cancellationToken)
|
public async Task<QueryResult<LiveTvChannel>> GetInternalChannels(LiveTvChannelQuery query, CancellationToken cancellationToken)
|
||||||
@ -1238,7 +1241,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
var programs = new List<Guid>();
|
var programs = new List<Guid>();
|
||||||
var channels = new List<Guid>();
|
var channels = new List<Guid>();
|
||||||
|
|
||||||
var guideDays = GetGuideDays(list.Count);
|
var guideDays = GetGuideDays();
|
||||||
|
|
||||||
_logger.Info("Refreshing guide with {0} days of guide data", guideDays);
|
_logger.Info("Refreshing guide with {0} days of guide data", guideDays);
|
||||||
|
|
||||||
@ -1326,7 +1329,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private const int MaxGuideDays = 14;
|
private const int MaxGuideDays = 14;
|
||||||
private double GetGuideDays(int channelCount)
|
private double GetGuideDays()
|
||||||
{
|
{
|
||||||
var config = GetConfiguration();
|
var config = GetConfiguration();
|
||||||
|
|
||||||
@ -1335,13 +1338,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
return Math.Max(1, Math.Min(config.GuideDays.Value, MaxGuideDays));
|
return Math.Max(1, Math.Min(config.GuideDays.Value, MaxGuideDays));
|
||||||
}
|
}
|
||||||
|
|
||||||
var programsPerDay = channelCount * 48;
|
return 7;
|
||||||
|
|
||||||
const int maxPrograms = 24000;
|
|
||||||
|
|
||||||
var days = Math.Round((double)maxPrograms / programsPerDay);
|
|
||||||
|
|
||||||
return Math.Max(3, Math.Min(days, MaxGuideDays));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IEnumerable<Tuple<string, ChannelInfo>>> GetChannels(ILiveTvService service, CancellationToken cancellationToken)
|
private async Task<IEnumerable<Tuple<string, ChannelInfo>>> GetChannels(ILiveTvService service, CancellationToken cancellationToken)
|
||||||
@ -2309,6 +2306,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly object _disposeLock = new object();
|
private readonly object _disposeLock = new object();
|
||||||
|
private bool _isDisposed = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Releases unmanaged and - optionally - managed resources.
|
/// Releases unmanaged and - optionally - managed resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -2317,6 +2315,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
{
|
{
|
||||||
if (dispose)
|
if (dispose)
|
||||||
{
|
{
|
||||||
|
_isDisposed = true;
|
||||||
|
|
||||||
lock (_disposeLock)
|
lock (_disposeLock)
|
||||||
{
|
{
|
||||||
foreach (var stream in _openStreams.Values.ToList())
|
foreach (var stream in _openStreams.Values.ToList())
|
||||||
|
@ -431,7 +431,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||||||
list.Add(await GetMediaSource(info, hdhrId, "mobile").ConfigureAwait(false));
|
list.Add(await GetMediaSource(info, hdhrId, "mobile").ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -649,7 +649,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp
|
|||||||
|
|
||||||
#region Public Events
|
#region Public Events
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
////public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||||||
|
|
||||||
public event EventHandler<NotificationUpdateEventArgs> NotificationAdded;
|
public event EventHandler<NotificationUpdateEventArgs> NotificationAdded;
|
||||||
public event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
|
public event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
|
||||||
public event EventHandler<NotificationUpdateEventArgs> NotificationUpdated;
|
////public event EventHandler<NotificationUpdateEventArgs> NotificationUpdated;
|
||||||
|
|
||||||
public async Task Initialize()
|
public async Task Initialize()
|
||||||
{
|
{
|
||||||
|
@ -3817,37 +3817,42 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query)
|
||||||
|
{
|
||||||
|
return GetItemValues(query, new[] { 0, 1 }, typeof(MusicArtist).FullName);
|
||||||
|
}
|
||||||
|
|
||||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query)
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
return GetItemValues(query, 0, typeof(MusicArtist).FullName);
|
return GetItemValues(query, new[] { 0 }, typeof(MusicArtist).FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query)
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
return GetItemValues(query, 1, typeof(MusicArtist).FullName);
|
return GetItemValues(query, new[] { 1 }, typeof(MusicArtist).FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query)
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
return GetItemValues(query, 3, typeof(Studio).FullName);
|
return GetItemValues(query, new[] { 3 }, typeof(Studio).FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetGenres(InternalItemsQuery query)
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetGenres(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
return GetItemValues(query, 2, typeof(Genre).FullName);
|
return GetItemValues(query, new[] { 2 }, typeof(Genre).FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetGameGenres(InternalItemsQuery query)
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetGameGenres(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
return GetItemValues(query, 2, typeof(GameGenre).FullName);
|
return GetItemValues(query, new[] { 2 }, typeof(GameGenre).FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetMusicGenres(InternalItemsQuery query)
|
public QueryResult<Tuple<BaseItem, ItemCounts>> GetMusicGenres(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
return GetItemValues(query, 2, typeof(MusicGenre).FullName);
|
return GetItemValues(query, new[] { 2 }, typeof(MusicGenre).FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuery query, int itemValueType, string returnType)
|
private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuery query, int[] itemValueTypes, string returnType)
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
@ -3863,6 +3868,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
|
|
||||||
|
var typeClause = itemValueTypes.Length == 1 ?
|
||||||
|
("Type=" + itemValueTypes[0].ToString(CultureInfo.InvariantCulture)) :
|
||||||
|
("Type in (" + string.Join(",", itemValueTypes.Select(i => i.ToString(CultureInfo.InvariantCulture)).ToArray()) + ")");
|
||||||
|
|
||||||
using (var cmd = _connection.CreateCommand())
|
using (var cmd = _connection.CreateCommand())
|
||||||
{
|
{
|
||||||
var itemCountColumns = new List<Tuple<string, string>>();
|
var itemCountColumns = new List<Tuple<string, string>>();
|
||||||
@ -3887,7 +3896,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
};
|
};
|
||||||
var whereClauses = GetWhereClauses(typeSubQuery, cmd, "itemTypes");
|
var whereClauses = GetWhereClauses(typeSubQuery, cmd, "itemTypes");
|
||||||
|
|
||||||
whereClauses.Add("guid in (select ItemId from ItemValues where ItemValues.CleanValue=A.CleanName AND Type=@ItemValueType)");
|
whereClauses.Add("guid in (select ItemId from ItemValues where ItemValues.CleanValue=A.CleanName AND " + typeClause + ")");
|
||||||
|
|
||||||
var typeWhereText = whereClauses.Count == 0 ?
|
var typeWhereText = whereClauses.Count == 0 ?
|
||||||
string.Empty :
|
string.Empty :
|
||||||
@ -3929,12 +3938,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
if (typesToCount.Count == 0)
|
if (typesToCount.Count == 0)
|
||||||
{
|
{
|
||||||
whereText += " And CleanName In (Select CleanValue from ItemValues where Type=@ItemValueType AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))";
|
whereText += " And CleanName In (Select CleanValue from ItemValues where " + typeClause + " AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//whereText += " And itemTypes not null";
|
//whereText += " And itemTypes not null";
|
||||||
whereText += " And CleanName In (Select CleanValue from ItemValues where Type=@ItemValueType AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))";
|
whereText += " And CleanName In (Select CleanValue from ItemValues where " + typeClause + " AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))";
|
||||||
}
|
}
|
||||||
|
|
||||||
var outerQuery = new InternalItemsQuery(query.User)
|
var outerQuery = new InternalItemsQuery(query.User)
|
||||||
@ -3964,7 +3973,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
cmd.CommandText += " group by PresentationUniqueKey";
|
cmd.CommandText += " group by PresentationUniqueKey";
|
||||||
|
|
||||||
cmd.Parameters.Add(cmd, "@SelectType", DbType.String).Value = returnType;
|
cmd.Parameters.Add(cmd, "@SelectType", DbType.String).Value = returnType;
|
||||||
cmd.Parameters.Add(cmd, "@ItemValueType", DbType.Int32).Value = itemValueType;
|
|
||||||
|
|
||||||
if (EnableJoinUserData(query))
|
if (EnableJoinUserData(query))
|
||||||
{
|
{
|
||||||
|
@ -606,7 +606,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
{
|
{
|
||||||
return new ImageMagickEncoder(LogManager.GetLogger("ImageMagick"), ApplicationPaths, HttpClient, FileSystemManager, ServerConfigurationManager);
|
return new ImageMagickEncoder(LogManager.GetLogger("ImageMagick"), ApplicationPaths, HttpClient, FileSystemManager, ServerConfigurationManager);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
Logger.Error("Error loading ImageMagick. Will revert to GDI.");
|
Logger.Error("Error loading ImageMagick. Will revert to GDI.");
|
||||||
}
|
}
|
||||||
@ -616,7 +616,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
{
|
{
|
||||||
return new GDIImageEncoder(FileSystemManager, LogManager.GetLogger("GDI"));
|
return new GDIImageEncoder(FileSystemManager, LogManager.GetLogger("GDI"));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
Logger.Error("Error loading GDI. Will revert to NullImageEncoder.");
|
Logger.Error("Error loading GDI. Will revert to NullImageEncoder.");
|
||||||
}
|
}
|
||||||
@ -1412,7 +1412,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
{
|
{
|
||||||
return new Uri(externalDns).Host;
|
return new Uri(externalDns).Host;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch
|
||||||
{
|
{
|
||||||
return externalDns;
|
return externalDns;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user