public ActionResult <SyncStats> StartCheckpointSync([FromRoute] Guid checkpointID) { var request = new StartCheckpointSync { CheckpointID = checkpointID }; return(_service.Post(request)); }
public SyncStats Post(StartCheckpointSync request) { _logger.LogDebug($"InfuseSync: Sync request for CheckpointID '{request.CheckpointID}'"); var checkpoint = Plugin.Instance.Db.GetCheckpoint(request.CheckpointID); if (checkpoint == null) { throw new ResourceNotFoundException($"Checkpoint with ID '{request.CheckpointID}' not found."); } var db = Plugin.Instance.Db; var syncTimestamp = DateTime.UtcNow.ToFileTime(); db.UpdateCheckpoint(request.CheckpointID, syncTimestamp); var folderTypes = new string [] { "Folder" }; var boxSetTypes = new string [] { "BoxSet" }; var playlistTypes = new string [] { "Playlist" }; var seriesTypes = new string [] { "Series" }; var seasonTypes = new string [] { "Season" }; var collectionFolderTypes = new string [] { "CollectionFolder" }; var videoTypes = new string [] { "Video", "MusicVideo", "Movie", "Episode" }; return(new SyncStats { UpdatedFolders = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Updated, folderTypes), RemovedFolders = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Removed, folderTypes), UpdatedBoxSets = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Updated, boxSetTypes), RemovedBoxSets = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Removed, boxSetTypes), UpdatedPlaylists = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Updated, playlistTypes), RemovedPlaylists = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Removed, playlistTypes), UpdatedTvShows = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Updated, seriesTypes), RemovedTvShows = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Removed, seriesTypes), UpdatedSeasons = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Updated, seasonTypes), RemovedSeasons = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Removed, seasonTypes), UpdatedVideos = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Updated, videoTypes), RemovedVideos = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Removed, videoTypes), UpdatedCollectionFolders = db.ItemsCount(checkpoint.Timestamp, syncTimestamp, ItemStatus.Updated, collectionFolderTypes), UpdatedUserData = db.UserInfoCount(checkpoint.Timestamp, syncTimestamp, checkpoint.UserId, videoTypes) }); }