diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-05-08 01:04:39 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-05-08 01:04:39 -0400 |
| commit | 374dd8d44152e49f4616a9c8c3d36e8793ed037e (patch) | |
| tree | 4eddaf75d210b7b4a0a2faff157af6a325670713 /MediaBrowser.Controller | |
| parent | 0b7e39877295bc6b879a95b8572b5fa62179b8c0 (diff) | |
fixed subtitle downloading
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Providers/DirectoryService.cs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 9d41b6d252..6f70df4352 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -11,6 +11,7 @@ namespace MediaBrowser.Controller.Providers { List<FileSystemInfo> GetFileSystemEntries(string path); IEnumerable<FileSystemInfo> GetFiles(string path); + IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache); FileSystemInfo GetFile(string path); } @@ -27,8 +28,20 @@ namespace MediaBrowser.Controller.Providers public List<FileSystemInfo> GetFileSystemEntries(string path) { + return GetFileSystemEntries(path, false); + } + + private List<FileSystemInfo> GetFileSystemEntries(string path, bool clearCache) + { List<FileSystemInfo> entries; + if (clearCache) + { + List<FileSystemInfo> removed; + + _cache.TryRemove(path, out removed); + } + if (!_cache.TryGetValue(path, out entries)) { //_logger.Debug("Getting files for " + path); @@ -50,7 +63,12 @@ namespace MediaBrowser.Controller.Providers public IEnumerable<FileSystemInfo> GetFiles(string path) { - return GetFileSystemEntries(path).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory); + return GetFiles(path, false); + } + + public IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache) + { + return GetFileSystemEntries(path, clearCache).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory); } public FileSystemInfo GetFile(string path) |
