mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 00:55:13 +01:00
Merge branch 'master' into authenticationdb-efcore
# Conflicts: # Emby.Server.Implementations/Security/AuthenticationRepository.cs # Jellyfin.Server.Implementations/Security/AuthorizationContext.cs # MediaBrowser.Controller/Devices/IDeviceManager.cs
This commit is contained in:
@@ -181,11 +181,9 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
foreach (var row in connection.Query("PRAGMA table_info(" + table + ")"))
|
||||
{
|
||||
if (row[1].SQLiteType != SQLiteType.Null)
|
||||
if (row.TryGetString(1, out var columnName))
|
||||
{
|
||||
var name = row[1].ToString();
|
||||
|
||||
columnNames.Add(name);
|
||||
columnNames.Add(columnName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using SQLitePCL.pretty;
|
||||
|
||||
@@ -96,21 +97,43 @@ namespace Emby.Server.Implementations.Data
|
||||
DateTimeStyles.None).ToUniversalTime();
|
||||
}
|
||||
|
||||
public static DateTime? TryReadDateTime(this IResultSetValue result)
|
||||
public static bool TryReadDateTime(this IReadOnlyList<IResultSetValue> reader, int index, out DateTime result)
|
||||
{
|
||||
var dateText = result.ToString();
|
||||
var item = reader[index];
|
||||
if (item.IsDbNull())
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
var dateText = item.ToString();
|
||||
|
||||
if (DateTime.TryParseExact(dateText, _datetimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out var dateTimeResult))
|
||||
{
|
||||
return dateTimeResult.ToUniversalTime();
|
||||
result = dateTimeResult.ToUniversalTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsDBNull(this IReadOnlyList<IResultSetValue> result, int index)
|
||||
public static bool TryGetGuid(this IReadOnlyList<IResultSetValue> reader, int index, out Guid result)
|
||||
{
|
||||
return result[index].SQLiteType == SQLiteType.Null;
|
||||
var item = reader[index];
|
||||
if (item.IsDbNull())
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
result = item.ReadGuidFromBlob();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsDbNull(this IResultSetValue result)
|
||||
{
|
||||
return result.SQLiteType == SQLiteType.Null;
|
||||
}
|
||||
|
||||
public static string GetString(this IReadOnlyList<IResultSetValue> result, int index)
|
||||
@@ -118,14 +141,48 @@ namespace Emby.Server.Implementations.Data
|
||||
return result[index].ToString();
|
||||
}
|
||||
|
||||
public static bool TryGetString(this IReadOnlyList<IResultSetValue> reader, int index, out string result)
|
||||
{
|
||||
result = null;
|
||||
var item = reader[index];
|
||||
if (item.IsDbNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
result = item.ToString();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool GetBoolean(this IReadOnlyList<IResultSetValue> result, int index)
|
||||
{
|
||||
return result[index].ToBool();
|
||||
}
|
||||
|
||||
public static int GetInt32(this IReadOnlyList<IResultSetValue> result, int index)
|
||||
public static bool TryGetBoolean(this IReadOnlyList<IResultSetValue> reader, int index, out bool result)
|
||||
{
|
||||
return result[index].ToInt();
|
||||
var item = reader[index];
|
||||
if (item.IsDbNull())
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
result = item.ToBool();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryGetInt32(this IReadOnlyList<IResultSetValue> reader, int index, out int result)
|
||||
{
|
||||
var item = reader[index];
|
||||
if (item.IsDbNull())
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
result = item.ToInt();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static long GetInt64(this IReadOnlyList<IResultSetValue> result, int index)
|
||||
@@ -133,9 +190,43 @@ namespace Emby.Server.Implementations.Data
|
||||
return result[index].ToInt64();
|
||||
}
|
||||
|
||||
public static float GetFloat(this IReadOnlyList<IResultSetValue> result, int index)
|
||||
public static bool TryGetInt64(this IReadOnlyList<IResultSetValue> reader, int index, out long result)
|
||||
{
|
||||
return result[index].ToFloat();
|
||||
var item = reader[index];
|
||||
if (item.IsDbNull())
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
result = item.ToInt64();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryGetSingle(this IReadOnlyList<IResultSetValue> reader, int index, out float result)
|
||||
{
|
||||
var item = reader[index];
|
||||
if (item.IsDbNull())
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
result = item.ToFloat();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryGetDouble(this IReadOnlyList<IResultSetValue> reader, int index, out double result)
|
||||
{
|
||||
var item = reader[index];
|
||||
if (item.IsDbNull())
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
result = item.ToDouble();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Guid GetGuid(this IReadOnlyList<IResultSetValue> result, int index)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -355,9 +355,9 @@ namespace Emby.Server.Implementations.Data
|
||||
userData.Key = reader[0].ToString();
|
||||
// userData.UserId = reader[1].ReadGuidFromBlob();
|
||||
|
||||
if (reader[2].SQLiteType != SQLiteType.Null)
|
||||
if (reader.TryGetDouble(2, out var rating))
|
||||
{
|
||||
userData.Rating = reader[2].ToDouble();
|
||||
userData.Rating = rating;
|
||||
}
|
||||
|
||||
userData.Played = reader[3].ToBool();
|
||||
@@ -365,19 +365,19 @@ namespace Emby.Server.Implementations.Data
|
||||
userData.IsFavorite = reader[5].ToBool();
|
||||
userData.PlaybackPositionTicks = reader[6].ToInt64();
|
||||
|
||||
if (reader[7].SQLiteType != SQLiteType.Null)
|
||||
if (reader.TryReadDateTime(7, out var lastPlayedDate))
|
||||
{
|
||||
userData.LastPlayedDate = reader[7].TryReadDateTime();
|
||||
userData.LastPlayedDate = lastPlayedDate;
|
||||
}
|
||||
|
||||
if (reader[8].SQLiteType != SQLiteType.Null)
|
||||
if (reader.TryGetInt32(8, out var audioStreamIndex))
|
||||
{
|
||||
userData.AudioStreamIndex = reader[8].ToInt();
|
||||
userData.AudioStreamIndex = audioStreamIndex;
|
||||
}
|
||||
|
||||
if (reader[9].SQLiteType != SQLiteType.Null)
|
||||
if (reader.TryGetInt32(9, out var subtitleStreamIndex))
|
||||
{
|
||||
userData.SubtitleStreamIndex = reader[9].ToInt();
|
||||
userData.SubtitleStreamIndex = subtitleStreamIndex;
|
||||
}
|
||||
|
||||
return userData;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.6" />
|
||||
<PackageReference Include="Mono.Nat" Version="3.0.1" />
|
||||
<PackageReference Include="prometheus-net.DotNetRuntime" Version="4.1.0" />
|
||||
<PackageReference Include="sharpcompress" Version="0.28.2" />
|
||||
|
||||
@@ -165,13 +165,13 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
|
||||
protected void SetVideoType(Video video, VideoFileInfo videoInfo)
|
||||
{
|
||||
var extension = Path.GetExtension(video.Path);
|
||||
video.VideoType = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
|
||||
VideoType.Iso :
|
||||
VideoType.VideoFile;
|
||||
var extension = Path.GetExtension(video.Path.AsSpan());
|
||||
video.VideoType = extension.Equals(".iso", StringComparison.OrdinalIgnoreCase)
|
||||
|| extension.Equals(".img", StringComparison.OrdinalIgnoreCase)
|
||||
? VideoType.Iso
|
||||
: VideoType.VideoFile;
|
||||
|
||||
video.IsShortcut = string.Equals(extension, ".strm", StringComparison.OrdinalIgnoreCase);
|
||||
video.IsShortcut = extension.Equals(".strm", StringComparison.OrdinalIgnoreCase);
|
||||
video.IsPlaceHolder = videoInfo.IsStub;
|
||||
|
||||
if (videoInfo.IsStub)
|
||||
@@ -193,11 +193,11 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
if (video.VideoType == VideoType.Iso)
|
||||
{
|
||||
if (video.Path.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
if (video.Path.Contains("dvd", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
video.IsoType = IsoType.Dvd;
|
||||
}
|
||||
else if (video.Path.IndexOf("bluray", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
else if (video.Path.Contains("bluray", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
video.IsoType = IsoType.BluRay;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using MediaBrowser.Controller.LiveTv;
|
||||
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
internal class RecordingHelper
|
||||
internal static class RecordingHelper
|
||||
{
|
||||
public static DateTime GetStartTime(TimerInfo timer)
|
||||
{
|
||||
@@ -70,17 +70,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
private static string GetDateString(DateTime date)
|
||||
{
|
||||
date = date.ToLocalTime();
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0}_{1}_{2}_{3}_{4}_{5}",
|
||||
date.Year.ToString("0000", CultureInfo.InvariantCulture),
|
||||
date.Month.ToString("00", CultureInfo.InvariantCulture),
|
||||
date.Day.ToString("00", CultureInfo.InvariantCulture),
|
||||
date.Hour.ToString("00", CultureInfo.InvariantCulture),
|
||||
date.Minute.ToString("00", CultureInfo.InvariantCulture),
|
||||
date.Second.ToString("00", CultureInfo.InvariantCulture));
|
||||
return date.ToLocalTime().ToString("yyyy_MM_dd_HH_mm_ss", CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
{
|
||||
var model = await GetModelInfo(info, false, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(model.LineupURL, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(model.LineupURL ?? model.BaseURL + "/lineup.json", HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var lineup = await JsonSerializer.DeserializeAsync<List<Channels>>(stream, _jsonOptions, cancellationToken)
|
||||
.ConfigureAwait(false) ?? new List<Channels>();
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"MixedContent": "Смесено съдържание",
|
||||
"Movies": "Филми",
|
||||
"Music": "Музика",
|
||||
"MusicVideos": "Музикални клипове",
|
||||
"MusicVideos": "Музикални видеа",
|
||||
"NameInstallFailed": "{0} не можа да се инсталира",
|
||||
"NameSeasonNumber": "Сезон {0}",
|
||||
"NameSeasonUnknown": "Неразпознат сезон",
|
||||
@@ -62,7 +62,7 @@
|
||||
"NotificationOptionVideoPlaybackStopped": "Възпроизвеждането на видео е спряно",
|
||||
"Photos": "Снимки",
|
||||
"Playlists": "Списъци",
|
||||
"Plugin": "Приставка",
|
||||
"Plugin": "Добавка",
|
||||
"PluginInstalledWithName": "{0} е инсталиранa",
|
||||
"PluginUninstalledWithName": "{0} е деинсталиранa",
|
||||
"PluginUpdatedWithName": "{0} е обновенa",
|
||||
@@ -116,5 +116,7 @@
|
||||
"TasksMaintenanceCategory": "Поддръжка",
|
||||
"Undefined": "Неопределено",
|
||||
"Forced": "Принудително",
|
||||
"Default": "По подразбиране"
|
||||
"Default": "По подразбиране",
|
||||
"TaskCleanActivityLogDescription": "Изтрива записите в дневника с активност по стари от конфигурираната възраст.",
|
||||
"TaskCleanActivityLog": "Изчисти дневника с активност"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"DeviceOnlineWithName": "{0}-এর সাথে সংযুক্ত হয়েছে",
|
||||
"DeviceOfflineWithName": "{0}-এর সাথে সংযোগ বিচ্ছিন্ন হয়েছে",
|
||||
"Collections": "কলেক্শন",
|
||||
"Collections": "সংগ্রহ",
|
||||
"ChapterNameValue": "অধ্যায় {0}",
|
||||
"Channels": "চ্যানেল",
|
||||
"CameraImageUploadedFrom": "{0} থেকে একটি নতুন ক্যামেরার চিত্র আপলোড করা হয়েছে",
|
||||
|
||||
Reference in New Issue
Block a user