Remove some dead code

pull/7326/head
Bond_009 3 years ago
parent 7ccf7e6157
commit adad13b865

@ -21,7 +21,6 @@ using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
@ -738,8 +737,7 @@ namespace Emby.Server.Implementations.Dto
dto.Tags = item.Tags;
}
var hasAspectRatio = item as IHasAspectRatio;
if (hasAspectRatio != null)
if (item is IHasAspectRatio hasAspectRatio)
{
dto.AspectRatio = hasAspectRatio.AspectRatio;
}
@ -889,15 +887,13 @@ namespace Emby.Server.Implementations.Dto
dto.CommunityRating = item.CommunityRating;
}
var supportsPlaceHolders = item as ISupportsPlaceHolders;
if (supportsPlaceHolders != null && supportsPlaceHolders.IsPlaceHolder)
if (item is ISupportsPlaceHolders supportsPlaceHolders && supportsPlaceHolders.IsPlaceHolder)
{
dto.IsPlaceHolder = supportsPlaceHolders.IsPlaceHolder;
}
// Add audio info
var audio = item as Audio;
if (audio != null)
if (item is Audio audio)
{
dto.Album = audio.Album;
if (audio.ExtraType.HasValue)
@ -970,8 +966,7 @@ namespace Emby.Server.Implementations.Dto
}).Where(i => i != null).ToArray();
}
var hasAlbumArtist = item as IHasAlbumArtist;
if (hasAlbumArtist != null)
if (item is IHasAlbumArtist hasAlbumArtist)
{
dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault();

@ -45,7 +45,6 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Providers.MediaInfo;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
@ -680,9 +679,7 @@ namespace Emby.Server.Implementations.Library
if (result?.Items.Count > 0)
{
var items = new List<BaseItem>();
items.AddRange(result.Items);
var items = result.Items;
foreach (var item in items)
{
ResolverHelper.SetInitialItemValues(item, parent, this, directoryService);
@ -1030,15 +1027,6 @@ namespace Emby.Server.Implementations.Library
return Task.CompletedTask;
}
/// <summary>
/// Queues the library scan.
/// </summary>
public void QueueLibraryScan()
{
// Just run the scheduled task so that the user can see it
_taskManager.QueueScheduledTask<RefreshMediaLibraryTask>();
}
/// <summary>
/// Validates the media library internal.
/// </summary>
@ -1644,27 +1632,6 @@ namespace Emby.Server.Implementations.Library
}
}
/// <summary>
/// Gets all intro files.
/// </summary>
/// <returns>IEnumerable{System.String}.</returns>
public IEnumerable<string> GetAllIntroFiles()
{
return IntroProviders.SelectMany(i =>
{
try
{
return i.GetAllIntroFiles().ToList();
}
catch (Exception ex)
{
_logger.LogError(ex, "Error getting intro files");
return new List<string>();
}
});
}
/// <summary>
/// Resolves the intro.
/// </summary>
@ -2463,24 +2430,6 @@ namespace Emby.Server.Implementations.Library
return item;
}
public void AddExternalSubtitleStreams(
List<MediaStream> streams,
string videoPath,
string[] files)
{
new SubtitleResolver(BaseItem.LocalizationManager).AddExternalSubtitleStreams(streams, videoPath, streams.Count, files);
}
public BaseItem GetParentItem(string parentId, Guid? userId)
{
if (string.IsNullOrEmpty(parentId))
{
return GetParentItem((Guid?)null, userId);
}
return GetParentItem(new Guid(parentId), userId);
}
public BaseItem GetParentItem(Guid? parentId, Guid? userId)
{
if (parentId.HasValue)
@ -2488,7 +2437,7 @@ namespace Emby.Server.Implementations.Library
return GetItemById(parentId.Value);
}
if (userId.HasValue && userId != Guid.Empty)
if (userId.HasValue && !userId.Equals(default))
{
return GetUserRootFolder();
}
@ -2778,16 +2727,6 @@ namespace Emby.Server.Implementations.Library
return path;
}
public string SubstitutePath(string path, string from, string to)
{
if (path.TryReplaceSubPath(from, to, out var newPath))
{
return newPath;
}
return path;
}
public List<PersonInfo> GetPeople(InternalPeopleQuery query)
{
return _itemRepository.GetPeople(query);

@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.LiveTv
/// <summary>
/// Class LiveTvManager.
/// </summary>
public class LiveTvManager : ILiveTvManager, IDisposable
public class LiveTvManager : ILiveTvManager
{
private const int MaxGuideDays = 14;
private const string ExternalServiceTag = "ExternalServiceId";
@ -63,8 +63,6 @@ namespace Emby.Server.Implementations.LiveTv
private ITunerHost[] _tunerHosts = Array.Empty<ITunerHost>();
private IListingsProvider[] _listingProviders = Array.Empty<IListingsProvider>();
private bool _disposed = false;
public LiveTvManager(
IServerConfigurationManager config,
ILogger<LiveTvManager> logger,
@ -2092,36 +2090,6 @@ namespace Emby.Server.Implementations.LiveTv
};
}
/// <inheritdoc />
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool dispose)
{
if (_disposed)
{
return;
}
if (dispose)
{
// TODO: Dispose stuff
}
_services = null;
_listingProviders = null;
_tunerHosts = null;
_disposed = true;
}
private LiveTvServiceInfo[] GetServiceInfos()
{
return Services.Select(GetServiceInfo).ToArray();

@ -24,11 +24,5 @@ namespace MediaBrowser.Controller.Library
/// <param name="user">The user.</param>
/// <returns>IEnumerable{System.String}.</returns>
Task<IEnumerable<IntroInfo>> GetIntros(BaseItem item, Jellyfin.Data.Entities.User user);
/// <summary>
/// Gets all intro files.
/// </summary>
/// <returns>IEnumerable{System.String}.</returns>
IEnumerable<string> GetAllIntroFiles();
}
}

@ -151,11 +151,6 @@ namespace MediaBrowser.Controller.Library
/// <returns>Task.</returns>
Task ValidateMediaLibrary(IProgress<double> progress, CancellationToken cancellationToken);
/// <summary>
/// Queues the library scan.
/// </summary>
void QueueLibraryScan();
Task UpdateImagesAsync(BaseItem item, bool forceUpdate = false);
/// <summary>
@ -181,12 +176,6 @@ namespace MediaBrowser.Controller.Library
/// <returns>IEnumerable{System.String}.</returns>
Task<IEnumerable<Video>> GetIntros(BaseItem item, User user);
/// <summary>
/// Gets all intro files.
/// </summary>
/// <returns>IEnumerable{System.String}.</returns>
IEnumerable<string> GetAllIntroFiles();
/// <summary>
/// Adds the parts.
/// </summary>
@ -507,15 +496,6 @@ namespace MediaBrowser.Controller.Library
string GetPathAfterNetworkSubstitution(string path, BaseItem ownerItem = null);
/// <summary>
/// Substitutes the path.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="from">From.</param>
/// <param name="to">To.</param>
/// <returns>System.String.</returns>
string SubstitutePath(string path, string from, string to);
/// <summary>
/// Converts the image to local.
/// </summary>
@ -587,15 +567,8 @@ namespace MediaBrowser.Controller.Library
int GetCount(InternalItemsQuery query);
void AddExternalSubtitleStreams(
List<MediaStream> streams,
string videoPath,
string[] files);
Task RunMetadataSavers(BaseItem item, ItemUpdateType updateReason);
BaseItem GetParentItem(string parentId, Guid? userId);
BaseItem GetParentItem(Guid? parentId, Guid? userId);
}
}

Loading…
Cancel
Save