Remove more and more warnings

pull/6475/head
Cody Robibero 3 years ago
parent e88367fe70
commit cba07b1ca6

@ -17,7 +17,7 @@ namespace Emby.Dlna.ContentDirectory
{ {
Item = item; Item = item;
if (item is IItemByName && !(item is Folder)) if (item is IItemByName && item is not Folder)
{ {
StubType = Dlna.ContentDirectory.StubType.Folder; StubType = Dlna.ContentDirectory.StubType.Folder;
} }

@ -748,7 +748,7 @@ namespace Emby.Dlna.Didl
AddValue(writer, "upnp", "publisher", studio, NsUpnp); AddValue(writer, "upnp", "publisher", studio, NsUpnp);
} }
if (!(item is Folder)) if (item is not Folder)
{ {
if (filter.Contains("dc:description")) if (filter.Contains("dc:description"))
{ {

@ -456,6 +456,7 @@ namespace Emby.Server.Implementations
/// <summary> /// <summary>
/// Runs the startup tasks. /// Runs the startup tasks.
/// </summary> /// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns><see cref="Task" />.</returns> /// <returns><see cref="Task" />.</returns>
public async Task RunStartupTasksAsync(CancellationToken cancellationToken) public async Task RunStartupTasksAsync(CancellationToken cancellationToken)
{ {
@ -469,7 +470,7 @@ namespace Emby.Server.Implementations
_mediaEncoder.SetFFmpegPath(); _mediaEncoder.SetFFmpegPath();
Logger.LogInformation("ServerId: {0}", SystemId); Logger.LogInformation("ServerId: {ServerId}", SystemId);
var entryPoints = GetExports<IServerEntryPoint>(); var entryPoints = GetExports<IServerEntryPoint>();

@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Channels
var internalChannel = _libraryManager.GetItemById(item.ChannelId); var internalChannel = _libraryManager.GetItemById(item.ChannelId);
var channel = Channels.FirstOrDefault(i => GetInternalChannelId(i.Name).Equals(internalChannel.Id)); var channel = Channels.FirstOrDefault(i => GetInternalChannelId(i.Name).Equals(internalChannel.Id));
return !(channel is IDisableMediaSourceDisplay); return channel is not IDisableMediaSourceDisplay;
} }
/// <inheritdoc /> /// <inheritdoc />
@ -1079,11 +1079,11 @@ namespace Emby.Server.Implementations.Channels
// was used for status // was used for status
// if (!string.Equals(item.ExternalEtag ?? string.Empty, info.Etag ?? string.Empty, StringComparison.Ordinal)) // if (!string.Equals(item.ExternalEtag ?? string.Empty, info.Etag ?? string.Empty, StringComparison.Ordinal))
//{ // {
// item.ExternalEtag = info.Etag; // item.ExternalEtag = info.Etag;
// forceUpdate = true; // forceUpdate = true;
// _logger.LogDebug("Forcing update due to ExternalEtag {0}", item.Name); // _logger.LogDebug("Forcing update due to ExternalEtag {0}", item.Name);
//} // }
if (!internalChannelId.Equals(item.ChannelId)) if (!internalChannelId.Equals(item.ChannelId))
{ {

@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.Data
protected virtual int? CacheSize => null; protected virtual int? CacheSize => null;
/// <summary> /// <summary>
/// Gets the journal mode. <see href="https://www.sqlite.org/pragma.html#pragma_journal_mode" /> /// Gets the journal mode. <see href="https://www.sqlite.org/pragma.html#pragma_journal_mode" />.
/// </summary> /// </summary>
/// <value>The journal mode.</value> /// <value>The journal mode.</value>
protected virtual string JournalMode => "TRUNCATE"; protected virtual string JournalMode => "TRUNCATE";

@ -72,9 +72,16 @@ namespace Emby.Server.Implementations.Data
_mediaAttachmentInsertPrefix = queryPrefixText.ToString(); _mediaAttachmentInsertPrefix = queryPrefixText.ToString();
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class. /// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
/// </summary> /// </summary>
/// <param name="config">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
/// <param name="appHost">Instance of the <see cref="IServerApplicationHost"/> interface.</param>
/// <param name="logger">Instance of the <see cref="ILogger{SqliteItemRepository}"/> interface.</param>
/// <param name="localization">Instance of the <see cref="ILocalizationManager"/> interface.</param>
/// <param name="imageProcessor">Instance of the <see cref="IImageProcessor"/> interface.</param>
/// <exception cref="ArgumentNullException">config is null.</exception>
public SqliteItemRepository( public SqliteItemRepository(
IServerConfigurationManager config, IServerConfigurationManager config,
IServerApplicationHost appHost, IServerApplicationHost appHost,
@ -4879,7 +4886,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
foreach (var t in _knownTypes) foreach (var t in _knownTypes)
{ {
dict[t.Name] = t.FullName ; dict[t.Name] = t.FullName;
} }
dict["Program"] = typeof(LiveTvProgram).FullName; dict["Program"] = typeof(LiveTvProgram).FullName;

@ -174,7 +174,6 @@ namespace Emby.Server.Implementations.Data
/// <param name="key">The key.</param> /// <param name="key">The key.</param>
/// <param name="userData">The user data.</param> /// <param name="userData">The user data.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
public void PersistUserData(long internalUserId, string key, UserItemData userData, CancellationToken cancellationToken) public void PersistUserData(long internalUserId, string key, UserItemData userData, CancellationToken cancellationToken)
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
@ -319,8 +318,8 @@ namespace Emby.Server.Implementations.Data
/// <summary> /// <summary>
/// Return all user-data associated with the given user. /// Return all user-data associated with the given user.
/// </summary> /// </summary>
/// <param name="internalUserId"></param> /// <param name="internalUserId">The internal user id.</param>
/// <returns></returns> /// <returns>The list of user item data.</returns>
public List<UserItemData> GetAllUserData(long internalUserId) public List<UserItemData> GetAllUserData(long internalUserId)
{ {
if (internalUserId <= 0) if (internalUserId <= 0)
@ -349,7 +348,8 @@ namespace Emby.Server.Implementations.Data
/// <summary> /// <summary>
/// Read a row from the specified reader into the provided userData object. /// Read a row from the specified reader into the provided userData object.
/// </summary> /// </summary>
/// <param name="reader"></param> /// <param name="reader">The list of result set values.</param>
/// <returns>The user item data.</returns>
private UserItemData ReadRow(IReadOnlyList<ResultSetValue> reader) private UserItemData ReadRow(IReadOnlyList<ResultSetValue> reader)
{ {
var userData = new UserItemData(); var userData = new UserItemData();

@ -807,7 +807,7 @@ namespace Emby.Server.Implementations.Dto
dto.MediaType = item.MediaType; dto.MediaType = item.MediaType;
if (!(item is LiveTvProgram)) if (item is not LiveTvProgram)
{ {
dto.LocationType = item.LocationType; dto.LocationType = item.LocationType;
} }
@ -928,9 +928,9 @@ namespace Emby.Server.Implementations.Dto
} }
// if (options.ContainsField(ItemFields.MediaSourceCount)) // if (options.ContainsField(ItemFields.MediaSourceCount))
//{ // {
// Songs always have one // Songs always have one
//} // }
} }
if (item is IHasArtist hasArtist) if (item is IHasArtist hasArtist)
@ -938,10 +938,10 @@ namespace Emby.Server.Implementations.Dto
dto.Artists = hasArtist.Artists; dto.Artists = hasArtist.Artists;
// var artistItems = _libraryManager.GetArtists(new InternalItemsQuery // var artistItems = _libraryManager.GetArtists(new InternalItemsQuery
//{ // {
// EnableTotalRecordCount = false, // EnableTotalRecordCount = false,
// ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) } // ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
//}); // });
// dto.ArtistItems = artistItems.Items // dto.ArtistItems = artistItems.Items
// .Select(i => // .Select(i =>
@ -958,7 +958,7 @@ namespace Emby.Server.Implementations.Dto
// Include artists that are not in the database yet, e.g., just added via metadata editor // Include artists that are not in the database yet, e.g., just added via metadata editor
// var foundArtists = artistItems.Items.Select(i => i.Item1.Name).ToList(); // var foundArtists = artistItems.Items.Select(i => i.Item1.Name).ToList();
dto.ArtistItems = hasArtist.Artists dto.ArtistItems = hasArtist.Artists
//.Except(foundArtists, new DistinctNameComparer()) // .Except(foundArtists, new DistinctNameComparer())
.Select(i => .Select(i =>
{ {
// This should not be necessary but we're seeing some cases of it // This should not be necessary but we're seeing some cases of it
@ -990,10 +990,10 @@ namespace Emby.Server.Implementations.Dto
dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault(); dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault();
// var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery // var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery
//{ // {
// EnableTotalRecordCount = false, // EnableTotalRecordCount = false,
// ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) } // ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
//}); // });
// dto.AlbumArtists = artistItems.Items // dto.AlbumArtists = artistItems.Items
// .Select(i => // .Select(i =>
@ -1008,7 +1008,7 @@ namespace Emby.Server.Implementations.Dto
// .ToList(); // .ToList();
dto.AlbumArtists = hasAlbumArtist.AlbumArtists dto.AlbumArtists = hasAlbumArtist.AlbumArtists
//.Except(foundArtists, new DistinctNameComparer()) // .Except(foundArtists, new DistinctNameComparer())
.Select(i => .Select(i =>
{ {
// This should not be necessary but we're seeing some cases of it // This should not be necessary but we're seeing some cases of it
@ -1035,8 +1035,7 @@ namespace Emby.Server.Implementations.Dto
} }
// Add video info // Add video info
var video = item as Video; if (item is Video video)
if (video != null)
{ {
dto.VideoType = video.VideoType; dto.VideoType = video.VideoType;
dto.Video3DFormat = video.Video3DFormat; dto.Video3DFormat = video.Video3DFormat;
@ -1075,9 +1074,7 @@ namespace Emby.Server.Implementations.Dto
if (options.ContainsField(ItemFields.MediaStreams)) if (options.ContainsField(ItemFields.MediaStreams))
{ {
// Add VideoInfo // Add VideoInfo
var iHasMediaSources = item as IHasMediaSources; if (item is IHasMediaSources)
if (iHasMediaSources != null)
{ {
MediaStream[] mediaStreams; MediaStream[] mediaStreams;
@ -1146,7 +1143,7 @@ namespace Emby.Server.Implementations.Dto
// TODO maybe remove the if statement entirely // TODO maybe remove the if statement entirely
// if (options.ContainsField(ItemFields.SeriesPrimaryImage)) // if (options.ContainsField(ItemFields.SeriesPrimaryImage))
{ {
episodeSeries = episodeSeries ?? episode.Series; episodeSeries ??= episode.Series;
if (episodeSeries != null) if (episodeSeries != null)
{ {
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary); dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary);
@ -1159,7 +1156,7 @@ namespace Emby.Server.Implementations.Dto
if (options.ContainsField(ItemFields.SeriesStudio)) if (options.ContainsField(ItemFields.SeriesStudio))
{ {
episodeSeries = episodeSeries ?? episode.Series; episodeSeries ??= episode.Series;
if (episodeSeries != null) if (episodeSeries != null)
{ {
dto.SeriesStudio = episodeSeries.Studios.FirstOrDefault(); dto.SeriesStudio = episodeSeries.Studios.FirstOrDefault();
@ -1172,7 +1169,7 @@ namespace Emby.Server.Implementations.Dto
{ {
dto.AirDays = series.AirDays; dto.AirDays = series.AirDays;
dto.AirTime = series.AirTime; dto.AirTime = series.AirTime;
dto.Status = series.Status.HasValue ? series.Status.Value.ToString() : null; dto.Status = series.Status?.ToString();
} }
// Add SeasonInfo // Add SeasonInfo
@ -1185,7 +1182,7 @@ namespace Emby.Server.Implementations.Dto
if (options.ContainsField(ItemFields.SeriesStudio)) if (options.ContainsField(ItemFields.SeriesStudio))
{ {
series = series ?? season.Series; series ??= season.Series;
if (series != null) if (series != null)
{ {
dto.SeriesStudio = series.Studios.FirstOrDefault(); dto.SeriesStudio = series.Studios.FirstOrDefault();
@ -1196,7 +1193,7 @@ namespace Emby.Server.Implementations.Dto
// TODO maybe remove the if statement entirely // TODO maybe remove the if statement entirely
// if (options.ContainsField(ItemFields.SeriesPrimaryImage)) // if (options.ContainsField(ItemFields.SeriesPrimaryImage))
{ {
series = series ?? season.Series; series ??= season.Series;
if (series != null) if (series != null)
{ {
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary); dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary);
@ -1283,7 +1280,7 @@ namespace Emby.Server.Implementations.Dto
var parent = currentItem.DisplayParent ?? currentItem.GetOwner() ?? currentItem.GetParent(); var parent = currentItem.DisplayParent ?? currentItem.GetOwner() ?? currentItem.GetParent();
if (parent == null && !(originalItem is UserRootFolder) && !(originalItem is UserView) && !(originalItem is AggregateFolder) && !(originalItem is ICollectionFolder) && !(originalItem is Channel)) if (parent == null && originalItem is not UserRootFolder && originalItem is not UserView && originalItem is not AggregateFolder && originalItem is not ICollectionFolder && originalItem is not Channel)
{ {
parent = _libraryManager.GetCollectionFolders(originalItem).FirstOrDefault(); parent = _libraryManager.GetCollectionFolders(originalItem).FirstOrDefault();
} }
@ -1317,7 +1314,7 @@ namespace Emby.Server.Implementations.Dto
var imageTags = dto.ImageTags; var imageTags = dto.ImageTags;
while (((!(imageTags != null && imageTags.ContainsKey(ImageType.Logo)) && logoLimit > 0) || (!(imageTags != null && imageTags.ContainsKey(ImageType.Art)) && artLimit > 0) || (!(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && thumbLimit > 0) || parent is Series) && while (((!(imageTags != null && imageTags.ContainsKey(ImageType.Logo)) && logoLimit > 0) || (!(imageTags != null && imageTags.ContainsKey(ImageType.Art)) && artLimit > 0) || (!(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && thumbLimit > 0) || parent is Series) &&
(parent = parent ?? (isFirst ? GetImageDisplayParent(item, item) ?? owner : parent)) != null) (parent ??= (isFirst ? GetImageDisplayParent(item, item) ?? owner : parent)) != null)
{ {
if (parent == null) if (parent == null)
{ {
@ -1348,7 +1345,7 @@ namespace Emby.Server.Implementations.Dto
} }
} }
if (thumbLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId == null || parent is Series) && !(parent is ICollectionFolder) && !(parent is UserView)) if (thumbLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId == null || parent is Series) && parent is not ICollectionFolder && parent is not UserView)
{ {
var image = allImages.FirstOrDefault(i => i.Type == ImageType.Thumb); var image = allImages.FirstOrDefault(i => i.Type == ImageType.Thumb);

@ -149,7 +149,7 @@ namespace Emby.Server.Implementations.EntryPoints
private static bool EnableRefreshMessage(BaseItem item) private static bool EnableRefreshMessage(BaseItem item)
{ {
if (!(item is Folder folder)) if (item is not Folder folder)
{ {
return false; return false;
} }
@ -403,7 +403,7 @@ namespace Emby.Server.Implementations.EntryPoints
return false; return false;
} }
if (item is IItemByName && !(item is MusicArtist)) if (item is IItemByName && item is not MusicArtist)
{ {
return false; return false;
} }

@ -37,6 +37,9 @@ namespace Emby.Server.Implementations.EntryPoints
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UdpServerEntryPoint" /> class. /// Initializes a new instance of the <see cref="UdpServerEntryPoint" /> class.
/// </summary> /// </summary>
/// <param name="logger">Instance of the <see cref="ILogger{UdpServerEntryPoint}"/> interface.</param>
/// <param name="appHost">Instance of the <see cref="IServerApplicationHost"/> interface.</param>
/// <param name="configuration">Instance of the <see cref="IConfiguration"/> interface.</param>
public UdpServerEntryPoint( public UdpServerEntryPoint(
ILogger<UdpServerEntryPoint> logger, ILogger<UdpServerEntryPoint> logger,
IServerApplicationHost appHost, IServerApplicationHost appHost,

@ -74,6 +74,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
auth.TryGetValue("Token", out token); auth.TryGetValue("Token", out token);
} }
#pragma warning disable CA1508 // string.IsNullOrEmpty(token) is always false.
if (string.IsNullOrEmpty(token)) if (string.IsNullOrEmpty(token))
{ {
token = headers["X-Emby-Token"]; token = headers["X-Emby-Token"];
@ -111,6 +112,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
// Request doesn't contain a token. // Request doesn't contain a token.
return authInfo; return authInfo;
} }
#pragma warning restore CA1508
authInfo.HasToken = true; authInfo.HasToken = true;
var result = _authRepo.Get(new AuthenticationInfoQuery var result = _authRepo.Get(new AuthenticationInfoQuery

@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.HttpServer
public event EventHandler<EventArgs>? Closed; public event EventHandler<EventArgs>? Closed;
/// <summary> /// <summary>
/// Gets or sets the remote end point. /// Gets the remote end point.
/// </summary> /// </summary>
public IPAddress? RemoteEndPoint { get; } public IPAddress? RemoteEndPoint { get; }
@ -82,7 +82,7 @@ namespace Emby.Server.Implementations.HttpServer
public DateTime LastKeepAliveDate { get; set; } public DateTime LastKeepAliveDate { get; set; }
/// <summary> /// <summary>
/// Gets or sets the query string. /// Gets the query string.
/// </summary> /// </summary>
/// <value>The query string.</value> /// <value>The query string.</value>
public IQueryCollection QueryString { get; } public IQueryCollection QueryString { get; }

@ -10,7 +10,7 @@ namespace Emby.Server.Implementations
string? FFmpegPath { get; } string? FFmpegPath { get; }
/// <summary> /// <summary>
/// Gets the value of the --service command line option. /// Gets a value value indicating whether to run as service by the --service command line option.
/// </summary> /// </summary>
bool IsService { get; } bool IsService { get; }

@ -30,27 +30,27 @@ namespace Emby.Server.Implementations.Images
string[] includeItemTypes; string[] includeItemTypes;
if (string.Equals(viewType, CollectionType.Movies)) if (string.Equals(viewType, CollectionType.Movies, StringComparison.Ordinal))
{ {
includeItemTypes = new string[] { "Movie" }; includeItemTypes = new string[] { "Movie" };
} }
else if (string.Equals(viewType, CollectionType.TvShows)) else if (string.Equals(viewType, CollectionType.TvShows, StringComparison.Ordinal))
{ {
includeItemTypes = new string[] { "Series" }; includeItemTypes = new string[] { "Series" };
} }
else if (string.Equals(viewType, CollectionType.Music)) else if (string.Equals(viewType, CollectionType.Music, StringComparison.Ordinal))
{ {
includeItemTypes = new string[] { "MusicAlbum" }; includeItemTypes = new string[] { "MusicAlbum" };
} }
else if (string.Equals(viewType, CollectionType.Books)) else if (string.Equals(viewType, CollectionType.Books, StringComparison.Ordinal))
{ {
includeItemTypes = new string[] { "Book", "AudioBook" }; includeItemTypes = new string[] { "Book", "AudioBook" };
} }
else if (string.Equals(viewType, CollectionType.BoxSets)) else if (string.Equals(viewType, CollectionType.BoxSets, StringComparison.Ordinal))
{ {
includeItemTypes = new string[] { "BoxSet" }; includeItemTypes = new string[] { "BoxSet" };
} }
else if (string.Equals(viewType, CollectionType.HomeVideos) || string.Equals(viewType, CollectionType.Photos)) else if (string.Equals(viewType, CollectionType.HomeVideos, StringComparison.Ordinal) || string.Equals(viewType, CollectionType.Photos, StringComparison.Ordinal))
{ {
includeItemTypes = new string[] { "Video", "Photo" }; includeItemTypes = new string[] { "Video", "Photo" };
} }

@ -287,14 +287,14 @@ namespace Emby.Server.Implementations.Library
if (item is IItemByName) if (item is IItemByName)
{ {
if (!(item is MusicArtist)) if (item is not MusicArtist)
{ {
return; return;
} }
} }
else if (!item.IsFolder) else if (!item.IsFolder)
{ {
if (!(item is Video) && !(item is LiveTvChannel)) if (item is not Video && item is not LiveTvChannel)
{ {
return; return;
} }
@ -866,7 +866,7 @@ namespace Emby.Server.Implementations.Library
{ {
var path = Person.GetPath(name); var path = Person.GetPath(name);
var id = GetItemByNameId<Person>(path); var id = GetItemByNameId<Person>(path);
if (!(GetItemById(id) is Person item)) if (GetItemById(id) is not Person item)
{ {
item = new Person item = new Person
{ {
@ -2118,7 +2118,7 @@ namespace Emby.Server.Implementations.Library
public LibraryOptions GetLibraryOptions(BaseItem item) public LibraryOptions GetLibraryOptions(BaseItem item)
{ {
if (!(item is CollectionFolder collectionFolder)) if (item is not CollectionFolder collectionFolder)
{ {
// List.Find is more performant than FirstOrDefault due to enumerator allocation // List.Find is more performant than FirstOrDefault due to enumerator allocation
collectionFolder = GetCollectionFolders(item) collectionFolder = GetCollectionFolders(item)

@ -21,11 +21,11 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
/// </summary> /// </summary>
public class AudioResolver : ItemResolver<MediaBrowser.Controller.Entities.Audio.Audio>, IMultiItemResolver public class AudioResolver : ItemResolver<MediaBrowser.Controller.Entities.Audio.Audio>, IMultiItemResolver
{ {
private readonly ILibraryManager LibraryManager; private readonly ILibraryManager _libraryManager;
public AudioResolver(ILibraryManager libraryManager) public AudioResolver(ILibraryManager libraryManager)
{ {
LibraryManager = libraryManager; _libraryManager = libraryManager;
} }
/// <summary> /// <summary>
@ -88,13 +88,13 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
} }
var files = args.FileSystemChildren var files = args.FileSystemChildren
.Where(i => !LibraryManager.IgnoreFile(i, args.Parent)) .Where(i => !_libraryManager.IgnoreFile(i, args.Parent))
.ToList(); .ToList();
return FindAudio<AudioBook>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false); return FindAudio<AudioBook>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
} }
if (LibraryManager.IsAudioFile(args.Path)) if (_libraryManager.IsAudioFile(args.Path))
{ {
var extension = Path.GetExtension(args.Path); var extension = Path.GetExtension(args.Path);
@ -107,7 +107,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
var isMixedCollectionType = string.IsNullOrEmpty(collectionType); var isMixedCollectionType = string.IsNullOrEmpty(collectionType);
// For conflicting extensions, give priority to videos // For conflicting extensions, give priority to videos
if (isMixedCollectionType && LibraryManager.IsVideoFile(args.Path)) if (isMixedCollectionType && _libraryManager.IsVideoFile(args.Path))
{ {
return null; return null;
} }
@ -182,7 +182,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
} }
} }
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions(); var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();
var resolver = new AudioBookListResolver(namingOptions); var resolver = new AudioBookListResolver(namingOptions);
var resolverResult = resolver.Resolve(files).ToList(); var resolverResult = resolver.Resolve(files).ToList();

@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// <summary> /// <summary>
/// Resolves a Path into a Video or Video subclass. /// Resolves a Path into a Video or Video subclass.
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T">The type of item to resolve.</typeparam>
public abstract class BaseVideoResolver<T> : MediaBrowser.Controller.Resolvers.ItemResolver<T> public abstract class BaseVideoResolver<T> : MediaBrowser.Controller.Resolvers.ItemResolver<T>
where T : Video, new() where T : Video, new()
{ {
@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
break; break;
} }
if (IsBluRayDirectory(child.FullName, filename, args.DirectoryService)) if (IsBluRayDirectory(filename))
{ {
videoInfo = VideoResolver.ResolveDirectory(args.Path, namingOptions); videoInfo = VideoResolver.ResolveDirectory(args.Path, namingOptions);
@ -279,25 +279,13 @@ namespace Emby.Server.Implementations.Library.Resolvers
} }
/// <summary> /// <summary>
/// Determines whether [is blu ray directory] [the specified directory name]. /// Determines whether [is bluray directory] [the specified directory name].
/// </summary> /// </summary>
protected bool IsBluRayDirectory(string fullPath, string directoryName, IDirectoryService directoryService) /// <param name="directoryName">The directory name.</param>
/// <returns>Whether the directory is a bluray directory.</returns>
protected bool IsBluRayDirectory(string directoryName)
{ {
if (!string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase)) return string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase);
{
return false;
}
return true;
// var blurayExtensions = new[]
//{
// ".mts",
// ".m2ts",
// ".bdmv",
// ".mpls"
//};
// return directoryService.GetFiles(fullPath).Any(i => blurayExtensions.Contains(i.Extension ?? string.Empty, StringComparer.OrdinalIgnoreCase));
} }
} }
} }

@ -9,7 +9,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// <summary> /// <summary>
/// Class ItemResolver. /// Class ItemResolver.
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T">The type of BaseItem.</typeparam>
public abstract class ItemResolver<T> : IItemResolver public abstract class ItemResolver<T> : IItemResolver
where T : BaseItem, new() where T : BaseItem, new()
{ {

@ -400,7 +400,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
return movie; return movie;
} }
if (IsBluRayDirectory(child.FullName, filename, directoryService)) if (IsBluRayDirectory(filename))
{ {
var movie = new T var movie = new T
{ {
@ -481,7 +481,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
return true; return true;
} }
if (subfolders.Any(s => IsBluRayDirectory(s.FullName, s.Name, directoryService))) if (subfolders.Any(s => IsBluRayDirectory(s.Name)))
{ {
videoTypes.Add(VideoType.BluRay); videoTypes.Add(VideoType.BluRay);
return true; return true;

@ -18,7 +18,8 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// </summary> /// </summary>
public class PlaylistResolver : FolderResolver<Playlist> public class PlaylistResolver : FolderResolver<Playlist>
{ {
private string[] _musicPlaylistCollectionTypes = new string[] { private string[] _musicPlaylistCollectionTypes =
{
string.Empty, string.Empty,
CollectionType.Music CollectionType.Music
}; };

@ -87,12 +87,15 @@ namespace Emby.Server.Implementations.Library.Validators
foreach (var item in deadEntities) foreach (var item in deadEntities)
{ {
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name, item.GetType().Name); _logger.LogInformation("Deleting dead {ItemType} {ItemId} {ItemName}", item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions _libraryManager.DeleteItem(
item,
new DeleteOptions
{ {
DeleteFileLocation = false DeleteFileLocation = false
}, false); },
false);
} }
progress.Report(100); progress.Report(100);

@ -1458,7 +1458,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (item.GetType() == typeof(Folder) && string.Equals(item.Path, parentPath, StringComparison.OrdinalIgnoreCase)) if (item.GetType() == typeof(Folder) && string.Equals(item.Path, parentPath, StringComparison.OrdinalIgnoreCase))
{ {
var parentItem = item.GetParent(); var parentItem = item.GetParent();
if (parentItem != null && !(parentItem is AggregateFolder)) if (parentItem != null && parentItem is not AggregateFolder)
{ {
item = parentItem; item = parentItem;
} }

@ -8,7 +8,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
internal class EpgChannelData internal class EpgChannelData
{ {
private readonly Dictionary<string, ChannelInfo> _channelsById; private readonly Dictionary<string, ChannelInfo> _channelsById;
private readonly Dictionary<string, ChannelInfo> _channelsByNumber; private readonly Dictionary<string, ChannelInfo> _channelsByNumber;

@ -14,6 +14,7 @@ using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos;
using MediaBrowser.Common; using MediaBrowser.Common;
using Jellyfin.Extensions.Json; using Jellyfin.Extensions.Json;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
@ -96,12 +97,12 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var dates = GetScheduleRequestDates(startDateUtc, endDateUtc); var dates = GetScheduleRequestDates(startDateUtc, endDateUtc);
_logger.LogInformation("Channel Station ID is: {ChannelID}", channelId); _logger.LogInformation("Channel Station ID is: {ChannelID}", channelId);
var requestList = new List<ScheduleDirect.RequestScheduleForChannel>() var requestList = new List<RequestScheduleForChannelDto>()
{ {
new ScheduleDirect.RequestScheduleForChannel() new RequestScheduleForChannelDto()
{ {
stationID = channelId, StationId = channelId,
date = dates Date = dates
} }
}; };
@ -113,61 +114,61 @@ namespace Emby.Server.Implementations.LiveTv.Listings
options.Headers.TryAddWithoutValidation("token", token); options.Headers.TryAddWithoutValidation("token", token);
using var response = await Send(options, true, info, cancellationToken).ConfigureAwait(false); using var response = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var dailySchedules = await JsonSerializer.DeserializeAsync<List<ScheduleDirect.Day>>(responseStream, _jsonOptions, cancellationToken).ConfigureAwait(false); var dailySchedules = await JsonSerializer.DeserializeAsync<List<DayDto>>(responseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId); _logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);
using var programRequestOptions = new HttpRequestMessage(HttpMethod.Post, ApiUrl + "/programs"); using var programRequestOptions = new HttpRequestMessage(HttpMethod.Post, ApiUrl + "/programs");
programRequestOptions.Headers.TryAddWithoutValidation("token", token); programRequestOptions.Headers.TryAddWithoutValidation("token", token);
var programsID = dailySchedules.SelectMany(d => d.programs.Select(s => s.programID)).Distinct(); var programsID = dailySchedules.SelectMany(d => d.Programs.Select(s => s.ProgramId)).Distinct();
programRequestOptions.Content = new StringContent("[\"" + string.Join("\", \"", programsID) + "\"]", Encoding.UTF8, MediaTypeNames.Application.Json); programRequestOptions.Content = new StringContent("[\"" + string.Join("\", \"", programsID) + "\"]", Encoding.UTF8, MediaTypeNames.Application.Json);
using var innerResponse = await Send(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false); using var innerResponse = await Send(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false);
await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var programDetails = await JsonSerializer.DeserializeAsync<List<ScheduleDirect.ProgramDetails>>(innerResponseStream, _jsonOptions, cancellationToken).ConfigureAwait(false); var programDetails = await JsonSerializer.DeserializeAsync<List<ProgramDetailsDto>>(innerResponseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
var programDict = programDetails.ToDictionary(p => p.programID, y => y); var programDict = programDetails.ToDictionary(p => p.ProgramId, y => y);
var programIdsWithImages = programDetails var programIdsWithImages = programDetails
.Where(p => p.hasImageArtwork).Select(p => p.programID) .Where(p => p.HasImageArtwork).Select(p => p.ProgramId)
.ToList(); .ToList();
var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false); var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
var programsInfo = new List<ProgramInfo>(); var programsInfo = new List<ProgramInfo>();
foreach (ScheduleDirect.Program schedule in dailySchedules.SelectMany(d => d.programs)) foreach (ProgramDto schedule in dailySchedules.SelectMany(d => d.Programs))
{ {
// _logger.LogDebug("Proccesing Schedule for statio ID " + stationID + // _logger.LogDebug("Proccesing Schedule for statio ID " + stationID +
// " which corresponds to channel " + channelNumber + " and program id " + // " which corresponds to channel " + channelNumber + " and program id " +
// schedule.programID + " which says it has images? " + // schedule.ProgramId + " which says it has images? " +
// programDict[schedule.programID].hasImageArtwork); // programDict[schedule.ProgramId].hasImageArtwork);
if (images != null) if (images != null)
{ {
var imageIndex = images.FindIndex(i => i.programID == schedule.programID.Substring(0, 10)); var imageIndex = images.FindIndex(i => i.ProgramId == schedule.ProgramId[..10]);
if (imageIndex > -1) if (imageIndex > -1)
{ {
var programEntry = programDict[schedule.programID]; var programEntry = programDict[schedule.ProgramId];
var allImages = images[imageIndex].data ?? new List<ScheduleDirect.ImageData>(); var allImages = images[imageIndex].Data ?? new List<ImageDataDto>();
var imagesWithText = allImages.Where(i => string.Equals(i.text, "yes", StringComparison.OrdinalIgnoreCase)); var imagesWithText = allImages.Where(i => string.Equals(i.Text, "yes", StringComparison.OrdinalIgnoreCase));
var imagesWithoutText = allImages.Where(i => string.Equals(i.text, "no", StringComparison.OrdinalIgnoreCase)); var imagesWithoutText = allImages.Where(i => string.Equals(i.Text, "no", StringComparison.OrdinalIgnoreCase));
const double DesiredAspect = 2.0 / 3; const double DesiredAspect = 2.0 / 3;
programEntry.primaryImage = GetProgramImage(ApiUrl, imagesWithText, true, DesiredAspect) ?? programEntry.PrimaryImage = GetProgramImage(ApiUrl, imagesWithText, true, DesiredAspect) ??
GetProgramImage(ApiUrl, allImages, true, DesiredAspect); GetProgramImage(ApiUrl, allImages, true, DesiredAspect);
const double WideAspect = 16.0 / 9; const double WideAspect = 16.0 / 9;
programEntry.thumbImage = GetProgramImage(ApiUrl, imagesWithText, true, WideAspect); programEntry.ThumbImage = GetProgramImage(ApiUrl, imagesWithText, true, WideAspect);
// Don't supply the same image twice // Don't supply the same image twice
if (string.Equals(programEntry.primaryImage, programEntry.thumbImage, StringComparison.Ordinal)) if (string.Equals(programEntry.PrimaryImage, programEntry.ThumbImage, StringComparison.Ordinal))
{ {
programEntry.thumbImage = null; programEntry.ThumbImage = null;
} }
programEntry.backdropImage = GetProgramImage(ApiUrl, imagesWithoutText, true, WideAspect); programEntry.BackdropImage = GetProgramImage(ApiUrl, imagesWithoutText, true, WideAspect);
// programEntry.bannerImage = GetProgramImage(ApiUrl, data, "Banner", false) ?? // programEntry.bannerImage = GetProgramImage(ApiUrl, data, "Banner", false) ??
// GetProgramImage(ApiUrl, data, "Banner-L1", false) ?? // GetProgramImage(ApiUrl, data, "Banner-L1", false) ??
@ -176,15 +177,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings
} }
} }
programsInfo.Add(GetProgram(channelId, schedule, programDict[schedule.programID])); programsInfo.Add(GetProgram(channelId, schedule, programDict[schedule.ProgramId]));
} }
return programsInfo; return programsInfo;
} }
private static int GetSizeOrder(ScheduleDirect.ImageData image) private static int GetSizeOrder(ImageDataDto image)
{ {
if (int.TryParse(image.height, out int value)) if (int.TryParse(image.Height, out int value))
{ {
return value; return value;
} }
@ -192,53 +193,53 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return 0; return 0;
} }
private static string GetChannelNumber(ScheduleDirect.Map map) private static string GetChannelNumber(MapDto map)
{ {
var channelNumber = map.logicalChannelNumber; var channelNumber = map.LogicalChannelNumber;
if (string.IsNullOrWhiteSpace(channelNumber)) if (string.IsNullOrWhiteSpace(channelNumber))
{ {
channelNumber = map.channel; channelNumber = map.Channel;
} }
if (string.IsNullOrWhiteSpace(channelNumber)) if (string.IsNullOrWhiteSpace(channelNumber))
{ {
channelNumber = map.atscMajor + "." + map.atscMinor; channelNumber = map.AtscMajor + "." + map.AtscMinor;
} }
return channelNumber.TrimStart('0'); return channelNumber.TrimStart('0');
} }
private static bool IsMovie(ScheduleDirect.ProgramDetails programInfo) private static bool IsMovie(ProgramDetailsDto programInfo)
{ {
return string.Equals(programInfo.entityType, "movie", StringComparison.OrdinalIgnoreCase); return string.Equals(programInfo.EntityType, "movie", StringComparison.OrdinalIgnoreCase);
} }
private ProgramInfo GetProgram(string channelId, ScheduleDirect.Program programInfo, ScheduleDirect.ProgramDetails details) private ProgramInfo GetProgram(string channelId, ProgramDto programInfo, ProgramDetailsDto details)
{ {
var startAt = GetDate(programInfo.airDateTime); var startAt = GetDate(programInfo.AirDateTime);
var endAt = startAt.AddSeconds(programInfo.duration); var endAt = startAt.AddSeconds(programInfo.Duration);
var audioType = ProgramAudio.Stereo; var audioType = ProgramAudio.Stereo;
var programId = programInfo.programID ?? string.Empty; var programId = programInfo.ProgramId ?? string.Empty;
string newID = programId + "T" + startAt.Ticks + "C" + channelId; string newID = programId + "T" + startAt.Ticks + "C" + channelId;
if (programInfo.audioProperties != null) if (programInfo.AudioProperties != null)
{ {
if (programInfo.audioProperties.Exists(item => string.Equals(item, "atmos", StringComparison.OrdinalIgnoreCase))) if (programInfo.AudioProperties.Exists(item => string.Equals(item, "atmos", StringComparison.OrdinalIgnoreCase)))
{ {
audioType = ProgramAudio.Atmos; audioType = ProgramAudio.Atmos;
} }
else if (programInfo.audioProperties.Exists(item => string.Equals(item, "dd 5.1", StringComparison.OrdinalIgnoreCase))) else if (programInfo.AudioProperties.Exists(item => string.Equals(item, "dd 5.1", StringComparison.OrdinalIgnoreCase)))
{ {
audioType = ProgramAudio.DolbyDigital; audioType = ProgramAudio.DolbyDigital;
} }
else if (programInfo.audioProperties.Exists(item => string.Equals(item, "dd", StringComparison.OrdinalIgnoreCase))) else if (programInfo.AudioProperties.Exists(item => string.Equals(item, "dd", StringComparison.OrdinalIgnoreCase)))
{ {
audioType = ProgramAudio.DolbyDigital; audioType = ProgramAudio.DolbyDigital;
} }
else if (programInfo.audioProperties.Exists(item => string.Equals(item, "stereo", StringComparison.OrdinalIgnoreCase))) else if (programInfo.AudioProperties.Exists(item => string.Equals(item, "stereo", StringComparison.OrdinalIgnoreCase)))
{ {
audioType = ProgramAudio.Stereo; audioType = ProgramAudio.Stereo;
} }
@ -249,9 +250,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
} }
string episodeTitle = null; string episodeTitle = null;
if (details.episodeTitle150 != null) if (details.EpisodeTitle150 != null)
{ {
episodeTitle = details.episodeTitle150; episodeTitle = details.EpisodeTitle150;
} }
var info = new ProgramInfo var info = new ProgramInfo
@ -260,22 +261,22 @@ namespace Emby.Server.Implementations.LiveTv.Listings
Id = newID, Id = newID,
StartDate = startAt, StartDate = startAt,
EndDate = endAt, EndDate = endAt,
Name = details.titles[0].title120 ?? "Unknown", Name = details.Titles[0].Title120 ?? "Unknown",
OfficialRating = null, OfficialRating = null,
CommunityRating = null, CommunityRating = null,
EpisodeTitle = episodeTitle, EpisodeTitle = episodeTitle,
Audio = audioType, Audio = audioType,
// IsNew = programInfo.@new ?? false, // IsNew = programInfo.@new ?? false,
IsRepeat = programInfo.@new == null, IsRepeat = programInfo.New == null,
IsSeries = string.Equals(details.entityType, "episode", StringComparison.OrdinalIgnoreCase), IsSeries = string.Equals(details.EntityType, "episode", StringComparison.OrdinalIgnoreCase),
ImageUrl = details.primaryImage, ImageUrl = details.PrimaryImage,
ThumbImageUrl = details.thumbImage, ThumbImageUrl = details.ThumbImage,
IsKids = string.Equals(details.audience, "children", StringComparison.OrdinalIgnoreCase), IsKids = string.Equals(details.Audience, "children", StringComparison.OrdinalIgnoreCase),
IsSports = string.Equals(details.entityType, "sports", StringComparison.OrdinalIgnoreCase), IsSports = string.Equals(details.EntityType, "sports", StringComparison.OrdinalIgnoreCase),
IsMovie = IsMovie(details), IsMovie = IsMovie(details),
Etag = programInfo.md5, Etag = programInfo.Md5,
IsLive = string.Equals(programInfo.liveTapeDelay, "live", StringComparison.OrdinalIgnoreCase), IsLive = string.Equals(programInfo.LiveTapeDelay, "live", StringComparison.OrdinalIgnoreCase),
IsPremiere = programInfo.premiere || (programInfo.isPremiereOrFinale ?? string.Empty).IndexOf("premiere", StringComparison.OrdinalIgnoreCase) != -1 IsPremiere = programInfo.Premiere || (programInfo.IsPremiereOrFinale ?? string.Empty).IndexOf("premiere", StringComparison.OrdinalIgnoreCase) != -1
}; };
var showId = programId; var showId = programId;
@ -298,15 +299,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings
info.ShowId = showId; info.ShowId = showId;
if (programInfo.videoProperties != null) if (programInfo.VideoProperties != null)
{ {
info.IsHD = programInfo.videoProperties.Contains("hdtv", StringComparer.OrdinalIgnoreCase); info.IsHD = programInfo.VideoProperties.Contains("hdtv", StringComparer.OrdinalIgnoreCase);
info.Is3D = programInfo.videoProperties.Contains("3d", StringComparer.OrdinalIgnoreCase); info.Is3D = programInfo.VideoProperties.Contains("3d", StringComparer.OrdinalIgnoreCase);
} }
if (details.contentRating != null && details.contentRating.Count > 0) if (details.ContentRating != null && details.ContentRating.Count > 0)
{ {
info.OfficialRating = details.contentRating[0].code.Replace("TV", "TV-", StringComparison.Ordinal) info.OfficialRating = details.ContentRating[0].Code.Replace("TV", "TV-", StringComparison.Ordinal)
.Replace("--", "-", StringComparison.Ordinal); .Replace("--", "-", StringComparison.Ordinal);
var invalid = new[] { "N/A", "Approved", "Not Rated", "Passed" }; var invalid = new[] { "N/A", "Approved", "Not Rated", "Passed" };
@ -316,15 +317,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings
} }
} }
if (details.descriptions != null) if (details.Descriptions != null)
{ {
if (details.descriptions.description1000 != null && details.descriptions.description1000.Count > 0) if (details.Descriptions.Description1000 != null && details.Descriptions.Description1000.Count > 0)
{ {
info.Overview = details.descriptions.description1000[0].description; info.Overview = details.Descriptions.Description1000[0].Description;
} }
else if (details.descriptions.description100 != null && details.descriptions.description100.Count > 0) else if (details.Descriptions.Description100 != null && details.Descriptions.Description100.Count > 0)
{ {
info.Overview = details.descriptions.description100[0].description; info.Overview = details.Descriptions.Description100[0].Description;
} }
} }
@ -334,18 +335,18 @@ namespace Emby.Server.Implementations.LiveTv.Listings
info.SeriesProviderIds[MetadataProvider.Zap2It.ToString()] = info.SeriesId; info.SeriesProviderIds[MetadataProvider.Zap2It.ToString()] = info.SeriesId;
if (details.metadata != null) if (details.Metadata != null)
{ {
foreach (var metadataProgram in details.metadata) foreach (var metadataProgram in details.Metadata)
{ {
var gracenote = metadataProgram.Gracenote; var gracenote = metadataProgram.Gracenote;
if (gracenote != null) if (gracenote != null)
{ {
info.SeasonNumber = gracenote.season; info.SeasonNumber = gracenote.Season;
if (gracenote.episode > 0) if (gracenote.Episode > 0)
{ {
info.EpisodeNumber = gracenote.episode; info.EpisodeNumber = gracenote.Episode;
} }
break; break;
@ -354,25 +355,25 @@ namespace Emby.Server.Implementations.LiveTv.Listings
} }
} }
if (!string.IsNullOrWhiteSpace(details.originalAirDate)) if (!string.IsNullOrWhiteSpace(details.OriginalAirDate))
{ {
info.OriginalAirDate = DateTime.Parse(details.originalAirDate, CultureInfo.InvariantCulture); info.OriginalAirDate = DateTime.Parse(details.OriginalAirDate, CultureInfo.InvariantCulture);
info.ProductionYear = info.OriginalAirDate.Value.Year; info.ProductionYear = info.OriginalAirDate.Value.Year;
} }
if (details.movie != null) if (details.Movie != null)
{ {
if (!string.IsNullOrEmpty(details.movie.year) if (!string.IsNullOrEmpty(details.Movie.Year)
&& int.TryParse(details.movie.year, out int year)) && int.TryParse(details.Movie.Year, out int year))
{ {
info.ProductionYear = year; info.ProductionYear = year;
} }
} }
if (details.genres != null) if (details.Genres != null)
{ {
info.Genres = details.genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList(); info.Genres = details.Genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList();
info.IsNews = details.genres.Contains("news", StringComparer.OrdinalIgnoreCase); info.IsNews = details.Genres.Contains("news", StringComparer.OrdinalIgnoreCase);
if (info.Genres.Contains("children", StringComparer.OrdinalIgnoreCase)) if (info.Genres.Contains("children", StringComparer.OrdinalIgnoreCase))
{ {
@ -395,11 +396,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return date; return date;
} }
private string GetProgramImage(string apiUrl, IEnumerable<ScheduleDirect.ImageData> images, bool returnDefaultImage, double desiredAspect) private string GetProgramImage(string apiUrl, IEnumerable<ImageDataDto> images, bool returnDefaultImage, double desiredAspect)
{ {
var match = images var match = images
.OrderBy(i => Math.Abs(desiredAspect - GetAspectRatio(i))) .OrderBy(i => Math.Abs(desiredAspect - GetAspectRatio(i)))
.ThenByDescending(GetSizeOrder) .ThenByDescending(i => GetSizeOrder(i))
.FirstOrDefault(); .FirstOrDefault();
if (match == null) if (match == null)
@ -407,7 +408,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return null; return null;
} }
var uri = match.uri; var uri = match.Uri;
if (string.IsNullOrWhiteSpace(uri)) if (string.IsNullOrWhiteSpace(uri))
{ {
@ -423,19 +424,19 @@ namespace Emby.Server.Implementations.LiveTv.Listings
} }
} }
private static double GetAspectRatio(ScheduleDirect.ImageData i) private static double GetAspectRatio(ImageDataDto i)
{ {
int width = 0; int width = 0;
int height = 0; int height = 0;
if (!string.IsNullOrWhiteSpace(i.width)) if (!string.IsNullOrWhiteSpace(i.Width))
{ {
int.TryParse(i.width, out width); _ = int.TryParse(i.Width, out width);
} }
if (!string.IsNullOrWhiteSpace(i.height)) if (!string.IsNullOrWhiteSpace(i.Height))
{ {
int.TryParse(i.height, out height); _ = int.TryParse(i.Height, out height);
} }
if (height == 0 || width == 0) if (height == 0 || width == 0)
@ -448,14 +449,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return result; return result;
} }
private async Task<List<ScheduleDirect.ShowImages>> GetImageForPrograms( private async Task<List<ShowImagesDto>> GetImageForPrograms(
ListingsProviderInfo info, ListingsProviderInfo info,
IReadOnlyList<string> programIds, IReadOnlyList<string> programIds,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
if (programIds.Count == 0) if (programIds.Count == 0)
{ {
return new List<ScheduleDirect.ShowImages>(); return new List<ShowImagesDto>();
} }
StringBuilder str = new StringBuilder("[", 1 + (programIds.Count * 13)); StringBuilder str = new StringBuilder("[", 1 + (programIds.Count * 13));
@ -479,13 +480,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings
{ {
using var innerResponse2 = await Send(message, true, info, cancellationToken).ConfigureAwait(false); using var innerResponse2 = await Send(message, true, info, cancellationToken).ConfigureAwait(false);
await using var response = await innerResponse2.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var response = await innerResponse2.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
return await JsonSerializer.DeserializeAsync<List<ScheduleDirect.ShowImages>>(response, _jsonOptions, cancellationToken).ConfigureAwait(false); return await JsonSerializer.DeserializeAsync<List<ShowImagesDto>>(response, _jsonOptions, cancellationToken).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Error getting image info from schedules direct"); _logger.LogError(ex, "Error getting image info from schedules direct");
return new List<ScheduleDirect.ShowImages>(); return new List<ShowImagesDto>();
} }
} }
@ -508,18 +509,18 @@ namespace Emby.Server.Implementations.LiveTv.Listings
using var httpResponse = await Send(options, false, info, cancellationToken).ConfigureAwait(false); using var httpResponse = await Send(options, false, info, cancellationToken).ConfigureAwait(false);
await using var response = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var response = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var root = await JsonSerializer.DeserializeAsync<List<ScheduleDirect.Headends>>(response, _jsonOptions, cancellationToken).ConfigureAwait(false); var root = await JsonSerializer.DeserializeAsync<List<HeadendsDto>>(response, _jsonOptions, cancellationToken).ConfigureAwait(false);
if (root != null) if (root != null)
{ {
foreach (ScheduleDirect.Headends headend in root) foreach (HeadendsDto headend in root)
{ {
foreach (ScheduleDirect.Lineup lineup in headend.lineups) foreach (LineupDto lineup in headend.Lineups)
{ {
lineups.Add(new NameIdPair lineups.Add(new NameIdPair
{ {
Name = string.IsNullOrWhiteSpace(lineup.name) ? lineup.lineup : lineup.name, Name = string.IsNullOrWhiteSpace(lineup.Name) ? lineup.Lineup : lineup.Name,
Id = lineup.uri.Substring(18) Id = lineup.Uri[18..]
}); });
} }
} }
@ -649,14 +650,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
using var response = await Send(options, false, null, cancellationToken).ConfigureAwait(false); using var response = await Send(options, false, null, cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var root = await JsonSerializer.DeserializeAsync<ScheduleDirect.Token>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false); var root = await JsonSerializer.DeserializeAsync<TokenDto>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
if (string.Equals(root.message, "OK", StringComparison.Ordinal)) if (string.Equals(root.Message, "OK", StringComparison.Ordinal))
{ {
_logger.LogInformation("Authenticated with Schedules Direct token: " + root.token); _logger.LogInformation("Authenticated with Schedules Direct token: {Token}", root.Token);
return root.token; return root.Token;
} }
throw new Exception("Could not authenticate with Schedules Direct Error: " + root.message); throw new Exception("Could not authenticate with Schedules Direct Error: " + root.Message);
} }
private async Task AddLineupToAccount(ListingsProviderInfo info, CancellationToken cancellationToken) private async Task AddLineupToAccount(ListingsProviderInfo info, CancellationToken cancellationToken)
@ -705,9 +706,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
httpResponse.EnsureSuccessStatusCode(); httpResponse.EnsureSuccessStatusCode();
await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
using var response = httpResponse.Content; using var response = httpResponse.Content;
var root = await JsonSerializer.DeserializeAsync<ScheduleDirect.Lineups>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false); var root = await JsonSerializer.DeserializeAsync<LineupsDto>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
return root.lineups.Any(i => string.Equals(info.ListingsId, i.lineup, StringComparison.OrdinalIgnoreCase)); return root.Lineups.Any(i => string.Equals(info.ListingsId, i.Lineup, StringComparison.OrdinalIgnoreCase));
} }
catch (HttpRequestException ex) catch (HttpRequestException ex)
{ {
@ -777,35 +778,35 @@ namespace Emby.Server.Implementations.LiveTv.Listings
using var httpResponse = await Send(options, true, info, cancellationToken).ConfigureAwait(false); using var httpResponse = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var root = await JsonSerializer.DeserializeAsync<ScheduleDirect.Channel>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false); var root = await JsonSerializer.DeserializeAsync<ChannelDto>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
_logger.LogInformation("Found {ChannelCount} channels on the lineup on ScheduleDirect", root.map.Count); _logger.LogInformation("Found {ChannelCount} channels on the lineup on ScheduleDirect", root.Map.Count);
_logger.LogInformation("Mapping Stations to Channel"); _logger.LogInformation("Mapping Stations to Channel");
var allStations = root.stations ?? new List<ScheduleDirect.Station>(); var allStations = root.Stations ?? new List<StationDto>();
var map = root.map; var map = root.Map;
var list = new List<ChannelInfo>(map.Count); var list = new List<ChannelInfo>(map.Count);
foreach (var channel in map) foreach (var channel in map)
{ {
var channelNumber = GetChannelNumber(channel); var channelNumber = GetChannelNumber(channel);
var station = allStations.Find(item => string.Equals(item.stationID, channel.stationID, StringComparison.OrdinalIgnoreCase)) var station = allStations.Find(item => string.Equals(item.StationId, channel.StationId, StringComparison.OrdinalIgnoreCase))
?? new ScheduleDirect.Station ?? new StationDto
{ {
stationID = channel.stationID StationId = channel.StationId
}; };
var channelInfo = new ChannelInfo var channelInfo = new ChannelInfo
{ {
Id = station.stationID, Id = station.StationId,
CallSign = station.callsign, CallSign = station.Callsign,
Number = channelNumber, Number = channelNumber,
Name = string.IsNullOrWhiteSpace(station.name) ? channelNumber : station.name Name = string.IsNullOrWhiteSpace(station.Name) ? channelNumber : station.Name
}; };
if (station.logo != null) if (station.Logo != null)
{ {
channelInfo.ImageUrl = station.logo.URL; channelInfo.ImageUrl = station.Logo.Url;
} }
list.Add(channelInfo); list.Add(channelInfo);
@ -818,402 +819,5 @@ namespace Emby.Server.Implementations.LiveTv.Listings
{ {
return value.Replace(" ", string.Empty, StringComparison.Ordinal).Replace("-", string.Empty, StringComparison.Ordinal); return value.Replace(" ", string.Empty, StringComparison.Ordinal).Replace("-", string.Empty, StringComparison.Ordinal);
} }
public class ScheduleDirect
{
public class Token
{
public int code { get; set; }
public string message { get; set; }
public string serverID { get; set; }
public string token { get; set; }
}
public class Lineup
{
public string lineup { get; set; }
public string name { get; set; }
public string transport { get; set; }
public string location { get; set; }
public string uri { get; set; }
}
public class Lineups
{
public int code { get; set; }
public string serverID { get; set; }
public string datetime { get; set; }
public List<Lineup> lineups { get; set; }
}
public class Headends
{
public string headend { get; set; }
public string transport { get; set; }
public string location { get; set; }
public List<Lineup> lineups { get; set; }
}
public class Map
{
public string stationID { get; set; }
public string channel { get; set; }
public string logicalChannelNumber { get; set; }
public int uhfVhf { get; set; }
public int atscMajor { get; set; }
public int atscMinor { get; set; }
}
public class Broadcaster
{
public string city { get; set; }
public string state { get; set; }
public string postalcode { get; set; }
public string country { get; set; }
}
public class Logo
{
public string URL { get; set; }
public int height { get; set; }
public int width { get; set; }
public string md5 { get; set; }
}
public class Station
{
public string stationID { get; set; }
public string name { get; set; }
public string callsign { get; set; }
public List<string> broadcastLanguage { get; set; }
public List<string> descriptionLanguage { get; set; }
public Broadcaster broadcaster { get; set; }
public string affiliate { get; set; }
public Logo logo { get; set; }
public bool? isCommercialFree { get; set; }
}
public class Metadata
{
public string lineup { get; set; }
public string modified { get; set; }
public string transport { get; set; }
}
public class Channel
{
public List<Map> map { get; set; }
public List<Station> stations { get; set; }
public Metadata metadata { get; set; }
}
public class RequestScheduleForChannel
{
public string stationID { get; set; }
public List<string> date { get; set; }
}
public class Rating
{
public string body { get; set; }
public string code { get; set; }
}
public class Multipart
{
public int partNumber { get; set; }
public int totalParts { get; set; }
}
public class Program
{
public string programID { get; set; }
public string airDateTime { get; set; }
public int duration { get; set; }
public string md5 { get; set; }
public List<string> audioProperties { get; set; }
public List<string> videoProperties { get; set; }
public List<Rating> ratings { get; set; }
public bool? @new { get; set; }
public Multipart multipart { get; set; }
public string liveTapeDelay { get; set; }
public bool premiere { get; set; }
public bool repeat { get; set; }
public string isPremiereOrFinale { get; set; }
}
public class MetadataSchedule
{
public string modified { get; set; }
public string md5 { get; set; }
public string startDate { get; set; }
public string endDate { get; set; }
public int days { get; set; }
}
public class Day
{
public string stationID { get; set; }
public List<Program> programs { get; set; }
public MetadataSchedule metadata { get; set; }
public Day()
{
programs = new List<Program>();
}
}
public class Title
{
public string title120 { get; set; }
}
public class EventDetails
{
public string subType { get; set; }
}
public class Description100
{
public string descriptionLanguage { get; set; }
public string description { get; set; }
}
public class Description1000
{
public string descriptionLanguage { get; set; }
public string description { get; set; }
}
public class DescriptionsProgram
{
public List<Description100> description100 { get; set; }
public List<Description1000> description1000 { get; set; }
}
public class Gracenote
{
public int season { get; set; }
public int episode { get; set; }
}
public class MetadataPrograms
{
public Gracenote Gracenote { get; set; }
}
public class ContentRating
{
public string body { get; set; }
public string code { get; set; }
}
public class Cast
{
public string billingOrder { get; set; }
public string role { get; set; }
public string nameId { get; set; }
public string personId { get; set; }
public string name { get; set; }
public string characterName { get; set; }
}
public class Crew
{
public string billingOrder { get; set; }
public string role { get; set; }
public string nameId { get; set; }
public string personId { get; set; }
public string name { get; set; }
}
public class QualityRating
{
public string ratingsBody { get; set; }
public string rating { get; set; }
public string minRating { get; set; }
public string maxRating { get; set; }
public string increment { get; set; }
}
public class Movie
{
public string year { get; set; }
public int duration { get; set; }
public List<QualityRating> qualityRating { get; set; }
}
public class Recommendation
{
public string programID { get; set; }
public string title120 { get; set; }
}
public class ProgramDetails
{
public string audience { get; set; }
public string programID { get; set; }
public List<Title> titles { get; set; }
public EventDetails eventDetails { get; set; }
public DescriptionsProgram descriptions { get; set; }
public string originalAirDate { get; set; }
public List<string> genres { get; set; }
public string episodeTitle150 { get; set; }
public List<MetadataPrograms> metadata { get; set; }
public List<ContentRating> contentRating { get; set; }
public List<Cast> cast { get; set; }
public List<Crew> crew { get; set; }
public string entityType { get; set; }
public string showType { get; set; }
public bool hasImageArtwork { get; set; }
public string primaryImage { get; set; }
public string thumbImage { get; set; }
public string backdropImage { get; set; }
public string bannerImage { get; set; }
public string imageID { get; set; }
public string md5 { get; set; }
public List<string> contentAdvisory { get; set; }
public Movie movie { get; set; }
public List<Recommendation> recommendations { get; set; }
}
public class Caption
{
public string content { get; set; }
public string lang { get; set; }
}
public class ImageData
{
public string width { get; set; }
public string height { get; set; }
public string uri { get; set; }
public string size { get; set; }
public string aspect { get; set; }
public string category { get; set; }
public string text { get; set; }
public string primary { get; set; }
public string tier { get; set; }
public Caption caption { get; set; }
}
public class ShowImages
{
public string programID { get; set; }
public List<ImageData> data { get; set; }
}
}
} }
} }

@ -0,0 +1,36 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Broadcaster dto.
/// </summary>
public class BroadcasterDto
{
/// <summary>
/// Gets or sets the city.
/// </summary>
[JsonPropertyName("city")]
public string City { get; set; }
/// <summary>
/// Gets or sets the state.
/// </summary>
[JsonPropertyName("state")]
public string State { get; set; }
/// <summary>
/// Gets or sets the postal code.
/// </summary>
[JsonPropertyName("postalCode")]
public string Postalcode { get; set; }
/// <summary>
/// Gets or sets the country.
/// </summary>
[JsonPropertyName("country")]
public string Country { get; set; }
}
}

@ -0,0 +1,24 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Caption dto.
/// </summary>
public class CaptionDto
{
/// <summary>
/// Gets or sets the content.
/// </summary>
[JsonPropertyName("content")]
public string Content { get; set; }
/// <summary>
/// Gets or sets the lang.
/// </summary>
[JsonPropertyName("lang")]
public string Lang { get; set; }
}
}

@ -0,0 +1,48 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Cast dto.
/// </summary>
public class CastDto
{
/// <summary>
/// Gets or sets the billing order.
/// </summary>
[JsonPropertyName("billingOrder")]
public string BillingOrder { get; set; }
/// <summary>
/// Gets or sets the role.
/// </summary>
[JsonPropertyName("role")]
public string Role { get; set; }
/// <summary>
/// Gets or sets the name id.
/// </summary>
[JsonPropertyName("nameId")]
public string NameId { get; set; }
/// <summary>
/// Gets or sets the person id.
/// </summary>
[JsonPropertyName("personId")]
public string PersonId { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the character name.
/// </summary>
[JsonPropertyName("characterName")]
public string CharacterName { get; set; }
}
}

@ -0,0 +1,31 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Channel dto.
/// </summary>
public class ChannelDto
{
/// <summary>
/// Gets or sets the list of maps.
/// </summary>
[JsonPropertyName("map")]
public List<MapDto> Map { get; set; }
/// <summary>
/// Gets or sets the list of stations.
/// </summary>
[JsonPropertyName("stations")]
public List<StationDto> Stations { get; set; }
/// <summary>
/// Gets or sets the metadata.
/// </summary>
[JsonPropertyName("metadata")]
public MetadataDto Metadata { get; set; }
}
}

@ -0,0 +1,24 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Content rating dto.
/// </summary>
public class ContentRatingDto
{
/// <summary>
/// Gets or sets the body.
/// </summary>
[JsonPropertyName("body")]
public string Body { get; set; }
/// <summary>
/// Gets or sets the code.
/// </summary>
[JsonPropertyName("code")]
public string Code { get; set; }
}
}

@ -0,0 +1,42 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Crew dto.
/// </summary>
public class CrewDto
{
/// <summary>
/// Gets or sets the billing order.
/// </summary>
[JsonPropertyName("billingOrder")]
public string BillingOrder { get; set; }
/// <summary>
/// Gets or sets the role.
/// </summary>
[JsonPropertyName("role")]
public string Role { get; set; }
/// <summary>
/// Gets or sets the name id.
/// </summary>
[JsonPropertyName("nameId")]
public string NameId { get; set; }
/// <summary>
/// Gets or sets the person id.
/// </summary>
[JsonPropertyName("personId")]
public string PersonId { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}
}

@ -0,0 +1,39 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Day dto.
/// </summary>
public class DayDto
{
/// <summary>
/// Initializes a new instance of the <see cref="DayDto"/> class.
/// </summary>
public DayDto()
{
Programs = new List<ProgramDto>();
}
/// <summary>
/// Gets or sets the station id.
/// </summary>
[JsonPropertyName("stationID")]
public string StationId { get; set; }
/// <summary>
/// Gets or sets the list of programs.
/// </summary>
[JsonPropertyName("programs")]
public List<ProgramDto> Programs { get; set; }
/// <summary>
/// Gets or sets the metadata schedule.
/// </summary>
[JsonPropertyName("metadata")]
public MetadataScheduleDto Metadata { get; set; }
}
}

@ -0,0 +1,24 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Description 1_000 dto.
/// </summary>
public class Description1000Dto
{
/// <summary>
/// Gets or sets the description language.
/// </summary>
[JsonPropertyName("descriptionLanguage")]
public string DescriptionLanguage { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
[JsonPropertyName("description")]
public string Description { get; set; }
}
}

@ -0,0 +1,24 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Description 100 dto.
/// </summary>
public class Description100Dto
{
/// <summary>
/// Gets or sets the description language.
/// </summary>
[JsonPropertyName("descriptionLanguage")]
public string DescriptionLanguage { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
[JsonPropertyName("description")]
public string Description { get; set; }
}
}

@ -0,0 +1,25 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Descriptions program dto.
/// </summary>
public class DescriptionsProgramDto
{
/// <summary>
/// Gets or sets the list of description 100.
/// </summary>
[JsonPropertyName("description100")]
public List<Description100Dto> Description100 { get; set; }
/// <summary>
/// Gets or sets the list of description1000.
/// </summary>
[JsonPropertyName("description1000")]
public List<Description1000Dto> Description1000 { get; set; }
}
}

@ -0,0 +1,18 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Event details dto.
/// </summary>
public class EventDetailsDto
{
/// <summary>
/// Gets or sets the sub type.
/// </summary>
[JsonPropertyName("subType")]
public string SubType { get; set; }
}
}

@ -0,0 +1,24 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Gracenote dto.
/// </summary>
public class GracenoteDto
{
/// <summary>
/// Gets or sets the season.
/// </summary>
[JsonPropertyName("season")]
public int Season { get; set; }
/// <summary>
/// Gets or sets the episode.
/// </summary>
[JsonPropertyName("episode")]
public int Episode { get; set; }
}
}

@ -0,0 +1,37 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Headends dto.
/// </summary>
public class HeadendsDto
{
/// <summary>
/// Gets or sets the headend.
/// </summary>
[JsonPropertyName("headend")]
public string Headend { get; set; }
/// <summary>
/// Gets or sets the transport.
/// </summary>
[JsonPropertyName("transport")]
public string Transport { get; set; }
/// <summary>
/// Gets or sets the location.
/// </summary>
[JsonPropertyName("location")]
public string Location { get; set; }
/// <summary>
/// Gets or sets the list of lineups.
/// </summary>
[JsonPropertyName("lineups")]
public List<LineupDto> Lineups { get; set; }
}
}

@ -0,0 +1,69 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
public class ImageDataDto
{
/// <summary>
/// Gets or sets the width.
/// </summary>
[JsonPropertyName("width")]
public string Width { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
[JsonPropertyName("height")]
public string Height { get; set; }
/// <summary>
/// Gets or sets the uri.
/// </summary>
[JsonPropertyName("uri")]
public string Uri { get; set; }
/// <summary>
/// Gets or sets the size.
/// </summary>
[JsonPropertyName("size")]
public string Size { get; set; }
/// <summary>
/// Gets or sets the aspect.
/// </summary>
[JsonPropertyName("aspect")]
public string aspect { get; set; }
/// <summary>
/// Gets or sets the category.
/// </summary>
[JsonPropertyName("category")]
public string Category { get; set; }
/// <summary>
/// Gets or sets the text.
/// </summary>
[JsonPropertyName("text")]
public string Text { get; set; }
/// <summary>
/// Gets or sets the primary.
/// </summary>
[JsonPropertyName("primary")]
public string Primary { get; set; }
/// <summary>
/// Gets or sets the tier.
/// </summary>
[JsonPropertyName("tier")]
public string Tier { get; set; }
/// <summary>
/// Gets or sets the caption.
/// </summary>
[JsonPropertyName("caption")]
public CaptionDto Caption { get; set; }
}
}

@ -0,0 +1,42 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// The lineup dto.
/// </summary>
public class LineupDto
{
/// <summary>
/// Gets or sets the linup.
/// </summary>
[JsonPropertyName("lineup")]
public string Lineup { get; set; }
/// <summary>
/// Gets or sets the lineup name.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the transport.
/// </summary>
[JsonPropertyName("transport.")]
public string Transport { get; set; }
/// <summary>
/// Gets or sets the location.
/// </summary>
[JsonPropertyName("location")]
public string Location { get; set; }
/// <summary>
/// Gets or sets the uri.
/// </summary>
[JsonPropertyName("uri")]
public string Uri { get; set; }
}
}

@ -0,0 +1,37 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Lineups dto.
/// </summary>
public class LineupsDto
{
/// <summary>
/// Gets or sets the response code.
/// </summary>
[JsonPropertyName("code")]
public int Code { get; set; }
/// <summary>
/// Gets or sets the server id.
/// </summary>
[JsonPropertyName("serverID")]
public string ServerId { get; set; }
/// <summary>
/// Gets or sets the datetime.
/// </summary>
[JsonPropertyName("datetime")]
public string Datetime { get; set; }
/// <summary>
/// Gets or sets the list of lineups.
/// </summary>
[JsonPropertyName("lineups")]
public List<LineupDto> Lineups { get; set; }
}
}

@ -0,0 +1,36 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Logo dto.
/// </summary>
public class LogoDto
{
/// <summary>
/// Gets or sets the url.
/// </summary>
[JsonPropertyName("URL")]
public string Url { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
[JsonPropertyName("height")]
public int Height { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
[JsonPropertyName("width")]
public int Width { get; set; }
/// <summary>
/// Gets or sets the md5.
/// </summary>
[JsonPropertyName("md5")]
public string Md5 { get; set; }
}
}

@ -0,0 +1,48 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Map dto.
/// </summary>
public class MapDto
{
/// <summary>
/// Gets or sets the station id.
/// </summary>
[JsonPropertyName("stationID")]
public string StationId { get; set; }
/// <summary>
/// Gets or sets the channel.
/// </summary>
[JsonPropertyName("channel")]
public string Channel { get; set; }
/// <summary>
/// Gets or sets the logical channel number.
/// </summary>
[JsonPropertyName("logicalChannelNumber")]
public string LogicalChannelNumber { get; set; }
/// <summary>
/// Gets or sets the uhfvhf.
/// </summary>
[JsonPropertyName("uhfVhf")]
public int UhfVhf { get; set; }
/// <summary>
/// Gets or sets the astc major.
/// </summary>
[JsonPropertyName("astcMajor")]
public int AtscMajor { get; set; }
/// <summary>
/// Gets or sets the astc minor.
/// </summary>
[JsonPropertyName("astcMinor")]
public int AtscMinor { get; set; }
}
}

@ -0,0 +1,30 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Metadata dto.
/// </summary>
public class MetadataDto
{
/// <summary>
/// Gets or sets the linup.
/// </summary>
[JsonPropertyName("lineup")]
public string Lineup { get; set; }
/// <summary>
/// Gets or sets the modified timestamp.
/// </summary>
[JsonPropertyName("modified")]
public string Modified { get; set; }
/// <summary>
/// Gets or sets the transport.
/// </summary>
[JsonPropertyName("transport")]
public string Transport { get; set; }
}
}

@ -0,0 +1,18 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Metadata programs dto.
/// </summary>
public class MetadataProgramsDto
{
/// <summary>
/// Gets or sets the gracenote object.
/// </summary>
[JsonPropertyName("gracenote")]
public GracenoteDto Gracenote { get; set; }
}
}

@ -0,0 +1,42 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Metadata schedule dto.
/// </summary>
public class MetadataScheduleDto
{
/// <summary>
/// Gets or sets the modified timestamp.
/// </summary>
[JsonPropertyName("modified")]
public string Modified { get; set; }
/// <summary>
/// Gets or sets the md5.
/// </summary>
[JsonPropertyName("md5")]
public string Md5 { get; set; }
/// <summary>
/// Gets or sets the start date.
/// </summary>
[JsonPropertyName("startDate")]
public string StartDate { get; set; }
/// <summary>
/// Gets or sets the end date.
/// </summary>
[JsonPropertyName("endDate")]
public string EndDate { get; set; }
/// <summary>
/// Gets or sets the days count.
/// </summary>
[JsonPropertyName("days")]
public int Days { get; set; }
}
}

@ -0,0 +1,31 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Movie dto.
/// </summary>
public class MovieDto
{
/// <summary>
/// Gets or sets the year.
/// </summary>
[JsonPropertyName("year")]
public string Year { get; set; }
/// <summary>
/// Gets or sets the duration.
/// </summary>
[JsonPropertyName("duration")]
public int Duration { get; set; }
/// <summary>
/// Gets or sets the list of quality rating.
/// </summary>
[JsonPropertyName("qualityRating")]
public List<QualityRatingDto> QualityRating { get; set; }
}
}

@ -0,0 +1,24 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Multipart dto.
/// </summary>
public class MultipartDto
{
/// <summary>
/// Gets or sets the part number.
/// </summary>
[JsonPropertyName("partNumber")]
public int PartNumber { get; set; }
/// <summary>
/// Gets or sets the total parts.
/// </summary>
[JsonPropertyName("totalParts")]
public int TotalParts { get; set; }
}
}

@ -0,0 +1,157 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Program details dto.
/// </summary>
public class ProgramDetailsDto
{
/// <summary>
/// Gets or sets the audience.
/// </summary>
[JsonPropertyName("audience")]
public string Audience { get; set; }
/// <summary>
/// Gets or sets the program id.
/// </summary>
[JsonPropertyName("programID")]
public string ProgramId { get; set; }
/// <summary>
/// Gets or sets the list of titles.
/// </summary>
[JsonPropertyName("titles")]
public List<TitleDto> Titles { get; set; }
/// <summary>
/// Gets or sets the event details object.
/// </summary>
[JsonPropertyName("eventDetails")]
public EventDetailsDto EventDetails { get; set; }
/// <summary>
/// Gets or sets the descriptions.
/// </summary>
[JsonPropertyName("descriptions")]
public DescriptionsProgramDto Descriptions { get; set; }
/// <summary>
/// Gets or sets the original air date.
/// </summary>
[JsonPropertyName("originalAirDate")]
public string OriginalAirDate { get; set; }
/// <summary>
/// Gets or sets the list of genres.
/// </summary>
[JsonPropertyName("genres")]
public List<string> Genres { get; set; }
/// <summary>
/// Gets or sets the episode title.
/// </summary>
[JsonPropertyName("episodeTitle150")]
public string EpisodeTitle150 { get; set; }
/// <summary>
/// Gets or sets the list of metadata.
/// </summary>
[JsonPropertyName("metadata")]
public List<MetadataProgramsDto> Metadata { get; set; }
/// <summary>
/// Gets or sets the list of content raitings.
/// </summary>
[JsonPropertyName("contentRating")]
public List<ContentRatingDto> ContentRating { get; set; }
/// <summary>
/// Gets or sets the list of cast.
/// </summary>
[JsonPropertyName("cast")]
public List<CastDto> Cast { get; set; }
/// <summary>
/// Gets or sets the list of crew.
/// </summary>
[JsonPropertyName("crew")]
public List<CrewDto> Crew { get; set; }
/// <summary>
/// Gets or sets the entity type.
/// </summary>
[JsonPropertyName("entityType")]
public string EntityType { get; set; }
/// <summary>
/// Gets or sets the show type.
/// </summary>
[JsonPropertyName("showType")]
public string ShowType { get; set; }
/// <summary>
/// Gets or sets a value indicating whether there is image artwork.
/// </summary>
[JsonPropertyName("hasImageArtwork")]
public bool HasImageArtwork { get; set; }
/// <summary>
/// Gets or sets the primary image.
/// </summary>
[JsonPropertyName("primaryImage")]
public string PrimaryImage { get; set; }
/// <summary>
/// Gets or sets the thumb image.
/// </summary>
[JsonPropertyName("thumbImage")]
public string ThumbImage { get; set; }
/// <summary>
/// Gets or sets the backdrop image.
/// </summary>
[JsonPropertyName("backdropImage")]
public string BackdropImage { get; set; }
/// <summary>
/// Gets or sets the banner image.
/// </summary>
[JsonPropertyName("bannerImage")]
public string BannerImage { get; set; }
/// <summary>
/// Gets or sets the image id.
/// </summary>
[JsonPropertyName("imageID")]
public string ImageId { get; set; }
/// <summary>
/// Gets or sets the md5.
/// </summary>
[JsonPropertyName("md5")]
public string Md5 { get; set; }
/// <summary>
/// Gets or sets the list of content advisory.
/// </summary>
[JsonPropertyName("contentAdvisory")]
public List<string> ContentAdvisory { get; set; }
/// <summary>
/// Gets or sets the movie object.
/// </summary>
[JsonPropertyName("movie")]
public MovieDto Movie { get; set; }
/// <summary>
/// Gets or sets the list of recommendations.
/// </summary>
[JsonPropertyName("recommendations")]
public List<RecommendationDto> Recommendations { get; set; }
}
}

@ -0,0 +1,91 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Program dto.
/// </summary>
public class ProgramDto
{
/// <summary>
/// Gets or sets the program id.
/// </summary>
[JsonPropertyName("programID")]
public string ProgramId { get; set; }
/// <summary>
/// Gets or sets the air date time.
/// </summary>
[JsonPropertyName("airDateTime")]
public string AirDateTime { get; set; }
/// <summary>
/// Gets or sets the duration.
/// </summary>
[JsonPropertyName("duration")]
public int Duration { get; set; }
/// <summary>
/// Gets or sets the md5.
/// </summary>
[JsonPropertyName("md5")]
public string Md5 { get; set; }
/// <summary>
/// Gets or sets the list of audio properties.
/// </summary>
[JsonPropertyName("audioProperties")]
public List<string> AudioProperties { get; set; }
/// <summary>
/// Gets or sets the list of video properties.
/// </summary>
[JsonPropertyName("videoProperties")]
public List<string> VideoProperties { get; set; }
/// <summary>
/// Gets or sets the list of ratings.
/// </summary>
[JsonPropertyName("ratings")]
public List<RatingDto> Ratings { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this program is new.
/// </summary>
[JsonPropertyName("new")]
public bool? New { get; set; }
/// <summary>
/// Gets or sets the multipart object.
/// </summary>
[JsonPropertyName("multipart")]
public MultipartDto Multipart { get; set; }
/// <summary>
/// Gets or sets the live tape delay.
/// </summary>
[JsonPropertyName("liveTapeDelay")]
public string LiveTapeDelay { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this is the premiere.
/// </summary>
[JsonPropertyName("premiere")]
public bool Premiere { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this is a repeat.
/// </summary>
[JsonPropertyName("repeat")]
public bool Repeat { get; set; }
/// <summary>
/// Gets or sets the premiere or finale.
/// </summary>
[JsonPropertyName("isPremiereOrFinale")]
public string IsPremiereOrFinale { get; set; }
}
}

@ -0,0 +1,42 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Quality rating dto.
/// </summary>
public class QualityRatingDto
{
/// <summary>
/// Gets or sets the ratings body.
/// </summary>
[JsonPropertyName("ratingsBody")]
public string RatingsBody { get; set; }
/// <summary>
/// Gets or sets the rating.
/// </summary>
[JsonPropertyName("rating")]
public string Rating { get; set; }
/// <summary>
/// Gets or sets the min rating.
/// </summary>
[JsonPropertyName("minRating")]
public string MinRating { get; set; }
/// <summary>
/// Gets or sets the max rating.
/// </summary>
[JsonPropertyName("maxRating")]
public string MaxRating { get; set; }
/// <summary>
/// Gets or sets the increment.
/// </summary>
[JsonPropertyName("increment")]
public string Increment { get; set; }
}
}

@ -0,0 +1,24 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Rating dto.
/// </summary>
public class RatingDto
{
/// <summary>
/// Gets or sets the body.
/// </summary>
[JsonPropertyName("body")]
public string Body { get; set; }
/// <summary>
/// Gets or sets the code.
/// </summary>
[JsonPropertyName("code")]
public string Code { get; set; }
}
}

@ -0,0 +1,24 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Recommendation dto.
/// </summary>
public class RecommendationDto
{
/// <summary>
/// Gets or sets the program id.
/// </summary>
[JsonPropertyName("programID")]
public string ProgramId { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
[JsonPropertyName("title120")]
public string Title120 { get; set; }
}
}

@ -0,0 +1,25 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Request schedule for channel dto.
/// </summary>
public class RequestScheduleForChannelDto
{
/// <summary>
/// Gets or sets the station id.
/// </summary>
[JsonPropertyName("stationID")]
public string StationId { get; set; }
/// <summary>
/// Gets or sets the list of dates.
/// </summary>
[JsonPropertyName("date")]
public List<string> Date { get; set; }
}
}

@ -0,0 +1,22 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
public class ShowImagesDto
{
/// <summary>
/// Gets or sets the program id.
/// </summary>
[JsonPropertyName("programID")]
public string ProgramId { get; set; }
/// <summary>
/// Gets or sets the list of data.
/// </summary>
[JsonPropertyName("data")]
public List<ImageDataDto> Data { get; set; }
}
}

@ -0,0 +1,67 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Station dto.
/// </summary>
public class StationDto
{
/// <summary>
/// Gets or sets the station id.
/// </summary>
[JsonPropertyName("stationID")]
public string StationId { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the callsign.
/// </summary>
[JsonPropertyName("callsign")]
public string Callsign { get; set; }
/// <summary>
/// Gets or sets the broadcast language.
/// </summary>
[JsonPropertyName("broadcastLanguage")]
public List<string> BroadcastLanguage { get; set; }
/// <summary>
/// Gets or sets the description language.
/// </summary>
[JsonPropertyName("descriptionLanguage")]
public List<string> DescriptionLanguage { get; set; }
/// <summary>
/// Gets or sets the broadcaster.
/// </summary>
[JsonPropertyName("broadcaster")]
public BroadcasterDto Broadcaster { get; set; }
/// <summary>
/// Gets or sets the affiliate.
/// </summary>
[JsonPropertyName("affiliate")]
public string Affiliate { get; set; }
/// <summary>
/// Gets or sets the logo.
/// </summary>
[JsonPropertyName("logo")]
public LogoDto Logo { get; set; }
/// <summary>
/// Gets or set a value indicating whether it is commercial free.
/// </summary>
[JsonPropertyName("isCommercialFree")]
public bool? IsCommercialFree { get; set; }
}
}

@ -0,0 +1,18 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Title dto.
/// </summary>
public class TitleDto
{
/// <summary>
/// Gets or sets the title.
/// </summary>
[JsonPropertyName("title120")]
public string Title120 { get; set; }
}
}

@ -0,0 +1,36 @@
#nullable disable
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// The token dto.
/// </summary>
public class TokenDto
{
/// <summary>
/// Gets or sets the response code.
/// </summary>
[JsonPropertyName("code")]
public int Code { get; set; }
/// <summary>
/// Gets or sets the response message.
/// </summary>
[JsonPropertyName("message")]
public string Message { get; set; }
/// <summary>
/// Gets or sets the server id.
/// </summary>
[JsonPropertyName("serverID")]
public string ServerId { get; set; }
/// <summary>
/// Gets or sets the token.
/// </summary>
[JsonPropertyName("token")]
public string Token { get; set; }
}
}

@ -403,7 +403,7 @@ namespace Emby.Server.Implementations.LiveTv
// Set the total bitrate if not already supplied // Set the total bitrate if not already supplied
mediaSource.InferTotalBitrate(); mediaSource.InferTotalBitrate();
if (!(service is EmbyTV.EmbyTV)) if (service is not EmbyTV.EmbyTV)
{ {
// We can't trust that we'll be able to direct stream it through emby server, no matter what the provider says // We can't trust that we'll be able to direct stream it through emby server, no matter what the provider says
// mediaSource.SupportsDirectPlay = false; // mediaSource.SupportsDirectPlay = false;
@ -1724,7 +1724,7 @@ namespace Emby.Server.Implementations.LiveTv
await service.CancelTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); await service.CancelTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false);
if (!(service is EmbyTV.EmbyTV)) if (service is not EmbyTV.EmbyTV)
{ {
TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>(new TimerEventInfo(id))); TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>(new TimerEventInfo(id)));
} }
@ -2050,7 +2050,7 @@ namespace Emby.Server.Implementations.LiveTv
_logger.LogInformation("New recording scheduled"); _logger.LogInformation("New recording scheduled");
if (!(service is EmbyTV.EmbyTV)) if (service is not EmbyTV.EmbyTV)
{ {
TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>( TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>(
new TimerEventInfo(newTimerId) new TimerEventInfo(newTimerId)

@ -27,6 +27,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{ {
private string _channel; private string _channel;
private string _program; private string _program;
public LegacyHdHomerunChannelCommands(string url) public LegacyHdHomerunChannelCommands(string url)
{ {
// parse url for channel and program // parse url for channel and program

@ -260,7 +260,7 @@ namespace Emby.Server.Implementations.Playlists
public async Task RemoveFromPlaylistAsync(string playlistId, IEnumerable<string> entryIds) public async Task RemoveFromPlaylistAsync(string playlistId, IEnumerable<string> entryIds)
{ {
if (!(_libraryManager.GetItemById(playlistId) is Playlist playlist)) if (_libraryManager.GetItemById(playlistId) is not Playlist playlist)
{ {
throw new ArgumentException("No Playlist exists with the supplied Id"); throw new ArgumentException("No Playlist exists with the supplied Id");
} }
@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.Playlists
public async Task MoveItemAsync(string playlistId, string entryId, int newIndex) public async Task MoveItemAsync(string playlistId, string entryId, int newIndex)
{ {
if (!(_libraryManager.GetItemById(playlistId) is Playlist playlist)) if (_libraryManager.GetItemById(playlistId) is not Playlist playlist)
{ {
throw new ArgumentException("No Playlist exists with the supplied Id"); throw new ArgumentException("No Playlist exists with the supplied Id");
} }

@ -24,7 +24,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </summary> /// </summary>
public class ScheduledTaskWorker : IScheduledTaskWorker public class ScheduledTaskWorker : IScheduledTaskWorker
{ {
/// <summary> /// <summary>
/// Gets or sets the application paths. /// Gets or sets the application paths.
/// </summary> /// </summary>
@ -267,7 +266,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
} }
/// <summary> /// <summary>
/// Gets the triggers that define when the task will run. /// Gets or sets the triggers that define when the task will run.
/// </summary> /// </summary>
/// <value>The triggers.</value> /// <value>The triggers.</value>
/// <exception cref="ArgumentNullException"><c>value</c> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException"><c>value</c> is <c>null</c>.</exception>

@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
private static string? GetValue(BaseItem? x) private static string? GetValue(BaseItem? x)
{ {
if (!(x is Audio audio)) if (x is not Audio audio)
{ {
return string.Empty; return string.Empty;
} }

@ -154,11 +154,11 @@ namespace Jellyfin.Api.Controllers
}; };
if (!item.IsVirtualItem if (!item.IsVirtualItem
&& !(item is ICollectionFolder) && item is not ICollectionFolder
&& !(item is UserView) && item is not UserView
&& !(item is AggregateFolder) && item is not AggregateFolder
&& !(item is LiveTvChannel) && item is not LiveTvChannel
&& !(item is IItemByName) && item is not IItemByName
&& item.SourceType == SourceType.Library) && item.SourceType == SourceType.Library)
{ {
var inheritedContentType = _libraryManager.GetInheritedContentType(item); var inheritedContentType = _libraryManager.GetInheritedContentType(item);

@ -241,7 +241,7 @@ namespace Jellyfin.Api.Controllers
var item = _libraryManager.GetParentItem(parentId, userId); var item = _libraryManager.GetParentItem(parentId, userId);
QueryResult<BaseItem> result; QueryResult<BaseItem> result;
if (!(item is Folder folder)) if (item is not Folder folder)
{ {
folder = _libraryManager.GetUserRootFolder(); folder = _libraryManager.GetUserRootFolder();
} }
@ -285,7 +285,7 @@ namespace Jellyfin.Api.Controllers
return Unauthorized($"{user.Username} is not permitted to access Library {item.Name}."); return Unauthorized($"{user.Username} is not permitted to access Library {item.Name}.");
} }
if ((recursive.HasValue && recursive.Value) || ids.Length != 0 || !(item is UserRootFolder)) if ((recursive.HasValue && recursive.Value) || ids.Length != 0 || item is not UserRootFolder)
{ {
var query = new InternalItemsQuery(user!) var query = new InternalItemsQuery(user!)
{ {

@ -700,7 +700,7 @@ namespace Jellyfin.Api.Controllers
: _libraryManager.RootFolder) : _libraryManager.RootFolder)
: _libraryManager.GetItemById(itemId); : _libraryManager.GetItemById(itemId);
if (item is Episode || (item is IItemByName && !(item is MusicArtist))) if (item is Episode || (item is IItemByName && item is not MusicArtist))
{ {
return new QueryResult<BaseItemDto>(); return new QueryResult<BaseItemDto>();
} }

@ -228,7 +228,7 @@ namespace Jellyfin.Api.Controllers
if (seasonId.HasValue) // Season id was supplied. Get episodes by season id. if (seasonId.HasValue) // Season id was supplied. Get episodes by season id.
{ {
var item = _libraryManager.GetItemById(seasonId.Value); var item = _libraryManager.GetItemById(seasonId.Value);
if (!(item is Season seasonItem)) if (item is not Season seasonItem)
{ {
return NotFound("No season exists with Id " + seasonId); return NotFound("No season exists with Id " + seasonId);
} }
@ -237,7 +237,7 @@ namespace Jellyfin.Api.Controllers
} }
else if (season.HasValue) // Season number was supplied. Get episodes by season number else if (season.HasValue) // Season number was supplied. Get episodes by season number
{ {
if (!(_libraryManager.GetItemById(seriesId) is Series series)) if (_libraryManager.GetItemById(seriesId) is not Series series)
{ {
return NotFound("Series not found"); return NotFound("Series not found");
} }
@ -252,7 +252,7 @@ namespace Jellyfin.Api.Controllers
} }
else // No season number or season id was supplied. Returning all episodes. else // No season number or season id was supplied. Returning all episodes.
{ {
if (!(_libraryManager.GetItemById(seriesId) is Series series)) if (_libraryManager.GetItemById(seriesId) is not Series series)
{ {
return NotFound("Series not found"); return NotFound("Series not found");
} }
@ -336,7 +336,7 @@ namespace Jellyfin.Api.Controllers
? _userManager.GetUserById(userId.Value) ? _userManager.GetUserById(userId.Value)
: null; : null;
if (!(_libraryManager.GetItemById(seriesId) is Series series)) if (_libraryManager.GetItemById(seriesId) is not Series series)
{ {
return NotFound("Series not found"); return NotFound("Series not found");
} }

@ -222,11 +222,7 @@ namespace Jellyfin.Api.Helpers
{ {
var resolution = ResolutionNormalizer.Normalize( var resolution = ResolutionNormalizer.Normalize(
state.VideoStream?.BitRate, state.VideoStream?.BitRate,
state.VideoStream?.Width,
state.VideoStream?.Height,
state.OutputVideoBitrate.Value, state.OutputVideoBitrate.Value,
state.VideoStream?.Codec,
state.OutputVideoCodec,
state.VideoRequest.MaxWidth, state.VideoRequest.MaxWidth,
state.VideoRequest.MaxHeight); state.VideoRequest.MaxHeight);

@ -112,7 +112,7 @@ namespace MediaBrowser.Controller.Entities
private string _name; private string _name;
public static char SlugChar = '-'; public const char SlugChar = '-';
protected BaseItem() protected BaseItem()
{ {
@ -2050,7 +2050,7 @@ namespace MediaBrowser.Controller.Entities
public virtual string GetClientTypeName() public virtual string GetClientTypeName()
{ {
if (IsFolder && SourceType == SourceType.Channel && !(this is Channel)) if (IsFolder && SourceType == SourceType.Channel && this is not Channel)
{ {
return "ChannelFolderItem"; return "ChannelFolderItem";
} }

@ -233,7 +233,7 @@ namespace MediaBrowser.Controller.Entities
public override bool IsVisible(User user) public override bool IsVisible(User user)
{ {
if (this is ICollectionFolder && !(this is BasePluginFolder)) if (this is ICollectionFolder && this is not BasePluginFolder)
{ {
var blockedMediaFolders = user.GetPreferenceValues<Guid>(PreferenceKind.BlockedMediaFolders); var blockedMediaFolders = user.GetPreferenceValues<Guid>(PreferenceKind.BlockedMediaFolders);
if (blockedMediaFolders.Length > 0) if (blockedMediaFolders.Length > 0)
@ -673,7 +673,7 @@ namespace MediaBrowser.Controller.Entities
{ {
if (LinkedChildren.Length > 0) if (LinkedChildren.Length > 0)
{ {
if (!(this is ICollectionFolder)) if (this is not ICollectionFolder)
{ {
return GetChildren(user, true).Count; return GetChildren(user, true).Count;
} }
@ -730,7 +730,7 @@ namespace MediaBrowser.Controller.Entities
return PostFilterAndSort(items, query, true); return PostFilterAndSort(items, query, true);
} }
if (!(this is UserRootFolder) && !(this is AggregateFolder) && query.ParentId == Guid.Empty) if (this is not UserRootFolder && this is not AggregateFolder && query.ParentId == Guid.Empty)
{ {
query.Parent = this; query.Parent = this;
} }
@ -805,7 +805,7 @@ namespace MediaBrowser.Controller.Entities
{ {
if (LinkedChildren.Length > 0) if (LinkedChildren.Length > 0)
{ {
if (!(this is ICollectionFolder)) if (this is not ICollectionFolder)
{ {
Logger.LogDebug("Query requires post-filtering due to LinkedChildren. Type: " + GetType().Name); Logger.LogDebug("Query requires post-filtering due to LinkedChildren. Type: " + GetType().Name);
return true; return true;
@ -1545,7 +1545,7 @@ namespace MediaBrowser.Controller.Entities
var childOwner = child.GetOwner() ?? child; var childOwner = child.GetOwner() ?? child;
if (childOwner != null && !(child is IItemByName)) if (child is not IItemByName)
{ {
var childProtocol = childOwner.PathProtocol; var childProtocol = childOwner.PathProtocol;
if (!childProtocol.HasValue || childProtocol.Value != Model.MediaInfo.MediaProtocol.File) if (!childProtocol.HasValue || childProtocol.Value != Model.MediaInfo.MediaProtocol.File)

@ -296,7 +296,7 @@ namespace MediaBrowser.Controller.Entities.TV
// Refresh seasons // Refresh seasons
foreach (var item in items) foreach (var item in items)
{ {
if (!(item is Season)) if (item is not Season)
{ {
continue; continue;
} }

@ -504,7 +504,9 @@ namespace MediaBrowser.Controller.MediaEncoding
var arg = new StringBuilder(); var arg = new StringBuilder();
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions) ?? string.Empty; var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions) ?? string.Empty;
var outputVideoCodec = GetVideoEncoder(state, encodingOptions) ?? string.Empty; var outputVideoCodec = GetVideoEncoder(state, encodingOptions) ?? string.Empty;
#pragma warning disable CA1508 // Defaults to string.Empty
var isSwDecoder = string.IsNullOrEmpty(videoDecoder); var isSwDecoder = string.IsNullOrEmpty(videoDecoder);
#pragma warning restore CA1508
var isD3d11vaDecoder = videoDecoder.IndexOf("d3d11va", StringComparison.OrdinalIgnoreCase) != -1; var isD3d11vaDecoder = videoDecoder.IndexOf("d3d11va", StringComparison.OrdinalIgnoreCase) != -1;
var isVaapiDecoder = videoDecoder.IndexOf("vaapi", StringComparison.OrdinalIgnoreCase) != -1; var isVaapiDecoder = videoDecoder.IndexOf("vaapi", StringComparison.OrdinalIgnoreCase) != -1;
var isVaapiEncoder = outputVideoCodec.IndexOf("vaapi", StringComparison.OrdinalIgnoreCase) != -1; var isVaapiEncoder = outputVideoCodec.IndexOf("vaapi", StringComparison.OrdinalIgnoreCase) != -1;
@ -1759,7 +1761,7 @@ namespace MediaBrowser.Controller.MediaEncoding
var request = state.BaseRequest; var request = state.BaseRequest;
var inputChannels = audioStream?.Channels; var inputChannels = audioStream.Channels;
if (inputChannels <= 0) if (inputChannels <= 0)
{ {
@ -2027,8 +2029,8 @@ namespace MediaBrowser.Controller.MediaEncoding
{ {
// Adjust the size of graphical subtitles to fit the video stream. // Adjust the size of graphical subtitles to fit the video stream.
var videoStream = state.VideoStream; var videoStream = state.VideoStream;
var inputWidth = videoStream?.Width; var inputWidth = videoStream.Width;
var inputHeight = videoStream?.Height; var inputHeight = videoStream.Height;
var (width, height) = GetFixedOutputSize(inputWidth, inputHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight); var (width, height) = GetFixedOutputSize(inputWidth, inputHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight);
if (width.HasValue && height.HasValue) if (width.HasValue && height.HasValue)
@ -3101,7 +3103,7 @@ namespace MediaBrowser.Controller.MediaEncoding
inputModifier += " " + videoDecoder; inputModifier += " " + videoDecoder;
if (!IsCopyCodec(state.OutputVideoCodec) if (!IsCopyCodec(state.OutputVideoCodec)
&& (videoDecoder ?? string.Empty).IndexOf("cuvid", StringComparison.OrdinalIgnoreCase) != -1) && videoDecoder.IndexOf("cuvid", StringComparison.OrdinalIgnoreCase) != -1)
{ {
var videoStream = state.VideoStream; var videoStream = state.VideoStream;
var inputWidth = videoStream?.Width; var inputWidth = videoStream?.Width;
@ -3110,7 +3112,7 @@ namespace MediaBrowser.Controller.MediaEncoding
var (width, height) = GetFixedOutputSize(inputWidth, inputHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight); var (width, height) = GetFixedOutputSize(inputWidth, inputHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight);
if ((videoDecoder ?? string.Empty).IndexOf("cuvid", StringComparison.OrdinalIgnoreCase) != -1 if (videoDecoder.IndexOf("cuvid", StringComparison.OrdinalIgnoreCase) != -1
&& width.HasValue && width.HasValue
&& height.HasValue) && height.HasValue)
{ {

@ -422,7 +422,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (EncodingHelper.IsCopyCodec(OutputVideoCodec)) if (EncodingHelper.IsCopyCodec(OutputVideoCodec))
{ {
return VideoStream?.Codec; return VideoStream.Codec;
} }
return OutputVideoCodec; return OutputVideoCodec;
@ -440,7 +440,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (EncodingHelper.IsCopyCodec(OutputAudioCodec)) if (EncodingHelper.IsCopyCodec(OutputAudioCodec))
{ {
return AudioStream?.Codec; return AudioStream.Codec;
} }
return OutputAudioCodec; return OutputAudioCodec;
@ -568,7 +568,7 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
} }
return forceDeinterlaceIfSourceIsInterlaced && isInputInterlaced; return forceDeinterlaceIfSourceIsInterlaced;
} }
public string[] GetRequestedProfiles(string codec) public string[] GetRequestedProfiles(string codec)

@ -283,7 +283,7 @@ namespace MediaBrowser.LocalMetadata.Images
{ {
imageFileNames = _seriesImageFileNames; imageFileNames = _seriesImageFileNames;
} }
else if (item is Video && !(item is Episode)) else if (item is Video && item is not Episode)
{ {
imageFileNames = _videoImageFileNames; imageFileNames = _videoImageFileNames;
} }

@ -223,7 +223,7 @@ namespace MediaBrowser.LocalMetadata.Savers
writer.WriteElementString("CustomRating", item.CustomRating); writer.WriteElementString("CustomRating", item.CustomRating);
} }
if (!string.IsNullOrEmpty(item.Name) && !(item is Episode)) if (!string.IsNullOrEmpty(item.Name) && item is not Episode)
{ {
writer.WriteElementString("LocalTitle", item.Name); writer.WriteElementString("LocalTitle", item.Name);
} }
@ -240,7 +240,7 @@ namespace MediaBrowser.LocalMetadata.Savers
{ {
writer.WriteElementString("BirthDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); writer.WriteElementString("BirthDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
} }
else if (!(item is Episode)) else if (item is not Episode)
{ {
writer.WriteElementString("PremiereDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); writer.WriteElementString("PremiereDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
} }
@ -252,7 +252,7 @@ namespace MediaBrowser.LocalMetadata.Savers
{ {
writer.WriteElementString("DeathDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); writer.WriteElementString("DeathDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
} }
else if (!(item is Episode)) else if (item is not Episode)
{ {
writer.WriteElementString("EndDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); writer.WriteElementString("EndDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
} }
@ -292,7 +292,7 @@ namespace MediaBrowser.LocalMetadata.Savers
writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(_usCulture)); writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(_usCulture));
} }
if (item.ProductionYear.HasValue && !(item is Person)) if (item.ProductionYear.HasValue && item is not Person)
{ {
writer.WriteElementString("ProductionYear", item.ProductionYear.Value.ToString(_usCulture)); writer.WriteElementString("ProductionYear", item.ProductionYear.Value.ToString(_usCulture));
} }

@ -1,4 +1,4 @@
#pragma warning disable CS1591 #pragma warning disable CS1591, CA1707
namespace MediaBrowser.Model.Dlna namespace MediaBrowser.Model.Dlna
{ {

@ -21,11 +21,7 @@ namespace MediaBrowser.Model.Dlna
public static ResolutionOptions Normalize( public static ResolutionOptions Normalize(
int? inputBitrate, int? inputBitrate,
int? unused1,
int? unused2,
int outputBitrate, int outputBitrate,
string inputCodec,
string outputCodec,
int? maxWidth, int? maxWidth,
int? maxHeight) int? maxHeight)
{ {

@ -694,7 +694,7 @@ namespace MediaBrowser.Model.Dlna
if (isEligibleForDirectPlay || isEligibleForDirectStream) if (isEligibleForDirectPlay || isEligibleForDirectStream)
{ {
// See if it can be direct played // See if it can be direct played
var directPlayInfo = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream); var directPlayInfo = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectStream);
var directPlay = directPlayInfo.Item1; var directPlay = directPlayInfo.Item1;
if (directPlay != null) if (directPlay != null)
@ -810,7 +810,7 @@ namespace MediaBrowser.Model.Dlna
// Honor requested max channels // Honor requested max channels
playlistItem.GlobalMaxAudioChannels = options.MaxAudioChannels; playlistItem.GlobalMaxAudioChannels = options.MaxAudioChannels;
int audioBitrate = GetAudioBitrate(playlistItem.SubProtocol, options.GetMaxBitrate(false) ?? 0, playlistItem.TargetAudioCodec, audioStream, playlistItem); int audioBitrate = GetAudioBitrate(options.GetMaxBitrate(false) ?? 0, playlistItem.TargetAudioCodec, audioStream, playlistItem);
playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate); playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate);
isFirstAppliedCodecProfile = true; isFirstAppliedCodecProfile = true;
@ -907,7 +907,7 @@ namespace MediaBrowser.Model.Dlna
return 192000; return 192000;
} }
private static int GetAudioBitrate(string subProtocol, long maxTotalBitrate, string[] targetAudioCodecs, MediaStream audioStream, StreamInfo item) private static int GetAudioBitrate(long maxTotalBitrate, string[] targetAudioCodecs, MediaStream audioStream, StreamInfo item)
{ {
string targetAudioCodec = targetAudioCodecs.Length == 0 ? null : targetAudioCodecs[0]; string targetAudioCodec = targetAudioCodecs.Length == 0 ? null : targetAudioCodecs[0];
@ -1005,7 +1005,6 @@ namespace MediaBrowser.Model.Dlna
MediaSourceInfo mediaSource, MediaSourceInfo mediaSource,
MediaStream videoStream, MediaStream videoStream,
MediaStream audioStream, MediaStream audioStream,
bool isEligibleForDirectPlay,
bool isEligibleForDirectStream) bool isEligibleForDirectStream)
{ {
if (options.ForceDirectPlay) if (options.ForceDirectPlay)
@ -1146,7 +1145,7 @@ namespace MediaBrowser.Model.Dlna
{ {
string audioCodec = audioStream.Codec; string audioCodec = audioStream.Codec;
conditions = new List<ProfileCondition>(); conditions = new List<ProfileCondition>();
bool? isSecondaryAudio = audioStream == null ? null : mediaSource.IsSecondaryAudio(audioStream); bool? isSecondaryAudio = mediaSource.IsSecondaryAudio(audioStream);
foreach (var i in profile.CodecProfiles) foreach (var i in profile.CodecProfiles)
{ {
@ -1262,7 +1261,7 @@ namespace MediaBrowser.Model.Dlna
continue; continue;
} }
if (playMethod == PlayMethod.Transcode && !IsSubtitleEmbedSupported(subtitleStream, profile, transcodingSubProtocol, outputContainer)) if (playMethod == PlayMethod.Transcode && !IsSubtitleEmbedSupported(outputContainer))
{ {
continue; continue;
} }
@ -1291,7 +1290,7 @@ namespace MediaBrowser.Model.Dlna
continue; continue;
} }
if (playMethod == PlayMethod.Transcode && !IsSubtitleEmbedSupported(subtitleStream, profile, transcodingSubProtocol, outputContainer)) if (playMethod == PlayMethod.Transcode && !IsSubtitleEmbedSupported(outputContainer))
{ {
continue; continue;
} }
@ -1313,7 +1312,7 @@ namespace MediaBrowser.Model.Dlna
}; };
} }
private static bool IsSubtitleEmbedSupported(MediaStream subtitleStream, SubtitleProfile subtitleProfile, string transcodingSubProtocol, string transcodingContainer) private static bool IsSubtitleEmbedSupported(string transcodingContainer)
{ {
if (!string.IsNullOrEmpty(transcodingContainer)) if (!string.IsNullOrEmpty(transcodingContainer))
{ {
@ -1728,18 +1727,14 @@ namespace MediaBrowser.Model.Dlna
continue; continue;
} }
if (!string.IsNullOrEmpty(value)) // change from split by | to comma
{ // strip spaces to avoid having to encode
// change from split by | to comma var values = value
.Split('|', StringSplitOptions.RemoveEmptyEntries);
// strip spaces to avoid having to encode
var values = value
.Split('|', StringSplitOptions.RemoveEmptyEntries);
if (condition.Condition == ProfileConditionType.Equals || condition.Condition == ProfileConditionType.EqualsAny) if (condition.Condition == ProfileConditionType.Equals || condition.Condition == ProfileConditionType.EqualsAny)
{ {
item.SetOption(qualifier, "profile", string.Join(',', values)); item.SetOption(qualifier, "profile", string.Join(',', values));
}
} }
break; break;

@ -636,7 +636,7 @@ namespace MediaBrowser.Model.Dlna
continue; continue;
} }
var encodedValue = pair.Value.Replace(" ", "%20"); var encodedValue = pair.Value.Replace(" ", "%20", StringComparison.Ordinal);
list.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}", pair.Name, encodedValue)); list.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}", pair.Name, encodedValue));
} }

@ -261,7 +261,7 @@ namespace MediaBrowser.Model.Entities
foreach (var tag in attributes) foreach (var tag in attributes)
{ {
// Keep Tags that are not already in Title. // Keep Tags that are not already in Title.
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1) if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
{ {
result.Append(" - ").Append(tag); result.Append(" - ").Append(tag);
} }

@ -51,7 +51,7 @@ namespace MediaBrowser.Model.IO
/// <returns>A <see cref="FileSystemMetadata" /> object.</returns> /// <returns>A <see cref="FileSystemMetadata" /> object.</returns>
/// <remarks><para>If the specified path points to a directory, the returned <see cref="FileSystemMetadata" /> object's /// <remarks><para>If the specified path points to a directory, the returned <see cref="FileSystemMetadata" /> object's
/// <see cref="FileSystemMetadata.IsDirectory" /> property and the <see cref="FileSystemMetadata.Exists" /> property will both be set to false.</para> /// <see cref="FileSystemMetadata.IsDirectory" /> property and the <see cref="FileSystemMetadata.Exists" /> property will both be set to false.</para>
/// <para>For automatic handling of files <b>and</b> directories, use <see cref="M:IFileSystem.GetFileSystemInfo(System.String)" />.</para></remarks> /// <para>For automatic handling of files <b>and</b> directories, use <see cref="GetFileSystemInfo(string)" />.</para></remarks>
FileSystemMetadata GetFileInfo(string path); FileSystemMetadata GetFileInfo(string path);
/// <summary> /// <summary>
@ -61,7 +61,7 @@ namespace MediaBrowser.Model.IO
/// <returns>A <see cref="FileSystemMetadata" /> object.</returns> /// <returns>A <see cref="FileSystemMetadata" /> object.</returns>
/// <remarks><para>If the specified path points to a file, the returned <see cref="FileSystemMetadata" /> object's /// <remarks><para>If the specified path points to a file, the returned <see cref="FileSystemMetadata" /> object's
/// <see cref="FileSystemMetadata.IsDirectory" /> property will be set to true and the <see cref="FileSystemMetadata.Exists" /> property will be set to false.</para> /// <see cref="FileSystemMetadata.IsDirectory" /> property will be set to true and the <see cref="FileSystemMetadata.Exists" /> property will be set to false.</para>
/// <para>For automatic handling of files <b>and</b> directories, use <see cref="M:IFileSystem.GetFileSystemInfo(System.String)" />.</para></remarks> /// <para>For automatic handling of files <b>and</b> directories, use <see cref="GetFileSystemInfo(string)" />.</para></remarks>
FileSystemMetadata GetDirectoryInfo(string path); FileSystemMetadata GetDirectoryInfo(string path);
/// <summary> /// <summary>

@ -91,7 +91,7 @@ namespace MediaBrowser.Providers.Manager
throw new ArgumentNullException(nameof(mimeType)); throw new ArgumentNullException(nameof(mimeType));
} }
var saveLocally = item.SupportsLocalMetadata && item.IsSaveLocalMetadataEnabled() && !item.ExtraType.HasValue && !(item is Audio); var saveLocally = item.SupportsLocalMetadata && item.IsSaveLocalMetadataEnabled() && !item.ExtraType.HasValue && item is not Audio;
if (type != ImageType.Primary && item is Episode) if (type != ImageType.Primary && item is Episode)
{ {

@ -57,7 +57,7 @@ namespace MediaBrowser.Providers.Manager
{ {
var hasChanges = false; var hasChanges = false;
if (!(item is Photo)) if (item is not Photo)
{ {
var images = providers.OfType<ILocalImageProvider>() var images = providers.OfType<ILocalImageProvider>()
.SelectMany(i => i.GetImages(item, directoryService)) .SelectMany(i => i.GetImages(item, directoryService))
@ -529,7 +529,7 @@ namespace MediaBrowser.Providers.Manager
return true; return true;
} }
if (item is IItemByName && !(item is MusicArtist)) if (item is IItemByName && item is not MusicArtist)
{ {
var hasDualAccess = item as IHasDualAccess; var hasDualAccess = item as IHasDualAccess;
if (hasDualAccess == null || hasDualAccess.IsAccessedByName) if (hasDualAccess == null || hasDualAccess.IsAccessedByName)

@ -584,7 +584,7 @@ namespace MediaBrowser.Providers.Manager
protected virtual IEnumerable<IImageProvider> GetNonLocalImageProviders(BaseItem item, IEnumerable<IImageProvider> allImageProviders, ImageRefreshOptions options) protected virtual IEnumerable<IImageProvider> GetNonLocalImageProviders(BaseItem item, IEnumerable<IImageProvider> allImageProviders, ImageRefreshOptions options)
{ {
// Get providers to refresh // Get providers to refresh
var providers = allImageProviders.Where(i => !(i is ILocalImageProvider)); var providers = allImageProviders.Where(i => i is not ILocalImageProvider);
var dateLastImageRefresh = item.DateLastRefreshed; var dateLastImageRefresh = item.DateLastRefreshed;
@ -729,7 +729,7 @@ namespace MediaBrowser.Providers.Manager
refreshResult.Failures += remoteResult.Failures; refreshResult.Failures += remoteResult.Failures;
} }
if (providers.Any(i => !(i is ICustomMetadataProvider))) if (providers.Any(i => i is not ICustomMetadataProvider))
{ {
if (refreshResult.UpdateType > ItemUpdateType.None) if (refreshResult.UpdateType > ItemUpdateType.None)
{ {
@ -748,7 +748,7 @@ namespace MediaBrowser.Providers.Manager
// var isUnidentified = failedProviderCount > 0 && successfulProviderCount == 0; // var isUnidentified = failedProviderCount > 0 && successfulProviderCount == 0;
foreach (var provider in customProviders.Where(i => !(i is IPreRefreshProvider))) foreach (var provider in customProviders.Where(i => i is not IPreRefreshProvider))
{ {
await RunCustomProvider(provider, item, logName, options, refreshResult, cancellationToken).ConfigureAwait(false); await RunCustomProvider(provider, item, logName, options, refreshResult, cancellationToken).ConfigureAwait(false);
} }

@ -323,7 +323,7 @@ namespace MediaBrowser.Providers.Manager
.OrderBy(i => .OrderBy(i =>
{ {
// See if there's a user-defined order // See if there's a user-defined order
if (!(i is ILocalImageProvider)) if (i is not ILocalImageProvider)
{ {
var fetcherOrder = typeFetcherOrder ?? currentOptions.ImageFetcherOrder; var fetcherOrder = typeFetcherOrder ?? currentOptions.ImageFetcherOrder;
var index = Array.IndexOf(fetcherOrder, i.Name); var index = Array.IndexOf(fetcherOrder, i.Name);
@ -390,7 +390,7 @@ namespace MediaBrowser.Providers.Manager
if (!includeDisabled) if (!includeDisabled)
{ {
// If locked only allow local providers // If locked only allow local providers
if (item.IsLocked && !(provider is ILocalMetadataProvider) && !(provider is IForcedProvider)) if (item.IsLocked && provider is not ILocalMetadataProvider && provider is not IForcedProvider)
{ {
return false; return false;
} }
@ -431,7 +431,7 @@ namespace MediaBrowser.Providers.Manager
if (!includeDisabled) if (!includeDisabled)
{ {
// If locked only allow local providers // If locked only allow local providers
if (item.IsLocked && !(provider is ILocalImageProvider)) if (item.IsLocked && provider is not ILocalImageProvider)
{ {
if (refreshOptions.ImageRefreshMode != MetadataRefreshMode.FullRefresh) if (refreshOptions.ImageRefreshMode != MetadataRefreshMode.FullRefresh)
{ {
@ -466,7 +466,7 @@ namespace MediaBrowser.Providers.Manager
/// <returns>System.Int32.</returns> /// <returns>System.Int32.</returns>
private int GetOrder(IImageProvider provider) private int GetOrder(IImageProvider provider)
{ {
if (!(provider is IHasOrder hasOrder)) if (provider is not IHasOrder hasOrder)
{ {
return 0; return 0;
} }
@ -745,7 +745,7 @@ namespace MediaBrowser.Providers.Manager
{ {
// Manual edit occurred // Manual edit occurred
// Even if save local is off, save locally anyway if the metadata file already exists // Even if save local is off, save locally anyway if the metadata file already exists
if (!(saver is IMetadataFileSaver fileSaver) || !File.Exists(fileSaver.GetSavePath(item))) if (saver is not IMetadataFileSaver fileSaver || !File.Exists(fileSaver.GetSavePath(item)))
{ {
return false; return false;
} }

@ -135,7 +135,7 @@ namespace MediaBrowser.Providers.Manager
{ {
if (replaceData || !target.RunTimeTicks.HasValue) if (replaceData || !target.RunTimeTicks.HasValue)
{ {
if (!(target is Audio) && !(target is Video)) if (target is not Audio && target is not Video)
{ {
target.RunTimeTicks = source.RunTimeTicks; target.RunTimeTicks = source.RunTimeTicks;
} }

@ -555,7 +555,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
} }
// Series xml saver already saves this // Series xml saver already saves this
if (!(item is Series)) if (item is not Series)
{ {
var tvdb = item.GetProviderId(MetadataProvider.Tvdb); var tvdb = item.GetProviderId(MetadataProvider.Tvdb);
if (!string.IsNullOrEmpty(tvdb)) if (!string.IsNullOrEmpty(tvdb))
@ -582,7 +582,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
writer.WriteElementString("countrycode", item.PreferredMetadataCountryCode); writer.WriteElementString("countrycode", item.PreferredMetadataCountryCode);
} }
if (item.PremiereDate.HasValue && !(item is Episode)) if (item.PremiereDate.HasValue && item is not Episode)
{ {
var formatString = options.ReleaseDateFormat; var formatString = options.ReleaseDateFormat;
@ -605,7 +605,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
if (item.EndDate.HasValue) if (item.EndDate.HasValue)
{ {
if (!(item is Episode)) if (item is not Episode)
{ {
var formatString = options.ReleaseDateFormat; var formatString = options.ReleaseDateFormat;

@ -82,7 +82,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
} }
// Check parent for null to avoid running this against things like video backdrops // Check parent for null to avoid running this against things like video backdrops
if (item is Video video && !(item is Episode) && !video.ExtraType.HasValue) if (item is Video video && item is not Episode && !video.ExtraType.HasValue)
{ {
return updateType >= MinimumUpdateType; return updateType >= MinimumUpdateType;
} }

@ -52,7 +52,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return false; return false;
} }
if (!(item is Season)) if (item is not Season)
{ {
return false; return false;
} }

Loading…
Cancel
Save