mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-08 07:12:56 +01:00
add additional view settings
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Model.Configuration
|
||||
{
|
||||
@@ -90,7 +88,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
NotificationOption opt = GetOptions(notificationType);
|
||||
|
||||
return opt == null ||
|
||||
!opt.DisabledServices.Contains(service, StringComparer.OrdinalIgnoreCase);
|
||||
!ListHelper.ContainsIgnoreCase(opt.DisabledServices, service);
|
||||
}
|
||||
|
||||
public bool IsEnabledToMonitorUser(string type, string userId)
|
||||
@@ -98,7 +96,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
NotificationOption opt = GetOptions(type);
|
||||
|
||||
return opt != null && opt.Enabled &&
|
||||
!opt.DisabledMonitorUsers.Contains(userId, StringComparer.OrdinalIgnoreCase);
|
||||
!ListHelper.ContainsIgnoreCase(opt.DisabledMonitorUsers, userId);
|
||||
}
|
||||
|
||||
public bool IsEnabledToSendToUser(string type, string userId, UserConfiguration userConfig)
|
||||
@@ -117,7 +115,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
return true;
|
||||
}
|
||||
|
||||
return opt.SendToUsers.Contains(userId, StringComparer.OrdinalIgnoreCase);
|
||||
return ListHelper.ContainsIgnoreCase(opt.SendToUsers, userId);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
public UnratedItem[] BlockUnratedItems { get; set; }
|
||||
|
||||
public SubtitlePlaybackMode SubtitleMode { get; set; }
|
||||
public bool DisplayCollectionsView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
|
||||
@@ -92,6 +93,8 @@ namespace MediaBrowser.Model.Configuration
|
||||
BlockUnratedItems = new UnratedItem[] { };
|
||||
|
||||
ExcludeFoldersFromGrouping = new string[] { };
|
||||
|
||||
DisplayCollectionsView = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec)
|
||||
{
|
||||
container = (container ?? string.Empty).TrimStart('.');
|
||||
container = StringHelper.TrimStart((container ?? string.Empty), '.');
|
||||
|
||||
foreach (var i in TranscodingProfiles)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public TranscodingProfile GetVideoTranscodingProfile(string container, string audioCodec, string videoCodec)
|
||||
{
|
||||
container = (container ?? string.Empty).TrimStart('.');
|
||||
container = StringHelper.TrimStart((container ?? string.Empty), '.');
|
||||
|
||||
foreach (var i in TranscodingProfiles)
|
||||
{
|
||||
@@ -172,7 +172,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate)
|
||||
{
|
||||
container = (container ?? string.Empty).TrimStart('.');
|
||||
container = StringHelper.TrimStart((container ?? string.Empty), '.');
|
||||
|
||||
foreach (var i in ResponseProfiles)
|
||||
{
|
||||
@@ -217,7 +217,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public ResponseProfile GetImageMediaProfile(string container, int? width, int? height)
|
||||
{
|
||||
container = (container ?? string.Empty).TrimStart('.');
|
||||
container = StringHelper.TrimStart((container ?? string.Empty), '.');
|
||||
|
||||
foreach (var i in ResponseProfiles)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
TransportStreamTimestamp timestamp,
|
||||
bool? isAnamorphic)
|
||||
{
|
||||
container = (container ?? string.Empty).TrimStart('.');
|
||||
container = StringHelper.TrimStart((container ?? string.Empty), '.');
|
||||
|
||||
foreach (var i in ResponseProfiles)
|
||||
{
|
||||
|
||||
@@ -136,7 +136,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
||||
{
|
||||
if (i.Type == CodecType.Audio && i.ContainsCodec(audioCodec))
|
||||
conditions.AddRange(i.Conditions);
|
||||
{
|
||||
foreach (var c in i.Conditions)
|
||||
{
|
||||
conditions.Add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int? audioChannels = audioStream.Channels;
|
||||
@@ -195,7 +200,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>();
|
||||
foreach (CodecProfile i in audioCodecProfiles)
|
||||
audioTranscodingConditions.AddRange(i.Conditions);
|
||||
{
|
||||
foreach (var c in i.Conditions)
|
||||
{
|
||||
audioTranscodingConditions.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
ApplyTranscodingConditions(playlistItem, audioTranscodingConditions);
|
||||
|
||||
@@ -276,7 +286,10 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
if (i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec))
|
||||
{
|
||||
videoTranscodingConditions.AddRange(i.Conditions);
|
||||
foreach (var c in i.Conditions)
|
||||
{
|
||||
videoTranscodingConditions.Add(c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -287,7 +300,10 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
if (i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec))
|
||||
{
|
||||
audioTranscodingConditions.AddRange(i.Conditions);
|
||||
foreach (var c in i.Conditions)
|
||||
{
|
||||
audioTranscodingConditions.Add(c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -363,7 +379,10 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (i.Type == DlnaProfileType.Video &&
|
||||
ListHelper.ContainsIgnoreCase(i.GetContainers(), container))
|
||||
{
|
||||
conditions.AddRange(i.Conditions);
|
||||
foreach (var c in i.Conditions)
|
||||
{
|
||||
conditions.Add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,7 +424,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
foreach (CodecProfile i in profile.CodecProfiles)
|
||||
{
|
||||
if (i.Type == CodecType.Video && i.ContainsCodec(videoCodec))
|
||||
conditions.AddRange(i.Conditions);
|
||||
{
|
||||
foreach (var c in i.Conditions)
|
||||
{
|
||||
conditions.Add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ProfileCondition i in conditions)
|
||||
@@ -429,7 +453,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
foreach (CodecProfile i in profile.CodecProfiles)
|
||||
{
|
||||
if (i.Type == CodecType.VideoAudio && i.ContainsCodec(audioCodec))
|
||||
conditions.AddRange(i.Conditions);
|
||||
{
|
||||
foreach (var c in i.Conditions)
|
||||
{
|
||||
conditions.Add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ProfileCondition i in conditions)
|
||||
|
||||
@@ -305,8 +305,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
int? totalBitrate = TargetTotalBitrate;
|
||||
|
||||
double totalSeconds = RunTimeTicks.Value;
|
||||
// Convert to ms
|
||||
totalSeconds /= 10000;
|
||||
// Convert to seconds
|
||||
totalSeconds /= 1000;
|
||||
|
||||
return totalBitrate.HasValue ?
|
||||
Convert.ToInt64(totalBitrate.Value * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds) :
|
||||
Convert.ToInt64(totalBitrate.Value * totalSeconds) :
|
||||
(long?)null;
|
||||
}
|
||||
|
||||
@@ -375,11 +381,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
Height = videoStream.Height.Value
|
||||
};
|
||||
|
||||
double? maxWidth = MaxWidth.HasValue ? (double)MaxWidth.Value : (double?)null;
|
||||
double? maxHeight = MaxHeight.HasValue ? (double)MaxHeight.Value : (double?)null;
|
||||
|
||||
ImageSize newSize = DrawingUtils.Resize(size,
|
||||
null,
|
||||
null,
|
||||
MaxWidth,
|
||||
MaxHeight);
|
||||
maxWidth,
|
||||
maxHeight);
|
||||
|
||||
return Convert.ToInt32(newSize.Width);
|
||||
}
|
||||
@@ -402,11 +411,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
Height = videoStream.Height.Value
|
||||
};
|
||||
|
||||
double? maxWidth = MaxWidth.HasValue ? (double)MaxWidth.Value : (double?)null;
|
||||
double? maxHeight = MaxHeight.HasValue ? (double)MaxHeight.Value : (double?)null;
|
||||
|
||||
ImageSize newSize = DrawingUtils.Resize(size,
|
||||
null,
|
||||
null,
|
||||
MaxWidth,
|
||||
MaxHeight);
|
||||
maxWidth,
|
||||
maxHeight);
|
||||
|
||||
return Convert.ToInt32(newSize.Height);
|
||||
}
|
||||
|
||||
@@ -59,5 +59,16 @@ namespace MediaBrowser.Model.Extensions
|
||||
{
|
||||
return val.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trims the start.
|
||||
/// </summary>
|
||||
/// <param name="str">The string.</param>
|
||||
/// <param name="c">The c.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string TrimStart(string str, char c)
|
||||
{
|
||||
return str.TrimStart(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,5 @@ namespace MediaBrowser.Model.Notifications
|
||||
public string Url { get; set; }
|
||||
|
||||
public NotificationLevel Level { get; set; }
|
||||
|
||||
public Notification()
|
||||
{
|
||||
Date = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user