mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-26 02:27:06 +01:00
Merge remote-tracking branch 'upstream/master' into api-migration
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Model.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
#nullable disable
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Enums;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the display preferences for any item that supports them (usually Folders).
|
||||
/// </summary>
|
||||
public class DisplayPreferences
|
||||
public class DisplayPreferencesDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The image scale.
|
||||
/// Initializes a new instance of the <see cref="DisplayPreferencesDto" /> class.
|
||||
/// </summary>
|
||||
private const double ImageScale = .9;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DisplayPreferences" /> class.
|
||||
/// </summary>
|
||||
public DisplayPreferences()
|
||||
public DisplayPreferencesDto()
|
||||
{
|
||||
RememberIndexing = false;
|
||||
PrimaryImageHeight = 250;
|
||||
@@ -112,107 +112,146 @@ namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Type == MediaStreamType.Audio)
|
||||
switch (Type)
|
||||
{
|
||||
// if (!string.IsNullOrEmpty(Title))
|
||||
//{
|
||||
// return AddLanguageIfNeeded(Title);
|
||||
//}
|
||||
|
||||
var attributes = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(Language))
|
||||
case MediaStreamType.Audio:
|
||||
{
|
||||
attributes.Add(StringHelper.FirstToUpper(Language));
|
||||
var attributes = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(Language))
|
||||
{
|
||||
// Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
|
||||
string fullLanguage = CultureInfo
|
||||
.GetCultures(CultureTypes.NeutralCultures)
|
||||
.FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
|
||||
?.DisplayName;
|
||||
attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
attributes.Add(AudioCodec.GetFriendlyName(Codec));
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
attributes.Add(Profile);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ChannelLayout))
|
||||
{
|
||||
attributes.Add(StringHelper.FirstToUpper(ChannelLayout));
|
||||
}
|
||||
else if (Channels.HasValue)
|
||||
{
|
||||
attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");
|
||||
}
|
||||
|
||||
if (IsDefault)
|
||||
{
|
||||
attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Title))
|
||||
{
|
||||
var result = new StringBuilder(Title);
|
||||
foreach (var tag in attributes)
|
||||
{
|
||||
// Keep Tags that are not already in Title.
|
||||
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
result.Append(" - ").Append(tag);
|
||||
}
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
return string.Join(" - ", attributes);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
|
||||
case MediaStreamType.Video:
|
||||
{
|
||||
attributes.Add(AudioCodec.GetFriendlyName(Codec));
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
attributes.Add(Profile);
|
||||
var attributes = new List<string>();
|
||||
|
||||
var resolutionText = GetResolutionText();
|
||||
|
||||
if (!string.IsNullOrEmpty(resolutionText))
|
||||
{
|
||||
attributes.Add(resolutionText);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Codec))
|
||||
{
|
||||
attributes.Add(Codec.ToUpperInvariant());
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Title))
|
||||
{
|
||||
var result = new StringBuilder(Title);
|
||||
foreach (var tag in attributes)
|
||||
{
|
||||
// Keep Tags that are not already in Title.
|
||||
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
result.Append(" - ").Append(tag);
|
||||
}
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
return string.Join(" ", attributes);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ChannelLayout))
|
||||
case MediaStreamType.Subtitle:
|
||||
{
|
||||
attributes.Add(ChannelLayout);
|
||||
}
|
||||
else if (Channels.HasValue)
|
||||
{
|
||||
attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");
|
||||
var attributes = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(Language))
|
||||
{
|
||||
// Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
|
||||
string fullLanguage = CultureInfo
|
||||
.GetCultures(CultureTypes.NeutralCultures)
|
||||
.FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
|
||||
?.DisplayName;
|
||||
attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes.Add(string.IsNullOrEmpty(localizedUndefined) ? "Und" : localizedUndefined);
|
||||
}
|
||||
|
||||
if (IsDefault)
|
||||
{
|
||||
attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
|
||||
}
|
||||
|
||||
if (IsForced)
|
||||
{
|
||||
attributes.Add(string.IsNullOrEmpty(localizedForced) ? "Forced" : localizedForced);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Title))
|
||||
{
|
||||
var result = new StringBuilder(Title);
|
||||
foreach (var tag in attributes)
|
||||
{
|
||||
// Keep Tags that are not already in Title.
|
||||
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
result.Append(" - ").Append(tag);
|
||||
}
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
return string.Join(" - ", attributes.ToArray());
|
||||
}
|
||||
|
||||
if (IsDefault)
|
||||
{
|
||||
attributes.Add("Default");
|
||||
}
|
||||
|
||||
return string.Join(" ", attributes);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Type == MediaStreamType.Video)
|
||||
{
|
||||
var attributes = new List<string>();
|
||||
|
||||
var resolutionText = GetResolutionText();
|
||||
|
||||
if (!string.IsNullOrEmpty(resolutionText))
|
||||
{
|
||||
attributes.Add(resolutionText);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Codec))
|
||||
{
|
||||
attributes.Add(Codec.ToUpperInvariant());
|
||||
}
|
||||
|
||||
return string.Join(" ", attributes);
|
||||
}
|
||||
|
||||
if (Type == MediaStreamType.Subtitle)
|
||||
{
|
||||
|
||||
var attributes = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(Language))
|
||||
{
|
||||
attributes.Add(StringHelper.FirstToUpper(Language));
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes.Add(string.IsNullOrEmpty(localizedUndefined) ? "Und" : localizedUndefined);
|
||||
}
|
||||
|
||||
if (IsDefault)
|
||||
{
|
||||
attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
|
||||
}
|
||||
|
||||
if (IsForced)
|
||||
{
|
||||
attributes.Add(string.IsNullOrEmpty(localizedForced) ? "Forced" : localizedForced);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Title))
|
||||
{
|
||||
return attributes.AsEnumerable()
|
||||
// keep Tags that are not already in Title
|
||||
.Where(tag => Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
||||
// attributes concatenation, starting with Title
|
||||
.Aggregate(new StringBuilder(Title), (builder, attr) => builder.Append(" - ").Append(attr))
|
||||
.ToString();
|
||||
}
|
||||
|
||||
return string.Join(" - ", attributes.ToArray());
|
||||
}
|
||||
|
||||
if (Type == MediaStreamType.Video)
|
||||
{
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum ScrollDirection.
|
||||
/// </summary>
|
||||
public enum ScrollDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// The horizontal.
|
||||
/// </summary>
|
||||
Horizontal,
|
||||
|
||||
/// <summary>
|
||||
/// The vertical.
|
||||
/// </summary>
|
||||
Vertical
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum SortOrder.
|
||||
/// </summary>
|
||||
public enum SortOrder
|
||||
{
|
||||
/// <summary>
|
||||
/// The ascending.
|
||||
/// </summary>
|
||||
Ascending,
|
||||
|
||||
/// <summary>
|
||||
/// The descending.
|
||||
/// </summary>
|
||||
Descending
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
|
||||
namespace MediaBrowser.Model.LiveTv
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Model.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
|
||||
namespace MediaBrowser.Model.LiveTv
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#pragma warning disable CA1819 // Properties should not return arrays
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
@@ -9,21 +10,27 @@ namespace MediaBrowser.Model.Notifications
|
||||
public NotificationOption(string type)
|
||||
{
|
||||
Type = type;
|
||||
|
||||
DisabledServices = Array.Empty<string>();
|
||||
DisabledMonitorUsers = Array.Empty<string>();
|
||||
SendToUsers = Array.Empty<string>();
|
||||
}
|
||||
|
||||
public string Type { get; set; }
|
||||
public NotificationOption()
|
||||
{
|
||||
DisabledServices = Array.Empty<string>();
|
||||
DisabledMonitorUsers = Array.Empty<string>();
|
||||
SendToUsers = Array.Empty<string>();
|
||||
}
|
||||
|
||||
public string? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User Ids to not monitor (it's opt out).
|
||||
/// Gets or sets user Ids to not monitor (it's opt out).
|
||||
/// </summary>
|
||||
public string[] DisabledMonitorUsers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User Ids to send to (if SendToUserMode == Custom)
|
||||
/// Gets or sets user Ids to send to (if SendToUserMode == Custom).
|
||||
/// </summary>
|
||||
public string[] SendToUsers { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user