update guide
This commit is contained in:
parent
8c32aefb53
commit
3787af4c9c
|
@ -138,8 +138,9 @@ namespace MediaBrowser.Api.Music
|
|||
public object Get(GetInstantMixFromArtist request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
var artist = _libraryManager.GetArtist(request.Name);
|
||||
|
||||
var items = _musicManager.GetInstantMixFromArtist(request.Name, user);
|
||||
var items = _musicManager.GetInstantMixFromArtist(artist, user);
|
||||
|
||||
return GetResult(items, user, request);
|
||||
}
|
||||
|
|
|
@ -502,5 +502,12 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <param name="query">The query.</param>
|
||||
/// <returns>List<System.String>.</returns>
|
||||
List<string> GetPeopleNames(InternalPeopleQuery query);
|
||||
|
||||
/// <summary>
|
||||
/// Queries the items.
|
||||
/// </summary>
|
||||
/// <param name="query">The query.</param>
|
||||
/// <returns>QueryResult<BaseItem>.</returns>
|
||||
QueryResult<BaseItem> QueryItems(InternalItemsQuery query);
|
||||
}
|
||||
}
|
|
@ -16,10 +16,10 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <summary>
|
||||
/// Gets the instant mix from artist.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="artist">The artist.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>IEnumerable{Audio}.</returns>
|
||||
IEnumerable<Audio> GetInstantMixFromArtist(string name, User user);
|
||||
IEnumerable<Audio> GetInstantMixFromArtist(MusicArtist artist, User user);
|
||||
/// <summary>
|
||||
/// Gets the instant mix from genre.
|
||||
/// </summary>
|
||||
|
|
|
@ -3,12 +3,14 @@ using MediaBrowser.Common.Extensions;
|
|||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
|
@ -243,10 +245,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The _items by name path
|
||||
/// </summary>
|
||||
private string _itemsByNamePath;
|
||||
/// <summary>
|
||||
/// The _season zero display name
|
||||
/// </summary>
|
||||
|
@ -260,7 +258,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
private void RecordConfigurationValues(ServerConfiguration configuration)
|
||||
{
|
||||
_seasonZeroDisplayName = configuration.SeasonZeroDisplayName;
|
||||
_itemsByNamePath = ConfigurationManager.ApplicationPaths.ItemsByNamePath;
|
||||
_wizardCompleted = configuration.IsStartupWizardCompleted;
|
||||
}
|
||||
|
||||
|
@ -273,56 +270,24 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
{
|
||||
var config = ConfigurationManager.Configuration;
|
||||
|
||||
var ibnPathChanged = !string.Equals(_itemsByNamePath, ConfigurationManager.ApplicationPaths.ItemsByNamePath, StringComparison.Ordinal);
|
||||
|
||||
if (ibnPathChanged)
|
||||
{
|
||||
RemoveItemsByNameFromCache();
|
||||
}
|
||||
|
||||
var newSeasonZeroName = ConfigurationManager.Configuration.SeasonZeroDisplayName;
|
||||
var seasonZeroNameChanged = !string.Equals(_seasonZeroDisplayName, newSeasonZeroName, StringComparison.Ordinal);
|
||||
var wizardChanged = config.IsStartupWizardCompleted != _wizardCompleted;
|
||||
|
||||
RecordConfigurationValues(config);
|
||||
|
||||
Task.Run(async () =>
|
||||
if (seasonZeroNameChanged || wizardChanged)
|
||||
{
|
||||
if (seasonZeroNameChanged)
|
||||
_taskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
|
||||
}
|
||||
|
||||
if (seasonZeroNameChanged)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await UpdateSeasonZeroNames(newSeasonZeroName, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (seasonZeroNameChanged || ibnPathChanged || wizardChanged)
|
||||
{
|
||||
_taskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void RemoveItemsByNameFromCache()
|
||||
{
|
||||
RemoveItemsFromCache(i => i is Person);
|
||||
RemoveItemsFromCache(i => i is Year);
|
||||
RemoveItemsFromCache(i => i is Genre);
|
||||
RemoveItemsFromCache(i => i is MusicGenre);
|
||||
RemoveItemsFromCache(i => i is GameGenre);
|
||||
RemoveItemsFromCache(i => i is Studio);
|
||||
RemoveItemsFromCache(i =>
|
||||
{
|
||||
var artist = i as MusicArtist;
|
||||
return artist != null && artist.IsAccessedByName;
|
||||
});
|
||||
}
|
||||
|
||||
private void RemoveItemsFromCache(Func<BaseItem, bool> remove)
|
||||
{
|
||||
var items = _libraryItemsCache.ToList().Where(i => remove(i.Value)).ToList();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
BaseItem value;
|
||||
_libraryItemsCache.TryRemove(item.Key, out value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,6 +339,21 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
private void RegisterItem(Guid id, BaseItem item)
|
||||
{
|
||||
if (item is LiveTvProgram)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (item is IChannelItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (item is IItemByName)
|
||||
{
|
||||
if (!(item is MusicArtist))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
LibraryItemsCache.AddOrUpdate(id, item, delegate { return item; });
|
||||
}
|
||||
|
||||
|
@ -951,11 +931,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
DateModified = DateTime.UtcNow,
|
||||
Path = path
|
||||
};
|
||||
}
|
||||
|
||||
if (isArtist)
|
||||
{
|
||||
(item as MusicArtist).IsAccessedByName = true;
|
||||
if (isArtist)
|
||||
{
|
||||
(item as MusicArtist).IsAccessedByName = true;
|
||||
}
|
||||
|
||||
var task = item.UpdateToRepository(ItemUpdateType.None, CancellationToken.None);
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
return item;
|
||||
|
@ -1259,6 +1242,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
};
|
||||
}
|
||||
|
||||
public QueryResult<BaseItem> QueryItems(InternalItemsQuery query)
|
||||
{
|
||||
return ItemRepository.GetItems(query);
|
||||
}
|
||||
|
||||
public List<Guid> GetItemIds(InternalItemsQuery query)
|
||||
{
|
||||
return ItemRepository.GetItemIdsList(query);
|
||||
|
|
|
@ -27,10 +27,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
return list.Concat(GetInstantMixFromGenres(item.Genres, user));
|
||||
}
|
||||
|
||||
public IEnumerable<Audio> GetInstantMixFromArtist(string name, User user)
|
||||
public IEnumerable<Audio> GetInstantMixFromArtist(MusicArtist artist, User user)
|
||||
{
|
||||
var artist = _libraryManager.GetArtist(name);
|
||||
|
||||
var genres = user.RootFolder
|
||||
.GetRecursiveChildren(user, i => i is Audio)
|
||||
.Cast<Audio>()
|
||||
|
@ -107,7 +105,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
var artist = item as MusicArtist;
|
||||
if (artist != null)
|
||||
{
|
||||
return GetInstantMixFromArtist(artist.Name, user);
|
||||
return GetInstantMixFromArtist(artist, user);
|
||||
}
|
||||
|
||||
var song = item as Audio;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.IO;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
@ -26,6 +25,7 @@ using MoreLinq;
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -59,8 +59,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
private readonly SemaphoreSlim _refreshRecordingsLock = new SemaphoreSlim(1, 1);
|
||||
|
||||
private readonly ConcurrentDictionary<Guid, Guid> _refreshedPrograms = new ConcurrentDictionary<Guid, Guid>();
|
||||
|
||||
private readonly List<ITunerHost> _tunerHosts = new List<ITunerHost>();
|
||||
private readonly List<IListingsProvider> _listingProviders = new List<IListingsProvider>();
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
@ -253,7 +251,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
var programs = _libraryManager.GetItems(new InternalItemsQuery
|
||||
var programs = _libraryManager.QueryItems(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
|
||||
MaxStartDate = now,
|
||||
|
@ -799,7 +797,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
}
|
||||
}
|
||||
|
||||
IEnumerable<LiveTvProgram> programs = _libraryManager.GetItems(internalQuery).Items.Cast<LiveTvProgram>();
|
||||
IEnumerable<LiveTvProgram> programs = _libraryManager.QueryItems(internalQuery).Items.Cast<LiveTvProgram>();
|
||||
|
||||
programs = _libraryManager.Sort(programs, user, query.SortBy, query.SortOrder ?? SortOrder.Ascending)
|
||||
.Cast<LiveTvProgram>();
|
||||
|
@ -869,7 +867,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
}
|
||||
}
|
||||
|
||||
IEnumerable<LiveTvProgram> programs = _libraryManager.GetItems(internalQuery).Items.Cast<LiveTvProgram>();
|
||||
IEnumerable<LiveTvProgram> programs = _libraryManager.QueryItems(internalQuery).Items.Cast<LiveTvProgram>();
|
||||
|
||||
var programList = programs.ToList();
|
||||
|
||||
|
@ -1081,8 +1079,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
await CleanDatabaseInternal(newChannelIdList, new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);
|
||||
await CleanDatabaseInternal(newProgramIdList, new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
_refreshedPrograms.Clear();
|
||||
|
||||
// Load these now which will prefetch metadata
|
||||
var dtoOptions = new DtoOptions();
|
||||
dtoOptions.Fields.Remove(ItemFields.SyncInfo);
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
|
|||
|
||||
if (stream != null)
|
||||
{
|
||||
return null;
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
|
|||
throw new LiveTvConflictException();
|
||||
}
|
||||
|
||||
protected abstract Task<bool> IsAvailable(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken);
|
||||
protected async Task<bool> IsAvailable(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await IsAvailableInternal(tuner, channelId, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error checking tuner availability", ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken);
|
||||
|
||||
protected abstract bool IsValidChannelId(string channelId);
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
var name = line.Substring(0, index - 1);
|
||||
var currentChannel = line.Substring(index + 7);
|
||||
if (currentChannel != "none") { status = LiveTvTunerStatus.LiveTv; } else { status = LiveTvTunerStatus.Available; }
|
||||
tuners.Add(new LiveTvTunerInfo()
|
||||
tuners.Add(new LiveTvTunerInfo
|
||||
{
|
||||
Name = name,
|
||||
SourceType = string.IsNullOrWhiteSpace(model) ? Name : model,
|
||||
|
@ -385,10 +385,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
await GetChannels(info, false, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
protected override async Task<bool> IsAvailable(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
||||
protected override async Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
||||
{
|
||||
// TODO
|
||||
return true;
|
||||
var info = await GetTunerInfos(tuner, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return info.Any(i => i.Status == LiveTvTunerStatus.Available);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Task<bool> IsAvailable(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
||||
protected override Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user