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

View File

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

View File

@ -127,14 +127,22 @@ namespace MediaBrowser.Providers.TV
bool isVirtualItem,
CancellationToken cancellationToken)
{
var seasonName = seasonNumber == 0
? _libraryManager.GetLibraryOptions(series).SeasonZeroDisplayName
: (seasonNumber.HasValue
? string.Format(
CultureInfo.InvariantCulture,
_localization.GetLocalizedString("NameSeasonNumber"),
seasonNumber.Value)
: _localization.GetLocalizedString("NameSeasonUnknown"));
string seasonName;
if (seasonNumber == null)
{
seasonName =_localization.GetLocalizedString("NameSeasonUnknown")
}
else if (seasonNumber == 0)
{
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);