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);
|
||||
|
||||
DeletePartialStreamFiles(path, jobType, retryCount + 1, 500);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
//Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using MediaBrowser.Controller.Providers;
|
|||
using ServiceStack;
|
||||
using System.Threading;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Api
|
||||
{
|
||||
|
@ -39,12 +40,14 @@ namespace MediaBrowser.Api
|
|||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IProviderManager _providerManager;
|
||||
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;
|
||||
_providerManager = providerManager;
|
||||
_fileSystem = fileSystem;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -69,7 +72,7 @@ namespace MediaBrowser.Api
|
|||
|
||||
private MetadataRefreshOptions GetRefreshOptions(BaseRefreshRequest request)
|
||||
{
|
||||
return new MetadataRefreshOptions(new DirectoryService(_fileSystem))
|
||||
return new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||
{
|
||||
MetadataRefreshMode = request.MetadataRefreshMode,
|
||||
ImageRefreshMode = request.ImageRefreshMode,
|
||||
|
|
|
@ -1093,7 +1093,7 @@ namespace MediaBrowser.Api.Playback
|
|||
//process.BeginOutputReadLine();
|
||||
|
||||
// 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
|
||||
while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
|
||||
|
|
|
@ -227,7 +227,7 @@ namespace MediaBrowser.Api
|
|||
.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
//Logger.ErrorException("Error getting plugin list", ex);
|
||||
// Play it safe here
|
||||
|
|
|
@ -11,6 +11,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Model.Dto;
|
||||
|
||||
namespace MediaBrowser.Api
|
||||
{
|
||||
|
@ -81,11 +82,18 @@ namespace MediaBrowser.Api
|
|||
|
||||
var dtoOptions = GetDtoOptions(request);
|
||||
|
||||
var video = (Video)item;
|
||||
|
||||
var items = video.GetAdditionalParts()
|
||||
var video = item as Video;
|
||||
BaseItemDto[] items;
|
||||
if (video != null)
|
||||
{
|
||||
items = video.GetAdditionalParts()
|
||||
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, video))
|
||||
.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
items = new BaseItemDto[] { };
|
||||
}
|
||||
|
||||
var result = new ItemsResult
|
||||
{
|
||||
|
|
|
@ -211,7 +211,7 @@ namespace MediaBrowser.Common.Plugins
|
|||
{
|
||||
return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
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))
|
||||
{
|
||||
|
|
|
@ -1003,7 +1003,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
public Task RefreshMetadata(CancellationToken cancellationToken)
|
||||
{
|
||||
return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(FileSystem)), cancellationToken);
|
||||
return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem)), cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
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))
|
||||
{
|
||||
|
|
|
@ -278,7 +278,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
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>
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
Name = newName;
|
||||
|
||||
return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(FileSystem))
|
||||
return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem))
|
||||
{
|
||||
ReplaceAllMetadata = true,
|
||||
ImageRefreshMode = ImageRefreshMode.FullRefresh,
|
||||
|
|
|
@ -562,5 +562,6 @@ namespace MediaBrowser.Controller.Library
|
|||
QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(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>> GetArtists(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,8 @@ namespace MediaBrowser.Controller.Providers
|
|||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var dict = GetFileSystemDictionary(directory, false);
|
||||
|
||||
FileSystemMetadata entry;
|
||||
|
@ -115,6 +117,12 @@ namespace MediaBrowser.Controller.Providers
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Linq;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
|
@ -19,7 +20,7 @@ namespace MediaBrowser.Controller.Providers
|
|||
public bool ForceSave { get; set; }
|
||||
|
||||
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
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||
return directoryService.GetFile(Path.Combine(info.Path, "series.xml"));
|
||||
}
|
||||
|
||||
public int Order
|
||||
public override int Order
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
else
|
||||
{
|
||||
// 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);
|
||||
|
||||
|
|
|
@ -398,7 +398,8 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||
// These are mp4 chapters
|
||||
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
|
||||
|
|
|
@ -298,7 +298,7 @@ namespace MediaBrowser.Providers.Manager
|
|||
{
|
||||
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)
|
||||
|
@ -488,7 +488,7 @@ namespace MediaBrowser.Providers.Manager
|
|||
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);
|
||||
AddImagePlugins(summary.Plugins, dummy, imageProviders);
|
||||
|
|
|
@ -254,7 +254,7 @@ namespace MediaBrowser.Providers.Subtitles
|
|||
_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,
|
||||
MetadataRefreshMode = MetadataRefreshMode.ValidationOnly
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace MediaBrowser.Providers.TV
|
|||
{
|
||||
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);
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|||
{
|
||||
DiscoveredWanIpAddress = address;
|
||||
|
||||
UpdateConnectInfo();
|
||||
var task = UpdateConnectInfo();
|
||||
}
|
||||
|
||||
private async Task UpdateConnectInfo()
|
||||
|
|
|
@ -1620,7 +1620,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
{
|
||||
size = _imageProcessor.GetImageSize(imageInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
//_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path);
|
||||
return null;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
private readonly IInstallationManager _installationManager;
|
||||
|
||||
//private readonly ILogManager _logManager;
|
||||
private readonly ILogger _logger;
|
||||
//private readonly ILogger _logger;
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly ITaskManager _taskManager;
|
||||
private readonly IActivityManager _activityManager;
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
|
||||
CreateRules(device);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
// 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
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
var changes = _changedItems.ToList();
|
||||
_changedItems.Clear();
|
||||
|
||||
SendNotifications(changes, CancellationToken.None);
|
||||
var task = SendNotifications(changes, CancellationToken.None);
|
||||
|
||||
if (UpdateTimer != null)
|
||||
{
|
||||
|
|
|
@ -251,7 +251,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
|
||||
httpRes.Close();
|
||||
}
|
||||
catch (Exception errorEx)
|
||||
catch
|
||||
{
|
||||
//_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;
|
||||
}
|
||||
|
|
|
@ -1385,6 +1385,17 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
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)
|
||||
{
|
||||
if (query.User != null)
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
{
|
||||
|
@ -43,36 +44,39 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
/// <returns>Task.</returns>
|
||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var allSongs = _libraryManager.RootFolder
|
||||
.GetRecursiveChildren(i => !i.IsFolder && i is IHasArtist)
|
||||
.Cast<IHasArtist>()
|
||||
var items = _libraryManager.GetAllArtists(new InternalItemsQuery())
|
||||
.Items
|
||||
.Select(i => i.Item1)
|
||||
.ToList();
|
||||
|
||||
var allArtists = _libraryManager.GetArtists(allSongs).ToList();
|
||||
|
||||
var numComplete = 0;
|
||||
var numArtists = allArtists.Count;
|
||||
var count = items.Count;
|
||||
|
||||
foreach (var artistItem in allArtists)
|
||||
foreach (var item in items)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
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++;
|
||||
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>
|
||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var items = _libraryManager.RootFolder.GetRecursiveChildren(i => i is Game)
|
||||
.SelectMany(i => i.Genres)
|
||||
.DistinctNames()
|
||||
var items = _libraryManager.GetGameGenres(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Game).Name }
|
||||
})
|
||||
.Items
|
||||
.Select(i => i.Item1)
|
||||
.ToList();
|
||||
|
||||
var numComplete = 0;
|
||||
var count = items.Count;
|
||||
|
||||
foreach (var name in items)
|
||||
foreach (var item in items)
|
||||
{
|
||||
try
|
||||
{
|
||||
var itemByName = _libraryManager.GetGameGenre(name);
|
||||
|
||||
await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
@ -57,7 +58,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error refreshing {0}", ex, name);
|
||||
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||
}
|
||||
|
||||
numComplete++;
|
||||
|
|
|
@ -35,21 +35,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
/// <returns>Task.</returns>
|
||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var items = _libraryManager.RootFolder.GetRecursiveChildren(i => !(i is IHasMusicGenres) && !(i is Game))
|
||||
.SelectMany(i => i.Genres)
|
||||
.DistinctNames()
|
||||
var items = _libraryManager.GetGenres(new InternalItemsQuery
|
||||
{
|
||||
ExcludeItemTypes = new[] { typeof(Audio).Name, typeof(MusicArtist).Name, typeof(MusicAlbum).Name, typeof(MusicVideo).Name, typeof(Game).Name }
|
||||
})
|
||||
.Items
|
||||
.Select(i => i.Item1)
|
||||
.ToList();
|
||||
|
||||
var numComplete = 0;
|
||||
var count = items.Count;
|
||||
|
||||
foreach (var name in items)
|
||||
foreach (var item in items)
|
||||
{
|
||||
try
|
||||
{
|
||||
var itemByName = _libraryManager.GetGenre(name);
|
||||
|
||||
await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
@ -58,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error refreshing {0}", ex, name);
|
||||
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||
}
|
||||
|
||||
numComplete++;
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
{
|
||||
|
@ -34,21 +35,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
/// <returns>Task.</returns>
|
||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var items = _libraryManager.RootFolder.GetRecursiveChildren(i => i is IHasMusicGenres)
|
||||
.SelectMany(i => i.Genres)
|
||||
.DistinctNames()
|
||||
var items = _libraryManager.GetMusicGenres(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Audio).Name, typeof(MusicArtist).Name, typeof(MusicAlbum).Name, typeof(MusicVideo).Name }
|
||||
})
|
||||
.Items
|
||||
.Select(i => i.Item1)
|
||||
.ToList();
|
||||
|
||||
var numComplete = 0;
|
||||
var count = items.Count;
|
||||
|
||||
foreach (var name in items)
|
||||
foreach (var item in items)
|
||||
{
|
||||
try
|
||||
{
|
||||
var itemByName = _libraryManager.GetMusicGenre(name);
|
||||
|
||||
await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
@ -57,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error refreshing {0}", ex, name);
|
||||
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||
}
|
||||
|
||||
numComplete++;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
{
|
||||
|
@ -34,21 +34,19 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
/// <returns>Task.</returns>
|
||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var items = _libraryManager.RootFolder.GetRecursiveChildren(i => true)
|
||||
.SelectMany(i => i.Studios)
|
||||
.DistinctNames()
|
||||
var items = _libraryManager.GetStudios(new InternalItemsQuery())
|
||||
.Items
|
||||
.Select(i => i.Item1)
|
||||
.ToList();
|
||||
|
||||
var numComplete = 0;
|
||||
var count = items.Count;
|
||||
|
||||
foreach (var name in items)
|
||||
foreach (var item in items)
|
||||
{
|
||||
try
|
||||
{
|
||||
var itemByName = _libraryManager.GetStudio(name);
|
||||
|
||||
await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
@ -57,7 +55,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error refreshing {0}", ex, name);
|
||||
_logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||
}
|
||||
|
||||
numComplete++;
|
||||
|
|
|
@ -55,8 +55,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
public static EmbyTV Current;
|
||||
|
||||
public event EventHandler DataSourceChanged;
|
||||
public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged;
|
||||
public event EventHandler DataSourceChanged { add { } remove { } }
|
||||
public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged { add { } remove { } }
|
||||
|
||||
private readonly ConcurrentDictionary<string, ActiveRecordingInfo> _activeRecordings =
|
||||
new ConcurrentDictionary<string, ActiveRecordingInfo>(StringComparer.OrdinalIgnoreCase);
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
catch (FileNotFoundException)
|
||||
{
|
||||
}
|
||||
catch (DirectoryNotFoundException ex)
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
}
|
||||
catch (IOException ex)
|
||||
|
|
|
@ -132,9 +132,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
}
|
||||
|
||||
void service_DataSourceChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
|
||||
}
|
||||
}
|
||||
|
||||
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 channels = new List<Guid>();
|
||||
|
||||
var guideDays = GetGuideDays(list.Count);
|
||||
var guideDays = GetGuideDays();
|
||||
|
||||
_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 double GetGuideDays(int channelCount)
|
||||
private double GetGuideDays()
|
||||
{
|
||||
var config = GetConfiguration();
|
||||
|
||||
|
@ -1335,13 +1338,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
return Math.Max(1, Math.Min(config.GuideDays.Value, MaxGuideDays));
|
||||
}
|
||||
|
||||
var programsPerDay = channelCount * 48;
|
||||
|
||||
const int maxPrograms = 24000;
|
||||
|
||||
var days = Math.Round((double)maxPrograms / programsPerDay);
|
||||
|
||||
return Math.Max(3, Math.Min(days, MaxGuideDays));
|
||||
return 7;
|
||||
}
|
||||
|
||||
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 bool _isDisposed = false;
|
||||
/// <summary>
|
||||
/// Releases unmanaged and - optionally - managed resources.
|
||||
/// </summary>
|
||||
|
@ -2317,6 +2315,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
{
|
||||
if (dispose)
|
||||
{
|
||||
_isDisposed = true;
|
||||
|
||||
lock (_disposeLock)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -649,7 +649,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp
|
|||
|
||||
#region Public Events
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
////public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||
|
||||
public event EventHandler<NotificationUpdateEventArgs> NotificationAdded;
|
||||
public event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
|
||||
public event EventHandler<NotificationUpdateEventArgs> NotificationUpdated;
|
||||
////public event EventHandler<NotificationUpdateEventArgs> NotificationUpdated;
|
||||
|
||||
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)
|
||||
{
|
||||
return GetItemValues(query, 0, typeof(MusicArtist).FullName);
|
||||
return GetItemValues(query, new[] { 0 }, typeof(MusicArtist).FullName);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return GetItemValues(query, 3, typeof(Studio).FullName);
|
||||
return GetItemValues(query, new[] { 3 }, typeof(Studio).FullName);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return GetItemValues(query, 2, typeof(GameGenre).FullName);
|
||||
return GetItemValues(query, new[] { 2 }, typeof(GameGenre).FullName);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -3863,6 +3868,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
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())
|
||||
{
|
||||
var itemCountColumns = new List<Tuple<string, string>>();
|
||||
|
@ -3887,7 +3896,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
};
|
||||
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 ?
|
||||
string.Empty :
|
||||
|
@ -3929,12 +3938,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
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
|
||||
{
|
||||
//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)
|
||||
|
@ -3964,7 +3973,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
cmd.CommandText += " group by PresentationUniqueKey";
|
||||
|
||||
cmd.Parameters.Add(cmd, "@SelectType", DbType.String).Value = returnType;
|
||||
cmd.Parameters.Add(cmd, "@ItemValueType", DbType.Int32).Value = itemValueType;
|
||||
|
||||
if (EnableJoinUserData(query))
|
||||
{
|
||||
|
|
|
@ -606,7 +606,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
{
|
||||
return new ImageMagickEncoder(LogManager.GetLogger("ImageMagick"), ApplicationPaths, HttpClient, FileSystemManager, ServerConfigurationManager);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
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"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
Logger.Error("Error loading GDI. Will revert to NullImageEncoder.");
|
||||
}
|
||||
|
@ -1412,7 +1412,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
{
|
||||
return new Uri(externalDns).Host;
|
||||
}
|
||||
catch (Exception e)
|
||||
catch
|
||||
{
|
||||
return externalDns;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user