This commit is contained in:
Eric Reed
2013-06-20 12:19:55 -04:00
21 changed files with 115 additions and 310 deletions

View File

@@ -73,23 +73,23 @@ namespace MediaBrowser.Controller.Drawing
{
// http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx
if (format == PixelFormat.Indexed)
if ((format & PixelFormat.Indexed) == PixelFormat.Indexed)
{
return false;
}
if (format == PixelFormat.Undefined)
if ((format & PixelFormat.Undefined) == PixelFormat.Undefined)
{
return false;
}
if (format == PixelFormat.DontCare)
if ((format & PixelFormat.DontCare) == PixelFormat.DontCare)
{
return false;
}
if (format == PixelFormat.Format16bppArgb1555)
if ((format & PixelFormat.Format16bppArgb1555) == PixelFormat.Format16bppArgb1555)
{
return false;
}
if (format == PixelFormat.Format16bppGrayScale)
if ((format & PixelFormat.Format16bppGrayScale) == PixelFormat.Format16bppGrayScale)
{
return false;
}

View File

@@ -238,7 +238,6 @@ namespace MediaBrowser.Controller.Dto
if (fields.Contains(ItemFields.MetadataSettings))
{
dto.LockedFields = item.LockedFields;
dto.LockedImages = item.LockedImages;
dto.EnableInternetProviders = !item.DontFetchMeta;
}

View File

@@ -41,7 +41,6 @@ namespace MediaBrowser.Controller.Entities
ThemeVideoIds = new List<Guid>();
LocalTrailerIds = new List<Guid>();
LockedFields = new List<MetadataFields>();
LockedImages = new List<ImageType>();
}
/// <summary>
@@ -166,12 +165,6 @@ namespace MediaBrowser.Controller.Entities
/// <value>The locked fields.</value>
public List<MetadataFields> LockedFields { get; set; }
/// <summary>
/// Gets or sets the locked images.
/// </summary>
/// <value>The locked images.</value>
public List<ImageType> LockedImages { get; set; }
/// <summary>
/// Determines whether the item has a saved local image of the specified name (jpg or png).
/// </summary>

View File

@@ -3,6 +3,7 @@ using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace MediaBrowser.Controller.IO
{
@@ -29,22 +30,29 @@ namespace MediaBrowser.Controller.IO
throw new ArgumentNullException("path");
}
var dict = new Dictionary<string, FileSystemInfo>(StringComparer.OrdinalIgnoreCase);
var entries = new DirectoryInfo(path).EnumerateFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
if (!resolveShortcuts && flattenFolderDepth == 0)
{
return entries.ToDictionary(i => i.FullName, StringComparer.OrdinalIgnoreCase);
}
var dict = new Dictionary<string, FileSystemInfo>(StringComparer.OrdinalIgnoreCase);
foreach (var entry in entries)
{
var isDirectory = (entry.Attributes & FileAttributes.Directory) == FileAttributes.Directory;
if (resolveShortcuts && FileSystem.IsShortcut(entry.FullName))
var fullName = entry.FullName;
if (resolveShortcuts && FileSystem.IsShortcut(fullName))
{
var newPath = FileSystem.ResolveShortcut(entry.FullName);
var newPath = FileSystem.ResolveShortcut(fullName);
if (string.IsNullOrWhiteSpace(newPath))
{
//invalid shortcut - could be old or target could just be unavailable
logger.Warn("Encountered invalid shortcut: " + entry.FullName);
logger.Warn("Encountered invalid shortcut: " + fullName);
continue;
}
@@ -57,18 +65,18 @@ namespace MediaBrowser.Controller.IO
args.AddAdditionalLocation(newPath);
}
dict[data.FullName] = data;
dict[newPath] = data;
}
else if (flattenFolderDepth > 0 && isDirectory)
{
foreach (var child in GetFilteredFileSystemEntries(entry.FullName, logger, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts))
foreach (var child in GetFilteredFileSystemEntries(fullName, logger, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts))
{
dict[child.Key] = child.Value;
}
}
else
{
dict[entry.FullName] = entry;
dict[fullName] = entry;
}
}

View File

@@ -112,7 +112,7 @@ namespace MediaBrowser.Controller.Library
return false;
}
var parentDir = System.IO.Path.GetDirectoryName(FileInfo.FullName) ?? string.Empty;
var parentDir = System.IO.Path.GetDirectoryName(Path) ?? string.Empty;
return (parentDir.Length > _appPaths.RootFolderPath.Length
&& parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase));

View File

@@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Library
private static bool IsSeasonFolder(string path)
{
// It's a season folder if it's named as such and does not contain any audio files, apart from theme.mp3
return GetSeasonNumberFromPath(path) != null && !new DirectoryInfo(path).EnumerateFiles().Any(i => EntityResolutionHelper.IsAudioFile(i.FullName) && !string.Equals(Path.GetFileNameWithoutExtension(i.Name), BaseItem.ThemeSongFilename));
return GetSeasonNumberFromPath(path) != null && !Directory.EnumerateFiles(path).Any(i => EntityResolutionHelper.IsAudioFile(i) && !string.Equals(Path.GetFileNameWithoutExtension(i), BaseItem.ThemeSongFilename));
}
/// <summary>
@@ -223,7 +223,9 @@ namespace MediaBrowser.Controller.Library
}
else
{
if (EntityResolutionHelper.IsVideoFile(child.FullName) && GetEpisodeNumberFromFile(child.FullName, false).HasValue)
var fullName = child.FullName;
if (EntityResolutionHelper.IsVideoFile(fullName) && GetEpisodeNumberFromFile(fullName, false).HasValue)
{
return true;
}
@@ -275,7 +277,7 @@ namespace MediaBrowser.Controller.Library
}
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
private static int? ParseEpisodeNumber(string val)
{
int num;