Address comments

This commit is contained in:
Bond_009 2019-10-11 18:16:42 +02:00 committed by Bond_009
parent 016be02cd6
commit 10ae815bb4
3 changed files with 23 additions and 15 deletions

View File

@ -9,6 +9,9 @@ namespace Emby.Server.Implementations.Data
{ {
public static class SqliteExtensions public static class SqliteExtensions
{ {
private const string DatetimeFormatUtc = "yyyy-MM-dd HH:mm:ss.FFFFFFFK";
private const string DatetimeFormatLocal = "yyyy-MM-dd HH:mm:ss.FFFFFFF";
/// <summary> /// <summary>
/// An array of ISO-8601 DateTime formats that we support parsing. /// An array of ISO-8601 DateTime formats that we support parsing.
/// </summary> /// </summary>
@ -19,7 +22,7 @@ namespace Emby.Server.Implementations.Data
"HH:mm:ss.FFFFFFFK", "HH:mm:ss.FFFFFFFK",
"HH:mm:ssK", "HH:mm:ssK",
"HH:mmK", "HH:mmK",
"yyyy-MM-dd HH:mm:ss.FFFFFFFK", /* NOTE: UTC default (5). */ DatetimeFormatUtc,
"yyyy-MM-dd HH:mm:ssK", "yyyy-MM-dd HH:mm:ssK",
"yyyy-MM-dd HH:mmK", "yyyy-MM-dd HH:mmK",
"yyyy-MM-ddTHH:mm:ss.FFFFFFFK", "yyyy-MM-ddTHH:mm:ss.FFFFFFFK",
@ -33,7 +36,7 @@ namespace Emby.Server.Implementations.Data
"HH:mm:ss.FFFFFFF", "HH:mm:ss.FFFFFFF",
"HH:mm:ss", "HH:mm:ss",
"HH:mm", "HH:mm",
"yyyy-MM-dd HH:mm:ss.FFFFFFF", /* NOTE: Non-UTC default (19). */ DatetimeFormatLocal,
"yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss",
"yyyy-MM-dd HH:mm", "yyyy-MM-dd HH:mm",
"yyyy-MM-ddTHH:mm:ss.FFFFFFF", "yyyy-MM-ddTHH:mm:ss.FFFFFFF",
@ -47,9 +50,6 @@ namespace Emby.Server.Implementations.Data
"yy-MM-dd" "yy-MM-dd"
}; };
private static readonly string _datetimeFormatUtc = _datetimeFormats[5];
private static readonly string _datetimeFormatLocal = _datetimeFormats[19];
public static void RunQueries(this SQLiteDatabaseConnection connection, string[] queries) public static void RunQueries(this SQLiteDatabaseConnection connection, string[] queries)
{ {
if (queries == null) if (queries == null)
@ -82,7 +82,7 @@ namespace Emby.Server.Implementations.Data
} }
private static string GetDateTimeKindFormat(DateTimeKind kind) private static string GetDateTimeKindFormat(DateTimeKind kind)
=> (kind == DateTimeKind.Utc) ? _datetimeFormatUtc : _datetimeFormatLocal; => (kind == DateTimeKind.Utc) ? DatetimeFormatUtc : DatetimeFormatLocal;
public static DateTime ReadDateTime(this IResultSetValue result) public static DateTime ReadDateTime(this IResultSetValue result)
{ {

View File

@ -54,7 +54,7 @@ namespace MediaBrowser.Providers.Subtitles
public void AddParts(IEnumerable<ISubtitleProvider> subtitleProviders) public void AddParts(IEnumerable<ISubtitleProvider> subtitleProviders)
{ {
_subtitleProviders = subtitleProviders _subtitleProviders = subtitleProviders
.OrderBy(i => !(i is IHasOrder hasOrder) ? 0 : hasOrder.Order) .OrderBy(i => i is IHasOrder hasOrder ? hasOrder.Order : 0)
.ToArray(); .ToArray();
} }

View File

@ -127,14 +127,22 @@ namespace MediaBrowser.Providers.TV
bool isVirtualItem, bool isVirtualItem,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var seasonName = seasonNumber == 0 string seasonName;
? _libraryManager.GetLibraryOptions(series).SeasonZeroDisplayName if (seasonNumber == null)
: (seasonNumber.HasValue {
? string.Format( seasonName =_localization.GetLocalizedString("NameSeasonUnknown")
CultureInfo.InvariantCulture, }
_localization.GetLocalizedString("NameSeasonNumber"), else if (seasonNumber == 0)
seasonNumber.Value) {
: _localization.GetLocalizedString("NameSeasonUnknown")); seasonName = _libraryManager.GetLibraryOptions(series).SeasonZeroDisplayName;
}
else
{
seasonName = string.Format(
CultureInfo.InvariantCulture,
_localization.GetLocalizedString("NameSeasonNumber"),
seasonNumber.Value);
}
_logger.LogInformation("Creating Season {0} entry for {1}", seasonName, series.Name); _logger.LogInformation("Creating Season {0} entry for {1}", seasonName, series.Name);