mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-24 11:05:08 +01:00
sync updates
This commit is contained in:
@@ -35,6 +35,11 @@
|
||||
"LabelChapterImageExtractionForMoviesHelp": "Extracting chapter images will allow clients to display graphical scene selection menus. The process can be slow, cpu-intensive and may require several gigabytes of space. It runs as a nightly scheduled task at 4am, although this is configurable in the scheduled tasks area. It is not recommended to run this task during peak usage hours.",
|
||||
"LabelEnableAutomaticPortMapping": "Enable automatic port mapping",
|
||||
"LabelEnableAutomaticPortMappingHelp": "UPnP allows automated router configuration for easy remote access. This may not work with some router models.",
|
||||
"HeaderTermsOfService": "Media Browser Terms of Service",
|
||||
"MessagePleaseAcceptTermsOfService": "Please accept the terms of service and privacy policy before continuing.",
|
||||
"OptionIAcceptTermsOfService": "I accept the terms of service",
|
||||
"ButtonPrivacyPolicy": "Privacy policy",
|
||||
"ButtonTermsOfService": "Terms of Service",
|
||||
"ButtonOk": "Ok",
|
||||
"ButtonCancel": "Cancel",
|
||||
"ButtonNew": "New",
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</Reference>
|
||||
<Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.24\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.25\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Nat, Version=1.2.21.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
@@ -340,16 +340,17 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
|
||||
var innerProgress = new ActionableProgress<double>();
|
||||
|
||||
await ProcessJobItem(item, innerProgress, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var job = _syncRepo.GetJob(item.JobId);
|
||||
await ProcessJobItem(job, item, innerProgress, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
job = _syncRepo.GetJob(item.JobId);
|
||||
await UpdateJobStatus(job).ConfigureAwait(false);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ProcessJobItem(SyncJobItem jobItem, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
private async Task ProcessJobItem(SyncJob job, SyncJobItem jobItem, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(jobItem.ItemId);
|
||||
if (item == null)
|
||||
@@ -372,15 +373,17 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
jobItem.Progress = 0;
|
||||
jobItem.Status = SyncJobItemStatus.Converting;
|
||||
|
||||
var user = _userManager.GetUserById(job.UserId);
|
||||
|
||||
var video = item as Video;
|
||||
if (video != null)
|
||||
{
|
||||
await Sync(jobItem, video, deviceProfile, progress, cancellationToken).ConfigureAwait(false);
|
||||
await Sync(jobItem, video, user, deviceProfile, progress, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
else if (item is Audio)
|
||||
{
|
||||
await Sync(jobItem, (Audio)item, deviceProfile, progress, cancellationToken).ConfigureAwait(false);
|
||||
await Sync(jobItem, (Audio)item, user, deviceProfile, progress, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
else if (item is Photo)
|
||||
@@ -394,7 +397,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Sync(SyncJobItem jobItem, Video item, DeviceProfile profile, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
private async Task Sync(SyncJobItem jobItem, Video item, User user, DeviceProfile profile, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var options = new VideoOptions
|
||||
{
|
||||
@@ -402,7 +405,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
ItemId = item.Id.ToString("N"),
|
||||
DeviceId = jobItem.TargetId,
|
||||
Profile = profile,
|
||||
MediaSources = item.GetMediaSources(false).ToList()
|
||||
MediaSources = item.GetMediaSources(false, user).ToList()
|
||||
};
|
||||
|
||||
var streamInfo = new StreamBuilder().BuildVideoItem(options);
|
||||
@@ -413,6 +416,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
if (streamInfo.PlayMethod == PlayMethod.Transcode)
|
||||
{
|
||||
jobItem.Status = SyncJobItemStatus.Converting;
|
||||
jobItem.RequiresConversion = true;
|
||||
await _syncRepo.Update(jobItem).ConfigureAwait(false);
|
||||
|
||||
try
|
||||
@@ -438,6 +442,8 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
}
|
||||
else
|
||||
{
|
||||
jobItem.RequiresConversion = false;
|
||||
|
||||
if (mediaSource.Protocol == MediaProtocol.File)
|
||||
{
|
||||
jobItem.OutputPath = mediaSource.Path;
|
||||
@@ -457,7 +463,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
await _syncRepo.Update(jobItem).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task Sync(SyncJobItem jobItem, Audio item, DeviceProfile profile, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
private async Task Sync(SyncJobItem jobItem, Audio item, User user, DeviceProfile profile, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var options = new AudioOptions
|
||||
{
|
||||
@@ -465,7 +471,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
ItemId = item.Id.ToString("N"),
|
||||
DeviceId = jobItem.TargetId,
|
||||
Profile = profile,
|
||||
MediaSources = item.GetMediaSources(false).ToList()
|
||||
MediaSources = item.GetMediaSources(false, user).ToList()
|
||||
};
|
||||
|
||||
var streamInfo = new StreamBuilder().BuildAudioItem(options);
|
||||
@@ -476,6 +482,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
if (streamInfo.PlayMethod == PlayMethod.Transcode)
|
||||
{
|
||||
jobItem.Status = SyncJobItemStatus.Converting;
|
||||
jobItem.RequiresConversion = true;
|
||||
await _syncRepo.Update(jobItem).ConfigureAwait(false);
|
||||
|
||||
try
|
||||
@@ -500,6 +507,8 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
}
|
||||
else
|
||||
{
|
||||
jobItem.RequiresConversion = false;
|
||||
|
||||
if (mediaSource.Protocol == MediaProtocol.File)
|
||||
{
|
||||
jobItem.OutputPath = mediaSource.Path;
|
||||
|
||||
@@ -12,7 +12,6 @@ using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Controller.Sync;
|
||||
using MediaBrowser.Controller.TV;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Querying;
|
||||
@@ -393,6 +392,18 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
jobItem.Status = SyncJobItemStatus.Synced;
|
||||
jobItem.Progress = 100;
|
||||
|
||||
if (jobItem.RequiresConversion)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(jobItem.OutputPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error deleting temporary job file: {0}", ex, jobItem.OutputPath);
|
||||
}
|
||||
}
|
||||
|
||||
await _repo.Update(jobItem).ConfigureAwait(false);
|
||||
|
||||
var processor = new SyncJobProcessor(_libraryManager, _repo, this, _logger, _userManager, _tvSeriesManager, _mediaEncoder());
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
|
||||
public async Task Initialize()
|
||||
{
|
||||
var dbFile = Path.Combine(_appPaths.DataPath, "sync10.db");
|
||||
var dbFile = Path.Combine(_appPaths.DataPath, "sync11.db");
|
||||
|
||||
_connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
"create table if not exists SyncJobs (Id GUID PRIMARY KEY, TargetId TEXT NOT NULL, Name TEXT NOT NULL, Quality TEXT NOT NULL, Status TEXT NOT NULL, Progress FLOAT, UserId TEXT NOT NULL, ItemIds TEXT NOT NULL, Category TEXT, ParentId TEXT, UnwatchedOnly BIT, ItemLimit INT, SyncNewContent BIT, DateCreated DateTime, DateLastModified DateTime, ItemCount int)",
|
||||
"create index if not exists idx_SyncJobs on SyncJobs(Id)",
|
||||
|
||||
"create table if not exists SyncJobItems (Id GUID PRIMARY KEY, ItemId TEXT, ItemName TEXT, MediaSourceId TEXT, JobId TEXT, OutputPath TEXT, Status TEXT, TargetId TEXT, DateCreated DateTime, Progress FLOAT)",
|
||||
"create table if not exists SyncJobItems (Id GUID PRIMARY KEY, ItemId TEXT, ItemName TEXT, MediaSourceId TEXT, JobId TEXT, RequiresConversion BIT, OutputPath TEXT, Status TEXT, TargetId TEXT, DateCreated DateTime, Progress FLOAT)",
|
||||
"create index if not exists idx_SyncJobItems on SyncJobs(Id)",
|
||||
|
||||
//pragmas
|
||||
@@ -90,13 +90,14 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@ItemCount");
|
||||
|
||||
_saveJobItemCommand = _connection.CreateCommand();
|
||||
_saveJobItemCommand.CommandText = "replace into SyncJobItems (Id, ItemId, ItemName, MediaSourceId, JobId, OutputPath, Status, TargetId, DateCreated, Progress) values (@Id, @ItemId, @ItemName, @MediaSourceId, @JobId, @OutputPath, @Status, @TargetId, @DateCreated, @Progress)";
|
||||
_saveJobItemCommand.CommandText = "replace into SyncJobItems (Id, ItemId, ItemName, MediaSourceId, JobId, RequiresConversion, OutputPath, Status, TargetId, DateCreated, Progress) values (@Id, @ItemId, @ItemName, @MediaSourceId, @JobId, @RequiresConversion, @OutputPath, @Status, @TargetId, @DateCreated, @Progress)";
|
||||
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@Id");
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@ItemId");
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@ItemName");
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@MediaSourceId");
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@JobId");
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@RequiresConversion");
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@OutputPath");
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@Status");
|
||||
_saveJobItemCommand.Parameters.Add(_saveJobItemCommand, "@TargetId");
|
||||
@@ -105,7 +106,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
}
|
||||
|
||||
private const string BaseJobSelectText = "select Id, TargetId, Name, Quality, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount from SyncJobs";
|
||||
private const string BaseJobItemSelectText = "select Id, ItemId, ItemName, MediaSourceId, JobId, OutputPath, Status, TargetId, DateCreated, Progress from SyncJobItems";
|
||||
private const string BaseJobItemSelectText = "select Id, ItemId, ItemName, MediaSourceId, JobId, RequiresConversion, OutputPath, Status, TargetId, DateCreated, Progress from SyncJobItems";
|
||||
|
||||
public SyncJob GetJob(string id)
|
||||
{
|
||||
@@ -556,6 +557,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
_saveJobItemCommand.GetParameter(index++).Value = jobItem.ItemName;
|
||||
_saveJobItemCommand.GetParameter(index++).Value = jobItem.MediaSourceId;
|
||||
_saveJobItemCommand.GetParameter(index++).Value = jobItem.JobId;
|
||||
_saveJobItemCommand.GetParameter(index++).Value = jobItem.RequiresConversion;
|
||||
_saveJobItemCommand.GetParameter(index++).Value = jobItem.OutputPath;
|
||||
_saveJobItemCommand.GetParameter(index++).Value = jobItem.Status.ToString();
|
||||
_saveJobItemCommand.GetParameter(index++).Value = jobItem.TargetId;
|
||||
@@ -618,24 +620,25 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
}
|
||||
|
||||
info.JobId = reader.GetString(4);
|
||||
|
||||
if (!reader.IsDBNull(5))
|
||||
{
|
||||
info.OutputPath = reader.GetString(5);
|
||||
}
|
||||
info.RequiresConversion = reader.GetBoolean(5);
|
||||
|
||||
if (!reader.IsDBNull(6))
|
||||
{
|
||||
info.Status = (SyncJobItemStatus)Enum.Parse(typeof(SyncJobItemStatus), reader.GetString(6), true);
|
||||
info.OutputPath = reader.GetString(6);
|
||||
}
|
||||
|
||||
info.TargetId = reader.GetString(7);
|
||||
|
||||
info.DateCreated = reader.GetDateTime(8);
|
||||
|
||||
if (!reader.IsDBNull(9))
|
||||
if (!reader.IsDBNull(7))
|
||||
{
|
||||
info.Progress = reader.GetDouble(9);
|
||||
info.Status = (SyncJobItemStatus)Enum.Parse(typeof(SyncJobItemStatus), reader.GetString(7), true);
|
||||
}
|
||||
|
||||
info.TargetId = reader.GetString(8);
|
||||
|
||||
info.DateCreated = reader.GetDateTime(9);
|
||||
|
||||
if (!reader.IsDBNull(10))
|
||||
{
|
||||
info.Progress = reader.GetDouble(10);
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.Naming" version="1.0.0.24" targetFramework="net45" />
|
||||
<package id="MediaBrowser.Naming" version="1.0.0.25" targetFramework="net45" />
|
||||
<package id="Mono.Nat" version="1.2.21.0" targetFramework="net45" />
|
||||
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user