Merge pull request #2707 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-06-12 03:14:12 -04:00 committed by GitHub
commit d803b55f4d
22 changed files with 108 additions and 162 deletions

View File

@ -1058,18 +1058,8 @@ namespace Emby.Server.Implementations.Dto
dto.CommunityRating = item.CommunityRating;
}
//if (item.IsFolder)
//{
// var folder = (Folder)item;
// if (fields.Contains(ItemFields.IndexOptions))
// {
// dto.IndexOptions = folder.IndexByOptionStrings.ToArray();
// }
//}
var supportsPlaceHolders = item as ISupportsPlaceHolders;
if (supportsPlaceHolders != null)
if (supportsPlaceHolders != null && supportsPlaceHolders.IsPlaceHolder)
{
dto.IsPlaceHolder = supportsPlaceHolders.IsPlaceHolder;
}

View File

@ -174,7 +174,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var imagesWithText = allImages.Where(i => string.Equals(i.text, "yes", StringComparison.OrdinalIgnoreCase)).ToList();
var imagesWithoutText = allImages.Where(i => string.Equals(i.text, "no", StringComparison.OrdinalIgnoreCase)).ToList();
double desiredAspect = IsMovie(programEntry) ? 0.666666667 : wideAspect;
double desiredAspect = 0.666666667;
programEntry.primaryImage = GetProgramImage(ApiUrl, imagesWithText, true, desiredAspect) ??
GetProgramImage(ApiUrl, allImages, true, desiredAspect);

View File

@ -742,7 +742,7 @@ namespace Emby.Server.Implementations.LiveTv
else
{
// Increment this whenver some internal change deems it necessary
var etag = info.Etag + "4";
var etag = info.Etag + "5";
if (!string.Equals(etag, item.ExternalEtag, StringComparison.OrdinalIgnoreCase))
{
@ -1422,6 +1422,8 @@ namespace Emby.Server.Implementations.LiveTv
await _libraryManager.UpdateItem(program, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
}
if (!(service is EmbyTV.EmbyTV))
{
foreach (var program in newPrograms)
{
_providerManager.QueueRefresh(program.Id, new MetadataRefreshOptions(_fileSystem), RefreshPriority.Low);
@ -1430,6 +1432,7 @@ namespace Emby.Server.Implementations.LiveTv
{
_providerManager.QueueRefresh(program.Id, new MetadataRefreshOptions(_fileSystem), RefreshPriority.Low);
}
}
currentChannel.IsMovie = isMovie;
currentChannel.IsNews = isNews;

View File

@ -1671,7 +1671,6 @@ namespace Emby.Server.Implementations.Session
dtoOptions.Fields.Remove(ItemFields.DisplayPreferencesId);
dtoOptions.Fields.Remove(ItemFields.Etag);
dtoOptions.Fields.Remove(ItemFields.ExternalEtag);
dtoOptions.Fields.Remove(ItemFields.IndexOptions);
dtoOptions.Fields.Remove(ItemFields.InheritedParentalRatingValue);
dtoOptions.Fields.Remove(ItemFields.ItemCounts);
dtoOptions.Fields.Remove(ItemFields.Keywords);

View File

@ -211,33 +211,6 @@ namespace MediaBrowser.Controller.Entities
item.SetParent(null);
}
/// <summary>
/// Returns the valid set of index by options for this folder type.
/// Override or extend to modify.
/// </summary>
/// <returns>Dictionary{System.StringFunc{UserIEnumerable{BaseItem}}}.</returns>
protected virtual IEnumerable<string> GetIndexByOptions()
{
return new List<string> {
{"None"},
{"Performer"},
{"Genre"},
{"Director"},
{"Year"},
{"Studio"}
};
}
/// <summary>
/// Get the list of indexy by choices for this folder (localized).
/// </summary>
/// <value>The index by option strings.</value>
[IgnoreDataMember]
public IEnumerable<string> IndexByOptionStrings
{
get { return GetIndexByOptions(); }
}
/// <summary>
/// Gets the actual children.
/// </summary>

View File

@ -66,17 +66,6 @@ namespace MediaBrowser.Controller.Entities.TV
return series == null ? SeriesName : series.SortName;
}
// Genre, Rating and Stuido will all be the same
protected override IEnumerable<string> GetIndexByOptions()
{
return new List<string> {
{"None"},
{"Performer"},
{"Director"},
{"Year"},
};
}
public override List<string> GetUserDataKeys()
{
var list = base.GetUserDataKeys();

View File

@ -227,17 +227,6 @@ namespace MediaBrowser.Controller.Entities.TV
return list;
}
// Studio, Genre and Rating will all be the same so makes no sense to index by these
protected override IEnumerable<string> GetIndexByOptions()
{
return new List<string> {
{"None"},
{"Performer"},
{"Director"},
{"Year"},
};
}
[IgnoreDataMember]
public bool ContainsEpisodesWithoutSeasonFolders
{

View File

@ -57,8 +57,13 @@ namespace MediaBrowser.Controller.LiveTv
return value;
}
else
{
double value = 2;
value /= 3;
return null;
return value;
}
}
[IgnoreDataMember]

View File

@ -42,6 +42,11 @@ namespace MediaBrowser.Controller.MediaEncoding
{
var hwType = encodingOptions.HardwareAccelerationType;
if (!encodingOptions.EnableHardwareEncoding)
{
hwType = null;
}
if (string.Equals(hwType, "qsv", StringComparison.OrdinalIgnoreCase) ||
string.Equals(hwType, "h264_qsv", StringComparison.OrdinalIgnoreCase))
{
@ -1761,14 +1766,11 @@ namespace MediaBrowser.Controller.MediaEncoding
return null;
}
if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
if (state.VideoStream != null &&
!string.IsNullOrWhiteSpace(state.VideoStream.Codec) &&
!string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType) &&
encodingOptions.EnableHardwareDecoding)
{
if (!string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType))
{
// causing unpredictable results
//return "-hwaccel auto";
}
if (string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
{
switch (state.MediaSource.VideoStream.Codec.ToLower())
@ -1818,6 +1820,13 @@ namespace MediaBrowser.Controller.MediaEncoding
return "-c:v h264_cuvid ";
}
break;
case "hevc":
case "h265":
if (_mediaEncoder.SupportsDecoder("hevc_cuvid"))
{
return "-c:v hevc_cuvid ";
}
break;
}
}
}

View File

@ -91,7 +91,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
"hevc_qsv",
"mpeg2_qsv",
"vc1_qsv",
"h264_cuvid"
"h264_cuvid",
"hevc_cuvid"
};
foreach (var codec in required)

View File

@ -13,6 +13,8 @@ namespace MediaBrowser.Model.Configuration
public string VaapiDevice { get; set; }
public int H264Crf { get; set; }
public string H264Preset { get; set; }
public bool EnableHardwareDecoding { get; set; }
public bool EnableHardwareEncoding { get; set; }
public EncodingOptions()
{
@ -22,6 +24,8 @@ namespace MediaBrowser.Model.Configuration
EncodingThreadCount = -1;
VaapiDevice = "/dev/dri/card0";
H264Crf = 23;
EnableHardwareDecoding = true;
EnableHardwareEncoding = true;
}
}
}

View File

@ -87,11 +87,6 @@
/// </summary>
HomePageUrl,
/// <summary>
/// The fields that the server supports indexing on
/// </summary>
IndexOptions,
/// <summary>
/// The item counts
/// </summary>

View File

@ -72,7 +72,6 @@
<Compile Include="MediaInfo\SubtitleDownloader.cs" />
<Compile Include="MediaInfo\SubtitleResolver.cs" />
<Compile Include="MediaInfo\SubtitleScheduledTask.cs" />
<Compile Include="Movies\LiveTvMovieDbProvider.cs" />
<Compile Include="Movies\MovieDbTrailerProvider.cs" />
<Compile Include="Movies\MovieExternalIds.cs" />
<Compile Include="Movies\GenericMovieDbInfo.cs" />

View File

@ -1,38 +0,0 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Providers;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Providers.Movies
{
public class LiveTvMovieDbProvider : IRemoteMetadataProvider<LiveTvProgram, LiveTvProgramLookupInfo>, IHasOrder
{
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(LiveTvProgramLookupInfo searchInfo, CancellationToken cancellationToken)
{
return MovieDbProvider.Current.GetMovieSearchResults(searchInfo, cancellationToken);
}
public Task<MetadataResult<LiveTvProgram>> GetMetadata(LiveTvProgramLookupInfo info, CancellationToken cancellationToken)
{
return MovieDbProvider.Current.GetItemMetadata<LiveTvProgram>(info, cancellationToken);
}
public string Name
{
get { return "LiveTvMovieDbProvider"; }
}
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
{
return MovieDbProvider.Current.GetImageResponse(url, cancellationToken);
}
public int Order
{
get { return 1; }
}
}
}

View File

@ -43,13 +43,6 @@ namespace MediaBrowser.Providers.Movies
public bool Supports(IHasImages item)
{
// Supports images for tv movies
var tvProgram = item as LiveTvProgram;
if (tvProgram != null && tvProgram.IsMovie)
{
return true;
}
return item is Movie || item is MusicVideo || item is Trailer;
}

View File

@ -93,13 +93,6 @@ namespace MediaBrowser.Providers.Omdb
public bool Supports(IHasImages item)
{
// Supports images for tv movies
var tvProgram = item as LiveTvProgram;
if (tvProgram != null && tvProgram.IsMovie)
{
return true;
}
return item is Movie || item is Trailer || item is Episode;
}

View File

@ -22,7 +22,7 @@ using System.Threading.Tasks;
namespace MediaBrowser.Providers.Omdb
{
public class OmdbItemProvider : IRemoteMetadataProvider<Series, SeriesInfo>,
IRemoteMetadataProvider<Movie, MovieInfo>, IRemoteMetadataProvider<Trailer, TrailerInfo>, IRemoteMetadataProvider<LiveTvProgram, LiveTvProgramLookupInfo>
IRemoteMetadataProvider<Movie, MovieInfo>, IRemoteMetadataProvider<Trailer, TrailerInfo>
{
private readonly IJsonSerializer _jsonSerializer;
private readonly IHttpClient _httpClient;
@ -51,16 +51,6 @@ namespace MediaBrowser.Providers.Omdb
return GetSearchResults(searchInfo, "movie", cancellationToken);
}
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(LiveTvProgramLookupInfo searchInfo, CancellationToken cancellationToken)
{
if (!searchInfo.IsMovie)
{
return Task.FromResult<IEnumerable<RemoteSearchResult>>(new List<RemoteSearchResult>());
}
return GetSearchResults(searchInfo, "movie", cancellationToken);
}
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(ItemLookupInfo searchInfo, string type, CancellationToken cancellationToken)
{
return GetSearchResultsInternal(searchInfo, type, true, cancellationToken);
@ -230,15 +220,6 @@ namespace MediaBrowser.Providers.Omdb
return result;
}
public Task<MetadataResult<LiveTvProgram>> GetMetadata(LiveTvProgramLookupInfo info, CancellationToken cancellationToken)
{
if (!info.IsMovie)
{
return Task.FromResult(new MetadataResult<LiveTvProgram>());
}
return GetMovieResult<LiveTvProgram>(info, cancellationToken);
}
public Task<MetadataResult<Movie>> GetMetadata(MovieInfo info, CancellationToken cancellationToken)
{
return GetMovieResult<Movie>(info, cancellationToken);

View File

@ -107,7 +107,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
/// <param name="metadataFile">The metadata file.</param>
/// <param name="settings">The settings.</param>
/// <param name="cancellationToken">The cancellation token.</param>
private void Fetch(MetadataResult<T> item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken)
protected virtual void Fetch(MetadataResult<T> item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken)
{
if (!SupportsUrlAfterClosingXmlTag)
{
@ -233,7 +233,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
get { return "themoviedb.org/movie/"; }
}
private void ParseProviderLinks(T item, string xml)
protected void ParseProviderLinks(T item, string xml)
{
//Look for a match for the Regex pattern "tt" followed by 7 digits
Match m = Regex.Match(xml, @"tt([0-9]{7})", RegexOptions.IgnoreCase);

View File

@ -9,6 +9,8 @@ using System.Threading;
using System.Xml;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Xml;
using System.IO;
using System.Text;
namespace MediaBrowser.XbmcMetadata.Parsers
{
@ -24,6 +26,65 @@ namespace MediaBrowser.XbmcMetadata.Parsers
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
protected override void Fetch(MetadataResult<Episode> item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken)
{
using (var fileStream = FileSystem.OpenRead(metadataFile))
{
using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
{
item.ResetPeople();
var xml = streamReader.ReadToEnd();
var srch = "</episodedetails>";
var index = xml.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
if (index != -1)
{
xml = xml.Substring(0, index + srch.Length);
}
using (var ms = new MemoryStream())
{
var bytes = Encoding.UTF8.GetBytes(xml);
ms.Write(bytes, 0, bytes.Length);
ms.Position = 0;
// These are not going to be valid xml so no sense in causing the provider to fail and spamming the log with exceptions
try
{
// Use XmlReader for best performance
using (var reader = XmlReader.Create(ms, settings))
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
if (reader.NodeType == XmlNodeType.Element)
{
FetchDataFromXmlNode(reader, item);
}
else
{
reader.Read();
}
}
}
}
catch (XmlException)
{
}
}
}
}
}
/// <summary>
/// Fetches the data from XML node.
/// </summary>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.703</version>
<version>3.0.704</version>
<title>Emby.Common</title>
<authors>Emby 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.703</version>
<version>3.0.704</version>
<title>Emby.Server.Core</title>
<authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Emby Server.</description>
<copyright>Copyright © Emby 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.703" />
<dependency id="MediaBrowser.Common" version="3.0.704" />
</dependencies>
</metadata>
<files>

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.20.1")]
[assembly: AssemblyVersion("3.2.20.2")]