Skip to content

Commit 3a9d748

Browse files
Merge pull request #1689 from MediaBrowser/dev
Dev
2 parents 950fbce + 73cc1f7 commit 3a9d748

File tree

9 files changed

+55
-17
lines changed

9 files changed

+55
-17
lines changed

MediaBrowser.Model/Sync/SyncJobItem.cs

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public class SyncJobItem
102102
/// <value>The index of the job item.</value>
103103
public int JobItemIndex { get; set; }
104104

105+
public long ItemDateModifiedTicks { get; set; }
106+
105107
public SyncJobItem()
106108
{
107109
AdditionalFiles = new List<ItemFileInfo>();

MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs

+11
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ public Task UpdateJobStatus(string id)
149149
{
150150
var job = _syncRepo.GetJob(id);
151151

152+
if (job == null)
153+
{
154+
return Task.FromResult(true);
155+
}
156+
152157
var result = _syncManager.GetJobItems(new SyncJobItemQuery
153158
{
154159
JobId = job.Id,
@@ -632,6 +637,7 @@ private async Task Sync(SyncJobItem jobItem, Video item, User user, bool enableC
632637

633638
}, innerProgress, cancellationToken);
634639

640+
jobItem.ItemDateModifiedTicks = item.DateModified.Ticks;
635641
_syncManager.OnConversionComplete(jobItem);
636642
}
637643
catch (OperationCanceledException)
@@ -668,6 +674,7 @@ private async Task Sync(SyncJobItem jobItem, Video item, User user, bool enableC
668674
throw new InvalidOperationException(string.Format("Cannot direct stream {0} protocol", mediaSource.Protocol));
669675
}
670676

677+
jobItem.ItemDateModifiedTicks = item.DateModified.Ticks;
671678
jobItem.MediaSource = mediaSource;
672679
}
673680

@@ -819,6 +826,7 @@ private async Task Sync(SyncJobItem jobItem, Audio item, User user, bool enableC
819826

820827
}, innerProgress, cancellationToken);
821828

829+
jobItem.ItemDateModifiedTicks = item.DateModified.Ticks;
822830
_syncManager.OnConversionComplete(jobItem);
823831
}
824832
catch (OperationCanceledException)
@@ -855,6 +863,7 @@ private async Task Sync(SyncJobItem jobItem, Audio item, User user, bool enableC
855863
throw new InvalidOperationException(string.Format("Cannot direct stream {0} protocol", mediaSource.Protocol));
856864
}
857865

866+
jobItem.ItemDateModifiedTicks = item.DateModified.Ticks;
858867
jobItem.MediaSource = mediaSource;
859868
}
860869

@@ -871,6 +880,7 @@ private async Task Sync(SyncJobItem jobItem, Photo item, CancellationToken cance
871880

872881
jobItem.Progress = 50;
873882
jobItem.Status = SyncJobItemStatus.ReadyToTransfer;
883+
jobItem.ItemDateModifiedTicks = item.DateModified.Ticks;
874884
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
875885
}
876886

@@ -880,6 +890,7 @@ private async Task SyncGeneric(SyncJobItem jobItem, BaseItem item, CancellationT
880890

881891
jobItem.Progress = 50;
882892
jobItem.Status = SyncJobItemStatus.ReadyToTransfer;
893+
jobItem.ItemDateModifiedTicks = item.DateModified.Ticks;
883894
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
884895
}
885896

MediaBrowser.Server.Implementations/Sync/SyncManager.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,13 @@ public async Task<SyncDataResponse> SyncData(SyncDataRequest request)
775775
removeFromDevice = true;
776776
}
777777
}
778+
else if (libraryItem != null && libraryItem.DateModified.Ticks != jobItem.ItemDateModifiedTicks && jobItem.ItemDateModifiedTicks > 0)
779+
{
780+
_logger.Info("Setting status to Queued for {0} because the media has been modified since the original sync.", jobItem.ItemId);
781+
jobItem.Status = SyncJobItemStatus.Queued;
782+
jobItem.Progress = 0;
783+
requiresSaving = true;
784+
}
778785
}
779786
else
780787
{
@@ -881,6 +888,13 @@ private async Task<SyncDataResponse> SyncDataUsingSyncJobItemIds(SyncDataRequest
881888
removeFromDevice = true;
882889
}
883890
}
891+
else if (libraryItem != null && libraryItem.DateModified.Ticks != jobItem.ItemDateModifiedTicks && jobItem.ItemDateModifiedTicks > 0)
892+
{
893+
_logger.Info("Setting status to Queued for {0} because the media has been modified since the original sync.", jobItem.ItemId);
894+
jobItem.Status = SyncJobItemStatus.Queued;
895+
jobItem.Progress = 0;
896+
requiresSaving = true;
897+
}
884898
}
885899
else
886900
{
@@ -1117,7 +1131,7 @@ public QueryResult<SyncedItemProgress> GetSyncedItemProgresses(SyncJobItemQuery
11171131
public SyncJobOptions GetAudioOptions(SyncJobItem jobItem, SyncJob job)
11181132
{
11191133
var options = GetSyncJobOptions(jobItem.TargetId, null, null);
1120-
1134+
11211135
if (job.Bitrate.HasValue)
11221136
{
11231137
options.DeviceProfile.MaxStaticBitrate = job.Bitrate.Value;

MediaBrowser.Server.Implementations/Sync/SyncRepository.cs

+13-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task Initialize()
5050
"create table if not exists SyncJobs (Id GUID PRIMARY KEY, TargetId TEXT NOT NULL, Name TEXT NOT NULL, Profile TEXT, Quality TEXT, Bitrate INT, 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)",
5151
"create index if not exists idx_SyncJobs on SyncJobs(Id)",
5252

53-
"create table if not exists SyncJobItems (Id GUID PRIMARY KEY, ItemId TEXT, ItemName TEXT, MediaSourceId TEXT, JobId TEXT, TemporaryPath TEXT, OutputPath TEXT, Status TEXT, TargetId TEXT, DateCreated DateTime, Progress FLOAT, AdditionalFiles TEXT, MediaSource TEXT, IsMarkedForRemoval BIT, JobItemIndex INT)",
53+
"create table if not exists SyncJobItems (Id GUID PRIMARY KEY, ItemId TEXT, ItemName TEXT, MediaSourceId TEXT, JobId TEXT, TemporaryPath TEXT, OutputPath TEXT, Status TEXT, TargetId TEXT, DateCreated DateTime, Progress FLOAT, AdditionalFiles TEXT, MediaSource TEXT, IsMarkedForRemoval BIT, JobItemIndex INT, ItemDateModifiedTicks BIGINT)",
5454
"create index if not exists idx_SyncJobItems on SyncJobs(Id)",
5555

5656
//pragmas
@@ -63,6 +63,7 @@ public async Task Initialize()
6363

6464
_connection.AddColumn(Logger, "SyncJobs", "Profile", "TEXT");
6565
_connection.AddColumn(Logger, "SyncJobs", "Bitrate", "INT");
66+
_connection.AddColumn(Logger, "SyncJobItems", "ItemDateModifiedTicks", "BIGINT");
6667

6768
PrepareStatements();
6869
}
@@ -127,7 +128,7 @@ private void PrepareStatements()
127128

128129
// _insertJobItemCommand
129130
_insertJobItemCommand = _connection.CreateCommand();
130-
_insertJobItemCommand.CommandText = "insert into SyncJobItems (Id, ItemId, ItemName, MediaSourceId, JobId, TemporaryPath, OutputPath, Status, TargetId, DateCreated, Progress, AdditionalFiles, MediaSource, IsMarkedForRemoval, JobItemIndex) values (@Id, @ItemId, @ItemName, @MediaSourceId, @JobId, @TemporaryPath, @OutputPath, @Status, @TargetId, @DateCreated, @Progress, @AdditionalFiles, @MediaSource, @IsMarkedForRemoval, @JobItemIndex)";
131+
_insertJobItemCommand.CommandText = "insert into SyncJobItems (Id, ItemId, ItemName, MediaSourceId, JobId, TemporaryPath, OutputPath, Status, TargetId, DateCreated, Progress, AdditionalFiles, MediaSource, IsMarkedForRemoval, JobItemIndex, ItemDateModifiedTicks) values (@Id, @ItemId, @ItemName, @MediaSourceId, @JobId, @TemporaryPath, @OutputPath, @Status, @TargetId, @DateCreated, @Progress, @AdditionalFiles, @MediaSource, @IsMarkedForRemoval, @JobItemIndex, @ItemDateModifiedTicks)";
131132

132133
_insertJobItemCommand.Parameters.Add(_insertJobItemCommand, "@Id");
133134
_insertJobItemCommand.Parameters.Add(_insertJobItemCommand, "@ItemId");
@@ -144,10 +145,11 @@ private void PrepareStatements()
144145
_insertJobItemCommand.Parameters.Add(_insertJobItemCommand, "@MediaSource");
145146
_insertJobItemCommand.Parameters.Add(_insertJobItemCommand, "@IsMarkedForRemoval");
146147
_insertJobItemCommand.Parameters.Add(_insertJobItemCommand, "@JobItemIndex");
148+
_insertJobItemCommand.Parameters.Add(_insertJobItemCommand, "@ItemDateModifiedTicks");
147149

148150
// _updateJobItemCommand
149151
_updateJobItemCommand = _connection.CreateCommand();
150-
_updateJobItemCommand.CommandText = "update SyncJobItems set ItemId=@ItemId,ItemName=@ItemName,MediaSourceId=@MediaSourceId,JobId=@JobId,TemporaryPath=@TemporaryPath,OutputPath=@OutputPath,Status=@Status,TargetId=@TargetId,DateCreated=@DateCreated,Progress=@Progress,AdditionalFiles=@AdditionalFiles,MediaSource=@MediaSource,IsMarkedForRemoval=@IsMarkedForRemoval,JobItemIndex=@JobItemIndex where Id=@Id";
152+
_updateJobItemCommand.CommandText = "update SyncJobItems set ItemId=@ItemId,ItemName=@ItemName,MediaSourceId=@MediaSourceId,JobId=@JobId,TemporaryPath=@TemporaryPath,OutputPath=@OutputPath,Status=@Status,TargetId=@TargetId,DateCreated=@DateCreated,Progress=@Progress,AdditionalFiles=@AdditionalFiles,MediaSource=@MediaSource,IsMarkedForRemoval=@IsMarkedForRemoval,JobItemIndex=@JobItemIndex,ItemDateModifiedTicks=@ItemDateModifiedTicks where Id=@Id";
151153

152154
_updateJobItemCommand.Parameters.Add(_updateJobItemCommand, "@Id");
153155
_updateJobItemCommand.Parameters.Add(_updateJobItemCommand, "@ItemId");
@@ -164,10 +166,11 @@ private void PrepareStatements()
164166
_updateJobItemCommand.Parameters.Add(_updateJobItemCommand, "@MediaSource");
165167
_updateJobItemCommand.Parameters.Add(_updateJobItemCommand, "@IsMarkedForRemoval");
166168
_updateJobItemCommand.Parameters.Add(_updateJobItemCommand, "@JobItemIndex");
169+
_updateJobItemCommand.Parameters.Add(_updateJobItemCommand, "@ItemDateModifiedTicks");
167170
}
168171

169172
private const string BaseJobSelectText = "select Id, TargetId, Name, Profile, Quality, Bitrate, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount from SyncJobs";
170-
private const string BaseJobItemSelectText = "select Id, ItemId, ItemName, MediaSourceId, JobId, TemporaryPath, OutputPath, Status, TargetId, DateCreated, Progress, AdditionalFiles, MediaSource, IsMarkedForRemoval, JobItemIndex from SyncJobItems";
173+
private const string BaseJobItemSelectText = "select Id, ItemId, ItemName, MediaSourceId, JobId, TemporaryPath, OutputPath, Status, TargetId, DateCreated, Progress, AdditionalFiles, MediaSource, IsMarkedForRemoval, JobItemIndex, ItemDateModifiedTicks from SyncJobItems";
171174

172175
public SyncJob GetJob(string id)
173176
{
@@ -678,6 +681,7 @@ private async Task InsertOrUpdate(SyncJobItem jobItem, IDbCommand cmd)
678681
cmd.GetParameter(index++).Value = jobItem.MediaSource == null ? null : _json.SerializeToString(jobItem.MediaSource);
679682
cmd.GetParameter(index++).Value = jobItem.IsMarkedForRemoval;
680683
cmd.GetParameter(index++).Value = jobItem.JobItemIndex;
684+
cmd.GetParameter(index++).Value = jobItem.ItemDateModifiedTicks;
681685

682686
cmd.Transaction = transaction;
683687

@@ -782,6 +786,11 @@ private SyncJobItem GetJobItem(IDataReader reader)
782786
info.IsMarkedForRemoval = reader.GetBoolean(13);
783787
info.JobItemIndex = reader.GetInt32(14);
784788

789+
if (!reader.IsDBNull(15))
790+
{
791+
info.ItemDateModifiedTicks = reader.GetInt64(15);
792+
}
793+
785794
return info;
786795
}
787796

MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/.bower.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
},
1717
"devDependencies": {},
1818
"ignore": [],
19-
"version": "1.2.48",
20-
"_release": "1.2.48",
19+
"version": "1.2.49",
20+
"_release": "1.2.49",
2121
"_resolution": {
2222
"type": "version",
23-
"tag": "1.2.48",
24-
"commit": "342107db8bbaa343a4c61be6fd2591121a83ffff"
23+
"tag": "1.2.49",
24+
"commit": "dced619538d91455d46dcbaf0bc03178cbf5ebd8"
2525
},
2626
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
2727
"_target": "^1.2.0",

MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css

+2
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@
327327
text-decoration: none;
328328
overflow: hidden;
329329
align-items: center;
330+
/* Needed for Firefox */
331+
text-align: left;
330332
}
331333

332334
.timeslotCellInner {

MediaBrowser.WebDashboard/dashboard-ui/bower_components/iron-icon/.bower.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
"web-component-tester": "^4.0.0",
3333
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
3434
},
35-
"homepage": "https://github.com/PolymerElements/iron-icon",
35+
"homepage": "https://github.com/polymerelements/iron-icon",
3636
"_release": "1.0.8",
3737
"_resolution": {
3838
"type": "version",
3939
"tag": "v1.0.8",
4040
"commit": "f36b38928849ef3853db727faa8c9ef104d611eb"
4141
},
42-
"_source": "git://github.com/PolymerElements/iron-icon.git",
42+
"_source": "git://github.com/polymerelements/iron-icon.git",
4343
"_target": "^1.0.0",
44-
"_originalSource": "PolymerElements/iron-icon"
44+
"_originalSource": "polymerelements/iron-icon"
4545
}

MediaBrowser.WebDashboard/dashboard-ui/bower_components/paper-behaviors/.bower.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"tag": "v1.0.11",
4646
"commit": "e3c1ab0c72905b58fb4d9adc2921ea73b5c085a5"
4747
},
48-
"_source": "git://github.com/polymerelements/paper-behaviors.git",
48+
"_source": "git://github.com/PolymerElements/paper-behaviors.git",
4949
"_target": "^1.0.0",
50-
"_originalSource": "polymerelements/paper-behaviors"
50+
"_originalSource": "PolymerElements/paper-behaviors"
5151
}

MediaBrowser.WebDashboard/dashboard-ui/bower_components/paper-ripple/.bower.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
3333
},
3434
"ignore": [],
35-
"homepage": "https://github.com/polymerelements/paper-ripple",
35+
"homepage": "https://github.com/PolymerElements/paper-ripple",
3636
"_release": "1.0.5",
3737
"_resolution": {
3838
"type": "version",
3939
"tag": "v1.0.5",
4040
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
4141
},
42-
"_source": "git://github.com/polymerelements/paper-ripple.git",
42+
"_source": "git://github.com/PolymerElements/paper-ripple.git",
4343
"_target": "^1.0.0",
44-
"_originalSource": "polymerelements/paper-ripple"
44+
"_originalSource": "PolymerElements/paper-ripple"
4545
}

0 commit comments

Comments
 (0)