aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api
diff options
context:
space:
mode:
authorEric Reed <ebr@mediabrowser3.com>2013-05-17 11:53:13 -0400
committerEric Reed <ebr@mediabrowser3.com>2013-05-17 11:53:13 -0400
commit584641a6f43fee18f65dc9c8abd24b88742922ce (patch)
treec25da5ee2b3819281cf20a0f847a0c89fef10adb /MediaBrowser.Api
parent1b333d124487a49f221c4f09f259a1d1891c6b44 (diff)
parentda7af24fca3b2462b971dce595cfa5e548311cce (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Api')
-rw-r--r--MediaBrowser.Api/Images/ImageService.cs13
-rw-r--r--MediaBrowser.Api/Library/LibraryHelpers.cs2
-rw-r--r--MediaBrowser.Api/MediaBrowser.Api.csproj1
-rw-r--r--MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs10
-rw-r--r--MediaBrowser.Api/UserLibrary/ItemsService.cs14
5 files changed, 34 insertions, 6 deletions
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 081ba56124..3f5b9da2a1 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -1,4 +1,6 @@
-using MediaBrowser.Common.Configuration;
+using System.Drawing;
+using System.Text;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
@@ -717,6 +719,15 @@ namespace MediaBrowser.Api.Images
var bytes = Convert.FromBase64String(text);
+ // Validate first
+ using (var memoryStream = new MemoryStream(bytes))
+ {
+ using (var image = Image.FromStream(memoryStream))
+ {
+ Logger.Info("New image is {0}x{1}", image.Width, image.Height);
+ }
+ }
+
string filename;
switch (imageType)
diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs
index e956e214db..12b9d478ff 100644
--- a/MediaBrowser.Api/Library/LibraryHelpers.cs
+++ b/MediaBrowser.Api/Library/LibraryHelpers.cs
@@ -75,7 +75,7 @@ namespace MediaBrowser.Api.Library
throw new DirectoryNotFoundException("The media collection does not exist");
}
- if (Directory.Exists(newPath))
+ if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && Directory.Exists(newPath))
{
throw new ArgumentException("There is already a media collection with the name " + newPath + ".");
}
diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj
index d300fe19c3..2819a649aa 100644
--- a/MediaBrowser.Api/MediaBrowser.Api.csproj
+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj
@@ -55,6 +55,7 @@
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs
index 3ac8eec894..22098a368e 100644
--- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs
+++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs
@@ -133,6 +133,11 @@ namespace MediaBrowser.Api.UserLibrary
/// <returns>IEnumerable{IbnStub}.</returns>
private IEnumerable<IbnStub<TItemType>> FilterItems(GetItemsByName request, IEnumerable<IbnStub<TItemType>> items, User user)
{
+ if (!string.IsNullOrEmpty(request.NameStartsWithOrGreater))
+ {
+ items = items.Where(i => string.Compare(request.NameStartsWithOrGreater, i.Name, StringComparison.OrdinalIgnoreCase) < 1);
+ }
+
var filters = request.GetFilters().ToList();
if (filters.Count == 0)
@@ -227,7 +232,7 @@ namespace MediaBrowser.Api.UserLibrary
items = items.Where(f => vals.Contains(f.MediaType ?? string.Empty, StringComparer.OrdinalIgnoreCase));
}
-
+
return items;
}
@@ -304,6 +309,9 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
+ [ApiMember(Name = "NameStartsWithOrGreater", Description = "Optional filter by items whose name is sorted equally or greater than a given input string.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string NameStartsWithOrGreater { get; set; }
+
/// <summary>
/// What to sort the results by
/// </summary>
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index dc316cff18..c57778fd65 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -127,6 +127,9 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "SeriesStatus", Description = "Optional filter by Series Status. Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string SeriesStatus { get; set; }
+ [ApiMember(Name = "NameStartsWithOrGreater", Description = "Optional filter by items whose name is sorted equally or greater than a given input string.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string NameStartsWithOrGreater { get; set; }
+
/// <summary>
/// Gets or sets the air days.
/// </summary>
@@ -162,7 +165,7 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "HasTrailer", Description = "Optional filter by items with trailers.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public bool? HasTrailer { get; set; }
-
+
/// <summary>
/// Gets the order by.
/// </summary>
@@ -450,7 +453,12 @@ namespace MediaBrowser.Api.UserLibrary
var vals = request.IncludeItemTypes.Split(',');
items = items.Where(f => vals.Contains(f.GetType().Name, StringComparer.OrdinalIgnoreCase));
}
-
+
+ if (!string.IsNullOrEmpty(request.NameStartsWithOrGreater))
+ {
+ items = items.Where(i => string.Compare(request.NameStartsWithOrGreater, i.SortName, StringComparison.OrdinalIgnoreCase) < 1);
+ }
+
// Filter by Series Status
if (!string.IsNullOrEmpty(request.SeriesStatus))
{
@@ -489,7 +497,7 @@ namespace MediaBrowser.Api.UserLibrary
items = items.Where(i => !string.IsNullOrEmpty(i.MediaType) && types.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase));
}
-
+
var imageTypes = GetImageTypes(request).ToArray();
if (imageTypes.Length > 0)
{