add additional playlist buttons

This commit is contained in:
Luke Pulverenti 2014-08-08 00:36:51 -04:00
parent 515f21cc4f
commit 0f508dab47
11 changed files with 72 additions and 57 deletions

View File

@ -14,7 +14,6 @@ using ServiceStack.Text.Controller;
using ServiceStack.Web;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
@ -341,7 +340,7 @@ namespace MediaBrowser.Api.Images
ImageIndex = imageIndex,
ImageType = info.Type,
ImageTag = _imageProcessor.GetImageCacheTag(item, info),
Size = info.Length ?? fileInfo.Length,
Size = fileInfo.Length,
Width = Convert.ToInt32(size.Width),
Height = Convert.ToInt32(size.Height)
};
@ -365,7 +364,21 @@ namespace MediaBrowser.Api.Images
_libraryManager.RootFolder :
_libraryManager.GetItemById(request.Id);
return GetImage(request, item);
return GetImage(request, item, false);
}
/// <summary>
/// Gets the specified request.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
public object Head(GetItemImage request)
{
var item = string.IsNullOrEmpty(request.Id) ?
_libraryManager.RootFolder :
_libraryManager.GetItemById(request.Id);
return GetImage(request, item, true);
}
/// <summary>
@ -377,7 +390,7 @@ namespace MediaBrowser.Api.Images
{
var item = _userManager.Users.First(i => i.Id == request.Id);
return GetImage(request, item);
return GetImage(request, item, false);
}
public object Get(GetItemByNameImage request)
@ -387,7 +400,7 @@ namespace MediaBrowser.Api.Images
var item = GetItemByName(request.Name, type, _libraryManager);
return GetImage(request, item);
return GetImage(request, item, false);
}
/// <summary>
@ -484,10 +497,10 @@ namespace MediaBrowser.Api.Images
/// </summary>
/// <param name="request">The request.</param>
/// <param name="item">The item.</param>
/// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
/// <returns>System.Object.</returns>
/// <exception cref="ResourceNotFoundException">
/// </exception>
public object GetImage(ImageRequest request, IHasImages item)
/// <exception cref="ResourceNotFoundException"></exception>
public object GetImage(ImageRequest request, IHasImages item, bool isHeadRequest)
{
var imageInfo = GetImageInfo(request, item);
@ -534,7 +547,8 @@ namespace MediaBrowser.Api.Images
supportedImageEnhancers,
contentType,
cacheDuration,
responseHeaders)
responseHeaders,
isHeadRequest)
.Result;
}
@ -544,7 +558,8 @@ namespace MediaBrowser.Api.Images
List<IImageEnhancer> enhancers,
string contentType,
TimeSpan? cacheDuration,
IDictionary<string,string> headers)
IDictionary<string,string> headers,
bool isHeadRequest)
{
var cropwhitespace = request.Type == ImageType.Logo || request.Type == ImageType.Art;
@ -574,7 +589,7 @@ namespace MediaBrowser.Api.Images
var file = await _imageProcessor.ProcessImage(options).ConfigureAwait(false);
return ResultFactory.GetStaticFileResult(Request, file, contentType, cacheDuration, FileShare.Read, headers);
return ResultFactory.GetStaticFileResult(Request, file, contentType, cacheDuration, FileShare.Read, headers, isHeadRequest);
}
private string GetMimeType(ImageOutputFormat format, string path)

View File

@ -1309,8 +1309,7 @@ namespace MediaBrowser.Controller.Entities
{
Path = file.FullName,
Type = type,
DateModified = FileSystem.GetLastWriteTimeUtc(file),
Length = ((FileInfo)file).Length
DateModified = FileSystem.GetLastWriteTimeUtc(file)
});
}
else
@ -1421,14 +1420,11 @@ namespace MediaBrowser.Controller.Entities
return null;
}
var info = new FileInfo(path);
return new ItemImageInfo
{
Path = path,
DateModified = FileSystem.GetLastWriteTimeUtc(info),
Type = imageType,
Length = info.Length
DateModified = FileSystem.GetLastWriteTimeUtc(path),
Type = imageType
};
}

View File

@ -10,7 +10,5 @@ namespace MediaBrowser.Controller.Entities
public ImageType Type { get; set; }
public DateTime DateModified { get; set; }
public long? Length { get; set; }
}
}

View File

@ -636,18 +636,26 @@ namespace MediaBrowser.Dlna.Didl
if (!_profile.EnableAlbumArtInDidl)
{
return;
if (!(item is Photo) && !(item is Video))
{
return;
}
}
AddImageResElement(item, element, 4096, 4096, "jpg");
AddImageResElement(item, element, 4096, 4096, "png");
AddImageResElement(item, element, 1024, 768, "jpg");
AddImageResElement(item, element, 640, 480, "jpg");
AddImageResElement(item, element, 160, 160, "jpg");
AddImageResElement(item, element, 160, 160, "png");
AddImageResElement(item, element, 4096, 4096, "jpg", "JPEG_LRG");
AddImageResElement(item, element, 4096, 4096, "png", "PNG_LRG");
AddImageResElement(item, element, 1024, 768, "jpg", "JPEG_MED");
AddImageResElement(item, element, 640, 480, "jpg", "JPEG_SM");
AddImageResElement(item, element, 160, 160, "jpg", "JPEG_TN");
AddImageResElement(item, element, 160, 160, "png", "PNG_TN");
}
private void AddImageResElement(BaseItem item, XmlElement element, int maxWidth, int maxHeight, string format)
private void AddImageResElement(BaseItem item,
XmlElement element,
int maxWidth,
int maxHeight,
string format,
string org_Pn)
{
var imageInfo = GetImageInfo(item);
@ -667,7 +675,8 @@ namespace MediaBrowser.Dlna.Didl
var width = albumartUrlInfo.Width;
var height = albumartUrlInfo.Height;
var contentFeatures = new ContentFeatureBuilder(_profile).BuildImageHeader(format, width, height, imageInfo.IsDirectStream);
var contentFeatures = new ContentFeatureBuilder(_profile)
.BuildImageHeader(format, width, height, imageInfo.IsDirectStream, org_Pn);
res.SetAttribute("protocolInfo", String.Format(
"http-get:*:{0}:{1}",
@ -675,14 +684,6 @@ namespace MediaBrowser.Dlna.Didl
contentFeatures
));
res.SetAttribute("colorDepth", "24");
if (imageInfo.IsDirectStream)
{
var length = imageInfo.ItemImageInfo.Length ?? new FileInfo(imageInfo.File).Length;
res.SetAttribute("size", length.ToString(_usCulture));
}
if (width.HasValue && height.HasValue)
{
res.SetAttribute("resolution", string.Format("{0}x{1}", width.Value, height.Value));

View File

@ -15,15 +15,15 @@ namespace MediaBrowser.Model.Dlna
public string BuildImageHeader(string container,
int? width,
int? height,
bool isDirectStream)
bool isDirectStream,
string orgPn = null)
{
string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetImageOrgOpValue();
// 0 = native, 1 = transcoded
var orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1";
DlnaFlags flagValue = DlnaFlags.StreamingTransferMode |
DlnaFlags.BackgroundTransferMode |
DlnaFlags flagValue = DlnaFlags.BackgroundTransferMode |
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
@ -34,7 +34,10 @@ namespace MediaBrowser.Model.Dlna
width,
height);
string orgPn = mediaProfile == null ? null : mediaProfile.OrgPn;
if (string.IsNullOrEmpty(orgPn))
{
orgPn = mediaProfile == null ? null : mediaProfile.OrgPn;
}
if (string.IsNullOrEmpty(orgPn))
{
@ -66,10 +69,10 @@ namespace MediaBrowser.Model.Dlna
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
if (isDirectStream)
{
flagValue = flagValue | DlnaFlags.ByteBasedSeek;
}
//if (isDirectStream)
//{
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
//}
//else if (runtimeTicks.HasValue)
//{
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
@ -125,10 +128,10 @@ namespace MediaBrowser.Model.Dlna
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
if (isDirectStream)
{
flagValue = flagValue | DlnaFlags.ByteBasedSeek;
}
//if (isDirectStream)
//{
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
//}
//else if (runtimeTicks.HasValue)
//{
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;

View File

@ -123,7 +123,8 @@
"HeaderMyViews": "My Views",
"HeaderLibraryFolders": "Media Folders",
"HeaderLatestMedia": "Latest Media",
"ButtonMore": "More...",
"ButtonMoreItems": "More...",
"ButtonMore": "More",
"HeaderFavoriteMovies": "Favorite Movies",
"HeaderFavoriteShows": "Favorite Shows",
"HeaderFavoriteEpisodes": "Favorite Episodes",

View File

@ -964,5 +964,6 @@
"OptionReportBooks": "Books",
"OptionReportArtists": "Artists",
"OptionReportAlbums": "Albums",
"OptionReportAdultVideos": "Adult videos"
"OptionReportAdultVideos": "Adult videos",
"ButtonMore": "More"
}

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.424</version>
<version>3.0.425</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.424" />
<dependency id="MediaBrowser.Common" version="3.0.425" />
<dependency id="NLog" version="3.1.0.0" />
<dependency id="SimpleInjector" version="2.5.2" />
<dependency id="sharpcompress" version="0.10.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.424</version>
<version>3.0.425</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Model.Signed</id>
<version>3.0.424</version>
<version>3.0.425</version>
<title>MediaBrowser.Model - Signed Edition</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.424</version>
<version>3.0.425</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.424" />
<dependency id="MediaBrowser.Common" version="3.0.425" />
</dependencies>
</metadata>
<files>