mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-07 10:14:14 -04:00
commit
8c2095b24e
@ -110,5 +110,10 @@ namespace Emby.Common.Implementations.EnvironmentInfo
|
|||||||
{
|
{
|
||||||
get { return Environment.StackTrace; }
|
get { return Environment.StackTrace; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetProcessEnvironmentVariable(string name, string value)
|
||||||
|
{
|
||||||
|
Environment.SetEnvironmentVariable(name, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -789,7 +789,8 @@ namespace Emby.Server.Core
|
|||||||
MemoryStreamFactory,
|
MemoryStreamFactory,
|
||||||
ProcessFactory,
|
ProcessFactory,
|
||||||
(Environment.ProcessorCount > 2 ? 14000 : 40000),
|
(Environment.ProcessorCount > 2 ? 14000 : 40000),
|
||||||
EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows);
|
EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows,
|
||||||
|
EnvironmentInfo);
|
||||||
|
|
||||||
MediaEncoder = mediaEncoder;
|
MediaEncoder = mediaEncoder;
|
||||||
RegisterSingleInstance(MediaEncoder);
|
RegisterSingleInstance(MediaEncoder);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Emby.Server.Implementations.Localization;
|
using Emby.Server.Implementations.Localization;
|
||||||
|
|
||||||
namespace Emby.Server.Core.Localization
|
namespace Emby.Server.Core.Localization
|
||||||
@ -10,11 +11,41 @@ namespace Emby.Server.Core.Localization
|
|||||||
{
|
{
|
||||||
public string RemoveDiacritics(string text)
|
public string RemoveDiacritics(string text)
|
||||||
{
|
{
|
||||||
return String.Concat(
|
if (text == null)
|
||||||
text.Normalize(NormalizationForm.FormD)
|
{
|
||||||
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) !=
|
throw new ArgumentNullException("text");
|
||||||
UnicodeCategory.NonSpacingMark)
|
}
|
||||||
).Normalize(NormalizationForm.FormC);
|
|
||||||
|
var chars = Normalize(text, NormalizationForm.FormD)
|
||||||
|
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) != UnicodeCategory.NonSpacingMark);
|
||||||
|
|
||||||
|
return Normalize(String.Concat(chars), NormalizationForm.FormC);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string Normalize(string text, NormalizationForm form, bool stripStringOnFailure = true)
|
||||||
|
{
|
||||||
|
if (stripStringOnFailure)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return text.Normalize(form);
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
// will throw if input contains invalid unicode chars
|
||||||
|
// https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
|
||||||
|
text = StripInvalidUnicodeCharacters(text);
|
||||||
|
return Normalize(text, form, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text.Normalize(form);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string StripInvalidUnicodeCharacters(string str)
|
||||||
|
{
|
||||||
|
var invalidCharactersRegex = new Regex("([\ud800-\udbff](?![\udc00-\udfff]))|((?<![\ud800-\udbff])[\udc00-\udfff])");
|
||||||
|
return invalidCharactersRegex.Replace(str, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string NormalizeFormKD(string text)
|
public string NormalizeFormKD(string text)
|
||||||
|
@ -27,15 +27,9 @@ namespace Emby.Server.Implementations.Activity
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"pragma default_temp_store = memory",
|
|
||||||
"pragma temp_store = memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
"create table if not exists ActivityLogEntries (Id GUID PRIMARY KEY, Name TEXT, Overview TEXT, ShortOverview TEXT, Type TEXT, ItemId TEXT, UserId TEXT, DateCreated DATETIME, LogSeverity TEXT)",
|
"create table if not exists ActivityLogEntries (Id GUID PRIMARY KEY, Name TEXT, Overview TEXT, ShortOverview TEXT, Type TEXT, ItemId TEXT, UserId TEXT, DateCreated DATETIME, LogSeverity TEXT)",
|
||||||
"create index if not exists idx_ActivityLogEntries on ActivityLogEntries(Id)"
|
"create index if not exists idx_ActivityLogEntries on ActivityLogEntries(Id)"
|
||||||
};
|
};
|
||||||
@ -58,9 +52,9 @@ namespace Emby.Server.Implementations.Activity
|
|||||||
throw new ArgumentNullException("entry");
|
throw new ArgumentNullException("entry");
|
||||||
}
|
}
|
||||||
|
|
||||||
using (WriteLock.Write())
|
|
||||||
{
|
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
|
{
|
||||||
|
using (WriteLock.Write())
|
||||||
{
|
{
|
||||||
connection.RunInTransaction(db =>
|
connection.RunInTransaction(db =>
|
||||||
{
|
{
|
||||||
@ -79,16 +73,16 @@ namespace Emby.Server.Implementations.Activity
|
|||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit)
|
public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit)
|
||||||
{
|
|
||||||
using (WriteLock.Read())
|
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
|
{
|
||||||
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
var commandText = BaseActivitySelectText;
|
var commandText = BaseActivitySelectText;
|
||||||
var whereClauses = new List<string>();
|
var whereClauses = new List<string>();
|
||||||
|
@ -30,6 +30,11 @@ namespace Emby.Server.Implementations.Data
|
|||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected TransactionMode TransactionMode
|
||||||
|
{
|
||||||
|
get { return TransactionMode.Immediate; }
|
||||||
|
}
|
||||||
|
|
||||||
static BaseSqliteRepository()
|
static BaseSqliteRepository()
|
||||||
{
|
{
|
||||||
SQLite3.EnableSharedCache = false;
|
SQLite3.EnableSharedCache = false;
|
||||||
@ -62,20 +67,8 @@ namespace Emby.Server.Implementations.Data
|
|||||||
//Logger.Info("Opening write connection");
|
//Logger.Info("Opening write connection");
|
||||||
}
|
}
|
||||||
|
|
||||||
isReadOnly = false;
|
|
||||||
|
|
||||||
if (isReadOnly)
|
|
||||||
{
|
|
||||||
connectionFlags = ConnectionFlags.ReadOnly;
|
|
||||||
//connectionFlags = ConnectionFlags.Create;
|
|
||||||
//connectionFlags |= ConnectionFlags.ReadWrite;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
connectionFlags = ConnectionFlags.Create;
|
connectionFlags = ConnectionFlags.Create;
|
||||||
connectionFlags |= ConnectionFlags.ReadWrite;
|
connectionFlags |= ConnectionFlags.ReadWrite;
|
||||||
}
|
|
||||||
|
|
||||||
connectionFlags |= ConnectionFlags.SharedCached;
|
connectionFlags |= ConnectionFlags.SharedCached;
|
||||||
connectionFlags |= ConnectionFlags.NoMutex;
|
connectionFlags |= ConnectionFlags.NoMutex;
|
||||||
|
|
||||||
@ -84,6 +77,8 @@ namespace Emby.Server.Implementations.Data
|
|||||||
if (string.IsNullOrWhiteSpace(_defaultWal))
|
if (string.IsNullOrWhiteSpace(_defaultWal))
|
||||||
{
|
{
|
||||||
_defaultWal = db.Query("PRAGMA journal_mode").SelectScalarString().First();
|
_defaultWal = db.Query("PRAGMA journal_mode").SelectScalarString().First();
|
||||||
|
|
||||||
|
Logger.Info("Default journal_mode for {0} is {1}", DbFilePath, _defaultWal);
|
||||||
}
|
}
|
||||||
|
|
||||||
var queries = new List<string>
|
var queries = new List<string>
|
||||||
@ -110,7 +105,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
//Logger.Info("synchronous: " + db.Query("PRAGMA synchronous").SelectScalarString().First());
|
//Logger.Info("synchronous: " + db.Query("PRAGMA synchronous").SelectScalarString().First());
|
||||||
//Logger.Info("temp_store: " + db.Query("PRAGMA temp_store").SelectScalarString().First());
|
//Logger.Info("temp_store: " + db.Query("PRAGMA temp_store").SelectScalarString().First());
|
||||||
|
|
||||||
if (!string.Equals(_defaultWal, "wal", StringComparison.OrdinalIgnoreCase))
|
/*if (!string.Equals(_defaultWal, "wal", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
queries.Add("PRAGMA journal_mode=WAL");
|
queries.Add("PRAGMA journal_mode=WAL");
|
||||||
|
|
||||||
@ -119,7 +114,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
db.ExecuteAll(string.Join(";", queries.ToArray()));
|
db.ExecuteAll(string.Join(";", queries.ToArray()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (queries.Count > 0)
|
else*/ if (queries.Count > 0)
|
||||||
{
|
{
|
||||||
db.ExecuteAll(string.Join(";", queries.ToArray()));
|
db.ExecuteAll(string.Join(";", queries.ToArray()));
|
||||||
}
|
}
|
||||||
@ -127,6 +122,26 @@ namespace Emby.Server.Implementations.Data
|
|||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void RunDefaultInitialization(IDatabaseConnection db)
|
||||||
|
{
|
||||||
|
var queries = new List<string>
|
||||||
|
{
|
||||||
|
"PRAGMA journal_mode=WAL",
|
||||||
|
"PRAGMA page_size=4096",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (EnableTempStoreMemory)
|
||||||
|
{
|
||||||
|
queries.AddRange(new List<string>
|
||||||
|
{
|
||||||
|
"pragma default_temp_store = memory",
|
||||||
|
"pragma temp_store = memory"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
db.ExecuteAll(string.Join(";", queries.ToArray()));
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual bool EnableTempStoreMemory
|
protected virtual bool EnableTempStoreMemory
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -54,12 +54,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"pragma default_temp_store = memory",
|
|
||||||
"pragma temp_store = memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
@ -100,7 +95,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
connection.RunInTransaction(db =>
|
connection.RunInTransaction(db =>
|
||||||
{
|
{
|
||||||
SaveDisplayPreferences(displayPreferences, userId, client, db);
|
SaveDisplayPreferences(displayPreferences, userId, client, db);
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,7 +142,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{
|
{
|
||||||
SaveDisplayPreferences(displayPreference, userId, displayPreference.Client, db);
|
SaveDisplayPreferences(displayPreference, userId, displayPreference.Client, db);
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"pragma default_temp_store = memory",
|
|
||||||
"pragma temp_store = memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
@ -85,7 +80,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +103,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
statement.TryBind("@ResultId", id.ToGuidParamValue());
|
statement.TryBind("@ResultId", id.ToGuidParamValue());
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +119,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
var commandText = "delete from FileOrganizerResults";
|
var commandText = "delete from FileOrganizerResults";
|
||||||
|
|
||||||
db.Execute(commandText);
|
db.Execute(commandText);
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,12 +157,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"PRAGMA default_temp_store=memory",
|
|
||||||
"PRAGMA temp_store=memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
var createMediaStreamsTableCommand
|
var createMediaStreamsTableCommand
|
||||||
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
|
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
|
||||||
@ -316,7 +311,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
AddColumn(db, "MediaStreams", "RefFrames", "INT", existingColumnNames);
|
AddColumn(db, "MediaStreams", "RefFrames", "INT", existingColumnNames);
|
||||||
AddColumn(db, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames);
|
AddColumn(db, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames);
|
||||||
AddColumn(db, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames);
|
AddColumn(db, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames);
|
||||||
});
|
}, TransactionMode);
|
||||||
|
|
||||||
string[] postQueries =
|
string[] postQueries =
|
||||||
|
|
||||||
@ -395,10 +390,10 @@ namespace Emby.Server.Implementations.Data
|
|||||||
private void OnShrinkMemoryTimerCallback(object state)
|
private void OnShrinkMemoryTimerCallback(object state)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
|
||||||
using (WriteLock.Write())
|
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
|
{
|
||||||
|
using (WriteLock.Write())
|
||||||
{
|
{
|
||||||
connection.RunQueries(new string[]
|
connection.RunQueries(new string[]
|
||||||
{
|
{
|
||||||
@ -697,7 +692,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
connection.RunInTransaction(db =>
|
connection.RunInTransaction(db =>
|
||||||
{
|
{
|
||||||
SaveItemsInTranscation(db, tuples);
|
SaveItemsInTranscation(db, tuples);
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2211,7 +2206,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4531,7 +4526,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
// Delete the item
|
// Delete the item
|
||||||
ExecuteWithSingleParam(db, "delete from TypedBaseItems where guid=@Id", id.ToGuidParamValue());
|
ExecuteWithSingleParam(db, "delete from TypedBaseItems where guid=@Id", id.ToGuidParamValue());
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,6 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{
|
{
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
"pragma temp_store = memory",
|
|
||||||
|
|
||||||
"create table if not exists userdata (key nvarchar, userId GUID, rating float null, played bit, playCount int, isFavorite bit, playbackPositionTicks bigint, lastPlayedDate datetime null)",
|
"create table if not exists userdata (key nvarchar, userId GUID, rating float null, played bit, playCount int, isFavorite bit, playbackPositionTicks bigint, lastPlayedDate datetime null)",
|
||||||
|
|
||||||
"create table if not exists DataSettings (IsUserDataImported bit)",
|
"create table if not exists DataSettings (IsUserDataImported bit)",
|
||||||
@ -78,7 +76,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
AddColumn(db, "userdata", "AudioStreamIndex", "int", existingColumnNames);
|
AddColumn(db, "userdata", "AudioStreamIndex", "int", existingColumnNames);
|
||||||
AddColumn(db, "userdata", "SubtitleStreamIndex", "int", existingColumnNames);
|
AddColumn(db, "userdata", "SubtitleStreamIndex", "int", existingColumnNames);
|
||||||
});
|
}, TransactionMode);
|
||||||
|
|
||||||
ImportUserDataIfNeeded(connection);
|
ImportUserDataIfNeeded(connection);
|
||||||
}
|
}
|
||||||
@ -116,7 +114,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
statement.TryBind("@IsUserDataImported", true);
|
statement.TryBind("@IsUserDataImported", true);
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ImportUserData(IDatabaseConnection connection, string file)
|
private void ImportUserData(IDatabaseConnection connection, string file)
|
||||||
@ -128,7 +126,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
connection.RunInTransaction(db =>
|
connection.RunInTransaction(db =>
|
||||||
{
|
{
|
||||||
db.Execute("REPLACE INTO userdata(" + columns + ") SELECT " + columns + " FROM UserDataBackup.userdata;");
|
db.Execute("REPLACE INTO userdata(" + columns + ") SELECT " + columns + " FROM UserDataBackup.userdata;");
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -197,7 +195,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
connection.RunInTransaction(db =>
|
connection.RunInTransaction(db =>
|
||||||
{
|
{
|
||||||
SaveUserData(db, userId, key, userData);
|
SaveUserData(db, userId, key, userData);
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,7 +269,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{
|
{
|
||||||
SaveUserData(db, userId, userItemData.Key, userItemData);
|
SaveUserData(db, userId, userItemData.Key, userItemData);
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,12 +50,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"pragma default_temp_store = memory",
|
|
||||||
"pragma temp_store = memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
@ -102,7 +97,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
statement.TryBind("@data", serialized);
|
statement.TryBind("@data", serialized);
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +159,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
statement.TryBind("@id", user.Id.ToGuidParamValue());
|
statement.TryBind("@id", user.Id.ToGuidParamValue());
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2064,6 +2064,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
enabledTimersForSeries.Add(existingTimer);
|
enabledTimersForSeries.Add(existingTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
existingTimer.KeepUntil = seriesTimer.KeepUntil;
|
||||||
|
existingTimer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;
|
||||||
|
existingTimer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;
|
||||||
|
existingTimer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;
|
||||||
|
existingTimer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;
|
||||||
|
existingTimer.Priority = seriesTimer.Priority;
|
||||||
|
|
||||||
existingTimer.SeriesTimerId = seriesTimer.Id;
|
existingTimer.SeriesTimerId = seriesTimer.Id;
|
||||||
_timerProvider.Update(existingTimer);
|
_timerProvider.Update(existingTimer);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
private readonly IServerApplicationPaths _appPaths;
|
private readonly IServerApplicationPaths _appPaths;
|
||||||
private readonly LiveTvOptions _liveTvOptions;
|
private readonly LiveTvOptions _liveTvOptions;
|
||||||
private bool _hasExited;
|
private bool _hasExited;
|
||||||
private Stream _logFileStream;
|
|
||||||
private string _targetPath;
|
private string _targetPath;
|
||||||
private IProcess _process;
|
private IProcess _process;
|
||||||
private readonly IProcessFactory _processFactory;
|
private readonly IProcessFactory _processFactory;
|
||||||
@ -85,22 +84,26 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
_targetPath = targetFile;
|
_targetPath = targetFile;
|
||||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile));
|
_fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile));
|
||||||
|
|
||||||
|
var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "record-transcode-" + Guid.NewGuid().ToString("N") + ".txt");
|
||||||
|
_fileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath));
|
||||||
|
|
||||||
var process = _processFactory.Create(new ProcessOptions
|
var process = _processFactory.Create(new ProcessOptions
|
||||||
{
|
{
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
UseShellExecute = false,
|
UseShellExecute = true,
|
||||||
|
|
||||||
// Must consume both stdout and stderr or deadlocks may occur
|
// Must consume both stdout and stderr or deadlocks may occur
|
||||||
//RedirectStandardOutput = true,
|
//RedirectStandardOutput = true,
|
||||||
RedirectStandardError = true,
|
RedirectStandardError = false,
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = false,
|
||||||
|
|
||||||
FileName = _mediaEncoder.EncoderPath,
|
FileName = _mediaEncoder.EncoderPath,
|
||||||
Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration),
|
Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration),
|
||||||
|
|
||||||
IsHidden = true,
|
IsHidden = true,
|
||||||
ErrorDialog = false,
|
ErrorDialog = false,
|
||||||
EnableRaisingEvents = true
|
EnableRaisingEvents = true,
|
||||||
|
WorkingDirectory = Path.GetDirectoryName(logFilePath)
|
||||||
});
|
});
|
||||||
|
|
||||||
_process = process;
|
_process = process;
|
||||||
@ -108,14 +111,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
|
var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
|
||||||
_logger.Info(commandLineLogMessage);
|
_logger.Info(commandLineLogMessage);
|
||||||
|
|
||||||
var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "record-transcode-" + Guid.NewGuid() + ".txt");
|
_mediaEncoder.SetLogFilename(Path.GetFileName(logFilePath));
|
||||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath));
|
|
||||||
|
|
||||||
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
//var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(_json.SerializeToString(mediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
||||||
_logFileStream = _fileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true);
|
|
||||||
|
|
||||||
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(_json.SerializeToString(mediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
|
||||||
_logFileStream.Write(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length);
|
|
||||||
|
|
||||||
process.Exited += (sender, args) => OnFfMpegProcessExited(process, inputFile);
|
process.Exited += (sender, args) => OnFfMpegProcessExited(process, inputFile);
|
||||||
|
|
||||||
@ -128,10 +126,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
|
|
||||||
onStarted();
|
onStarted();
|
||||||
|
|
||||||
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
|
|
||||||
StartStreamingLog(process.StandardError.BaseStream, _logFileStream);
|
|
||||||
|
|
||||||
_logger.Info("ffmpeg recording process started for {0}", _targetPath);
|
_logger.Info("ffmpeg recording process started for {0}", _targetPath);
|
||||||
|
_mediaEncoder.ClearLogFilename();
|
||||||
|
|
||||||
return _taskCompletionSource.Task;
|
return _taskCompletionSource.Task;
|
||||||
}
|
}
|
||||||
@ -154,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
|
|
||||||
var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks);
|
var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks);
|
||||||
var inputModifiers = "-fflags +genpts -async 1 -vsync -1";
|
var inputModifiers = "-fflags +genpts -async 1 -vsync -1";
|
||||||
var commandLineArgs = "-i \"{0}\"{4} -sn {2} -map_metadata -1 -threads 0 {3} -y \"{1}\"";
|
var commandLineArgs = "-i \"{0}\"{4} -sn {2} -map_metadata -1 -threads 0 {3} -loglevel info -y \"{1}\"";
|
||||||
|
|
||||||
long startTimeTicks = 0;
|
long startTimeTicks = 0;
|
||||||
//if (mediaSource.DateLiveStreamOpened.HasValue)
|
//if (mediaSource.DateLiveStreamOpened.HasValue)
|
||||||
@ -234,16 +230,19 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _isCancelled;
|
||||||
private void Stop()
|
private void Stop()
|
||||||
{
|
{
|
||||||
if (!_hasExited)
|
if (!_hasExited)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
_isCancelled = true;
|
||||||
|
|
||||||
_logger.Info("Killing ffmpeg recording process for {0}", _targetPath);
|
_logger.Info("Killing ffmpeg recording process for {0}", _targetPath);
|
||||||
|
|
||||||
//process.Kill();
|
_process.Kill();
|
||||||
_process.StandardInput.WriteLine("q");
|
//_process.StandardInput.WriteLine("q");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -259,11 +258,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
{
|
{
|
||||||
_hasExited = true;
|
_hasExited = true;
|
||||||
|
|
||||||
DisposeLogStream();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var exitCode = process.ExitCode;
|
var exitCode = _isCancelled ? 0 : process.ExitCode;
|
||||||
|
|
||||||
_logger.Info("FFMpeg recording exited with code {0} for {1}", exitCode, _targetPath);
|
_logger.Info("FFMpeg recording exited with code {0} for {1}", exitCode, _targetPath);
|
||||||
|
|
||||||
@ -282,49 +279,5 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed", _targetPath)));
|
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed", _targetPath)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisposeLogStream()
|
|
||||||
{
|
|
||||||
if (_logFileStream != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logFileStream.Dispose();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.ErrorException("Error disposing recording log stream", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
_logFileStream = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void StartStreamingLog(Stream source, Stream target)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var reader = new StreamReader(source))
|
|
||||||
{
|
|
||||||
while (!reader.EndOfStream)
|
|
||||||
{
|
|
||||||
var line = await reader.ReadLineAsync().ConfigureAwait(false);
|
|
||||||
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(Environment.NewLine + line);
|
|
||||||
|
|
||||||
await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
|
||||||
await target.FlushAsync().ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
// Don't spam the log. This doesn't seem to throw in windows, but sometimes under linux
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.ErrorException("Error reading ffmpeg recording log", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,23 +15,24 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
|
|
||||||
public static TimerInfo CreateTimer(ProgramInfo parent, SeriesTimerInfo seriesTimer)
|
public static TimerInfo CreateTimer(ProgramInfo parent, SeriesTimerInfo seriesTimer)
|
||||||
{
|
{
|
||||||
var timer = new TimerInfo();
|
var timer = new TimerInfo
|
||||||
|
{
|
||||||
timer.ChannelId = parent.ChannelId;
|
ChannelId = parent.ChannelId,
|
||||||
timer.Id = (seriesTimer.Id + parent.Id).GetMD5().ToString("N");
|
Id = (seriesTimer.Id + parent.Id).GetMD5().ToString("N"),
|
||||||
timer.StartDate = parent.StartDate;
|
StartDate = parent.StartDate,
|
||||||
timer.EndDate = parent.EndDate;
|
EndDate = parent.EndDate,
|
||||||
timer.ProgramId = parent.Id;
|
ProgramId = parent.Id,
|
||||||
timer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;
|
PrePaddingSeconds = seriesTimer.PrePaddingSeconds,
|
||||||
timer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;
|
PostPaddingSeconds = seriesTimer.PostPaddingSeconds,
|
||||||
timer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;
|
IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired,
|
||||||
timer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;
|
IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired,
|
||||||
timer.KeepUntil = seriesTimer.KeepUntil;
|
KeepUntil = seriesTimer.KeepUntil,
|
||||||
timer.Priority = seriesTimer.Priority;
|
Priority = seriesTimer.Priority,
|
||||||
timer.Name = parent.Name;
|
Name = parent.Name,
|
||||||
timer.Overview = parent.Overview;
|
Overview = parent.Overview,
|
||||||
timer.SeriesTimerId = seriesTimer.Id;
|
SeriesTimerId = seriesTimer.Id,
|
||||||
timer.ShowId = parent.ShowId;
|
ShowId = parent.ShowId
|
||||||
|
};
|
||||||
|
|
||||||
CopyProgramInfoToTimerInfo(parent, timer);
|
CopyProgramInfoToTimerInfo(parent, timer);
|
||||||
|
|
||||||
|
@ -29,12 +29,7 @@ namespace Emby.Server.Implementations.Notifications
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"pragma default_temp_store = memory",
|
|
||||||
"pragma temp_store = memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
@ -58,7 +53,7 @@ namespace Emby.Server.Implementations.Notifications
|
|||||||
|
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
//using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
var clauses = new List<string>();
|
var clauses = new List<string>();
|
||||||
var paramList = new List<object>();
|
var paramList = new List<object>();
|
||||||
@ -113,7 +108,7 @@ namespace Emby.Server.Implementations.Notifications
|
|||||||
|
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
//using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement("select Level from Notifications where UserId=@UserId and IsRead=@IsRead"))
|
using (var statement = connection.PrepareStatement("select Level from Notifications where UserId=@UserId and IsRead=@IsRead"))
|
||||||
{
|
{
|
||||||
@ -249,7 +244,7 @@ namespace Emby.Server.Implementations.Notifications
|
|||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -304,7 +299,7 @@ namespace Emby.Server.Implementations.Notifications
|
|||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,7 +329,7 @@ namespace Emby.Server.Implementations.Notifications
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,7 @@ namespace Emby.Server.Implementations.Security
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"pragma default_temp_store = memory",
|
|
||||||
"pragma temp_store = memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
@ -50,7 +45,8 @@ namespace Emby.Server.Implementations.Security
|
|||||||
var existingColumnNames = GetColumnNames(db, "AccessTokens");
|
var existingColumnNames = GetColumnNames(db, "AccessTokens");
|
||||||
|
|
||||||
AddColumn(db, "AccessTokens", "AppVersion", "TEXT", existingColumnNames);
|
AddColumn(db, "AccessTokens", "AppVersion", "TEXT", existingColumnNames);
|
||||||
});
|
|
||||||
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,9 +66,9 @@ namespace Emby.Server.Implementations.Security
|
|||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
using (WriteLock.Write())
|
|
||||||
{
|
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
|
{
|
||||||
|
using (WriteLock.Write())
|
||||||
{
|
{
|
||||||
connection.RunInTransaction(db =>
|
connection.RunInTransaction(db =>
|
||||||
{
|
{
|
||||||
@ -100,7 +96,8 @@ namespace Emby.Server.Implementations.Security
|
|||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,10 +134,6 @@ namespace Emby.Server.Implementations.Security
|
|||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException("query");
|
||||||
}
|
}
|
||||||
|
|
||||||
using (WriteLock.Read())
|
|
||||||
{
|
|
||||||
using (var connection = CreateConnection(true))
|
|
||||||
{
|
|
||||||
var commandText = BaseSelectText;
|
var commandText = BaseSelectText;
|
||||||
|
|
||||||
var whereClauses = new List<string>();
|
var whereClauses = new List<string>();
|
||||||
@ -209,6 +202,10 @@ namespace Emby.Server.Implementations.Security
|
|||||||
|
|
||||||
var list = new List<AuthenticationInfo>();
|
var list = new List<AuthenticationInfo>();
|
||||||
|
|
||||||
|
using (var connection = CreateConnection(true))
|
||||||
|
{
|
||||||
|
using (WriteLock.Read())
|
||||||
|
{
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
using (var statement = connection.PrepareStatement(commandText))
|
||||||
{
|
{
|
||||||
BindAuthenticationQueryParams(query, statement);
|
BindAuthenticationQueryParams(query, statement);
|
||||||
@ -244,9 +241,9 @@ namespace Emby.Server.Implementations.Security
|
|||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
using (WriteLock.Read())
|
|
||||||
{
|
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
|
{
|
||||||
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
var commandText = BaseSelectText + " where Id=@Id";
|
var commandText = BaseSelectText + " where Id=@Id";
|
||||||
|
|
||||||
|
@ -27,12 +27,7 @@ namespace Emby.Server.Implementations.Social
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"pragma default_temp_store = memory",
|
|
||||||
"pragma temp_store = memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
@ -70,7 +65,7 @@ namespace Emby.Server.Implementations.Social
|
|||||||
info.ItemId,
|
info.ItemId,
|
||||||
info.UserId,
|
info.UserId,
|
||||||
info.ExpirationDate.ToDateTimeParamValue());
|
info.ExpirationDate.ToDateTimeParamValue());
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,12 +43,7 @@ namespace Emby.Server.Implementations.Sync
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection())
|
using (var connection = CreateConnection())
|
||||||
{
|
{
|
||||||
connection.ExecuteAll(string.Join(";", new[]
|
RunDefaultInitialization(connection);
|
||||||
{
|
|
||||||
"PRAGMA page_size=4096",
|
|
||||||
"pragma default_temp_store = memory",
|
|
||||||
"pragma temp_store = memory"
|
|
||||||
}));
|
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
@ -79,7 +74,7 @@ namespace Emby.Server.Implementations.Sync
|
|||||||
|
|
||||||
existingColumnNames = GetColumnNames(db, "SyncJobItems");
|
existingColumnNames = GetColumnNames(db, "SyncJobItems");
|
||||||
AddColumn(db, "SyncJobItems", "ItemDateModifiedTicks", "BIGINT", existingColumnNames);
|
AddColumn(db, "SyncJobItems", "ItemDateModifiedTicks", "BIGINT", existingColumnNames);
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +263,7 @@ namespace Emby.Server.Implementations.Sync
|
|||||||
connection.RunInTransaction(conn =>
|
connection.RunInTransaction(conn =>
|
||||||
{
|
{
|
||||||
conn.Execute(commandText, paramList.ToArray());
|
conn.Execute(commandText, paramList.ToArray());
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,7 +285,7 @@ namespace Emby.Server.Implementations.Sync
|
|||||||
{
|
{
|
||||||
conn.Execute("delete from SyncJobs where Id=?", id.ToGuidParamValue());
|
conn.Execute("delete from SyncJobs where Id=?", id.ToGuidParamValue());
|
||||||
conn.Execute("delete from SyncJobItems where JobId=?", id);
|
conn.Execute("delete from SyncJobItems where JobId=?", id);
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -743,7 +738,7 @@ namespace Emby.Server.Implementations.Sync
|
|||||||
connection.RunInTransaction(conn =>
|
connection.RunInTransaction(conn =>
|
||||||
{
|
{
|
||||||
conn.Execute(commandText, paramList.ToArray());
|
conn.Execute(commandText, paramList.ToArray());
|
||||||
});
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,5 +135,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
Task UpdateEncoderPath(string path, string pathType);
|
Task UpdateEncoderPath(string path, string pathType);
|
||||||
bool SupportsEncoder(string encoder);
|
bool SupportsEncoder(string encoder);
|
||||||
bool IsDefaultEncoderPath { get; }
|
bool IsDefaultEncoderPath { get; }
|
||||||
|
|
||||||
|
void SetLogFilename(string name);
|
||||||
|
void ClearLogFilename();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ using MediaBrowser.Common.Configuration;
|
|||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Model.Diagnostics;
|
using MediaBrowser.Model.Diagnostics;
|
||||||
|
using MediaBrowser.Model.System;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Encoder
|
namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
{
|
{
|
||||||
@ -88,9 +89,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
private readonly int DefaultImageExtractionTimeoutMs;
|
private readonly int DefaultImageExtractionTimeoutMs;
|
||||||
private readonly bool EnableEncoderFontFile;
|
private readonly bool EnableEncoderFontFile;
|
||||||
|
|
||||||
|
private readonly IEnvironmentInfo _environmentInfo;
|
||||||
|
|
||||||
public MediaEncoder(ILogger logger, IJsonSerializer jsonSerializer, string ffMpegPath, string ffProbePath, bool hasExternalEncoder, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILiveTvManager liveTvManager, IIsoManager isoManager, ILibraryManager libraryManager, IChannelManager channelManager, ISessionManager sessionManager, Func<ISubtitleEncoder> subtitleEncoder, Func<IMediaSourceManager> mediaSourceManager, IHttpClient httpClient, IZipClient zipClient, IMemoryStreamFactory memoryStreamProvider, IProcessFactory processFactory,
|
public MediaEncoder(ILogger logger, IJsonSerializer jsonSerializer, string ffMpegPath, string ffProbePath, bool hasExternalEncoder, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILiveTvManager liveTvManager, IIsoManager isoManager, ILibraryManager libraryManager, IChannelManager channelManager, ISessionManager sessionManager, Func<ISubtitleEncoder> subtitleEncoder, Func<IMediaSourceManager> mediaSourceManager, IHttpClient httpClient, IZipClient zipClient, IMemoryStreamFactory memoryStreamProvider, IProcessFactory processFactory,
|
||||||
int defaultImageExtractionTimeoutMs,
|
int defaultImageExtractionTimeoutMs,
|
||||||
bool enableEncoderFontFile)
|
bool enableEncoderFontFile, IEnvironmentInfo environmentInfo)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
@ -109,12 +112,66 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
_processFactory = processFactory;
|
_processFactory = processFactory;
|
||||||
DefaultImageExtractionTimeoutMs = defaultImageExtractionTimeoutMs;
|
DefaultImageExtractionTimeoutMs = defaultImageExtractionTimeoutMs;
|
||||||
EnableEncoderFontFile = enableEncoderFontFile;
|
EnableEncoderFontFile = enableEncoderFontFile;
|
||||||
|
_environmentInfo = environmentInfo;
|
||||||
FFProbePath = ffProbePath;
|
FFProbePath = ffProbePath;
|
||||||
FFMpegPath = ffMpegPath;
|
FFMpegPath = ffMpegPath;
|
||||||
_originalFFProbePath = ffProbePath;
|
_originalFFProbePath = ffProbePath;
|
||||||
_originalFFMpegPath = ffMpegPath;
|
_originalFFMpegPath = ffMpegPath;
|
||||||
|
|
||||||
_hasExternalEncoder = hasExternalEncoder;
|
_hasExternalEncoder = hasExternalEncoder;
|
||||||
|
|
||||||
|
SetEnvironmentVariable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly object _logLock = new object();
|
||||||
|
public void SetLogFilename(string name)
|
||||||
|
{
|
||||||
|
lock (_logLock)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_environmentInfo.SetProcessEnvironmentVariable("FFREPORT", "file=" + name + ":level=32");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error setting FFREPORT environment variable", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearLogFilename()
|
||||||
|
{
|
||||||
|
lock (_logLock)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_environmentInfo.SetProcessEnvironmentVariable("FFREPORT", null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//_logger.ErrorException("Error setting FFREPORT environment variable", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetEnvironmentVariable()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//_environmentInfo.SetProcessEnvironmentVariable("FFREPORT", "file=program-YYYYMMDD-HHMMSS.txt:level=32");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error setting FFREPORT environment variable", ex);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//_environmentInfo.SetUserEnvironmentVariable("FFREPORT", "file=program-YYYYMMDD-HHMMSS.txt:level=32");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error setting FFREPORT environment variable", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string EncoderLocationType
|
public string EncoderLocationType
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.System
|
namespace MediaBrowser.Model.System
|
||||||
{
|
{
|
||||||
public interface IEnvironmentInfo
|
public interface IEnvironmentInfo
|
||||||
@ -13,6 +8,7 @@ namespace MediaBrowser.Model.System
|
|||||||
string OperatingSystemVersion { get; }
|
string OperatingSystemVersion { get; }
|
||||||
Architecture SystemArchitecture { get; }
|
Architecture SystemArchitecture { get; }
|
||||||
string GetEnvironmentVariable(string name);
|
string GetEnvironmentVariable(string name);
|
||||||
|
void SetProcessEnvironmentVariable(string name, string value);
|
||||||
string GetUserId();
|
string GetUserId();
|
||||||
string StackTrace { get; }
|
string StackTrace { get; }
|
||||||
}
|
}
|
||||||
|
@ -1001,9 +1001,6 @@
|
|||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\README.md">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\README.md">
|
||||||
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\README.md</Link>
|
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\README.md</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\animations.css">
|
|
||||||
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\animations.css</Link>
|
|
||||||
</BundleResource>
|
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\appsettings.js">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\appsettings.js">
|
||||||
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\appsettings.js</Link>
|
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\appsettings.js</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
@ -1433,6 +1430,9 @@
|
|||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\guide\tvguide.template.html">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\guide\tvguide.template.html">
|
||||||
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\guide\tvguide.template.html</Link>
|
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\guide\tvguide.template.html</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\imageeditor\imageeditor.css">
|
||||||
|
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\imageeditor\imageeditor.css</Link>
|
||||||
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\imageeditor\imageeditor.js">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\imageeditor\imageeditor.js">
|
||||||
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\imageeditor\imageeditor.js</Link>
|
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\imageeditor\imageeditor.js</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
@ -1589,6 +1589,9 @@
|
|||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingeditor.template.html">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingeditor.template.html">
|
||||||
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingeditor.template.html</Link>
|
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingeditor.template.html</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingfields.css">
|
||||||
|
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingfields.css</Link>
|
||||||
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingfields.js">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingfields.js">
|
||||||
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingfields.js</Link>
|
<Link>Resources\dashboard-ui\bower_components\emby-webcomponents\recordingcreator\recordingfields.js</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
@ -1973,6 +1976,12 @@
|
|||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\hlsjs\API.md">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\hlsjs\API.md">
|
||||||
<Link>Resources\dashboard-ui\bower_components\hlsjs\API.md</Link>
|
<Link>Resources\dashboard-ui\bower_components\hlsjs\API.md</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\hlsjs\CONTRIBUTING.md">
|
||||||
|
<Link>Resources\dashboard-ui\bower_components\hlsjs\CONTRIBUTING.md</Link>
|
||||||
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\hlsjs\ISSUE_TEMPLATE.md">
|
||||||
|
<Link>Resources\dashboard-ui\bower_components\hlsjs\ISSUE_TEMPLATE.md</Link>
|
||||||
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\hlsjs\LICENSE">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\hlsjs\LICENSE">
|
||||||
<Link>Resources\dashboard-ui\bower_components\hlsjs\LICENSE</Link>
|
<Link>Resources\dashboard-ui\bower_components\hlsjs\LICENSE</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
@ -3428,6 +3437,9 @@
|
|||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\da.json">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\da.json">
|
||||||
<Link>Resources\dashboard-ui\strings\da.json</Link>
|
<Link>Resources\dashboard-ui\strings\da.json</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\de-DE.json">
|
||||||
|
<Link>Resources\dashboard-ui\strings\de-DE.json</Link>
|
||||||
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\de.json">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\de.json">
|
||||||
<Link>Resources\dashboard-ui\strings\de.json</Link>
|
<Link>Resources\dashboard-ui\strings\de.json</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
@ -3443,6 +3455,9 @@
|
|||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\es-AR.json">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\es-AR.json">
|
||||||
<Link>Resources\dashboard-ui\strings\es-AR.json</Link>
|
<Link>Resources\dashboard-ui\strings\es-AR.json</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\es-ES.json">
|
||||||
|
<Link>Resources\dashboard-ui\strings\es-ES.json</Link>
|
||||||
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\es-MX.json">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\es-MX.json">
|
||||||
<Link>Resources\dashboard-ui\strings\es-MX.json</Link>
|
<Link>Resources\dashboard-ui\strings\es-MX.json</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
@ -3485,6 +3500,9 @@
|
|||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\ko.json">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\ko.json">
|
||||||
<Link>Resources\dashboard-ui\strings\ko.json</Link>
|
<Link>Resources\dashboard-ui\strings\ko.json</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\lt-LT.json">
|
||||||
|
<Link>Resources\dashboard-ui\strings\lt-LT.json</Link>
|
||||||
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\ms.json">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\ms.json">
|
||||||
<Link>Resources\dashboard-ui\strings\ms.json</Link>
|
<Link>Resources\dashboard-ui\strings\ms.json</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
@ -22,7 +22,7 @@ namespace MediaBrowser.Server.Mac
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ namespace SocketHttpListener.Net
|
|||||||
{
|
{
|
||||||
context.Response.DetermineIfChunked();
|
context.Response.DetermineIfChunked();
|
||||||
|
|
||||||
if (context.Response.SendChunked || isExpect100Continue || context.Request.IsWebSocketRequest)
|
if (context.Response.SendChunked || isExpect100Continue || context.Request.IsWebSocketRequest || true)
|
||||||
{
|
{
|
||||||
o_stream = new ResponseStream(stream, context.Response, _memoryStreamFactory, _textEncoding);
|
o_stream = new ResponseStream(stream, context.Response, _memoryStreamFactory, _textEncoding);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user