diff options
30 files changed, 171 insertions, 230 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index a2ed1d772..431b6d615 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -82,7 +82,9 @@ namespace MediaBrowser.Api /// <param name="path">The path.</param> /// <param name="type">The type.</param> /// <param name="process">The process.</param> - public void OnTranscodeBeginning(string path, TranscodingJobType type, Process process) + /// <param name="isVideo">if set to <c>true</c> [is video].</param> + /// <param name="startTimeTicks">The start time ticks.</param> + public void OnTranscodeBeginning(string path, TranscodingJobType type, Process process, bool isVideo, long? startTimeTicks) { lock (_activeTranscodingJobs) { @@ -91,7 +93,9 @@ namespace MediaBrowser.Api Type = type, Path = path, Process = process, - ActiveRequestCount = 1 + ActiveRequestCount = 1, + IsVideo = isVideo, + StartTimeTicks = startTimeTicks }); } } @@ -262,7 +266,7 @@ namespace MediaBrowser.Api } catch (InvalidOperationException) { - + } catch (NotSupportedException) { @@ -273,7 +277,8 @@ namespace MediaBrowser.Api process.Dispose(); // If it didn't complete successfully cleanup the partial files - if (!hasExitedSuccessfully) + // Also don't cache output from resume points + if (!hasExitedSuccessfully || job.StartTimeTicks.HasValue) { Logger.Info("Deleting partial stream file(s) {0}", job.Path); @@ -364,6 +369,9 @@ namespace MediaBrowser.Api /// </summary> /// <value>The kill timer.</value> public Timer KillTimer { get; set; } + + public bool IsVideo { get; set; } + public long? StartTimeTicks { get; set; } } /// <summary> diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs index 9d11178c8..d88d85594 100644 --- a/MediaBrowser.Api/EnvironmentService.cs +++ b/MediaBrowser.Api/EnvironmentService.cs @@ -207,11 +207,6 @@ namespace MediaBrowser.Api { var entries = new DirectoryInfo(request.Path).EnumerateFileSystemInfos().Where(i => { - if (i.Attributes.HasFlag(FileAttributes.System)) - { - return false; - } - if (!request.IncludeHidden && i.Attributes.HasFlag(FileAttributes.Hidden)) { return false; diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 4886af916..1c1b569d7 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -598,7 +598,7 @@ namespace MediaBrowser.Api.Playback EnableRaisingEvents = true }; - ApiEntryPoint.Instance.OnTranscodeBeginning(outputPath, TranscodingJobType, process); + ApiEntryPoint.Instance.OnTranscodeBeginning(outputPath, TranscodingJobType, process, video != null, state.Request.StartTimeTicks); Logger.Info(process.StartInfo.FileName + " " + process.StartInfo.Arguments); diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index cd8423c3d..961c8770c 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -199,10 +199,10 @@ namespace MediaBrowser.Api.Playback.Progressive var outputPath = GetOutputFilePath(state); var outputPathExists = File.Exists(outputPath); - var isStatic = request.Static || - (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive)); + //var isStatic = request.Static || + // (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive)); - AddDlnaHeaders(state, responseHeaders, isStatic); + //AddDlnaHeaders(state, responseHeaders, isStatic); if (request.Static) { diff --git a/MediaBrowser.Controller/Drawing/ImageExtensions.cs b/MediaBrowser.Controller/Drawing/ImageExtensions.cs index 79b877b94..847c5dbe0 100644 --- a/MediaBrowser.Controller/Drawing/ImageExtensions.cs +++ b/MediaBrowser.Controller/Drawing/ImageExtensions.cs @@ -73,23 +73,23 @@ namespace MediaBrowser.Controller.Drawing { // http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx - if (format.HasFlag(PixelFormat.Indexed)) + if (format == PixelFormat.Indexed) { return false; } - if (format.HasFlag(PixelFormat.Undefined)) + if (format == PixelFormat.Undefined) { return false; } - if (format.HasFlag(PixelFormat.DontCare)) + if (format == PixelFormat.DontCare) { return false; } - if (format.HasFlag(PixelFormat.Format16bppArgb1555)) + if (format == PixelFormat.Format16bppArgb1555) { return false; } - if (format.HasFlag(PixelFormat.Format16bppGrayScale)) + if (format == PixelFormat.Format16bppGrayScale) { return false; } @@ -160,7 +160,7 @@ namespace MediaBrowser.Controller.Drawing } // Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here - var thumbnail = bmp.PixelFormat.HasFlag(PixelFormat.Indexed) ? new Bitmap(croppedWidth, croppedHeight) : new Bitmap(croppedWidth, croppedHeight, bmp.PixelFormat); + var thumbnail = bmp.PixelFormat == PixelFormat.Indexed ? new Bitmap(croppedWidth, croppedHeight) : new Bitmap(croppedWidth, croppedHeight, bmp.PixelFormat); // Preserve the original resolution thumbnail.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution); diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs index 981c2e5b4..2543d7037 100644 --- a/MediaBrowser.Controller/Dto/DtoBuilder.cs +++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs @@ -280,16 +280,13 @@ namespace MediaBrowser.Controller.Dto dto.Genres = item.Genres; } - if (item.Images != null) - { - dto.ImageTags = new Dictionary<ImageType, Guid>(); + dto.ImageTags = new Dictionary<ImageType, Guid>(); - foreach (var image in item.Images) - { - var type = image.Key; + foreach (var image in item.Images) + { + var type = image.Key; - dto.ImageTags[type] = Kernel.Instance.ImageManager.GetImageCacheTag(item, type, image.Value); - } + dto.ImageTags[type] = Kernel.Instance.ImageManager.GetImageCacheTag(item, type, image.Value); } dto.Id = GetClientItemId(item); diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 974b3f864..3a2879313 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -279,7 +279,7 @@ namespace MediaBrowser.Controller.Entities // Record the name of each file // Need to sort these because accoring to msdn docs, our i/o methods are not guaranteed in any order foreach (var file in ResolveArgs.FileSystemChildren - .Where(i => !i.Attributes.HasFlag(FileAttributes.System)) + .Where(i => (i.Attributes & FileAttributes.System) != FileAttributes.System) .OrderBy(f => f.Name)) { sb.Append(file.Name); @@ -363,12 +363,15 @@ namespace MediaBrowser.Controller.Entities return new ItemResolveArgs(ConfigurationManager.ApplicationPaths); } + var isDirectory = false; + if (UseParentPathToCreateResolveArgs) { path = System.IO.Path.GetDirectoryName(path); + isDirectory = true; } - pathInfo = pathInfo ?? FileSystem.GetFileSystemInfo(path); + pathInfo = pathInfo ?? (isDirectory ? new DirectoryInfo(path) : FileSystem.GetFileSystemInfo(path)); if (pathInfo == null || !pathInfo.Exists) { @@ -1001,31 +1004,6 @@ namespace MediaBrowser.Controller.Entities } /// <summary> - /// Clear out all metadata properties. Extend for sub-classes. - /// </summary> - public virtual void ClearMetaValues() - { - Images.Clear(); - ForcedSortName = null; - PremiereDate = null; - BackdropImagePaths.Clear(); - OfficialRating = null; - CustomRating = null; - Overview = null; - Taglines.Clear(); - Language = null; - Studios.Clear(); - Genres.Clear(); - CommunityRating = null; - RunTimeTicks = null; - AspectRatio = null; - ProductionYear = null; - ProviderIds.Clear(); - DisplayMediaType = GetType().Name; - ResolveArgs = null; - } - - /// <summary> /// Gets or sets the trailer URL. /// </summary> /// <value>The trailer URL.</value> @@ -1099,9 +1077,9 @@ namespace MediaBrowser.Controller.Entities var rating = CustomRating ?? OfficialRating; - if (user.Configuration.BlockNotRated && string.IsNullOrEmpty(rating)) + if (string.IsNullOrEmpty(rating)) { - return false; + return !user.Configuration.BlockNotRated; } var value = localizationManager.GetRatingLevel(rating); @@ -1447,11 +1425,6 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentException("Screenshots should be accessed using Item.Screenshots"); } - if (Images == null) - { - return null; - } - string val; Images.TryGetValue(type, out val); return val; @@ -1499,12 +1472,9 @@ namespace MediaBrowser.Controller.Entities // If it's null remove the key from the dictionary if (string.IsNullOrEmpty(path)) { - if (Images != null) + if (Images.ContainsKey(typeKey)) { - if (Images.ContainsKey(typeKey)) - { - Images.Remove(typeKey); - } + Images.Remove(typeKey); } } else diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index 6d1e3e05a..8896d4fc1 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.IO foreach (var entry in entries) { - var isDirectory = entry.Attributes.HasFlag(FileAttributes.Directory); + var isDirectory = (entry.Attributes & FileAttributes.Directory) == FileAttributes.Directory; if (resolveShortcuts && FileSystem.IsShortcut(entry.FullName)) { diff --git a/MediaBrowser.Controller/IO/NativeMethods.cs b/MediaBrowser.Controller/IO/NativeMethods.cs index 2f15f124d..5b9bf52a8 100644 --- a/MediaBrowser.Controller/IO/NativeMethods.cs +++ b/MediaBrowser.Controller/IO/NativeMethods.cs @@ -217,103 +217,6 @@ namespace MediaBrowser.Controller.IO public string cAlternate; /// <summary> - /// Gets a value indicating whether this instance is hidden. - /// </summary> - /// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value> - public bool IsHidden - { - get - { - return dwFileAttributes.HasFlag(FileAttributes.Hidden); - } - } - - /// <summary> - /// Gets a value indicating whether this instance is system file. - /// </summary> - /// <value><c>true</c> if this instance is system file; otherwise, <c>false</c>.</value> - public bool IsSystemFile - { - get - { - return dwFileAttributes.HasFlag(FileAttributes.System); - } - } - - /// <summary> - /// Gets a value indicating whether this instance is directory. - /// </summary> - /// <value><c>true</c> if this instance is directory; otherwise, <c>false</c>.</value> - public bool IsDirectory - { - get - { - return dwFileAttributes.HasFlag(FileAttributes.Directory); - } - } - - /// <summary> - /// Gets the creation time UTC. - /// </summary> - /// <value>The creation time UTC.</value> - public DateTime CreationTimeUtc - { - get - { - return ParseFileTime(ftCreationTime); - } - } - - /// <summary> - /// Gets the last access time UTC. - /// </summary> - /// <value>The last access time UTC.</value> - public DateTime LastAccessTimeUtc - { - get - { - return ParseFileTime(ftLastAccessTime); - } - } - - /// <summary> - /// Gets the last write time UTC. - /// </summary> - /// <value>The last write time UTC.</value> - public DateTime LastWriteTimeUtc - { - get - { - return ParseFileTime(ftLastWriteTime); - } - } - - /// <summary> - /// Parses the file time. - /// </summary> - /// <param name="filetime">The filetime.</param> - /// <returns>DateTime.</returns> - private DateTime ParseFileTime(FILETIME filetime) - { - long highBits = filetime.dwHighDateTime; - highBits = highBits << 32; - - var val = highBits + (long) filetime.dwLowDateTime; - - if (val < 0L) - { - return DateTime.MinValue; - } - - if (val > 2650467743999999999L) - { - return DateTime.MaxValue; - } - - return DateTime.FromFileTimeUtc(val); - } - - /// <summary> /// Gets or sets the path. /// </summary> /// <value>The path.</value> diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index dd2afcb3f..7e84350b3 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -26,12 +26,11 @@ namespace MediaBrowser.Controller.Library /// <summary> /// Resolves a path into a BaseItem /// </summary> - /// <param name="path">The path.</param> - /// <param name="parent">The parent.</param> /// <param name="fileInfo">The file info.</param> + /// <param name="parent">The parent.</param> /// <returns>BaseItem.</returns> /// <exception cref="System.ArgumentNullException"></exception> - BaseItem ResolvePath(string path, Folder parent = null, FileSystemInfo fileInfo = null); + BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null); /// <summary> /// Resolves a set of files into a list of BaseItem diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 0ddf61f19..9ca2b6ad5 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -68,7 +68,7 @@ namespace MediaBrowser.Controller.Library { get { - return FileInfo.Attributes.HasFlag(FileAttributes.Directory); + return (FileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory; } } @@ -80,7 +80,7 @@ namespace MediaBrowser.Controller.Library { get { - return FileInfo.Attributes.HasFlag(FileAttributes.Hidden); + return (FileInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden; } } @@ -92,7 +92,7 @@ namespace MediaBrowser.Controller.Library { get { - return FileInfo.Attributes.HasFlag(FileAttributes.System); + return (FileInfo.Attributes & FileAttributes.System) == FileAttributes.System; } } @@ -213,7 +213,7 @@ namespace MediaBrowser.Controller.Library /// <exception cref="System.IO.FileNotFoundException"></exception> public void AddMetadataFile(string path) { - var file = FileSystem.GetFileSystemInfo(path); + var file = new FileInfo(path); if (!file.Exists) { diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 046dd7698..921bbb808 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -197,12 +197,17 @@ namespace MediaBrowser.Controller.Library { var attributes = child.Attributes; - if (attributes.HasFlag(FileAttributes.Hidden) || attributes.HasFlag(FileAttributes.System)) + if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden) { continue; } - if (attributes.HasFlag(FileAttributes.Directory)) + if ((attributes & FileAttributes.System) == FileAttributes.System) + { + continue; + } + + if ((attributes & FileAttributes.Directory) == FileAttributes.Directory) { if (IsSeasonFolder(child.FullName)) { diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs index 9c76680c7..c54659453 100644 --- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs +++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs @@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Resolvers } // See if a different path came out of the resolver than what went in - if (!args.Path.Equals(item.Path, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(args.Path, item.Path, StringComparison.OrdinalIgnoreCase)) { var childData = args.IsDirectory ? args.GetFileSystemEntryByPath(item.Path) : null; diff --git a/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs b/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs index 49dd1bddd..160c171e3 100644 --- a/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs +++ b/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs @@ -86,11 +86,6 @@ namespace MediaBrowser.Providers /// <param name="item">The item.</param> private void ValidateImages(BaseItem item) { - if (item.Images == null) - { - return; - } - // 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 = item.Images.ToList().Where(image => { diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs index 4cf7c1eb6..c18210901 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs @@ -160,15 +160,18 @@ namespace MediaBrowser.Providers.MediaInfo if (!string.IsNullOrEmpty(val)) { + // Sometimes the artist name is listed here, account for that var studios = val.Split(new[] { '/', '|' }, StringSplitOptions.RemoveEmptyEntries) - .Where(i => !string.Equals(i, audio.Artist, StringComparison.OrdinalIgnoreCase) && !string.Equals(i, audio.AlbumArtist, StringComparison.OrdinalIgnoreCase)); + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Where(i => !string.Equals(i, audio.Artist, StringComparison.OrdinalIgnoreCase) && !string.Equals(i, audio.AlbumArtist, StringComparison.OrdinalIgnoreCase)); audio.Studios.Clear(); foreach (var studio in studios) { - audio.AddStudio(studio); + // Account for sloppy tags by trimming + audio.AddStudio(studio.Trim()); } } } @@ -190,7 +193,8 @@ namespace MediaBrowser.Providers.MediaInfo .Split(new[] { '/', '|' }, StringSplitOptions.RemoveEmptyEntries) .Where(i => !string.IsNullOrWhiteSpace(i))) { - audio.AddGenre(genre); + // Account for sloppy tags by trimming + audio.AddGenre(genre.Trim()); } } } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs index 5f24aa1e0..2a9495fd8 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.IO; +using System.Globalization; +using MediaBrowser.Common.IO; using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -51,7 +52,7 @@ namespace MediaBrowser.Providers.MediaInfo private readonly IIsoManager _isoManager; private readonly ILocalizationManager _localization; - + /// <summary> /// Returns true or false indicating if the provider should refresh when the contents of it's directory changes /// </summary> @@ -232,6 +233,67 @@ namespace MediaBrowser.Providers.MediaInfo } AddExternalSubtitles(video); + + FetchWtvInfo(video, data); + } + + /// <summary> + /// Fetches the WTV info. + /// </summary> + /// <param name="video">The video.</param> + /// <param name="data">The data.</param> + private void FetchWtvInfo(Video video, MediaInfoResult data) + { + if (data.format.tags == null) + { + return; + } + + var genres = GetDictionaryValue(data.format.tags, "genre"); + + if (!string.IsNullOrEmpty(genres)) + { + video.Genres = genres.Split(new[] { ';', '/' }, StringSplitOptions.RemoveEmptyEntries) + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(i => i.Trim()) + .ToList(); + } + + var overview = GetDictionaryValue(data.format.tags, "WM/SubTitleDescription"); + + if (!string.IsNullOrWhiteSpace(overview)) + { + video.Overview = overview; + } + + var officialRating = GetDictionaryValue(data.format.tags, "WM/ParentalRating"); + + if (!string.IsNullOrWhiteSpace(officialRating)) + { + video.OfficialRating = officialRating; + } + + var people = GetDictionaryValue(data.format.tags, "WM/MediaCredits"); + + if (!string.IsNullOrEmpty(people)) + { + video.People = people.Split(new[] { ';', '/' }, StringSplitOptions.RemoveEmptyEntries) + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(i => new PersonInfo { Name = i.Trim(), Type = PersonType.Actor }) + .ToList(); + } + + var year = GetDictionaryValue(data.format.tags, "WM/OriginalReleaseTime"); + + if (!string.IsNullOrWhiteSpace(year)) + { + int val; + + if (int.TryParse(year, NumberStyles.Integer, UsCulture, out val)) + { + video.ProductionYear = val; + } + } } /// <summary> diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 612dc0d42..ebb79e96b 100644 --- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -47,20 +47,30 @@ namespace MediaBrowser.Server.Implementations.Library { var parentFolderName = Path.GetFileName(Path.GetDirectoryName(args.Path)); - if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase) || string.Equals(parentFolderName, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase)) + { + return false; + } + if (string.Equals(parentFolderName, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase)) { return false; } // Drives will sometimes be hidden - if (args.Path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase)) + if (args.Path.EndsWith(Path.VolumeSeparatorChar + "\\", StringComparison.OrdinalIgnoreCase)) + { + return false; + } + + // Shares will sometimes be hidden + if (args.Path.StartsWith("\\", StringComparison.OrdinalIgnoreCase)) { - if (new DriveInfo(args.Path).IsReady) + // Look for a share, e.g. \\server\movies + // Is there a better way to detect if a path is a share without using native code? + if (args.Path.Substring(2).Split(Path.DirectorySeparatorChar).Length == 2) { return false; } - - _logger.Error("Operating system reports drive is not ready: {0}", args.Path); } return true; diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index fb05c8c43..bc122ff6d 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -446,24 +446,21 @@ namespace MediaBrowser.Server.Implementations.Library /// <summary> /// Resolves a path into a BaseItem /// </summary> - /// <param name="path">The path.</param> - /// <param name="parent">The parent.</param> /// <param name="fileInfo">The file info.</param> + /// <param name="parent">The parent.</param> /// <returns>BaseItem.</returns> /// <exception cref="System.ArgumentNullException"></exception> - public BaseItem ResolvePath(string path, Folder parent = null, FileSystemInfo fileInfo = null) + public BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null) { - if (string.IsNullOrEmpty(path)) + if (fileInfo == null) { - throw new ArgumentNullException(); + throw new ArgumentNullException("fileInfo"); } - fileInfo = fileInfo ?? FileSystem.GetFileSystemInfo(path); - var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths) { Parent = parent, - Path = path, + Path = fileInfo.FullName, FileInfo = fileInfo }; @@ -534,7 +531,7 @@ namespace MediaBrowser.Server.Implementations.Library { try { - var item = ResolvePath(f.FullName, parent, f) as T; + var item = ResolvePath(f, parent) as T; if (item != null) { @@ -567,7 +564,7 @@ namespace MediaBrowser.Server.Implementations.Library Directory.CreateDirectory(rootFolderPath); } - var rootFolder = RetrieveItem(rootFolderPath.GetMBId(typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(rootFolderPath); + var rootFolder = RetrieveItem(rootFolderPath.GetMBId(typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(new DirectoryInfo(rootFolderPath)); // Add in the plug-in folders foreach (var child in PluginFolderCreators) @@ -585,7 +582,7 @@ namespace MediaBrowser.Server.Implementations.Library /// <returns>UserRootFolder.</returns> public UserRootFolder GetUserRootFolder(string userRootPath) { - return _userRootFolders.GetOrAdd(userRootPath, key => RetrieveItem(userRootPath.GetMBId(typeof(UserRootFolder))) as UserRootFolder ?? (UserRootFolder)ResolvePath(userRootPath)); + return _userRootFolders.GetOrAdd(userRootPath, key => RetrieveItem(userRootPath.GetMBId(typeof(UserRootFolder))) as UserRootFolder ?? (UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath))); } /// <summary> diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs index ef303008d..5a4e27108 100644 --- a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs +++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs @@ -56,7 +56,7 @@ namespace MediaBrowser.Server.Implementations.Library if (string.IsNullOrEmpty(item.Name) && !string.IsNullOrEmpty(item.Path)) { //we use our resolve args name here to get the name of the containg folder, not actual video file - item.Name = GetMBName(item.ResolveArgs.FileInfo.Name, item.ResolveArgs.FileInfo.Attributes.HasFlag(FileAttributes.Directory)); + item.Name = GetMBName(item.ResolveArgs.FileInfo.Name, (item.ResolveArgs.FileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory); } } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs index 60a262fab..fa34a6a2e 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs @@ -40,7 +40,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio } // If we contain an album assume we are an artist folder - return args.FileSystemChildren.Where(i => i.Attributes.HasFlag(FileAttributes.Directory)).Any(i => MusicAlbumResolver.IsMusicAlbum(i.FullName)) ? new MusicArtist() : null; + return args.FileSystemChildren.Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory).Any(i => MusicAlbumResolver.IsMusicAlbum(i.FullName)) ? new MusicArtist() : null; } } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index f54c78f35..a21c15f4f 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -135,7 +135,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies // Loop through each child file/folder and see if we find a video foreach (var child in args.FileSystemChildren) { - if (child.Attributes.HasFlag(FileAttributes.Directory)) + if ((child.Attributes & FileAttributes.Directory) == FileAttributes.Directory) { if (IsDvdDirectory(child.Name)) { diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 509d46c74..1262e515e 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -278,7 +278,7 @@ <ItemGroup> <EmbeddedResource Include="MediaEncoder\fonts\ARIALUNI.TTF" /> <EmbeddedResource Include="MediaEncoder\fonts\fonts.conf" /> - <EmbeddedResource Include="MediaEncoder\ffmpeg20130523.zip" /> + <EmbeddedResource Include="MediaEncoder\ffmpeg20130611.zip" /> <None Include="packages.config" /> </ItemGroup> <ItemGroup /> diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/ffmpeg20130523.zip.REMOVED.git-id b/MediaBrowser.Server.Implementations/MediaEncoder/ffmpeg20130523.zip.REMOVED.git-id deleted file mode 100644 index 1bb538541..000000000 --- a/MediaBrowser.Server.Implementations/MediaEncoder/ffmpeg20130523.zip.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4d70588f0da1095974027f09130938f318f865c5
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/ffmpeg20130611.zip.REMOVED.git-id b/MediaBrowser.Server.Implementations/MediaEncoder/ffmpeg20130611.zip.REMOVED.git-id new file mode 100644 index 000000000..1d348d1cf --- /dev/null +++ b/MediaBrowser.Server.Implementations/MediaEncoder/ffmpeg20130611.zip.REMOVED.git-id @@ -0,0 +1 @@ +2c960e5beead36465770c7b4fb7d4cd73b3258d3
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs index ea1b83dec..08398e22e 100644 --- a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs +++ b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs @@ -153,9 +153,16 @@ namespace MediaBrowser.Server.Implementations.Providers continue; } - if (!force && !provider.NeedsRefresh(item)) + try { - continue; + if (!force && !provider.NeedsRefresh(item)) + { + continue; + } + } + catch (Exception ex) + { + _logger.Error("Error determining NeedsRefresh for {0}", ex, item.Path); } currentTasks.Add(FetchAsync(provider, item, force, cancellationToken)); diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs index 0e78824c1..058789665 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/ImageCleanupTask.cs @@ -125,22 +125,11 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks /// <returns>IEnumerable{System.String}.</returns> private IEnumerable<string> GetPathsInUse(BaseItem item) { - IEnumerable<string> images = new List<string>(); + IEnumerable<string> images = item.Images.Values.ToList(); - if (item.Images != null) - { - images = images.Concat(item.Images.Values); - } + images = images.Concat(item.BackdropImagePaths); - if (item.BackdropImagePaths != null) - { - images = images.Concat(item.BackdropImagePaths); - } - - if (item.ScreenshotImagePaths != null) - { - images = images.Concat(item.ScreenshotImagePaths); - } + images = images.Concat(item.ScreenshotImagePaths); var localTrailers = _itemRepo.GetItems(item.LocalTrailerIds).ToList(); images = localTrailers.Aggregate(images, (current, subItem) => current.Concat(GetPathsInUse(subItem))); @@ -162,8 +151,8 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks if (movie != null) { - var specialFeattures = _itemRepo.GetItems(movie.SpecialFeatureIds).ToList(); - images = specialFeattures.Aggregate(images, (current, subItem) => current.Concat(GetPathsInUse(subItem))); + var specialFeatures = _itemRepo.GetItems(movie.SpecialFeatureIds).ToList(); + images = specialFeatures.Aggregate(images, (current, subItem) => current.Concat(GetPathsInUse(subItem))); } return images; diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 7a552b591..348bf05ed 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.121</version> + <version>3.0.122</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.121" /> + <dependency id="MediaBrowser.Common" version="3.0.122" /> <dependency id="NLog" version="2.0.1.2" /> <dependency id="ServiceStack.Text" version="3.9.45" /> <dependency id="SimpleInjector" version="2.2.3" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index e563d85f5..50d16332c 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.121</version> + <version>3.0.122</version> <title>MediaBrowser.Common</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 1f755da57..ed3904434 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.121</version> + <version>3.0.122</version> <title>Media Browser.Server.Core</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains core components required to build plugins for Media Browser Server.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.121" /> + <dependency id="MediaBrowser.Common" version="3.0.122" /> </dependencies> </metadata> <files> @@ -22,6 +22,6 @@ http://community.mediabrowser.tv/ ## Current Versions ## -Release: 3.0.4906.22507<br/> +Release: 3.0.4910.39627<br/> Beta:<br/> -Dev:
\ No newline at end of file +Dev: 3.0.4910.17486
\ No newline at end of file |
