aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-23 12:51:51 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-23 12:51:51 -0400
commit73b294b4cea8a242910124e493e317ab0fae5e92 (patch)
tree05930422bc3159fa7ef33fb2fbfe76cd9a626716
parentffcfa2d85843aaa9a99131d531296b0b54cc0e34 (diff)
fixes #595 - Linux/Unix file quantity limitation for ImagesByName/People folder
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs8
-rw-r--r--MediaBrowser.Providers/Movies/TmdbPersonProvider.cs10
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs16
3 files changed, 25 insertions, 9 deletions
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 5f606a06b..8d0367804 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -244,7 +244,13 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
/// <value>The width of the min movie poster.</value>
public int MinMoviePosterWidth { get; set; }
-
+
+ /// <summary>
+ /// Gets or sets a value indicating whether [enable people prefix sub folders].
+ /// </summary>
+ /// <value><c>true</c> if [enable people prefix sub folders]; otherwise, <c>false</c>.</value>
+ public bool EnablePeoplePrefixSubFolders { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
diff --git a/MediaBrowser.Providers/Movies/TmdbPersonProvider.cs b/MediaBrowser.Providers/Movies/TmdbPersonProvider.cs
index f48ef4c26..4a5db1d81 100644
--- a/MediaBrowser.Providers/Movies/TmdbPersonProvider.cs
+++ b/MediaBrowser.Providers/Movies/TmdbPersonProvider.cs
@@ -205,7 +205,7 @@ namespace MediaBrowser.Providers.Movies
string url = string.Format(@"http://api.themoviedb.org/3/search/person?api_key={1}&query={0}", WebUtility.UrlEncode(person.Name), MovieDbProvider.ApiKey);
PersonSearchResults searchResult = null;
- using (Stream json = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
+ using (var json = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
@@ -231,15 +231,11 @@ namespace MediaBrowser.Providers.Movies
{
var personDataPath = GetPersonDataPath(ConfigurationManager.ApplicationPaths, id);
- Directory.CreateDirectory(personDataPath);
-
- var files = Directory.EnumerateFiles(personDataPath, "*.json", SearchOption.TopDirectoryOnly)
- .Select(Path.GetFileName)
- .ToList();
+ var file = Path.Combine(personDataPath, DataFileName);
// Only download if not already there
// The prescan task will take care of updates so we don't need to re-download here
- if (!files.Contains(DataFileName, StringComparer.OrdinalIgnoreCase))
+ if (!File.Exists(file))
{
await DownloadPersonInfo(id, cancellationToken).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index b632792f6..59ae9b734 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -703,7 +703,21 @@ namespace MediaBrowser.Server.Implementations.Library
var validFilename = FileSystem.GetValidFilename(name);
- var key = Path.Combine(path, validFilename);
+ string subFolderPrefix = null;
+
+ if (typeof(T) == typeof(Person) && ConfigurationManager.Configuration.EnablePeoplePrefixSubFolders)
+ {
+ subFolderPrefix = validFilename.Substring(0, 1);
+
+ if (string.IsNullOrWhiteSpace(subFolderPrefix))
+ {
+ subFolderPrefix = "0";
+ }
+ }
+
+ var key = string.IsNullOrEmpty(subFolderPrefix) ?
+ Path.Combine(path, validFilename) :
+ Path.Combine(path, subFolderPrefix, validFilename);
BaseItem obj;