Exemplo n.º 1
0
    /// <summary>
    /// Marks the FolderScanDate as null, which will cause the
    /// indexing service to pick it up and scan it for any changes.
    /// </summary>
    /// <param name="folders"></param>
    /// <returns></returns>
    public async Task MarkFoldersForScan(List <Folder> folders)
    {
        try
        {
            using var db = new ImageContext();

            var ids = folders.Select(x => x.FolderId).Distinct();

            var queryable = db.Folders.Where(f => ids.Contains(f.FolderId));
            await db.BatchUpdate(queryable, x => new Folder {
                FolderScanDate = null
            });

            if (folders.Count == 1)
            {
                _statusService.StatusText = $"Folder {folders.First().Name} flagged for re-indexing.";
            }
            else
            {
                _statusService.StatusText = $"{folders.Count} folders flagged for re-indexing.";
            }

            _workService.FlagNewJobs(this);
        }
        catch (Exception ex)
        {
            Logging.LogError($"Exception when marking folder for reindexing: {ex}");
        }
    }
Exemplo n.º 2
0
    public async Task MarkFolderForScan(Folder folder)
    {
        using var db = new ImageContext();

        //var queryable = db.Set<ImageMetaData>().Where(img => img.Image.FolderId == folder.FolderId);
        //int updated = await db.BatchUpdate(queryable, x => new ImageMetaData { AILastUpdated = null });

        int updated = await ImageMetaData.UpdateFields(db, folder, "AILastUpdated", "null");

        if (updated != 0)
        {
            _statusService.StatusText = $"{updated} images in folder {folder.Name} flagged for AI reprocessing.";
        }

        _workService.FlagNewJobs(this);
    }