Merge pull request #2945 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-10-07 02:16:08 -04:00 committed by GitHub
commit b7b1dbed5b
16 changed files with 120 additions and 31 deletions

View File

@ -725,12 +725,13 @@ namespace Emby.Server.Implementations.HttpServer
Summary = route.Summary
});
//routes.Add(new RouteAttribute(DoubleNormalizeEmbyRoutePath(route.Path), route.Verbs)
//{
// Notes = route.Notes,
// Priority = route.Priority,
// Summary = route.Summary
//});
// needed because apps add /emby, and some users also add /emby, thereby double prefixing
routes.Add(new RouteAttribute(DoubleNormalizeEmbyRoutePath(route.Path), route.Verbs)
{
Notes = route.Notes,
Priority = route.Priority,
Summary = route.Summary
});
}
return routes.ToArray(routes.Count);

View File

@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
/// </summary>
public class BookResolver : MediaBrowser.Controller.Resolvers.ItemResolver<Book>
{
private readonly string[] _validExtensions = {".pdf", ".epub", ".mobi", ".cbr", ".cbz"};
private readonly string[] _validExtensions = { ".pdf", ".epub", ".mobi", ".cbr", ".cbz", ".azw3" };
/// <summary>
///
@ -26,7 +26,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
// Only process items that are in a collection folder containing books
if (!string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
return null;
if (args.IsDirectory)
{
return GetBook(args);
@ -69,9 +69,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
return null;
return new Book
{
Path = bookFiles[0].FullName
};
{
Path = bookFiles[0].FullName
};
}
}
}

View File

@ -272,11 +272,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private bool EncodeVideo(MediaSourceInfo mediaSource)
{
if (string.Equals(_liveTvOptions.RecordedVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
return false;
}
var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>();
return !mediaStreams.Any(i => i.Type == MediaStreamType.Video && string.Equals(i.Codec, "h264", StringComparison.OrdinalIgnoreCase) && !i.IsInterlaced);
}

View File

@ -110,7 +110,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
_fileSystem.CreateDirectory(tempFolder);
_zipClient.ExtractAllFromGz(stream, tempFolder, true);
try
{
_zipClient.ExtractAllFromGz(stream, tempFolder, true);
}
catch
{
// If the extraction fails just return the original file, it could be a gz
return file;
}
return _fileSystem.GetFiles(tempFolder, true)
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))

View File

@ -299,6 +299,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
int? videoBitrate = null;
int? audioBitrate = null;
var isHd = channelInfo.IsHD ?? true;
if (string.Equals(profile, "mobile", StringComparison.OrdinalIgnoreCase))
{
width = 1280;
@ -350,7 +352,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
else
{
// This is for android tv's 1200 condition. Remove once not needed anymore so that we can avoid possible side effects of dummying up this data
if ((channelInfo.IsHD ?? true))
if (isHd)
{
width = 1920;
height = 1080;
@ -367,9 +369,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
if (!videoBitrate.HasValue)
{
videoBitrate = (channelInfo.IsHD ?? true) ? 15000000 : 2000000;
videoBitrate = isHd ? 15000000 : 2000000;
}
audioBitrate = (channelInfo.IsHD ?? true) ? 448000 : 192000;
audioBitrate = isHd ? 448000 : 192000;
}
// normalize

View File

@ -1,8 +1,9 @@
using MediaBrowser.Model.Serialization;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Controller.Entities.Audio
{
public class AudioPodcast : Audio
public class AudioPodcast : Audio, IHasLookupInfo<SongInfo>
{
[IgnoreDataMember]
public override bool SupportsPositionTicksResume
@ -13,6 +14,15 @@ namespace MediaBrowser.Controller.Entities.Audio
}
}
[IgnoreDataMember]
public override bool SupportsPlayedStatus
{
get
{
return true;
}
}
public override double? GetDefaultPrimaryImageAspectRatio()
{
return 1;

View File

@ -1,11 +1,12 @@
using System;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Entities
{
public class AudioBook : Audio.Audio, IHasSeries
public class AudioBook : Audio.Audio, IHasSeries, IHasLookupInfo<SongInfo>
{
[IgnoreDataMember]
public override bool SupportsPositionTicksResume

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities;
using System;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using System.Threading;
using System.Threading.Tasks;
@ -13,6 +14,7 @@ namespace MediaBrowser.Controller.Providers
/// <param name="item">The item.</param>
/// <returns><c>true</c> if this instance can refresh the specified item; otherwise, <c>false</c>.</returns>
bool CanRefresh(IHasMetadata item);
bool CanRefreshPrimary(Type type);
/// <summary>
/// Refreshes the metadata.

View File

@ -91,8 +91,6 @@ namespace MediaBrowser.Controller.Sync
/// </summary>
List<SyncTarget> GetSyncTargets(string userId);
List<SyncTarget> GetSyncTargets(string userId, bool? supportsRemoteSync);
/// <summary>
/// Supportses the synchronize.
/// </summary>

View File

@ -11,8 +11,6 @@ namespace MediaBrowser.Controller.Sync
/// <value>The name.</value>
string Name { get; }
bool SupportsRemoteSync { get; }
/// <summary>
/// Gets the synchronize targets.
/// </summary>

View File

@ -13,7 +13,6 @@ namespace MediaBrowser.Model.LiveTv
public string RecordingEncodingFormat { get; set; }
public bool EnableRecordingSubfolders { get; set; }
public bool EnableOriginalAudioWithEncodedRecordings { get; set; }
public string RecordedVideoCodec { get; set; }
public TunerHostInfo[] TunerHosts { get; set; }
public ListingsProviderInfo[] ListingProviders { get; set; }

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Providers.Books
{
public class GoogleBooksProvider : IRemoteMetadataProvider<AudioBook, SongInfo>
{
public string Name => "Google Books";
private readonly IHttpClient _httpClient;
public GoogleBooksProvider(IHttpClient httpClient)
{
_httpClient = httpClient;
}
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
{
return _httpClient.GetResponse(new HttpRequestOptions
{
CancellationToken = cancellationToken,
Url = url,
BufferContent = false
});
}
public async Task<MetadataResult<AudioBook>> GetMetadata(SongInfo info, CancellationToken cancellationToken)
{
return new MetadataResult<AudioBook>();
}
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SongInfo searchInfo, CancellationToken cancellationToken)
{
return new List<RemoteSearchResult>();
}
}
}

View File

@ -453,6 +453,11 @@ namespace MediaBrowser.Providers.Manager
return item is TItemType;
}
public bool CanRefreshPrimary(Type type)
{
return type == typeof(TItemType);
}
protected virtual async Task<RefreshResult> RefreshWithProviders(MetadataResult<TItemType> metadata,
TIdType id,
MetadataRefreshOptions options,

View File

@ -118,7 +118,29 @@ namespace MediaBrowser.Providers.Manager
public Task<ItemUpdateType> RefreshSingleItem(IHasMetadata item, MetadataRefreshOptions options, CancellationToken cancellationToken)
{
var service = _metadataServices.FirstOrDefault(i => i.CanRefresh(item));
IMetadataService service = null;
var type = item.GetType();
foreach (var current in _metadataServices)
{
if (current.CanRefreshPrimary(type))
{
service = current;
break;
}
}
if (service == null)
{
foreach (var current in _metadataServices)
{
if (current.CanRefresh(item))
{
service = current;
break;
}
}
}
if (service != null)
{
@ -452,6 +474,8 @@ namespace MediaBrowser.Providers.Manager
GetPluginSummary<MusicAlbum>(),
GetPluginSummary<MusicArtist>(),
GetPluginSummary<Audio>(),
GetPluginSummary<AudioBook>(),
GetPluginSummary<AudioPodcast>(),
GetPluginSummary<Genre>(),
GetPluginSummary<Studio>(),
GetPluginSummary<GameGenre>(),

View File

@ -41,6 +41,7 @@
<Compile Include="Books\AudioBookMetadataService.cs" />
<Compile Include="Books\AudioPodcastMetadataService.cs" />
<Compile Include="Books\BookMetadataService.cs" />
<Compile Include="Books\GoogleBooksProvider.cs" />
<Compile Include="BoxSets\BoxSetMetadataService.cs" />
<Compile Include="BoxSets\MovieDbBoxSetImageProvider.cs" />
<Compile Include="BoxSets\MovieDbBoxSetProvider.cs" />

View File

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