Merge pull request #2708 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-06-13 02:34:08 -04:00 committed by GitHub
commit e93aed7b6c
12 changed files with 58 additions and 180 deletions

View File

@ -3929,15 +3929,6 @@ namespace Emby.Server.Implementations.Data
} }
} }
if (!string.IsNullOrWhiteSpace(query.SlugName))
{
whereClauses.Add("CleanName=@SlugName");
if (statement != null)
{
statement.TryBind("@SlugName", GetCleanValue(query.SlugName));
}
}
if (!string.IsNullOrWhiteSpace(query.MinSortName)) if (!string.IsNullOrWhiteSpace(query.MinSortName))
{ {
whereClauses.Add("SortName>=@MinSortName"); whereClauses.Add("SortName>=@MinSortName");

View File

@ -167,7 +167,6 @@
<Compile Include="LiveTv\LiveTvDtoService.cs" /> <Compile Include="LiveTv\LiveTvDtoService.cs" />
<Compile Include="LiveTv\LiveTvManager.cs" /> <Compile Include="LiveTv\LiveTvManager.cs" />
<Compile Include="LiveTv\LiveTvMediaSourceProvider.cs" /> <Compile Include="LiveTv\LiveTvMediaSourceProvider.cs" />
<Compile Include="LiveTv\ProgramImageProvider.cs" />
<Compile Include="LiveTv\RecordingImageProvider.cs" /> <Compile Include="LiveTv\RecordingImageProvider.cs" />
<Compile Include="LiveTv\RefreshChannelsScheduledTask.cs" /> <Compile Include="LiveTv\RefreshChannelsScheduledTask.cs" />
<Compile Include="LiveTv\TunerHosts\BaseTunerHost.cs" /> <Compile Include="LiveTv\TunerHosts\BaseTunerHost.cs" />

View File

@ -1422,18 +1422,6 @@ namespace Emby.Server.Implementations.LiveTv
await _libraryManager.UpdateItem(program, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); 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);
}
foreach (var program in updatedPrograms)
{
_providerManager.QueueRefresh(program.Id, new MetadataRefreshOptions(_fileSystem), RefreshPriority.Low);
}
}
currentChannel.IsMovie = isMovie; currentChannel.IsMovie = isMovie;
currentChannel.IsNews = isNews; currentChannel.IsNews = isNews;
currentChannel.IsSports = isSports; currentChannel.IsSports = isSports;

View File

@ -1,103 +0,0 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Emby.Server.Implementations.LiveTv
{
public class ProgramImageProvider : IDynamicImageProvider, IHasItemChangeMonitor, IHasOrder
{
private readonly ILiveTvManager _liveTvManager;
public ProgramImageProvider(ILiveTvManager liveTvManager)
{
_liveTvManager = liveTvManager;
}
public IEnumerable<ImageType> GetSupportedImages(IHasImages item)
{
return new[] { ImageType.Primary };
}
private string GetItemExternalId(BaseItem item)
{
var externalId = item.ExternalId;
if (string.IsNullOrWhiteSpace(externalId))
{
externalId = item.GetProviderId("ProviderExternalId");
}
return externalId;
}
public async Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
{
var liveTvItem = (LiveTvProgram)item;
var imageResponse = new DynamicImageResponse();
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
if (service != null)
{
try
{
var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId);
if (channel != null)
{
var response = await service.GetProgramImageAsync(GetItemExternalId(liveTvItem), GetItemExternalId(channel), cancellationToken).ConfigureAwait(false);
if (response != null)
{
imageResponse.HasImage = true;
imageResponse.Stream = response.Stream;
imageResponse.Format = response.Format;
}
}
}
catch (NotImplementedException)
{
}
}
return imageResponse;
}
public string Name
{
get { return "Live TV Service Provider"; }
}
public bool Supports(IHasImages item)
{
return item is LiveTvProgram;
}
public int Order
{
get
{
// Let the better providers run first
return 100;
}
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var liveTvItem = item as LiveTvProgram;
if (liveTvItem != null)
{
return !liveTvItem.HasImage(ImageType.Primary);
}
return false;
}
}
}

View File

@ -178,13 +178,7 @@ namespace MediaBrowser.Api
{ {
if (name.IndexOf(BaseItem.SlugChar) != -1) if (name.IndexOf(BaseItem.SlugChar) != -1)
{ {
var result = libraryManager.GetItemList(new InternalItemsQuery var result = GetItemFromSlugName<MusicArtist>(libraryManager, name, dtoOptions);
{
SlugName = name,
IncludeItemTypes = new[] { typeof(MusicArtist).Name },
DtoOptions = dtoOptions
}).OfType<MusicArtist>().FirstOrDefault();
if (result != null) if (result != null)
{ {
@ -199,13 +193,7 @@ namespace MediaBrowser.Api
{ {
if (name.IndexOf(BaseItem.SlugChar) != -1) if (name.IndexOf(BaseItem.SlugChar) != -1)
{ {
var result = libraryManager.GetItemList(new InternalItemsQuery var result = GetItemFromSlugName<Studio>(libraryManager, name, dtoOptions);
{
SlugName = name,
IncludeItemTypes = new[] { typeof(Studio).Name },
DtoOptions = dtoOptions
}).OfType<Studio>().FirstOrDefault();
if (result != null) if (result != null)
{ {
@ -220,13 +208,7 @@ namespace MediaBrowser.Api
{ {
if (name.IndexOf(BaseItem.SlugChar) != -1) if (name.IndexOf(BaseItem.SlugChar) != -1)
{ {
var result = libraryManager.GetItemList(new InternalItemsQuery var result = GetItemFromSlugName<Genre>(libraryManager, name, dtoOptions);
{
SlugName = name,
IncludeItemTypes = new[] { typeof(Genre).Name },
DtoOptions = dtoOptions
}).OfType<Genre>().FirstOrDefault();
if (result != null) if (result != null)
{ {
@ -241,13 +223,7 @@ namespace MediaBrowser.Api
{ {
if (name.IndexOf(BaseItem.SlugChar) != -1) if (name.IndexOf(BaseItem.SlugChar) != -1)
{ {
var result = libraryManager.GetItemList(new InternalItemsQuery var result = GetItemFromSlugName<MusicGenre>(libraryManager, name, dtoOptions);
{
SlugName = name,
IncludeItemTypes = new[] { typeof(MusicGenre).Name },
DtoOptions = dtoOptions
}).OfType<MusicGenre>().FirstOrDefault();
if (result != null) if (result != null)
{ {
@ -262,13 +238,7 @@ namespace MediaBrowser.Api
{ {
if (name.IndexOf(BaseItem.SlugChar) != -1) if (name.IndexOf(BaseItem.SlugChar) != -1)
{ {
var result = libraryManager.GetItemList(new InternalItemsQuery var result = GetItemFromSlugName<GameGenre>(libraryManager, name, dtoOptions);
{
SlugName = name,
IncludeItemTypes = new[] { typeof(GameGenre).Name },
DtoOptions = dtoOptions
}).OfType<GameGenre>().FirstOrDefault();
if (result != null) if (result != null)
{ {
@ -283,13 +253,7 @@ namespace MediaBrowser.Api
{ {
if (name.IndexOf(BaseItem.SlugChar) != -1) if (name.IndexOf(BaseItem.SlugChar) != -1)
{ {
var result = libraryManager.GetItemList(new InternalItemsQuery var result = GetItemFromSlugName<Person>(libraryManager, name, dtoOptions);
{
SlugName = name,
IncludeItemTypes = new[] { typeof(Person).Name },
DtoOptions = dtoOptions
}).OfType<Person>().FirstOrDefault();
if (result != null) if (result != null)
{ {
@ -300,6 +264,42 @@ namespace MediaBrowser.Api
return libraryManager.GetPerson(name); return libraryManager.GetPerson(name);
} }
private T GetItemFromSlugName<T>(ILibraryManager libraryManager, string name, DtoOptions dtoOptions)
where T : BaseItem, new()
{
var result = libraryManager.GetItemList(new InternalItemsQuery
{
Name = name.Replace(BaseItem.SlugChar, '&'),
IncludeItemTypes = new[] { typeof(T).Name },
DtoOptions = dtoOptions
}).OfType<Person>().FirstOrDefault();
if (result == null)
{
result = libraryManager.GetItemList(new InternalItemsQuery
{
Name = name.Replace(BaseItem.SlugChar, '/'),
IncludeItemTypes = new[] { typeof(T).Name },
DtoOptions = dtoOptions
}).OfType<Person>().FirstOrDefault();
}
if (result == null)
{
result = libraryManager.GetItemList(new InternalItemsQuery
{
Name = name.Replace(BaseItem.SlugChar, '?'),
IncludeItemTypes = new[] { typeof(T).Name },
DtoOptions = dtoOptions
}).OfType<Person>().FirstOrDefault();
}
return result as T;
}
protected string GetPathValue(int index) protected string GetPathValue(int index)
{ {
var pathInfo = Parse(Request.PathInfo); var pathInfo = Parse(Request.PathInfo);

View File

@ -56,7 +56,6 @@ namespace MediaBrowser.Controller.Entities
public string Path { get; set; } public string Path { get; set; }
public string PathNotStartsWith { get; set; } public string PathNotStartsWith { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string SlugName { get; set; }
public string Person { get; set; } public string Person { get; set; }
public string[] PersonIds { get; set; } public string[] PersonIds { get; set; }

View File

@ -221,12 +221,6 @@ namespace MediaBrowser.Controller.LiveTv
public override bool IsInternetMetadataEnabled() public override bool IsInternetMetadataEnabled()
{ {
if (IsMovie)
{
var options = (LiveTvOptions)ConfigurationManager.GetConfiguration("livetv");
return options.EnableMovieProviders;
}
return false; return false;
} }

View File

@ -233,7 +233,12 @@ namespace MediaBrowser.Controller.MediaEncoding
return null; return null;
} }
return codec; if (_mediaEncoder.SupportsDecoder(codec))
{
return codec;
}
return null;
} }
/// <summary> /// <summary>

View File

@ -92,7 +92,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
"mpeg2_qsv", "mpeg2_qsv",
"vc1_qsv", "vc1_qsv",
"h264_cuvid", "h264_cuvid",
"hevc_cuvid" "hevc_cuvid",
"dts",
"ac3",
"aac",
"mp3",
"h264",
"hevc"
}; };
foreach (var codec in required) foreach (var codec in required)

View File

@ -1,13 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.LiveTv namespace MediaBrowser.Model.LiveTv
{ {
public class LiveTvOptions public class LiveTvOptions
{ {
public int? GuideDays { get; set; } public int? GuideDays { get; set; }
public bool EnableMovieProviders { get; set; }
public string RecordingPath { get; set; } public string RecordingPath { get; set; }
public string MovieRecordingPath { get; set; } public string MovieRecordingPath { get; set; }
public string SeriesRecordingPath { get; set; } public string SeriesRecordingPath { get; set; }
@ -30,7 +28,6 @@ namespace MediaBrowser.Model.LiveTv
public LiveTvOptions() public LiveTvOptions()
{ {
EnableMovieProviders = true;
TunerHosts = new List<TunerHostInfo>(); TunerHosts = new List<TunerHostInfo>();
ListingProviders = new List<ListingsProviderInfo>(); ListingProviders = new List<ListingsProviderInfo>();
MediaLocationsCreated = new string[] { }; MediaLocationsCreated = new string[] { };

View File

@ -70,6 +70,8 @@ namespace MediaBrowser.Model.Users
public UserPolicy() public UserPolicy()
{ {
EnableContentDeletion = true;
EnableSyncTranscoding = true; EnableSyncTranscoding = true;
EnableMediaPlayback = true; EnableMediaPlayback = true;

View File

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