diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-10 14:56:00 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-10 14:56:00 -0400 |
| commit | 740a10a4e3f85ffcfd26ec18263d4c78d4b14ecc (patch) | |
| tree | 61462d05ce44c1bb17f48e557b02e14bb480816d /MediaBrowser.Controller/Entities/BaseItem.cs | |
| parent | d078edfb96fe2dcfebdc34e9189f85b0487ac242 (diff) | |
de-normalize item by name data. create counts during library scan for fast access.
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index fb2260769..4887af2cf 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1537,5 +1537,58 @@ namespace MediaBrowser.Controller.Entities // Refresh metadata return RefreshMetadata(CancellationToken.None, forceSave: true); } + + /// <summary> + /// Validates that images within the item are still on the file system + /// </summary> + public void ValidateImages() + { + // Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below + var deletedKeys = Images + .ToList() + .Where(image => !File.Exists(image.Value)) + .Select(i => i.Key) + .ToList(); + + // Now remove them from the dictionary + foreach (var key in deletedKeys) + { + Images.Remove(key); + } + } + + /// <summary> + /// Validates that backdrops within the item are still on the file system + /// </summary> + public void ValidateBackdrops() + { + // Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below + var deletedImages = BackdropImagePaths + .Where(path => !File.Exists(path)) + .ToList(); + + // Now remove them from the dictionary + foreach (var path in deletedImages) + { + BackdropImagePaths.Remove(path); + } + } + + /// <summary> + /// Validates the screenshots. + /// </summary> + public void ValidateScreenshots() + { + // Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below + var deletedImages = ScreenshotImagePaths + .Where(path => !File.Exists(path)) + .ToList(); + + // Now remove them from the dictionary + foreach (var path in deletedImages) + { + ScreenshotImagePaths.Remove(path); + } + } } } |
