Reduce warnings in MediaBrowser.Controller (#6006)

Co-authored-by: Patrick Barron <18354464+barronpm@users.noreply.github.com>
This commit is contained in:
Cody Robibero 2021-05-11 05:55:46 -06:00 committed by GitHub
parent a84e8c3884
commit e3f55a0c54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 367 additions and 290 deletions

View File

@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.Collections
parentFolder.AddChild(collection, CancellationToken.None);
if (options.ItemIdList.Length > 0)
if (options.ItemIdList.Count > 0)
{
await AddToCollectionAsync(
collection.Id,
@ -248,11 +248,7 @@ namespace Emby.Server.Implementations.Collections
if (fireEvent)
{
ItemsAddedToCollection?.Invoke(this, new CollectionModifiedEventArgs
{
Collection = collection,
ItemsChanged = itemList
});
ItemsAddedToCollection?.Invoke(this, new CollectionModifiedEventArgs(collection, itemList));
}
}
}
@ -304,11 +300,7 @@ namespace Emby.Server.Implementations.Collections
},
RefreshPriority.High);
ItemsRemovedFromCollection?.Invoke(this, new CollectionModifiedEventArgs
{
Collection = collection,
ItemsChanged = itemList
});
ItemsRemovedFromCollection?.Invoke(this, new CollectionModifiedEventArgs(collection, itemList));
}
/// <inheritdoc />

View File

@ -191,7 +191,7 @@ namespace Emby.Server.Implementations.Images
InputPaths = GetStripCollageImagePaths(primaryItem, items).ToArray()
};
if (options.InputPaths.Length == 0)
if (options.InputPaths.Count == 0)
{
return null;
}

View File

@ -18,6 +18,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Jellyfin.Api.Controllers
@ -300,9 +301,8 @@ namespace Jellyfin.Api.Controllers
private IEnumerable<string> GetActors(IEnumerable<BaseItem> items)
{
var people = _libraryManager.GetPeople(new InternalPeopleQuery
var people = _libraryManager.GetPeople(new InternalPeopleQuery(Array.Empty<string>(), new[] { PersonType.Director })
{
ExcludePersonTypes = new[] { PersonType.Director },
MaxListOrder = 3
});
@ -316,10 +316,9 @@ namespace Jellyfin.Api.Controllers
private IEnumerable<string> GetDirectors(IEnumerable<BaseItem> items)
{
var people = _libraryManager.GetPeople(new InternalPeopleQuery
{
PersonTypes = new[] { PersonType.Director }
});
var people = _libraryManager.GetPeople(new InternalPeopleQuery(
new[] { PersonType.Director },
Array.Empty<string>()));
var itemIds = items.Select(i => i.Id).ToList();

View File

@ -94,10 +94,10 @@ namespace Jellyfin.Api.Controllers
}
var isFavoriteInFilters = filters.Any(f => f == ItemFilter.IsFavorite);
var peopleItems = _libraryManager.GetPeopleItems(new InternalPeopleQuery
var peopleItems = _libraryManager.GetPeopleItems(new InternalPeopleQuery(
personTypes,
excludePersonTypes)
{
PersonTypes = personTypes,
ExcludePersonTypes = excludePersonTypes,
NameContains = searchTerm,
User = user,
IsFavorite = !isFavorite.HasValue && isFavoriteInFilters ? true : isFavorite,

View File

@ -68,7 +68,7 @@ namespace Jellyfin.Drawing.Skia
/// <param name="outputPath">The path at which to place the resulting collage image.</param>
/// <param name="width">The desired width of the collage.</param>
/// <param name="height">The desired height of the collage.</param>
public void BuildSquareCollage(string[] paths, string outputPath, int width, int height)
public void BuildSquareCollage(IReadOnlyList<string> paths, string outputPath, int width, int height)
{
using var bitmap = BuildSquareCollageBitmap(paths, width, height);
using var outputStream = new SKFileWStream(outputPath);
@ -84,7 +84,7 @@ namespace Jellyfin.Drawing.Skia
/// <param name="width">The desired width of the collage.</param>
/// <param name="height">The desired height of the collage.</param>
/// <param name="libraryName">The name of the library to draw on the collage.</param>
public void BuildThumbCollage(string[] paths, string outputPath, int width, int height, string? libraryName)
public void BuildThumbCollage(IReadOnlyList<string> paths, string outputPath, int width, int height, string? libraryName)
{
using var bitmap = BuildThumbCollageBitmap(paths, width, height, libraryName);
using var outputStream = new SKFileWStream(outputPath);
@ -92,7 +92,7 @@ namespace Jellyfin.Drawing.Skia
pixmap.Encode(outputStream, GetEncodedFormat(outputPath), 90);
}
private SKBitmap BuildThumbCollageBitmap(string[] paths, int width, int height, string? libraryName)
private SKBitmap BuildThumbCollageBitmap(IReadOnlyList<string> paths, int width, int height, string? libraryName)
{
var bitmap = new SKBitmap(width, height);
@ -152,14 +152,14 @@ namespace Jellyfin.Drawing.Skia
return bitmap;
}
private SKBitmap? GetNextValidImage(string[] paths, int currentIndex, out int newIndex)
private SKBitmap? GetNextValidImage(IReadOnlyList<string> paths, int currentIndex, out int newIndex)
{
var imagesTested = new Dictionary<int, int>();
SKBitmap? bitmap = null;
while (imagesTested.Count < paths.Length)
while (imagesTested.Count < paths.Count)
{
if (currentIndex >= paths.Length)
if (currentIndex >= paths.Count)
{
currentIndex = 0;
}
@ -180,7 +180,7 @@ namespace Jellyfin.Drawing.Skia
return bitmap;
}
private SKBitmap BuildSquareCollageBitmap(string[] paths, int width, int height)
private SKBitmap BuildSquareCollageBitmap(IReadOnlyList<string> paths, int width, int height)
{
var bitmap = new SKBitmap(width, height);
var imageIndex = 0;

View File

@ -13,6 +13,19 @@ namespace MediaBrowser.Controller.Channels
{
public class ChannelItemInfo : IHasProviderIds
{
public ChannelItemInfo()
{
MediaSources = new List<MediaSourceInfo>();
TrailerTypes = new List<TrailerType>();
Genres = new List<string>();
Studios = new List<string>();
People = new List<PersonInfo>();
Tags = new List<string>();
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Artists = new List<string>();
AlbumArtists = new List<string>();
}
public string Name { get; set; }
public string SeriesName { get; set; }
@ -80,18 +93,5 @@ namespace MediaBrowser.Controller.Channels
public bool IsLiveStream { get; set; }
public string Etag { get; set; }
public ChannelItemInfo()
{
MediaSources = new List<MediaSourceInfo>();
TrailerTypes = new List<TrailerType>();
Genres = new List<string>();
Studios = new List<string>();
People = new List<PersonInfo>();
Tags = new List<string>();
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Artists = new List<string>();
AlbumArtists = new List<string>();
}
}
}

View File

@ -8,13 +8,13 @@ namespace MediaBrowser.Controller.Channels
{
public class ChannelItemResult
{
public List<ChannelItemInfo> Items { get; set; }
public int? TotalRecordCount { get; set; }
public ChannelItemResult()
{
Items = new List<ChannelItemInfo>();
}
public List<ChannelItemInfo> Items { get; set; }
public int? TotalRecordCount { get; set; }
}
}

View File

@ -0,0 +1,11 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Controller.Channels
{
public class ChannelLatestMediaSearch
{
public string UserId { get; set; }
}
}

View File

@ -10,9 +10,4 @@ namespace MediaBrowser.Controller.Channels
public string UserId { get; set; }
}
public class ChannelLatestMediaSearch
{
public string UserId { get; set; }
}
}

View File

@ -0,0 +1,24 @@
#nullable disable
#pragma warning disable CS1591
using System;
using MediaBrowser.Controller.Entities.Movies;
namespace MediaBrowser.Controller.Collections
{
public class CollectionCreatedEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the collection.
/// </summary>
/// <value>The collection.</value>
public BoxSet Collection { get; set; }
/// <summary>
/// Gets or sets the options.
/// </summary>
/// <value>The options.</value>
public CollectionCreationOptions Options { get; set; }
}
}

View File

@ -25,8 +25,8 @@ namespace MediaBrowser.Controller.Collections
public Dictionary<string, string> ProviderIds { get; set; }
public string[] ItemIdList { get; set; }
public IReadOnlyList<string> ItemIdList { get; set; }
public Guid[] UserIds { get; set; }
public IReadOnlyList<Guid> UserIds { get; set; }
}
}

View File

@ -9,23 +9,14 @@ using MediaBrowser.Controller.Entities.Movies;
namespace MediaBrowser.Controller.Collections
{
public class CollectionCreatedEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the collection.
/// </summary>
/// <value>The collection.</value>
public BoxSet Collection { get; set; }
/// <summary>
/// Gets or sets the options.
/// </summary>
/// <value>The options.</value>
public CollectionCreationOptions Options { get; set; }
}
public class CollectionModifiedEventArgs : EventArgs
{
public CollectionModifiedEventArgs(BoxSet collection, IReadOnlyCollection<BaseItem> itemsChanged)
{
Collection = collection;
ItemsChanged = itemsChanged;
}
/// <summary>
/// Gets or sets the collection.
/// </summary>
@ -36,6 +27,6 @@ namespace MediaBrowser.Controller.Collections
/// Gets or sets the items changed.
/// </summary>
/// <value>The items changed.</value>
public List<BaseItem> ItemsChanged { get; set; }
public IReadOnlyCollection<BaseItem> ItemsChanged { get; set; }
}
}

View File

@ -1,5 +1,7 @@
#nullable disable
using System.Collections.Generic;
#pragma warning disable CS1591
namespace MediaBrowser.Controller.Drawing
@ -10,7 +12,7 @@ namespace MediaBrowser.Controller.Drawing
/// Gets or sets the input paths.
/// </summary>
/// <value>The input paths.</value>
public string[] InputPaths { get; set; }
public IReadOnlyList<string> InputPaths { get; set; }
/// <summary>
/// Gets or sets the output path.

View File

@ -22,9 +22,15 @@ namespace MediaBrowser.Controller.Drawing
public void Dispose()
{
if (Stream != null)
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
Stream.Dispose();
if (disposing)
{
Stream?.Dispose();
}
}
}

View File

@ -18,6 +18,28 @@ namespace MediaBrowser.Controller.Dto
ItemFields.RefreshState
};
private static readonly ImageType[] AllImageTypes = Enum.GetValues<ImageType>();
private static readonly ItemFields[] AllItemFields = Enum.GetValues<ItemFields>()
.Except(DefaultExcludedFields)
.ToArray();
public DtoOptions()
: this(true)
{
}
public DtoOptions(bool allFields)
{
ImageTypeLimit = int.MaxValue;
EnableImages = true;
EnableUserData = true;
AddCurrentProgram = true;
Fields = allFields ? AllItemFields : Array.Empty<ItemFields>();
ImageTypes = AllImageTypes;
}
public IReadOnlyList<ItemFields> Fields { get; set; }
public IReadOnlyList<ImageType> ImageTypes { get; set; }
@ -32,34 +54,9 @@ namespace MediaBrowser.Controller.Dto
public bool AddCurrentProgram { get; set; }
public DtoOptions()
: this(true)
{
}
private static readonly ImageType[] AllImageTypes = Enum.GetNames(typeof(ImageType))
.Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true))
.ToArray();
private static readonly ItemFields[] AllItemFields = Enum.GetNames(typeof(ItemFields))
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
.Except(DefaultExcludedFields)
.ToArray();
public bool ContainsField(ItemFields field)
=> Fields.Contains(field);
public DtoOptions(bool allFields)
{
ImageTypeLimit = int.MaxValue;
EnableImages = true;
EnableUserData = true;
AddCurrentProgram = true;
Fields = allFields ? AllItemFields : Array.Empty<ItemFields>();
ImageTypes = AllImageTypes;
}
public int GetImageLimit(ImageType type)
{
if (EnableImages && ImageTypes.Contains(type))

View File

@ -86,6 +86,7 @@ namespace MediaBrowser.Controller.Entities
}
private bool _requiresRefresh;
public override bool RequiresRefresh()
{
var changed = base.RequiresRefresh() || _requiresRefresh;

View File

@ -114,7 +114,7 @@ namespace MediaBrowser.Controller.Entities.Audio
}
/// <summary>
/// Returns the folder containing the item.
/// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>

View File

@ -12,6 +12,11 @@ namespace MediaBrowser.Controller.Entities
{
public class Book : BaseItem, IHasLookupInfo<BookInfo>, IHasSeries
{
public Book()
{
this.RunTimeTicks = TimeSpan.TicksPerSecond;
}
[JsonIgnore]
public override string MediaType => Model.Entities.MediaType.Book;
@ -28,11 +33,6 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public Guid SeriesId { get; set; }
public Book()
{
this.RunTimeTicks = TimeSpan.TicksPerSecond;
}
public string FindSeriesSortName()
{
return SeriesName;

View File

@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
/// Returns the folder containing the item.
/// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>

View File

@ -3,12 +3,24 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using Jellyfin.Data.Entities;
namespace MediaBrowser.Controller.Entities
{
public class InternalPeopleQuery
{
public InternalPeopleQuery()
: this(Array.Empty<string>(), Array.Empty<string>())
{
}
public InternalPeopleQuery(IReadOnlyList<string> personTypes, IReadOnlyList<string> excludePersonTypes)
{
PersonTypes = personTypes;
ExcludePersonTypes = excludePersonTypes;
}
/// <summary>
/// Gets or sets the maximum number of items the query should return.
/// </summary>
@ -16,9 +28,9 @@ namespace MediaBrowser.Controller.Entities
public Guid ItemId { get; set; }
public string[] PersonTypes { get; set; }
public IReadOnlyList<string> PersonTypes { get; }
public string[] ExcludePersonTypes { get; set; }
public IReadOnlyList<string> ExcludePersonTypes { get; }
public int? MaxListOrder { get; set; }
@ -29,11 +41,5 @@ namespace MediaBrowser.Controller.Entities
public User User { get; set; }
public bool? IsFavorite { get; set; }
public InternalPeopleQuery()
{
PersonTypes = Array.Empty<string>();
ExcludePersonTypes = Array.Empty<string>();
}
}
}

View File

@ -3,15 +3,18 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.Json.Serialization;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Controller.Entities
{
public class LinkedChild
{
public LinkedChild()
{
Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
}
public string Path { get; set; }
public LinkedChildType Type { get; set; }
@ -22,7 +25,7 @@ namespace MediaBrowser.Controller.Entities
public string Id { get; set; }
/// <summary>
/// Serves as a cache.
/// Gets or sets the linked item id.
/// </summary>
public Guid? ItemId { get; set; }
@ -41,41 +44,5 @@ namespace MediaBrowser.Controller.Entities
return child;
}
public LinkedChild()
{
Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
}
}
public enum LinkedChildType
{
Manual = 0,
Shortcut = 1
}
public class LinkedChildComparer : IEqualityComparer<LinkedChild>
{
private readonly IFileSystem _fileSystem;
public LinkedChildComparer(IFileSystem fileSystem)
{
_fileSystem = fileSystem;
}
public bool Equals(LinkedChild x, LinkedChild y)
{
if (x.Type == y.Type)
{
return _fileSystem.AreEqual(x.Path, y.Path);
}
return false;
}
public int GetHashCode(LinkedChild obj)
{
return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode();
}
}
}

View File

@ -0,0 +1,34 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Controller.Entities
{
public class LinkedChildComparer : IEqualityComparer<LinkedChild>
{
private readonly IFileSystem _fileSystem;
public LinkedChildComparer(IFileSystem fileSystem)
{
_fileSystem = fileSystem;
}
public bool Equals(LinkedChild x, LinkedChild y)
{
if (x.Type == y.Type)
{
return _fileSystem.AreEqual(x.Path, y.Path);
}
return false;
}
public int GetHashCode(LinkedChild obj)
{
return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode();
}
}
}

View File

@ -0,0 +1,18 @@
namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// The linked child type.
/// </summary>
public enum LinkedChildType
{
/// <summary>
/// Manually linked child.
/// </summary>
Manual = 0,
/// <summary>
/// Shortcut linked child.
/// </summary>
Shortcut = 1
}
}

View File

@ -13,15 +13,15 @@ namespace MediaBrowser.Controller.Entities
{
public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasLookupInfo<MusicVideoInfo>
{
/// <inheritdoc />
[JsonIgnore]
public IReadOnlyList<string> Artists { get; set; }
public MusicVideo()
{
Artists = Array.Empty<string>();
}
/// <inheritdoc />
[JsonIgnore]
public IReadOnlyList<string> Artists { get; set; }
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.Music;

View File

@ -4,13 +4,13 @@ namespace MediaBrowser.Controller.Library
{
public class DeleteOptions
{
public bool DeleteFileLocation { get; set; }
public bool DeleteFromExternalProvider { get; set; }
public DeleteOptions()
{
DeleteFromExternalProvider = true;
}
public bool DeleteFileLocation { get; set; }
public bool DeleteFromExternalProvider { get; set; }
}
}

View File

@ -11,6 +11,12 @@ namespace MediaBrowser.Controller.Library
/// </summary>
public interface IIntroProvider
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
/// <summary>
/// Gets the intros.
/// </summary>
@ -24,11 +30,5 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <returns>IEnumerable{System.String}.</returns>
IEnumerable<string> GetAllIntroFiles();
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
}
}

View File

@ -15,12 +15,12 @@ namespace MediaBrowser.Controller.Library
/// <summary>
/// The name.
/// </summary>
readonly string _name;
private readonly string _name;
/// <summary>
/// The stopwatch.
/// </summary>
readonly Stopwatch _stopwatch;
private readonly Stopwatch _stopwatch;
/// <summary>
/// The _logger.

View File

@ -0,0 +1,19 @@
#nullable disable
#pragma warning disable CS1591
using System.Threading;
namespace MediaBrowser.Controller.LiveTv
{
public class ActiveRecordingInfo
{
public string Id { get; set; }
public string Path { get; set; }
public TimerInfo Timer { get; set; }
public CancellationTokenSource CancellationTokenSource { get; set; }
}
}

View File

@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.LiveTv
public string Number { get; set; }
/// <summary>
/// Get or sets the Id.
/// Gets or sets the Id.
/// </summary>
/// <value>The id of the channel.</value>
public string Id { get; set; }
@ -54,13 +54,13 @@ namespace MediaBrowser.Controller.LiveTv
public string ChannelGroup { get; set; }
/// <summary>
/// Supply the image path if it can be accessed directly from the file system.
/// Gets or sets the the image path if it can be accessed directly from the file system.
/// </summary>
/// <value>The image path.</value>
public string ImagePath { get; set; }
/// <summary>
/// Supply the image url if it can be downloaded.
/// Gets or sets the image url if it can be downloaded.
/// </summary>
/// <value>The image URL.</value>
public string ImageUrl { get; set; }

View File

@ -268,16 +268,21 @@ namespace MediaBrowser.Controller.LiveTv
void AddChannelInfo(IReadOnlyCollection<(BaseItemDto, LiveTvChannel)> items, DtoOptions options, User user);
Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken);
Task<List<ChannelInfo>> GetChannelsFromListingsProviderData(string id, CancellationToken cancellationToken);
IListingsProvider[] ListingProviders { get; }
List<NameIdPair> GetTunerHostTypes();
Task<List<TunerHostInfo>> DiscoverTuners(bool newDevicesOnly, CancellationToken cancellationToken);
event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCancelled;
event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCancelled;
event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated;
event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCreated;
string GetEmbyTvActiveRecordingPath(string id);
@ -288,15 +293,4 @@ namespace MediaBrowser.Controller.LiveTv
List<BaseItem> GetRecordingFolders(User user);
}
public class ActiveRecordingInfo
{
public string Id { get; set; }
public string Path { get; set; }
public TimerInfo Timer { get; set; }
public CancellationTokenSource CancellationTokenSource { get; set; }
}
}

View File

@ -101,7 +101,7 @@ namespace MediaBrowser.Controller.LiveTv
public bool IsMovie { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is sports.
/// Gets a value indicating whether this instance is sports.
/// </summary>
/// <value><c>true</c> if this instance is sports; otherwise, <c>false</c>.</value>
[JsonIgnore]
@ -115,35 +115,35 @@ namespace MediaBrowser.Controller.LiveTv
public bool IsSeries { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is live.
/// Gets a value indicating whether this instance is live.
/// </summary>
/// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value>
[JsonIgnore]
public bool IsLive => Tags.Contains("Live", StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets a value indicating whether this instance is news.
/// Gets a value indicating whether this instance is news.
/// </summary>
/// <value><c>true</c> if this instance is news; otherwise, <c>false</c>.</value>
[JsonIgnore]
public bool IsNews => Tags.Contains("News", StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets a value indicating whether this instance is kids.
/// Gets a value indicating whether this instance is kids.
/// </summary>
/// <value><c>true</c> if this instance is kids; otherwise, <c>false</c>.</value>
[JsonIgnore]
public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets a value indicating whether this instance is premiere.
/// Gets a value indicating whether this instance is premiere.
/// </summary>
/// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value>
[JsonIgnore]
public bool IsPremiere => Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Returns the folder containing the item.
/// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>

View File

@ -10,8 +10,16 @@ namespace MediaBrowser.Controller.LiveTv
{
public class ProgramInfo
{
public ProgramInfo()
{
Genres = new List<string>();
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
/// <summary>
/// Id of the program.
/// Gets or sets the id of the program.
/// </summary>
public string Id { get; set; }
@ -22,7 +30,7 @@ namespace MediaBrowser.Controller.LiveTv
public string ChannelId { get; set; }
/// <summary>
/// Name of the program.
/// Gets or sets the name of the program.
/// </summary>
public string Name { get; set; }
@ -45,17 +53,17 @@ namespace MediaBrowser.Controller.LiveTv
public string ShortOverview { get; set; }
/// <summary>
/// The start date of the program, in UTC.
/// Gets or sets the start date of the program, in UTC.
/// </summary>
public DateTime StartDate { get; set; }
/// <summary>
/// The end date of the program, in UTC.
/// Gets or sets the end date of the program, in UTC.
/// </summary>
public DateTime EndDate { get; set; }
/// <summary>
/// Genre of the program.
/// Gets or sets the genre of the program.
/// </summary>
public List<string> Genres { get; set; }
@ -71,6 +79,9 @@ namespace MediaBrowser.Controller.LiveTv
/// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value>
public bool? IsHD { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is 3d.
/// </summary>
public bool? Is3D { get; set; }
/// <summary>
@ -100,13 +111,13 @@ namespace MediaBrowser.Controller.LiveTv
public string EpisodeTitle { get; set; }
/// <summary>
/// Supply the image path if it can be accessed directly from the file system.
/// Gets or sets the image path if it can be accessed directly from the file system.
/// </summary>
/// <value>The image path.</value>
public string ImagePath { get; set; }
/// <summary>
/// Supply the image url if it can be downloaded.
/// Gets or sets the image url if it can be downloaded.
/// </summary>
/// <value>The image URL.</value>
public string ImageUrl { get; set; }
@ -212,13 +223,5 @@ namespace MediaBrowser.Controller.LiveTv
public Dictionary<string, string> ProviderIds { get; set; }
public Dictionary<string, string> SeriesProviderIds { get; set; }
public ProgramInfo()
{
Genres = new List<string>();
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@ -10,8 +10,13 @@ namespace MediaBrowser.Controller.LiveTv
{
public class RecordingInfo
{
public RecordingInfo()
{
Genres = new List<string>();
}
/// <summary>
/// Id of the recording.
/// Gets or sets the id of the recording.
/// </summary>
public string Id { get; set; }
@ -28,7 +33,7 @@ namespace MediaBrowser.Controller.LiveTv
public string TimerId { get; set; }
/// <summary>
/// ChannelId of the recording.
/// Gets or sets the channelId of the recording.
/// </summary>
public string ChannelId { get; set; }
@ -39,7 +44,7 @@ namespace MediaBrowser.Controller.LiveTv
public ChannelType ChannelType { get; set; }
/// <summary>
/// Name of the recording.
/// Gets or sets the name of the recording.
/// </summary>
public string Name { get; set; }
@ -62,12 +67,12 @@ namespace MediaBrowser.Controller.LiveTv
public string Overview { get; set; }
/// <summary>
/// The start date of the recording, in UTC.
/// Gets or sets the start date of the recording, in UTC.
/// </summary>
public DateTime StartDate { get; set; }
/// <summary>
/// The end date of the recording, in UTC.
/// Gets or sets the end date of the recording, in UTC.
/// </summary>
public DateTime EndDate { get; set; }
@ -84,7 +89,7 @@ namespace MediaBrowser.Controller.LiveTv
public RecordingStatus Status { get; set; }
/// <summary>
/// Genre of the program.
/// Gets or sets the genre of the program.
/// </summary>
public List<string> Genres { get; set; }
@ -173,13 +178,13 @@ namespace MediaBrowser.Controller.LiveTv
public float? CommunityRating { get; set; }
/// <summary>
/// Supply the image path if it can be accessed directly from the file system.
/// Gets or sets the image path if it can be accessed directly from the file system.
/// </summary>
/// <value>The image path.</value>
public string ImagePath { get; set; }
/// <summary>
/// Supply the image url if it can be downloaded.
/// Gets or sets the image url if it can be downloaded.
/// </summary>
/// <value>The image URL.</value>
public string ImageUrl { get; set; }
@ -201,10 +206,5 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The date last updated.</value>
public DateTime DateLastUpdated { get; set; }
public RecordingInfo()
{
Genres = new List<string>();
}
}
}

View File

@ -10,13 +10,20 @@ namespace MediaBrowser.Controller.LiveTv
{
public class SeriesTimerInfo
{
public SeriesTimerInfo()
{
Days = new List<DayOfWeek>();
SkipEpisodesInLibrary = true;
KeepUntil = KeepUntil.UntilDeleted;
}
/// <summary>
/// Id of the recording.
/// Gets or sets the id of the recording.
/// </summary>
public string Id { get; set; }
/// <summary>
/// ChannelId of the recording.
/// Gets or sets the channelId of the recording.
/// </summary>
public string ChannelId { get; set; }
@ -27,24 +34,27 @@ namespace MediaBrowser.Controller.LiveTv
public string ProgramId { get; set; }
/// <summary>
/// Name of the recording.
/// Gets or sets the name of the recording.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets the service name.
/// </summary>
public string ServiceName { get; set; }
/// <summary>
/// Description of the recording.
/// Gets or sets the description of the recording.
/// </summary>
public string Overview { get; set; }
/// <summary>
/// The start date of the recording, in UTC.
/// Gets or sets the start date of the recording, in UTC.
/// </summary>
public DateTime StartDate { get; set; }
/// <summary>
/// The end date of the recording, in UTC.
/// Gets or sets the end date of the recording, in UTC.
/// </summary>
public DateTime EndDate { get; set; }
@ -113,12 +123,5 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The series identifier.</value>
public string SeriesId { get; set; }
public SeriesTimerInfo()
{
Days = new List<DayOfWeek>();
SkipEpisodesInLibrary = true;
KeepUntil = KeepUntil.UntilDeleted;
}
}
}

View File

@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.Net
DateTime LastKeepAliveDate { get; set; }
/// <summary>
/// Gets or sets the query string.
/// Gets the query string.
/// </summary>
/// <value>The query string.</value>
IQueryCollection QueryString { get; }

View File

@ -7,6 +7,13 @@ namespace MediaBrowser.Controller.Providers
{
public class AlbumInfo : ItemLookupInfo
{
public AlbumInfo()
{
ArtistProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
SongInfos = new List<SongInfo>();
AlbumArtists = Array.Empty<string>();
}
/// <summary>
/// Gets or sets the album artist.
/// </summary>
@ -20,12 +27,5 @@ namespace MediaBrowser.Controller.Providers
public Dictionary<string, string> ArtistProviderIds { get; set; }
public List<SongInfo> SongInfos { get; set; }
public AlbumInfo()
{
ArtistProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
SongInfos = new List<SongInfo>();
AlbumArtists = Array.Empty<string>();
}
}
}

View File

@ -6,11 +6,11 @@ namespace MediaBrowser.Controller.Providers
{
public class ArtistInfo : ItemLookupInfo
{
public List<SongInfo> SongInfos { get; set; }
public ArtistInfo()
{
SongInfos = new List<SongInfo>();
}
public List<SongInfo> SongInfos { get; set; }
}
}

View File

@ -9,6 +9,11 @@ namespace MediaBrowser.Controller.Providers
{
public class EpisodeInfo : ItemLookupInfo
{
public EpisodeInfo()
{
SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
public Dictionary<string, string> SeriesProviderIds { get; set; }
public int? IndexNumberEnd { get; set; }
@ -16,10 +21,5 @@ namespace MediaBrowser.Controller.Providers
public bool IsMissingEpisode { get; set; }
public string SeriesDisplayOrder { get; set; }
public EpisodeInfo()
{
SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@ -10,6 +10,12 @@ namespace MediaBrowser.Controller.Providers
{
public interface IMetadataService
{
/// <summary>
/// Gets the order.
/// </summary>
/// <value>The order.</value>
int Order { get; }
/// <summary>
/// Determines whether this instance can refresh the specified item.
/// </summary>
@ -27,11 +33,5 @@ namespace MediaBrowser.Controller.Providers
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task<ItemUpdateType> RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken);
/// <summary>
/// Gets the order.
/// </summary>
/// <value>The order.</value>
int Order { get; }
}
}

View File

@ -191,11 +191,4 @@ namespace MediaBrowser.Controller.Providers
double? GetRefreshProgress(Guid id);
}
public enum RefreshPriority
{
High = 0,
Normal = 1,
Low = 2
}
}

View File

@ -10,6 +10,12 @@ namespace MediaBrowser.Controller.Providers
{
public class ItemLookupInfo : IHasProviderIds
{
public ItemLookupInfo()
{
IsAutomated = true;
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
/// <summary>
/// Gets or sets the name.
/// </summary>
@ -53,11 +59,5 @@ namespace MediaBrowser.Controller.Providers
public DateTime? PremiereDate { get; set; }
public bool IsAutomated { get; set; }
public ItemLookupInfo()
{
IsAutomated = true;
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@ -11,21 +11,6 @@ namespace MediaBrowser.Controller.Providers
{
public class MetadataRefreshOptions : ImageRefreshOptions
{
/// <summary>
/// When paired with MetadataRefreshMode=FullRefresh, all existing data will be overwritten with new data from the providers.
/// </summary>
public bool ReplaceAllMetadata { get; set; }
public MetadataRefreshMode MetadataRefreshMode { get; set; }
public RemoteSearchResult SearchResult { get; set; }
public string[] RefreshPaths { get; set; }
public bool ForceSave { get; set; }
public bool EnableRemoteContentProbe { get; set; }
public MetadataRefreshOptions(IDirectoryService directoryService)
: base(directoryService)
{
@ -53,6 +38,22 @@ namespace MediaBrowser.Controller.Providers
}
}
/// <summary>
/// Gets or sets a value indicating whether all existing data should be overwritten with new data from providers
/// when paired with MetadataRefreshMode=FullRefresh
/// </summary>
public bool ReplaceAllMetadata { get; set; }
public MetadataRefreshMode MetadataRefreshMode { get; set; }
public RemoteSearchResult SearchResult { get; set; }
public string[] RefreshPaths { get; set; }
public bool ForceSave { get; set; }
public bool EnableRemoteContentProbe { get; set; }
public bool RefreshItem(BaseItem item)
{
if (RefreshPaths != null && RefreshPaths.Length > 0)

View File

@ -0,0 +1,23 @@
namespace MediaBrowser.Controller.Providers
{
/// <summary>
/// Provider refresh priority.
/// </summary>
public enum RefreshPriority
{
/// <summary>
/// High priority.
/// </summary>
High = 0,
/// <summary>
/// Normal priority.
/// </summary>
Normal = 1,
/// <summary>
/// Low priority.
/// </summary>
Low = 2
}
}

View File

@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Providers
public Guid ItemId { get; set; }
/// <summary>
/// Will only search within the given provider when set.
/// Gets or sets the provider name to search within if set.
/// </summary>
public string SearchProviderName { get; set; }

View File

@ -7,11 +7,11 @@ namespace MediaBrowser.Controller.Providers
{
public class SeasonInfo : ItemLookupInfo
{
public Dictionary<string, string> SeriesProviderIds { get; set; }
public SeasonInfo()
{
SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
public Dictionary<string, string> SeriesProviderIds { get; set; }
}
}

View File

@ -4,7 +4,7 @@ using MediaBrowser.Model.IO;
namespace MediaBrowser.Controller.Resolvers
{
/// <summary>
/// Provides a base "rule" that anyone can use to have paths ignored by the resolver
/// Provides a base "rule" that anyone can use to have paths ignored by the resolver.
/// </summary>
public interface IResolverIgnoreRule
{

View File

@ -346,21 +346,19 @@ namespace MediaBrowser.Controller.Session
/// Logouts the specified access token.
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <returns>Task.</returns>
void Logout(string accessToken);
void Logout(AuthenticationInfo accessToken);
/// <summary>
/// Revokes the user tokens.
/// </summary>
/// <returns>Task.</returns>
void RevokeUserTokens(Guid userId, string currentAccessToken);
/// <summary>
/// Revokes the token.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>Task.</returns>
void RevokeToken(string id);
void CloseIfNeeded(SessionInfo session);

View File

@ -54,7 +54,7 @@ namespace MediaBrowser.Controller.Session
public string RemoteEndPoint { get; set; }
/// <summary>
/// Gets or sets the playable media types.
/// Gets the playable media types.
/// </summary>
/// <value>The playable media types.</value>
public IReadOnlyList<string> PlayableMediaTypes
@ -230,7 +230,7 @@ namespace MediaBrowser.Controller.Session
public string UserPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the supported commands.
/// Gets the supported commands.
/// </summary>
/// <value>The supported commands.</value>
public IReadOnlyList<GeneralCommandType> SupportedCommands