mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
commit
70a73984b8
22 changed files with 377 additions and 111 deletions
|
@ -148,6 +148,34 @@ namespace Emby.Server.Implementations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool CanLaunchWebBrowser
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!Environment.UserInteractive)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StartupOptions.ContainsOption("-service"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when [has pending restart changed].
|
/// Occurs when [has pending restart changed].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1936,6 +1964,7 @@ namespace Emby.Server.Implementations
|
||||||
OperatingSystemDisplayName = OperatingSystemDisplayName,
|
OperatingSystemDisplayName = OperatingSystemDisplayName,
|
||||||
CanSelfRestart = CanSelfRestart,
|
CanSelfRestart = CanSelfRestart,
|
||||||
CanSelfUpdate = CanSelfUpdate,
|
CanSelfUpdate = CanSelfUpdate,
|
||||||
|
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
||||||
WanAddress = ConnectManager.WanApiAddress,
|
WanAddress = ConnectManager.WanApiAddress,
|
||||||
HasUpdateAvailable = HasUpdateAvailable,
|
HasUpdateAvailable = HasUpdateAvailable,
|
||||||
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
|
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
|
||||||
|
@ -2358,13 +2387,7 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
public virtual void LaunchUrl(string url)
|
public virtual void LaunchUrl(string url)
|
||||||
{
|
{
|
||||||
if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&
|
if (!CanLaunchWebBrowser)
|
||||||
EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.OSX)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Environment.UserInteractive)
|
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,24 @@ namespace Emby.Server.Implementations.Archiving
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ExtractFirstFileFromGz(Stream source, string targetPath, string defaultFileName)
|
||||||
|
{
|
||||||
|
using (var reader = GZipReader.Open(source))
|
||||||
|
{
|
||||||
|
if (reader.MoveToNextEntry())
|
||||||
|
{
|
||||||
|
var entry = reader.Entry;
|
||||||
|
|
||||||
|
var filename = entry.Key;
|
||||||
|
if (string.IsNullOrWhiteSpace(filename))
|
||||||
|
{
|
||||||
|
filename = defaultFileName;
|
||||||
|
}
|
||||||
|
reader.WriteEntryToFile(Path.Combine(targetPath, filename));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extracts all from7z.
|
/// Extracts all from7z.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -5264,7 +5264,13 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
ItemIds = query.ItemIds,
|
ItemIds = query.ItemIds,
|
||||||
TopParentIds = query.TopParentIds,
|
TopParentIds = query.TopParentIds,
|
||||||
ParentId = query.ParentId,
|
ParentId = query.ParentId,
|
||||||
IsPlayed = query.IsPlayed
|
IsPlayed = query.IsPlayed,
|
||||||
|
IsAiring = query.IsAiring,
|
||||||
|
IsMovie = query.IsMovie,
|
||||||
|
IsSports = query.IsSports,
|
||||||
|
IsKids = query.IsKids,
|
||||||
|
IsNews = query.IsNews,
|
||||||
|
IsSeries = query.IsSeries
|
||||||
};
|
};
|
||||||
|
|
||||||
var innerWhereClauses = GetWhereClauses(innerQuery, null);
|
var innerWhereClauses = GetWhereClauses(innerQuery, null);
|
||||||
|
|
|
@ -35,15 +35,20 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
|
if (!_appHost.CanLaunchWebBrowser)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_appHost.IsFirstRun)
|
if (_appHost.IsFirstRun)
|
||||||
{
|
{
|
||||||
BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);
|
BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);
|
||||||
}
|
}
|
||||||
else if (_config.Configuration.IsStartupWizardCompleted)
|
else if (_config.Configuration.IsStartupWizardCompleted && _config.Configuration.AutoRunWebApp)
|
||||||
{
|
{
|
||||||
var options = ((ApplicationHost)_appHost).StartupOptions;
|
var options = ((ApplicationHost)_appHost).StartupOptions;
|
||||||
|
|
||||||
if (!options.ContainsOption("-service") && !options.ContainsOption("-nobrowser"))
|
if (!options.ContainsOption("-noautorunwebapp"))
|
||||||
{
|
{
|
||||||
BrowserLauncher.OpenDashboardPage("index.html", _appHost);
|
BrowserLauncher.OpenDashboardPage("index.html", _appHost);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,31 +104,64 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
var ext = Path.GetExtension(originalUrl.Split('?')[0]);
|
var ext = Path.GetExtension(originalUrl.Split('?')[0]);
|
||||||
|
|
||||||
if (string.Equals(ext, ".gz", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(ext, ".gz", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var tempFolder = ExtractGz(file);
|
||||||
|
return FindXmlFile(tempFolder);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//_logger.ErrorException("Error extracting from gz file {0}", ex, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var tempFolder = ExtractFirstFileFromGz(file);
|
||||||
|
return FindXmlFile(tempFolder);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//_logger.ErrorException("Error extracting from zip file {0}", ex, file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ExtractFirstFileFromGz(string file)
|
||||||
{
|
{
|
||||||
using (var stream = _fileSystem.OpenRead(file))
|
using (var stream = _fileSystem.OpenRead(file))
|
||||||
{
|
{
|
||||||
var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
|
var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
|
||||||
_fileSystem.CreateDirectory(tempFolder);
|
_fileSystem.CreateDirectory(tempFolder);
|
||||||
|
|
||||||
try
|
_zipClient.ExtractFirstFileFromGz(stream, tempFolder, "data.xml");
|
||||||
{
|
|
||||||
_zipClient.ExtractAllFromGz(stream, tempFolder, true);
|
return tempFolder;
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{
|
|
||||||
// If the extraction fails just return the original file, it could be a gz
|
|
||||||
return file;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _fileSystem.GetFiles(tempFolder, true)
|
private string ExtractGz(string file)
|
||||||
|
{
|
||||||
|
using (var stream = _fileSystem.OpenRead(file))
|
||||||
|
{
|
||||||
|
var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
|
||||||
|
_fileSystem.CreateDirectory(tempFolder);
|
||||||
|
|
||||||
|
_zipClient.ExtractAllFromGz(stream, tempFolder, true);
|
||||||
|
|
||||||
|
return tempFolder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string FindXmlFile(string directory)
|
||||||
|
{
|
||||||
|
return _fileSystem.GetFiles(directory, true)
|
||||||
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
|
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
|
||||||
.Select(i => i.FullName)
|
.Select(i => i.FullName)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
@ -149,6 +182,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
_logger.Debug("Getting xmltv programs for channel {0}", channelId);
|
_logger.Debug("Getting xmltv programs for channel {0}", channelId);
|
||||||
|
|
||||||
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
||||||
|
_logger.Debug("Opening XmlTvReader for {0}", path);
|
||||||
var reader = new XmlTvReader(path, GetLanguage(info));
|
var reader = new XmlTvReader(path, GetLanguage(info));
|
||||||
|
|
||||||
var results = reader.GetProgrammes(channelId, startDateUtc, endDateUtc, cancellationToken);
|
var results = reader.GetProgrammes(channelId, startDateUtc, endDateUtc, cancellationToken);
|
||||||
|
@ -251,6 +285,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
{
|
{
|
||||||
// In theory this should never be called because there is always only one lineup
|
// In theory this should never be called because there is always only one lineup
|
||||||
var path = await GetXml(info.Path, CancellationToken.None).ConfigureAwait(false);
|
var path = await GetXml(info.Path, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
_logger.Debug("Opening XmlTvReader for {0}", path);
|
||||||
var reader = new XmlTvReader(path, GetLanguage(info));
|
var reader = new XmlTvReader(path, GetLanguage(info));
|
||||||
var results = reader.GetChannels();
|
var results = reader.GetChannels();
|
||||||
|
|
||||||
|
@ -262,6 +297,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
{
|
{
|
||||||
// In theory this should never be called because there is always only one lineup
|
// In theory this should never be called because there is always only one lineup
|
||||||
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
||||||
|
_logger.Debug("Opening XmlTvReader for {0}", path);
|
||||||
var reader = new XmlTvReader(path, GetLanguage(info));
|
var reader = new XmlTvReader(path, GetLanguage(info));
|
||||||
var results = reader.GetChannels();
|
var results = reader.GetChannels();
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
public void AddParts(IEnumerable<ILiveTvService> services, IEnumerable<ITunerHost> tunerHosts, IEnumerable<IListingsProvider> listingProviders)
|
public void AddParts(IEnumerable<ILiveTvService> services, IEnumerable<ITunerHost> tunerHosts, IEnumerable<IListingsProvider> listingProviders)
|
||||||
{
|
{
|
||||||
_services = services.ToArray();
|
_services = services.ToArray();
|
||||||
_tunerHosts.AddRange(tunerHosts);
|
_tunerHosts.AddRange(tunerHosts.Where(i => i.IsSupported));
|
||||||
_listingProviders.AddRange(listingProviders);
|
_listingProviders.AddRange(listingProviders);
|
||||||
|
|
||||||
foreach (var service in _services)
|
foreach (var service in _services)
|
||||||
|
@ -947,6 +947,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
IsKids = query.IsKids,
|
IsKids = query.IsKids,
|
||||||
IsNews = query.IsNews,
|
IsNews = query.IsNews,
|
||||||
Genres = query.Genres,
|
Genres = query.Genres,
|
||||||
|
GenreIds = query.GenreIds,
|
||||||
StartIndex = query.StartIndex,
|
StartIndex = query.StartIndex,
|
||||||
Limit = query.Limit,
|
Limit = query.Limit,
|
||||||
OrderBy = query.OrderBy,
|
OrderBy = query.OrderBy,
|
||||||
|
|
|
@ -39,6 +39,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
FileSystem = fileSystem;
|
FileSystem = fileSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool IsSupported
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);
|
protected abstract Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);
|
||||||
public abstract string Type { get; }
|
public abstract string Type { get; }
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,21 @@ namespace Emby.Server.Implementations.MediaEncoder
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (video.VideoType == VideoType.Iso)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (video.IsShortcut)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!video.IsCompleteMedia)
|
if (!video.IsCompleteMedia)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -118,16 +133,6 @@ namespace Emby.Server.Implementations.MediaEncoder
|
||||||
{
|
{
|
||||||
if (extractImages)
|
if (extractImages)
|
||||||
{
|
{
|
||||||
if (video.VideoType == VideoType.Iso)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Add some time for the first chapter to make sure we don't end up with a black image
|
// Add some time for the first chapter to make sure we don't end up with a black image
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
using MediaBrowser.Model.Dto;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -11,7 +12,7 @@ using MediaBrowser.Model.Services;
|
||||||
namespace MediaBrowser.Api
|
namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
[Route("/Items/Filters", "GET", Summary = "Gets branding configuration")]
|
[Route("/Items/Filters", "GET", Summary = "Gets branding configuration")]
|
||||||
public class GetQueryFilters : IReturn<QueryFilters>
|
public class GetQueryFiltersLegacy : IReturn<QueryFiltersLegacy>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user id.
|
/// Gets or sets the user id.
|
||||||
|
@ -40,6 +41,43 @@ namespace MediaBrowser.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("/Items/Filters2", "GET", Summary = "Gets branding configuration")]
|
||||||
|
public class GetQueryFilters : IReturn<QueryFilters>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the user id.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The user id.</value>
|
||||||
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
|
public string UserId { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "ParentId", Description = "Specify this to localize the search to a specific item or folder. Omit to use the root", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
|
public string ParentId { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||||
|
public string IncludeItemTypes { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "MediaTypes", Description = "Optional filter by MediaType. Allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||||
|
public string MediaTypes { get; set; }
|
||||||
|
|
||||||
|
public string[] GetMediaTypes()
|
||||||
|
{
|
||||||
|
return (MediaTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] GetIncludeItemTypes()
|
||||||
|
{
|
||||||
|
return (IncludeItemTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool? IsAiring { get; set; }
|
||||||
|
public bool? IsMovie { get; set; }
|
||||||
|
public bool? IsSports { get; set; }
|
||||||
|
public bool? IsKids { get; set; }
|
||||||
|
public bool? IsNews { get; set; }
|
||||||
|
public bool? IsSeries { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[Authenticated]
|
[Authenticated]
|
||||||
public class FilterService : BaseApiService
|
public class FilterService : BaseApiService
|
||||||
{
|
{
|
||||||
|
@ -57,18 +95,96 @@ namespace MediaBrowser.Api
|
||||||
var parentItem = string.IsNullOrEmpty(request.ParentId) ? null : _libraryManager.GetItemById(request.ParentId);
|
var parentItem = string.IsNullOrEmpty(request.ParentId) ? null : _libraryManager.GetItemById(request.ParentId);
|
||||||
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
|
if (string.Equals(request.IncludeItemTypes, "BoxSet", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, "Playlist", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, typeof(Trailer).Name, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, "Program", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
parentItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var filters = new QueryFilters();
|
||||||
|
|
||||||
|
var genreQuery = new InternalItemsQuery(user)
|
||||||
|
{
|
||||||
|
AncestorIds = parentItem == null ? new string[] { } : new string[] { parentItem.Id.ToString("N") },
|
||||||
|
IncludeItemTypes = request.GetIncludeItemTypes(),
|
||||||
|
DtoOptions = new Controller.Dto.DtoOptions
|
||||||
|
{
|
||||||
|
Fields = new ItemFields[] { },
|
||||||
|
EnableImages = false,
|
||||||
|
EnableUserData = false
|
||||||
|
},
|
||||||
|
IsAiring = request.IsAiring,
|
||||||
|
IsMovie = request.IsMovie,
|
||||||
|
IsSports = request.IsSports,
|
||||||
|
IsKids = request.IsKids,
|
||||||
|
IsNews = request.IsNews,
|
||||||
|
IsSeries = request.IsSeries
|
||||||
|
};
|
||||||
|
|
||||||
|
if (string.Equals(request.IncludeItemTypes, "MusicAlbum", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, "MusicVideo", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, "MusicArtist", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, "Audio", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
filters.Genres = _libraryManager.GetMusicGenres(genreQuery).Items.Select(i => new NameIdPair
|
||||||
|
{
|
||||||
|
Name = i.Item1.Name,
|
||||||
|
Id = i.Item1.Id.ToString("N")
|
||||||
|
|
||||||
|
}).ToArray();
|
||||||
|
}
|
||||||
|
else if (string.Equals(request.IncludeItemTypes, "Game", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, "GameSystem", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
filters.Genres = _libraryManager.GetGameGenres(genreQuery).Items.Select(i => new NameIdPair
|
||||||
|
{
|
||||||
|
Name = i.Item1.Name,
|
||||||
|
Id = i.Item1.Id.ToString("N")
|
||||||
|
|
||||||
|
}).ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filters.Genres = _libraryManager.GetGenres(genreQuery).Items.Select(i => new NameIdPair
|
||||||
|
{
|
||||||
|
Name = i.Item1.Name,
|
||||||
|
Id = i.Item1.Id.ToString("N")
|
||||||
|
|
||||||
|
}).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ToOptimizedResult(filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Get(GetQueryFiltersLegacy request)
|
||||||
|
{
|
||||||
|
var parentItem = string.IsNullOrEmpty(request.ParentId) ? null : _libraryManager.GetItemById(request.ParentId);
|
||||||
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
|
if (string.Equals(request.IncludeItemTypes, "BoxSet", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, "Playlist", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, typeof(Trailer).Name, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(request.IncludeItemTypes, "Program", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
parentItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
var item = string.IsNullOrEmpty(request.ParentId) ?
|
var item = string.IsNullOrEmpty(request.ParentId) ?
|
||||||
user == null ? _libraryManager.RootFolder : user.RootFolder :
|
user == null ? _libraryManager.RootFolder : user.RootFolder :
|
||||||
parentItem;
|
parentItem;
|
||||||
|
|
||||||
var result = ((Folder)item).GetItemList(GetItemsQuery(request, user));
|
var result = ((Folder)item).GetItemList(GetItemsQuery(request, user));
|
||||||
|
|
||||||
return ToOptimizedResult(GetFilters(result));
|
var filters = GetFilters(result);
|
||||||
|
|
||||||
|
return ToOptimizedResult(filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryFilters GetFilters(BaseItem[] items)
|
private QueryFiltersLegacy GetFilters(BaseItem[] items)
|
||||||
{
|
{
|
||||||
var result = new QueryFilters();
|
var result = new QueryFiltersLegacy();
|
||||||
|
|
||||||
result.Years = items.Select(i => i.ProductionYear ?? -1)
|
result.Years = items.Select(i => i.ProductionYear ?? -1)
|
||||||
.Where(i => i > 0)
|
.Where(i => i > 0)
|
||||||
|
@ -97,7 +213,7 @@ namespace MediaBrowser.Api
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private InternalItemsQuery GetItemsQuery(GetQueryFilters request, User user)
|
private InternalItemsQuery GetItemsQuery(GetQueryFiltersLegacy request, User user)
|
||||||
{
|
{
|
||||||
var query = new InternalItemsQuery
|
var query = new InternalItemsQuery
|
||||||
{
|
{
|
||||||
|
|
|
@ -379,6 +379,9 @@ namespace MediaBrowser.Api.LiveTv
|
||||||
[ApiMember(Name = "Genres", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
|
[ApiMember(Name = "Genres", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
|
||||||
public string Genres { get; set; }
|
public string Genres { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "GenreIds", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
|
||||||
|
public string GenreIds { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
|
||||||
public bool? EnableImages { get; set; }
|
public bool? EnableImages { get; set; }
|
||||||
|
|
||||||
|
@ -1003,6 +1006,7 @@ namespace MediaBrowser.Api.LiveTv
|
||||||
query.IsSports = request.IsSports;
|
query.IsSports = request.IsSports;
|
||||||
query.SeriesTimerId = request.SeriesTimerId;
|
query.SeriesTimerId = request.SeriesTimerId;
|
||||||
query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
query.GenreIds = (request.GenreIds ?? String.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(request.LibrarySeriesId))
|
if (!string.IsNullOrWhiteSpace(request.LibrarySeriesId))
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,6 +67,7 @@ namespace MediaBrowser.Api
|
||||||
public void Post(ReportStartupWizardComplete request)
|
public void Post(ReportStartupWizardComplete request)
|
||||||
{
|
{
|
||||||
_config.Configuration.IsStartupWizardCompleted = true;
|
_config.Configuration.IsStartupWizardCompleted = true;
|
||||||
|
_config.Configuration.AutoRunWebApp = true;
|
||||||
_config.SetOptimalValues();
|
_config.SetOptimalValues();
|
||||||
_config.SaveConfiguration();
|
_config.SaveConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ namespace MediaBrowser.Controller
|
||||||
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
||||||
bool SupportsAutoRunAtStartup { get; }
|
bool SupportsAutoRunAtStartup { get; }
|
||||||
|
|
||||||
|
bool CanLaunchWebBrowser { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the HTTP server port.
|
/// Gets the HTTP server port.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -46,6 +46,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);
|
Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
Task<List<TunerHostInfo>> DiscoverDevices(int discoveryDurationMs, CancellationToken cancellationToken);
|
Task<List<TunerHostInfo>> DiscoverDevices(int discoveryDurationMs, CancellationToken cancellationToken);
|
||||||
|
bool IsSupported
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public interface IConfigurableTunerHost
|
public interface IConfigurableTunerHost
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,8 @@ namespace MediaBrowser.Model.Configuration
|
||||||
/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
|
||||||
public bool IsPortAuthorized { get; set; }
|
public bool IsPortAuthorized { get; set; }
|
||||||
|
|
||||||
|
public bool AutoRunWebApp { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether [enable case sensitive item ids].
|
/// Gets or sets a value indicating whether [enable case sensitive item ids].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace MediaBrowser.Model.IO
|
||||||
void ExtractAll(Stream source, string targetPath, bool overwriteExistingFiles);
|
void ExtractAll(Stream source, string targetPath, bool overwriteExistingFiles);
|
||||||
|
|
||||||
void ExtractAllFromGz(Stream source, string targetPath, bool overwriteExistingFiles);
|
void ExtractAllFromGz(Stream source, string targetPath, bool overwriteExistingFiles);
|
||||||
|
void ExtractFirstFileFromGz(Stream source, string targetPath, string defaultFileName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extracts all from zip.
|
/// Extracts all from zip.
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace MediaBrowser.Model.LiveTv
|
||||||
ChannelIds = new string[] { };
|
ChannelIds = new string[] { };
|
||||||
OrderBy = new Tuple<string, SortOrder>[] { };
|
OrderBy = new Tuple<string, SortOrder>[] { };
|
||||||
Genres = new string[] { };
|
Genres = new string[] { };
|
||||||
|
GenreIds = new string[] { };
|
||||||
EnableTotalRecordCount = true;
|
EnableTotalRecordCount = true;
|
||||||
EnableUserData = true;
|
EnableUserData = true;
|
||||||
}
|
}
|
||||||
|
@ -110,6 +111,7 @@ namespace MediaBrowser.Model.LiveTv
|
||||||
/// Limit results to items containing specific genres
|
/// Limit results to items containing specific genres
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The genres.</value>
|
/// <value>The genres.</value>
|
||||||
|
public string[] GenreIds { get; set; }
|
||||||
public string[] Genres { get; set; }
|
public string[] Genres { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,15 @@
|
||||||
|
using MediaBrowser.Model.Dto;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Querying
|
namespace MediaBrowser.Model.Querying
|
||||||
{
|
{
|
||||||
public class QueryFilters
|
public class QueryFiltersLegacy
|
||||||
{
|
{
|
||||||
public string[] Genres { get; set; }
|
public string[] Genres { get; set; }
|
||||||
public string[] Tags { get; set; }
|
public string[] Tags { get; set; }
|
||||||
public string[] OfficialRatings { get; set; }
|
public string[] OfficialRatings { get; set; }
|
||||||
public int[] Years { get; set; }
|
public int[] Years { get; set; }
|
||||||
|
|
||||||
public QueryFilters()
|
public QueryFiltersLegacy()
|
||||||
{
|
{
|
||||||
Genres = new string[] { };
|
Genres = new string[] { };
|
||||||
Tags = new string[] { };
|
Tags = new string[] { };
|
||||||
|
@ -16,4 +17,15 @@ namespace MediaBrowser.Model.Querying
|
||||||
Years = new int[] { };
|
Years = new int[] { };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class QueryFilters
|
||||||
|
{
|
||||||
|
public NameIdPair[] Genres { get; set; }
|
||||||
|
public string[] Tags { get; set; }
|
||||||
|
|
||||||
|
public QueryFilters()
|
||||||
|
{
|
||||||
|
Tags = new string[] { };
|
||||||
|
Genres = new NameIdPair[] { };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,8 @@ namespace MediaBrowser.Model.System
|
||||||
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||||
public bool CanSelfUpdate { get; set; }
|
public bool CanSelfUpdate { get; set; }
|
||||||
|
|
||||||
|
public bool CanLaunchWebBrowser { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets plugin assemblies that failed to load.
|
/// Gets or sets plugin assemblies that failed to load.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -153,7 +153,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
if (item.IsShortcut)
|
if (item.IsShortcut)
|
||||||
{
|
{
|
||||||
FetchShortcutInfo(item);
|
FetchShortcutInfo(item);
|
||||||
return Task.FromResult(ItemUpdateType.MetadataImport);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager, _libraryManager);
|
var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager, _libraryManager);
|
||||||
|
|
|
@ -74,6 +74,10 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
BlurayDiscInfo blurayDiscInfo = null;
|
BlurayDiscInfo blurayDiscInfo = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
Model.MediaInfo.MediaInfo mediaInfoResult = null;
|
||||||
|
|
||||||
|
if (!item.IsShortcut)
|
||||||
{
|
{
|
||||||
string[] streamFileNames = null;
|
string[] streamFileNames = null;
|
||||||
|
|
||||||
|
@ -113,11 +117,12 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
streamFileNames = new string[] { };
|
streamFileNames = new string[] { };
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);
|
mediaInfoResult = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
}
|
||||||
|
|
||||||
await Fetch(item, cancellationToken, result, isoMount, blurayDiscInfo, options).ConfigureAwait(false);
|
await Fetch(item, cancellationToken, mediaInfoResult, isoMount, blurayDiscInfo, options).ConfigureAwait(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -162,7 +167,12 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
BlurayDiscInfo blurayInfo,
|
BlurayDiscInfo blurayInfo,
|
||||||
MetadataRefreshOptions options)
|
MetadataRefreshOptions options)
|
||||||
{
|
{
|
||||||
var mediaStreams = mediaInfo.MediaStreams;
|
List<MediaStream> mediaStreams;
|
||||||
|
List<ChapterInfo> chapters;
|
||||||
|
|
||||||
|
if (mediaInfo != null)
|
||||||
|
{
|
||||||
|
mediaStreams = mediaInfo.MediaStreams;
|
||||||
|
|
||||||
video.TotalBitrate = mediaInfo.Bitrate;
|
video.TotalBitrate = mediaInfo.Bitrate;
|
||||||
//video.FormatName = (mediaInfo.Container ?? string.Empty)
|
//video.FormatName = (mediaInfo.Container ?? string.Empty)
|
||||||
|
@ -188,17 +198,29 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
}
|
}
|
||||||
video.Container = mediaInfo.Container;
|
video.Container = mediaInfo.Container;
|
||||||
|
|
||||||
var chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();
|
chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();
|
||||||
if (blurayInfo != null)
|
if (blurayInfo != null)
|
||||||
{
|
{
|
||||||
FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
|
FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mediaStreams = new List<MediaStream>();
|
||||||
|
chapters = new List<ChapterInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
await AddExternalSubtitles(video, mediaStreams, options, cancellationToken).ConfigureAwait(false);
|
await AddExternalSubtitles(video, mediaStreams, options, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var libraryOptions = _libraryManager.GetLibraryOptions(video);
|
var libraryOptions = _libraryManager.GetLibraryOptions(video);
|
||||||
|
|
||||||
|
if (mediaInfo != null)
|
||||||
|
{
|
||||||
FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions);
|
FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions);
|
||||||
FetchPeople(video, mediaInfo, options);
|
FetchPeople(video, mediaInfo, options);
|
||||||
|
video.Timestamp = mediaInfo.Timestamp;
|
||||||
|
video.Video3DFormat = video.Video3DFormat ?? mediaInfo.Video3DFormat;
|
||||||
|
}
|
||||||
|
|
||||||
video.IsHD = mediaStreams.Any(i => i.Type == MediaStreamType.Video && i.Width.HasValue && i.Width.Value >= 1260);
|
video.IsHD = mediaStreams.Any(i => i.Type == MediaStreamType.Video && i.Width.HasValue && i.Width.Value >= 1260);
|
||||||
|
|
||||||
|
@ -207,9 +229,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
video.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index;
|
video.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index;
|
||||||
|
|
||||||
video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
|
video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
|
||||||
video.Timestamp = mediaInfo.Timestamp;
|
|
||||||
|
|
||||||
video.Video3DFormat = video.Video3DFormat ?? mediaInfo.Video3DFormat;
|
|
||||||
|
|
||||||
_itemRepo.SaveMediaStreams(video.Id, mediaStreams, cancellationToken);
|
_itemRepo.SaveMediaStreams(video.Id, mediaStreams, cancellationToken);
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
var keepTypes = new[]
|
var keepTypes = new[]
|
||||||
{
|
{
|
||||||
PersonType.Director,
|
PersonType.Director,
|
||||||
PersonType.Writer,
|
//PersonType.Writer,
|
||||||
//PersonType.Producer
|
//PersonType.Producer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.2.40.6")]
|
[assembly: AssemblyVersion("3.2.40.7")]
|
||||||
|
|
Loading…
Reference in a new issue