From 198cb1bc9ccda757031963d01ef1f082da4a874f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 9 May 2017 14:51:26 -0400 Subject: update file responses --- Emby.Common.Implementations/IO/ManagedFileSystem.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'Emby.Common.Implementations/IO') diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs index 3ed4f650f..6cbf39758 100644 --- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs @@ -392,10 +392,27 @@ namespace Emby.Common.Implementations.IO if (_supportsAsyncFileStreams && isAsync) { - return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), 262144, true); + return GetFileStream(path, mode, access, share, FileOpenOptions.Asynchronous); } - return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), 262144); + return GetFileStream(path, mode, access, share, FileOpenOptions.None); + } + + public Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions) + { + if (_sharpCifsFileSystem.IsEnabledForPath(path)) + { + return _sharpCifsFileSystem.GetFileStream(path, mode, access, share); + } + + var defaultBufferSize = 4096; + return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), defaultBufferSize, GetFileOptions(fileOpenOptions)); + } + + private FileOptions GetFileOptions(FileOpenOptions mode) + { + var val = (int)mode; + return (FileOptions)val; } private FileMode GetFileMode(FileOpenMode mode) -- cgit v1.2.3 From 369df3ffdaa8da2f687ad6c1028aa955d219f34e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 10 May 2017 15:12:03 -0400 Subject: add smb fixes --- Emby.Common.Implementations/IO/SharpCifsFileSystem.cs | 5 +++++ Emby.Server.Core/ApplicationHost.cs | 5 ++++- Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs | 4 ++-- Emby.Server.Implementations/AppBase/ConfigurationHelper.cs | 2 +- Emby.Server.Implementations/Devices/DeviceManager.cs | 2 +- Emby.Server.Implementations/Devices/DeviceRepository.cs | 4 ++-- Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs | 4 ++-- Emby.Server.Implementations/Library/LibraryManager.cs | 1 + Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs | 2 +- .../Library/Validators/GameGenresValidator.cs | 2 +- Emby.Server.Implementations/Library/Validators/GenresValidator.cs | 2 +- .../Library/Validators/MusicGenresValidator.cs | 2 +- Emby.Server.Implementations/Library/Validators/StudiosValidator.cs | 2 +- Emby.Server.Implementations/Library/Validators/YearsPostScanTask.cs | 4 +++- 14 files changed, 26 insertions(+), 15 deletions(-) (limited to 'Emby.Common.Implementations/IO') diff --git a/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs b/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs index 0a407d64f..283bcdef0 100644 --- a/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs +++ b/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs @@ -53,6 +53,11 @@ namespace Emby.Common.Implementations.IO if (separator == '/') { result = result.Replace('\\', '/'); + + if (result.StartsWith("smb:/", StringComparison.OrdinalIgnoreCase) && !result.StartsWith("smb://", StringComparison.OrdinalIgnoreCase)) + { + result = result.Replace("smb:/", "smb://"); + } } return result; diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index 6a3881caf..5ceef0754 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -761,7 +761,10 @@ namespace Emby.Server.Core return null; } - X509Certificate2 localCert = new X509Certificate2(certificateLocation, info.Password); + // Don't use an empty string password + var password = string.IsNullOrWhiteSpace(info.Password) ? null : info.Password; + + X509Certificate2 localCert = new X509Certificate2(certificateLocation, password); //localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA; if (!localCert.HasPrivateKey) { diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs index 13874223c..385b4bd51 100644 --- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs +++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs @@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.AppBase Logger.Info("Saving system configuration"); var path = CommonApplicationPaths.SystemConfigurationFilePath; - FileSystem.CreateDirectory(Path.GetDirectoryName(path)); + FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path)); lock (_configurationSyncLock) { @@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.AppBase _configurations.AddOrUpdate(key, configuration, (k, v) => configuration); var path = GetConfigurationFile(key); - FileSystem.CreateDirectory(Path.GetDirectoryName(path)); + FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path)); lock (_configurationSyncLock) { diff --git a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs index ad2f45945..d6a41dd67 100644 --- a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs +++ b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs @@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.AppBase // If the file didn't exist before, or if something has changed, re-save if (buffer == null || !buffer.SequenceEqual(newBytes)) { - fileSystem.CreateDirectory(Path.GetDirectoryName(path)); + fileSystem.CreateDirectory(fileSystem.GetDirectoryName(path)); // Save it after load in case we got new items fileSystem.WriteAllBytes(path, newBytes); diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs index 588b42a09..b246ef196 100644 --- a/Emby.Server.Implementations/Devices/DeviceManager.cs +++ b/Emby.Server.Implementations/Devices/DeviceManager.cs @@ -158,7 +158,7 @@ namespace Emby.Server.Implementations.Devices _libraryMonitor.ReportFileSystemChangeBeginning(path); - _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); + _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); try { diff --git a/Emby.Server.Implementations/Devices/DeviceRepository.cs b/Emby.Server.Implementations/Devices/DeviceRepository.cs index f739765b3..de0dfda2e 100644 --- a/Emby.Server.Implementations/Devices/DeviceRepository.cs +++ b/Emby.Server.Implementations/Devices/DeviceRepository.cs @@ -46,7 +46,7 @@ namespace Emby.Server.Implementations.Devices public Task SaveDevice(DeviceInfo device) { var path = Path.Combine(GetDevicePath(device.Id), "device.json"); - _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); + _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); lock (_syncLock) { @@ -180,7 +180,7 @@ namespace Emby.Server.Implementations.Devices public void AddCameraUpload(string deviceId, LocalFileInfo file) { var path = Path.Combine(GetDevicePath(deviceId), "camerauploads.json"); - _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); + _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); lock (_syncLock) { diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs index 2becebb3d..3c8ad55fe 100644 --- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs +++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs @@ -97,7 +97,7 @@ namespace Emby.Server.Implementations.FFMpeg else { info = existingVersion; - versionedDirectoryPath = Path.GetDirectoryName(info.EncoderPath); + versionedDirectoryPath = _fileSystem.GetDirectoryName(info.EncoderPath); excludeFromDeletions.Add(versionedDirectoryPath); } } @@ -135,7 +135,7 @@ namespace Emby.Server.Implementations.FFMpeg { EncoderPath = encoder, ProbePath = probe, - Version = Path.GetFileName(Path.GetDirectoryName(probe)) + Version = Path.GetFileName(_fileSystem.GetDirectoryName(probe)) }; } } diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 685c794b7..3c94f9784 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -1197,6 +1197,7 @@ namespace Emby.Server.Implementations.Library catch (OperationCanceledException) { _logger.Info("Post-scan task cancelled: {0}", task.GetType().Name); + throw; } catch (Exception ex) { diff --git a/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs b/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs index 643c5970e..d4be2dabe 100644 --- a/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs +++ b/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs @@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Library.Validators catch (OperationCanceledException) { // Don't clutter the log - break; + throw; } catch (Exception ex) { diff --git a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs b/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs index b1820bb91..f7fbb9331 100644 --- a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs +++ b/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs @@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Library.Validators catch (OperationCanceledException) { // Don't clutter the log - break; + throw; } catch (Exception ex) { diff --git a/Emby.Server.Implementations/Library/Validators/GenresValidator.cs b/Emby.Server.Implementations/Library/Validators/GenresValidator.cs index d8956f78a..d71e77a9a 100644 --- a/Emby.Server.Implementations/Library/Validators/GenresValidator.cs +++ b/Emby.Server.Implementations/Library/Validators/GenresValidator.cs @@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.Library.Validators catch (OperationCanceledException) { // Don't clutter the log - break; + throw; } catch (Exception ex) { diff --git a/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs b/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs index 983c881b7..98d53c125 100644 --- a/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs +++ b/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs @@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.Library.Validators catch (OperationCanceledException) { // Don't clutter the log - break; + throw; } catch (Exception ex) { diff --git a/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs b/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs index 6faab7bb9..97b8ff0ac 100644 --- a/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs +++ b/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs @@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Library.Validators catch (OperationCanceledException) { // Don't clutter the log - break; + throw; } catch (Exception ex) { diff --git a/Emby.Server.Implementations/Library/Validators/YearsPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/YearsPostScanTask.cs index ae43c77f0..4afb4c04a 100644 --- a/Emby.Server.Implementations/Library/Validators/YearsPostScanTask.cs +++ b/Emby.Server.Implementations/Library/Validators/YearsPostScanTask.cs @@ -26,6 +26,8 @@ namespace Emby.Server.Implementations.Library.Validators while (yearNumber < maxYear) { + cancellationToken.ThrowIfCancellationRequested(); + try { var year = _libraryManager.GetYear(yearNumber); @@ -35,7 +37,7 @@ namespace Emby.Server.Implementations.Library.Validators catch (OperationCanceledException) { // Don't clutter the log - break; + throw; } catch (Exception ex) { -- cgit v1.2.3 From 1991da85af51b8500d84d60c1b4c5b42ac0eb923 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 12 May 2017 00:54:19 -0400 Subject: update setting of file attributes --- .../IO/ManagedFileSystem.cs | 58 ++++++++++++++++------ MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs | 6 +-- MediaBrowser.Model/IO/IFileSystem.cs | 3 +- MediaBrowser.Providers/Manager/ImageSaver.cs | 27 +++------- MediaBrowser.Providers/Omdb/OmdbItemProvider.cs | 19 +++---- MediaBrowser.Providers/Omdb/OmdbProvider.cs | 17 ++++--- MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs | 7 +-- 7 files changed, 75 insertions(+), 62 deletions(-) (limited to 'Emby.Common.Implementations/IO') diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs index 6cbf39758..7d14e521f 100644 --- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs @@ -518,6 +518,49 @@ namespace Emby.Common.Implementations.IO } } + public void SetAttributes(string path, bool isHidden, bool isReadOnly) + { + if (_sharpCifsFileSystem.IsEnabledForPath(path)) + { + _sharpCifsFileSystem.SetAttributes(path, isHidden, isReadOnly); + return; + } + + var info = GetFileInfo(path); + + if (!info.Exists) + { + return; + } + + if (info.IsReadOnly == isReadOnly && info.IsHidden == isHidden) + { + return; + } + + var attributes = File.GetAttributes(path); + + if (isReadOnly) + { + attributes = attributes | FileAttributes.ReadOnly; + } + else + { + attributes = RemoveAttribute(attributes, FileAttributes.ReadOnly); + } + + if (isHidden) + { + attributes = attributes | FileAttributes.Hidden; + } + else + { + attributes = RemoveAttribute(attributes, FileAttributes.Hidden); + } + + File.SetAttributes(path, attributes); + } + private static FileAttributes RemoveAttribute(FileAttributes attributes, FileAttributes attributesToRemove) { return attributes & ~attributesToRemove; @@ -690,20 +733,7 @@ namespace Emby.Common.Implementations.IO return; } - var fileInfo = GetFileInfo(path); - - if (fileInfo.Exists) - { - if (fileInfo.IsHidden) - { - SetHidden(path, false); - } - if (fileInfo.IsReadOnly) - { - SetReadOnly(path, false); - } - } - + SetAttributes(path, false, false); File.Delete(path); } diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index a3a55176c..57e2ec450 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -218,13 +218,9 @@ namespace MediaBrowser.LocalMetadata.Savers { if (file.IsHidden) { - FileSystem.SetHidden(path, false); wasHidden = true; } - if (file.IsReadOnly) - { - FileSystem.SetReadOnly(path, false); - } + FileSystem.SetAttributes(path, false, false); } using (var filestream = FileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) diff --git a/MediaBrowser.Model/IO/IFileSystem.cs b/MediaBrowser.Model/IO/IFileSystem.cs index 92112f4ae..ea6b04824 100644 --- a/MediaBrowser.Model/IO/IFileSystem.cs +++ b/MediaBrowser.Model/IO/IFileSystem.cs @@ -313,7 +313,8 @@ namespace MediaBrowser.Model.IO IEnumerable GetFileSystemEntryPaths(string path, bool recursive = false); void SetHidden(string path, bool isHidden); - void SetReadOnly(string path, bool isHidden); + void SetReadOnly(string path, bool readOnly); + void SetAttributes(string path, bool isHidden, bool readOnly); char DirectorySeparatorChar { get; } diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index 1d8275c26..4bd504409 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -166,7 +166,7 @@ namespace MediaBrowser.Providers.Manager { var currentPath = currentImagePath; - _logger.Debug("Deleting previous image {0}", currentPath); + _logger.Info("Deleting previous image {0}", currentPath); _libraryMonitor.ReportFileSystemChangeBeginning(currentPath); @@ -236,7 +236,7 @@ namespace MediaBrowser.Providers.Manager /// Task. private async Task SaveImageToLocation(Stream source, string path, CancellationToken cancellationToken) { - _logger.Debug("Saving image to {0}", path); + _logger.Info("Saving image to {0}", path); var parentFolder = _fileSystem.GetDirectoryName(path); @@ -249,31 +249,16 @@ namespace MediaBrowser.Providers.Manager _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); - // If the file is currently hidden we'll have to remove that or the save will fail - var file = _fileSystem.GetFileInfo(path); + _fileSystem.SetAttributes(path, false, false); - // This will fail if the file is hidden - if (file.Exists) + using (var fs = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.Asynchronous)) { - if (file.IsHidden) - { - _fileSystem.SetHidden(file.FullName, false); - } - if (file.IsReadOnly) - { - _fileSystem.SetReadOnly(path, false); - } - } - - using (var fs = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) - { - await source.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken) - .ConfigureAwait(false); + await source.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false); } if (_config.Configuration.SaveMetadataHidden) { - _fileSystem.SetHidden(file.FullName, true); + _fileSystem.SetHidden(path, true); } } finally diff --git a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs index 477543d5e..f9d19b6be 100644 --- a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs @@ -72,8 +72,7 @@ namespace MediaBrowser.Providers.Omdb var imdbId = searchInfo.GetProviderId(MetadataProviders.Imdb); - var baseUrl = await OmdbProvider.GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false); - var url = baseUrl + "/?plot=full&r=json"; + var urlQuery = "plot=full&r=json"; if (type == "episode" && episodeSearchInfo != null) { episodeSearchInfo.SeriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out imdbId); @@ -94,23 +93,23 @@ namespace MediaBrowser.Providers.Omdb { if (year.HasValue) { - url += "&y=" + year.Value.ToString(CultureInfo.InvariantCulture); + urlQuery += "&y=" + year.Value.ToString(CultureInfo.InvariantCulture); } // &s means search and returns a list of results as opposed to t if (isSearch) { - url += "&s=" + WebUtility.UrlEncode(name); + urlQuery += "&s=" + WebUtility.UrlEncode(name); } else { - url += "&t=" + WebUtility.UrlEncode(name); + urlQuery += "&t=" + WebUtility.UrlEncode(name); } - url += "&type=" + type; + urlQuery += "&type=" + type; } else { - url += "&i=" + imdbId; + urlQuery += "&i=" + imdbId; isSearch = false; } @@ -118,14 +117,16 @@ namespace MediaBrowser.Providers.Omdb { if (searchInfo.IndexNumber.HasValue) { - url += string.Format(CultureInfo.InvariantCulture, "&Episode={0}", searchInfo.IndexNumber); + urlQuery += string.Format(CultureInfo.InvariantCulture, "&Episode={0}", searchInfo.IndexNumber); } if (searchInfo.ParentIndexNumber.HasValue) { - url += string.Format(CultureInfo.InvariantCulture, "&Season={0}", searchInfo.ParentIndexNumber); + urlQuery += string.Format(CultureInfo.InvariantCulture, "&Season={0}", searchInfo.ParentIndexNumber); } } + var url = await OmdbProvider.GetOmdbUrl(urlQuery, cancellationToken).ConfigureAwait(false); + using (var stream = await OmdbProvider.GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false)) { var resultList = new List(); diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index d1c3b2214..b89105376 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -265,9 +265,16 @@ namespace MediaBrowser.Providers.Omdb return false; } - public static async Task GetOmdbBaseUrl(CancellationToken cancellationToken) + public static async Task GetOmdbUrl(string query, CancellationToken cancellationToken) { - return "https://www.omdbapi.com"; + var url = "https://www.omdbapi.com?apikey=fe53f97e"; + + if (!string.IsNullOrWhiteSpace(query)) + { + url += "&" + query; + } + + return url; } private async Task EnsureItemInfo(string imdbId, CancellationToken cancellationToken) @@ -292,8 +299,7 @@ namespace MediaBrowser.Providers.Omdb } } - var baseUrl = await GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false); - var url = string.Format(baseUrl + "/?i={0}&plot=full&tomatoes=true&r=json", imdbParam); + var url = await GetOmdbUrl(string.Format("i={0}&plot=full&tomatoes=true&r=json", imdbParam), cancellationToken).ConfigureAwait(false); using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false)) { @@ -327,8 +333,7 @@ namespace MediaBrowser.Providers.Omdb } } - var baseUrl = await GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false); - var url = string.Format(baseUrl + "/?i={0}&season={1}&detail=full", imdbParam, seasonId); + var url = await GetOmdbUrl(string.Format("i={0}&season={1}&detail=full", imdbParam, seasonId), cancellationToken).ConfigureAwait(false); using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false)) { diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 623b109f7..ae2492802 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -220,14 +220,9 @@ namespace MediaBrowser.XbmcMetadata.Savers { if (file.IsHidden) { - FileSystem.SetHidden(path, false); - wasHidden = true; } - if (file.IsReadOnly) - { - FileSystem.SetReadOnly(path, false); - } + FileSystem.SetAttributes(path, false, false); } using (var filestream = FileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) -- cgit v1.2.3 From 6c60656dade3e986b0320c7885f0e43c67ecc9f2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 12 May 2017 01:00:02 -0400 Subject: update sharpcifs --- .../IO/SharpCifsFileSystem.cs | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'Emby.Common.Implementations/IO') diff --git a/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs b/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs index 283bcdef0..64cac7623 100644 --- a/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs +++ b/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs @@ -166,23 +166,38 @@ namespace Emby.Common.Implementations.IO public void SetHidden(string path, bool isHidden) { var file = CreateSmbFile(path); + SetHidden(file, isHidden); + } + + public void SetReadOnly(string path, bool isReadOnly) + { + var file = CreateSmbFile(path); + SetReadOnly(file, isReadOnly); + } + + public void SetAttributes(string path, bool isHidden, bool isReadOnly) + { + var file = CreateSmbFile(path); + SetHidden(file, isHidden); + SetReadOnly(file, isReadOnly); + } + private void SetHidden(SmbFile file, bool isHidden) + { var isCurrentlyHidden = file.IsHidden(); if (isCurrentlyHidden && !isHidden) { - file.SetAttributes(file.GetAttributes() & ~SmbFile.AttrReadonly); + file.SetAttributes(file.GetAttributes() & ~SmbFile.AttrHidden); } else if (!isCurrentlyHidden && isHidden) { - file.SetAttributes(file.GetAttributes() | SmbFile.AttrReadonly); + file.SetAttributes(file.GetAttributes() | SmbFile.AttrHidden); } } - public void SetReadOnly(string path, bool isReadOnly) + private void SetReadOnly(SmbFile file, bool isReadOnly) { - var file = CreateSmbFile(path); - var isCurrentlyReadOnly = !file.CanWrite(); if (isCurrentlyReadOnly && !isReadOnly) -- cgit v1.2.3