diff --git a/MediaBrowser.Api/Dlna/DlnaServerService.cs b/Emby.Dlna/Api/DlnaServerService.cs similarity index 81% rename from MediaBrowser.Api/Dlna/DlnaServerService.cs rename to Emby.Dlna/Api/DlnaServerService.cs index 587b2ab25d..d3585bcc75 100644 --- a/MediaBrowser.Api/Dlna/DlnaServerService.cs +++ b/Emby.Dlna/Api/DlnaServerService.cs @@ -1,17 +1,16 @@ using MediaBrowser.Controller.Dlna; using System; using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Threading.Tasks; - -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; using MediaBrowser.Model.Services; using MediaBrowser.Common.Extensions; using System.Text; +using MediaBrowser.Controller.Net; +using System.Linq; -namespace MediaBrowser.Api.Dlna +namespace Emby.Dlna.Api { [Route("/Dlna/{UuId}/description.xml", "GET", Summary = "Gets dlna server info")] [Route("/Dlna/{UuId}/description", "GET", Summary = "Gets dlna server info")] @@ -107,7 +106,7 @@ public class GetIcon public string Filename { get; set; } } - public class DlnaServerService : BaseApiService + public class DlnaServerService : IService, IRequiresRequest { private readonly IDlnaManager _dlnaManager; private readonly IContentDirectory _contentDirectory; @@ -117,13 +116,22 @@ public class DlnaServerService : BaseApiService private const string XMLContentType = "text/xml; charset=UTF-8"; private readonly IMemoryStreamFactory _memoryStreamProvider; - public DlnaServerService(IDlnaManager dlnaManager, IContentDirectory contentDirectory, IConnectionManager connectionManager, IMediaReceiverRegistrar mediaReceiverRegistrar, IMemoryStreamFactory memoryStreamProvider) + public IRequest Request { get; set; } + private IHttpResultFactory _resultFactory; + + public DlnaServerService(IDlnaManager dlnaManager, IHttpResultFactory httpResultFactory, IContentDirectory contentDirectory, IConnectionManager connectionManager, IMediaReceiverRegistrar mediaReceiverRegistrar, IMemoryStreamFactory memoryStreamProvider) { _dlnaManager = dlnaManager; _contentDirectory = contentDirectory; _connectionManager = connectionManager; _mediaReceiverRegistrar = mediaReceiverRegistrar; _memoryStreamProvider = memoryStreamProvider; + _resultFactory = httpResultFactory; + } + + private string GetHeader(string name) + { + return Request.Headers[name]; } public object Get(GetDescriptionXml request) @@ -136,49 +144,49 @@ public object Get(GetDescriptionXml request) var cacheKey = Request.RawUrl.GetMD5(); var bytes = Encoding.UTF8.GetBytes(xml); - return ResultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, XMLContentType, () => Task.FromResult(new MemoryStream(bytes))); + return _resultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, XMLContentType, () => Task.FromResult(new MemoryStream(bytes))); } public object Get(GetContentDirectory request) { var xml = _contentDirectory.GetServiceXml(Request.Headers.ToDictionary()); - return ResultFactory.GetResult(xml, XMLContentType); + return _resultFactory.GetResult(xml, XMLContentType); } public object Get(GetMediaReceiverRegistrar request) { var xml = _mediaReceiverRegistrar.GetServiceXml(Request.Headers.ToDictionary()); - return ResultFactory.GetResult(xml, XMLContentType); + return _resultFactory.GetResult(xml, XMLContentType); } public object Get(GetConnnectionManager request) { var xml = _connectionManager.GetServiceXml(Request.Headers.ToDictionary()); - return ResultFactory.GetResult(xml, XMLContentType); + return _resultFactory.GetResult(xml, XMLContentType); } public object Post(ProcessMediaReceiverRegistrarControlRequest request) { var response = PostAsync(request.RequestStream, _mediaReceiverRegistrar); - return ResultFactory.GetResult(response.Xml, XMLContentType); + return _resultFactory.GetResult(response.Xml, XMLContentType); } public object Post(ProcessContentDirectoryControlRequest request) { var response = PostAsync(request.RequestStream, _contentDirectory); - return ResultFactory.GetResult(response.Xml, XMLContentType); + return _resultFactory.GetResult(response.Xml, XMLContentType); } public object Post(ProcessConnectionManagerControlRequest request) { var response = PostAsync(request.RequestStream, _connectionManager); - return ResultFactory.GetResult(response.Xml, XMLContentType); + return _resultFactory.GetResult(response.Xml, XMLContentType); } private ControlResponse PostAsync(Stream requestStream, IUpnpService service) @@ -194,6 +202,38 @@ private ControlResponse PostAsync(Stream requestStream, IUpnpService service) }); } + protected string GetPathValue(int index) + { + var pathInfo = Parse(Request.PathInfo); + var first = pathInfo[0]; + + // backwards compatibility + if (string.Equals(first, "mediabrowser", StringComparison.OrdinalIgnoreCase) || + string.Equals(first, "emby", StringComparison.OrdinalIgnoreCase)) + { + index++; + } + + return pathInfo[index]; + } + + private List Parse(string pathUri) + { + var actionParts = pathUri.Split(new[] { "://" }, StringSplitOptions.None); + + var pathInfo = actionParts[actionParts.Length - 1]; + + var optionsPos = pathInfo.LastIndexOf('?'); + if (optionsPos != -1) + { + pathInfo = pathInfo.Substring(0, optionsPos); + } + + var args = pathInfo.Split('/'); + + return args.Skip(1).ToList(); + } + public object Get(GetIcon request) { using (var response = _dlnaManager.GetIcon(request.Filename)) @@ -210,7 +250,7 @@ public object Get(GetIcon request) var cacheLength = TimeSpan.FromDays(365); var cacheKey = Request.RawUrl.GetMD5(); - return ResultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, contentType, ()=> Task.FromResult(new MemoryStream(bytes))); + return _resultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, contentType, ()=> Task.FromResult(new MemoryStream(bytes))); //return ResultFactory.GetResult(bytes, contentType); } } @@ -270,7 +310,7 @@ private object ProcessEventRequest(IEventManager eventManager) private object GetSubscriptionResponse(EventSubscriptionResponse response) { - return ResultFactory.GetResult(response.Content, response.ContentType, response.Headers); + return _resultFactory.GetResult(response.Content, response.ContentType, response.Headers); } } } diff --git a/MediaBrowser.Api/Dlna/DlnaService.cs b/Emby.Dlna/Api/DlnaService.cs similarity index 96% rename from MediaBrowser.Api/Dlna/DlnaService.cs rename to Emby.Dlna/Api/DlnaService.cs index 12d5994b58..fec610d230 100644 --- a/MediaBrowser.Api/Dlna/DlnaService.cs +++ b/Emby.Dlna/Api/DlnaService.cs @@ -4,7 +4,7 @@ using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Services; -namespace MediaBrowser.Api.Dlna +namespace Emby.Dlna.Api { [Route("/Dlna/ProfileInfos", "GET", Summary = "Gets a list of profiles")] public class GetProfileInfos : IReturn @@ -41,7 +41,7 @@ public class CreateProfile : DeviceProfile, IReturnVoid } [Authenticated(Roles = "Admin")] - public class DlnaService : BaseApiService + public class DlnaService : IService { private readonly IDlnaManager _dlnaManager; diff --git a/MediaBrowser.Model/Configuration/DlnaOptions.cs b/Emby.Dlna/Configuration/DlnaOptions.cs similarity index 94% rename from MediaBrowser.Model/Configuration/DlnaOptions.cs rename to Emby.Dlna/Configuration/DlnaOptions.cs index 71a24d707d..e510fe0e13 100644 --- a/MediaBrowser.Model/Configuration/DlnaOptions.cs +++ b/Emby.Dlna/Configuration/DlnaOptions.cs @@ -1,5 +1,5 @@  -namespace MediaBrowser.Model.Configuration +namespace Emby.Dlna.Configuration { public class DlnaOptions { diff --git a/Emby.Dlna/ConfigurationExtension.cs b/Emby.Dlna/ConfigurationExtension.cs index cec885e4a7..b23bf0b112 100644 --- a/Emby.Dlna/ConfigurationExtension.cs +++ b/Emby.Dlna/ConfigurationExtension.cs @@ -1,5 +1,5 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Model.Configuration; +using Emby.Dlna.Configuration; using System.Collections.Generic; namespace Emby.Dlna diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index 26ceeac4be..e961184f9d 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -21,7 +21,7 @@ using System.Threading.Tasks; using System.Xml; using MediaBrowser.Controller.MediaEncoding; -using MediaBrowser.Model.Configuration; +using Emby.Dlna.Configuration; using MediaBrowser.Model.Globalization; namespace Emby.Dlna.Didl diff --git a/Emby.Dlna/Emby.Dlna.csproj b/Emby.Dlna/Emby.Dlna.csproj index 718db98f6a..a48d2310b7 100644 --- a/Emby.Dlna/Emby.Dlna.csproj +++ b/Emby.Dlna/Emby.Dlna.csproj @@ -40,6 +40,7 @@ + diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 5a8519bc71..3a00b28a05 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -109,6 +109,11 @@ public bool EnableMediaProbe(BaseItem item) public Task DeleteItem(BaseItem item) { var internalChannel = _libraryManager.GetItemById(item.ChannelId); + if (internalChannel == null) + { + throw new ArgumentException(); + } + var channel = Channels.FirstOrDefault(i => GetInternalChannelId(i.Name).Equals(internalChannel.Id)); var supportsDelete = channel as ISupportsDelete; diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index 44c467d39e..13062f7be2 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -417,7 +417,7 @@ public async Task OpenLiveStream(LiveStreamRequest request, _openStreams[mediaSource.LiveStreamId] = info; var json = _jsonSerializer.SerializeToString(mediaSource); - _logger.Debug("Live stream opened: " + json); + _logger.Info("Live stream opened: " + json); var clone = _jsonSerializer.DeserializeFromString(json); if (!string.IsNullOrEmpty(request.UserId)) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 420446186c..943100e414 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -899,6 +899,7 @@ public Task GetNewTimerDefaultsAsync(CancellationToken cancella defaults.SeriesId = program.SeriesId; defaults.ProgramId = program.Id; defaults.RecordNewOnly = !program.IsRepeat; + defaults.Name = program.Name; } defaults.SkipEpisodesInLibrary = defaults.RecordNewOnly; @@ -2574,11 +2575,6 @@ private IEnumerable GetTimersForSeries(SeriesTimerInfo seriesTimer) throw new ArgumentNullException("seriesTimer"); } - if (string.IsNullOrWhiteSpace(seriesTimer.SeriesId)) - { - return new List(); - } - var query = new InternalItemsQuery { IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name }, @@ -2590,6 +2586,11 @@ private IEnumerable GetTimersForSeries(SeriesTimerInfo seriesTimer) MinEndDate = DateTime.UtcNow }; + if (string.IsNullOrEmpty(seriesTimer.SeriesId)) + { + query.Name = seriesTimer.Name; + } + if (!seriesTimer.RecordAnyChannel) { query.ChannelIds = new[] { _liveTvManager.GetInternalChannelId(Name, seriesTimer.ChannelId) }; diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs index 5723e1abdf..f656f0d32c 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -15,6 +15,7 @@ using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Extensions; +using System.Collections.Generic; namespace Emby.Server.Implementations.LiveTv { @@ -188,49 +189,47 @@ private void FillImages(BaseItemDto dto, string seriesName, string programSeries } } - if (!string.IsNullOrEmpty(programSeriesId)) + var program = _libraryManager.GetItemList(new InternalItemsQuery { - var program = _libraryManager.GetItemList(new InternalItemsQuery - { - IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name }, - ExternalSeriesId = programSeriesId, - Limit = 1, - ImageTypes = new ImageType[] { ImageType.Primary }, - DtoOptions = new DtoOptions(false) + IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name }, + ExternalSeriesId = programSeriesId, + Limit = 1, + ImageTypes = new ImageType[] { ImageType.Primary }, + DtoOptions = new DtoOptions(false), + Name = string.IsNullOrEmpty(programSeriesId) ? seriesName : null - }).FirstOrDefault(); + }).FirstOrDefault(); - if (program != null) + if (program != null) + { + var image = program.GetImageInfo(ImageType.Primary, 0); + if (image != null) { - var image = program.GetImageInfo(ImageType.Primary, 0); + try + { + dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image); + dto.ParentPrimaryImageItemId = program.Id.ToString("N"); + } + catch (Exception ex) + { + } + } + + if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0) + { + image = program.GetImageInfo(ImageType.Backdrop, 0); if (image != null) { try { - dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image); - dto.ParentPrimaryImageItemId = program.Id.ToString("N"); - } - catch (Exception ex) + dto.ParentBackdropImageTags = new string[] { + _imageProcessor.GetImageCacheTag(program, image) + }; + dto.ParentBackdropItemId = program.Id.ToString("N"); } - } - - if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0) - { - image = program.GetImageInfo(ImageType.Backdrop, 0); - if (image != null) + catch (Exception ex) { - try - { - dto.ParentBackdropImageTags = new string[] - { - _imageProcessor.GetImageCacheTag(program, image) - }; - dto.ParentBackdropItemId = program.Id.ToString("N"); - } - catch (Exception ex) - { - } } } } @@ -280,57 +279,60 @@ private void FillImages(SeriesTimerInfoDto dto, string seriesName, string progra } } - if (!string.IsNullOrEmpty(programSeriesId)) + var program = _libraryManager.GetItemList(new InternalItemsQuery { - var program = _libraryManager.GetItemList(new InternalItemsQuery - { - IncludeItemTypes = new string[] { typeof(Series).Name }, - Name = seriesName, - Limit = 1, - ImageTypes = new ImageType[] { ImageType.Primary }, - DtoOptions = new DtoOptions(false) + IncludeItemTypes = new string[] { typeof(Series).Name }, + Name = seriesName, + Limit = 1, + ImageTypes = new ImageType[] { ImageType.Primary }, + DtoOptions = new DtoOptions(false) - }).FirstOrDefault() ?? _libraryManager.GetItemList(new InternalItemsQuery + }).FirstOrDefault(); + + if (program == null) + { + program = _libraryManager.GetItemList(new InternalItemsQuery { IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name }, ExternalSeriesId = programSeriesId, Limit = 1, ImageTypes = new ImageType[] { ImageType.Primary }, - DtoOptions = new DtoOptions(false) + DtoOptions = new DtoOptions(false), + Name = string.IsNullOrEmpty(programSeriesId) ? seriesName : null }).FirstOrDefault(); + } - if (program != null) + if (program != null) + { + var image = program.GetImageInfo(ImageType.Primary, 0); + if (image != null) + { + try + { + dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image); + dto.ParentPrimaryImageItemId = program.Id.ToString("N"); + } + catch (Exception ex) + { + } + } + + if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0) { - var image = program.GetImageInfo(ImageType.Primary, 0); + image = program.GetImageInfo(ImageType.Backdrop, 0); if (image != null) { try { - dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image); - dto.ParentPrimaryImageItemId = program.Id.ToString("N"); - } - catch (Exception ex) + dto.ParentBackdropImageTags = new string[] { + _imageProcessor.GetImageCacheTag(program, image) + }; + dto.ParentBackdropItemId = program.Id.ToString("N"); } - } - - if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0) - { - image = program.GetImageInfo(ImageType.Backdrop, 0); - if (image != null) + catch (Exception ex) { - try - { - dto.ParentBackdropImageTags = new string[] - { - _imageProcessor.GetImageCacheTag(program, image) - }; - dto.ParentBackdropItemId = program.Id.ToString("N"); - } - catch (Exception ex) - { - } } } } diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 2bc740f88a..ff1f4f484f 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -542,6 +542,8 @@ private Tuple GetProgram(ProgramInfo info, Dictionary } item.ExternalSeriesId = seriesId; + var isSeries = info.IsSeries || !string.IsNullOrEmpty(info.EpisodeTitle); + var tags = new List(); if (info.IsLive) { @@ -571,7 +573,7 @@ private Tuple GetProgram(ProgramInfo info, Dictionary { tags.Add("Movie"); } - if (info.IsSeries) + if (isSeries) { tags.Add("Series"); } @@ -584,7 +586,13 @@ private Tuple GetProgram(ProgramInfo info, Dictionary item.IsMovie = info.IsMovie; item.IsNews = info.IsNews; item.IsRepeat = info.IsRepeat; - item.IsSeries = info.IsSeries; + + if(item.IsSeries != isSeries) + { + forceUpdate = true; + } + item.IsSeries = isSeries; + item.IsSports = info.IsSports; item.Name = info.Name; item.OfficialRating = item.OfficialRating ?? info.OfficialRating; @@ -613,7 +621,7 @@ private Tuple GetProgram(ProgramInfo info, Dictionary item.ProductionYear = info.ProductionYear; - if (!info.IsSeries || info.IsRepeat) + if (!isSeries || info.IsRepeat) { item.PremiereDate = info.OriginalAirDate; } diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs index 21ea4df78f..225bcc7ee8 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs @@ -155,9 +155,9 @@ public async Task> OpenMedia catch (Exception ex) { _logger.ErrorException("Error probing live tv stream", ex); + AddMediaInfo(stream, isAudio, cancellationToken); } - _logger.Info("Live stream info: {0}", _jsonSerializer.SerializeToString(stream)); return new Tuple(stream, directStreamProvider, allowLiveMediaProbe); } diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 4392889b75..040d81d077 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -607,7 +607,8 @@ public async Task OnPlaybackStart(PlaybackStartInfo info) MediaInfo = info.Item, DeviceName = session.DeviceName, ClientName = session.AppName, - DeviceId = session.DeviceId + DeviceId = session.DeviceId, + Session = session }, _logger); @@ -689,7 +690,8 @@ public async Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated DeviceId = session.DeviceId, IsPaused = info.IsPaused, PlaySessionId = info.PlaySessionId, - IsAutomated = isAutomated + IsAutomated = isAutomated, + Session = session }, _logger); @@ -841,7 +843,8 @@ public async Task OnPlaybackStopped(PlaybackStopInfo info) MediaInfo = info.Item, DeviceName = session.DeviceName, ClientName = session.AppName, - DeviceId = session.DeviceId + DeviceId = session.DeviceId, + Session = session }, _logger); } diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index 60b2d51870..b82ac08462 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -43,8 +43,6 @@ - - diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 4262a273bf..e4ec4a34df 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -344,16 +344,19 @@ public override bool BeforeMetadataRefresh() { var hasChanges = base.BeforeMetadataRefresh(); - try + if (SourceType == SourceType.Library) { - if (LibraryManager.FillMissingEpisodeNumbersFromPath(this)) + try { - hasChanges = true; + if (LibraryManager.FillMissingEpisodeNumbersFromPath(this)) + { + hasChanges = true; + } + } + catch (Exception ex) + { + Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString()); } - } - catch (Exception ex) - { - Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString()); } if (!ParentIndexNumber.HasValue) diff --git a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs index 9f98182ba3..00d9932a7a 100644 --- a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs +++ b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs @@ -2,6 +2,7 @@ using MediaBrowser.Model.Dto; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Session; namespace MediaBrowser.Controller.Library { @@ -23,7 +24,8 @@ public class PlaybackProgressEventArgs : EventArgs public string ClientName { get; set; } public string PlaySessionId { get; set; } - + public SessionInfo Session { get; set; } + public PlaybackProgressEventArgs() { Users = new List(); diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs index 52bd06bf2b..e41826be5b 100644 --- a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs +++ b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Controller.Subtitles { @@ -45,13 +46,12 @@ Task SearchSubtitles(SubtitleSearchRequest request, /// /// Downloads the subtitles. /// - /// The video. - /// The subtitle identifier. - /// The cancellation token. - /// Task. - Task DownloadSubtitles(Video video, - string subtitleId, - CancellationToken cancellationToken); + Task DownloadSubtitles(Video video, string subtitleId, CancellationToken cancellationToken); + + /// + /// Downloads the subtitles. + /// + Task DownloadSubtitles(Video video, LibraryOptions libraryOptions, string subtitleId, CancellationToken cancellationToken); /// /// Gets the remote subtitles. diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index cf8be5ff20..7b7902e4ef 100644 --- a/MediaBrowser.Model/Configuration/LibraryOptions.cs +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -44,6 +44,7 @@ public class LibraryOptions public bool SkipSubtitlesIfAudioTrackMatches { get; set; } public string[] SubtitleDownloadLanguages { get; set; } public bool RequirePerfectSubtitleMatch { get; set; } + public bool SaveSubtitlesWithMedia { get; set; } public TypeOptions[] TypeOptions { get; set; } @@ -70,6 +71,7 @@ public LibraryOptions() RequirePerfectSubtitleMatch = true; EnablePhotos = true; + SaveSubtitlesWithMedia = true; EnableRealtimeMonitor = true; PathInfos = new MediaPathInfo[] { }; EnableInternetProviders = true; diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 781e7d710e..1c439a1187 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -129,7 +129,6 @@ - diff --git a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs index 73f66668b5..4da4d4a692 100644 --- a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs +++ b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs @@ -17,11 +17,13 @@ public class LiveStreamRequest public bool EnableDirectPlay { get; set; } public bool EnableDirectStream { get; set; } + public MediaProtocol[] DirectPlayProtocols { get; set; } public LiveStreamRequest() { EnableDirectPlay = true; EnableDirectStream = true; + DirectPlayProtocols = new MediaProtocol[] { MediaProtocol.Http }; } public LiveStreamRequest(AudioOptions options) @@ -31,6 +33,8 @@ public LiveStreamRequest(AudioOptions options) DeviceProfile = options.Profile; MaxAudioChannels = options.MaxAudioChannels; + DirectPlayProtocols = new MediaProtocol[] { MediaProtocol.Http }; + VideoOptions videoOptions = options as VideoOptions; if (videoOptions != null) { diff --git a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs index 377959f548..4b61da7b2e 100644 --- a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs +++ b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs @@ -1,4 +1,5 @@ using MediaBrowser.Model.Dlna; +using System.Collections.Generic; namespace MediaBrowser.Model.MediaInfo { @@ -21,7 +22,7 @@ public class PlaybackInfoRequest public string MediaSourceId { get; set; } public string LiveStreamId { get; set; } - + public DeviceProfile DeviceProfile { get; set; } public bool EnableDirectPlay { get; set; } @@ -32,6 +33,8 @@ public class PlaybackInfoRequest public bool IsPlayback { get; set; } public bool AutoOpenLiveStream { get; set; } + public MediaProtocol[] DirectPlayProtocols { get; set; } + public PlaybackInfoRequest() { EnableDirectPlay = true; @@ -40,6 +43,7 @@ public PlaybackInfoRequest() AllowVideoStreamCopy = true; AllowAudioStreamCopy = true; IsPlayback = true; + DirectPlayProtocols = new MediaProtocol[] { MediaProtocol.Http }; } } } diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs index 9a173db28c..6b396967ec 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs @@ -166,8 +166,7 @@ private async Task DownloadSubtitles(Video video, if (result != null) { - await _subtitleManager.DownloadSubtitles(video, result.Id, cancellationToken) - .ConfigureAwait(false); + await _subtitleManager.DownloadSubtitles(video, result.Id, cancellationToken).ConfigureAwait(false); return true; } diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs index 1322ff8598..7caa6c39cc 100644 --- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs +++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs @@ -20,6 +20,7 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.IO; using MediaBrowser.Model.Globalization; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Providers.Subtitles { @@ -133,14 +134,22 @@ private SubtitleOptions GetOptions() return _config.GetConfiguration("subtitles"); } + public Task DownloadSubtitles(Video video, string subtitleId, CancellationToken cancellationToken) + { + var libraryOptions = BaseItem.LibraryManager.GetLibraryOptions(video); + + return DownloadSubtitles(video, libraryOptions, subtitleId, cancellationToken); + } + public async Task DownloadSubtitles(Video video, + LibraryOptions libraryOptions, string subtitleId, CancellationToken cancellationToken) { var parts = subtitleId.Split(new[] { '_' }, 2); var provider = GetProvider(parts.First()); - var saveInMediaFolder = video.IsSaveLocalMetadataEnabled(); + var saveInMediaFolder = libraryOptions.SaveSubtitlesWithMedia; try { diff --git a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/apiclientex.js b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/apiclientex.js index 600193d36a..b71cdfd47a 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/apiclientex.js +++ b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/apiclientex.js @@ -1 +1 @@ -define(["apiclientcore","localassetmanager"],function(ApiClient,localassetmanager){"use strict";function isLocalId(str){return startsWith(str,localPrefix)}function isLocalViewId(str){return startsWith(str,localViewPrefix)}function isTopLevelLocalViewId(str){return"localview"===str}function stripLocalPrefix(str){var res=stripStart(str,localPrefix);return res=stripStart(res,localViewPrefix)}function startsWith(str,find){return!!(str&&find&&str.length>find.length&&0===str.indexOf(find))}function stripStart(str,find){return startsWith(str,find)?str.substr(find.length):str}function createEmptyList(){return{Items:[],TotalRecordCount:0}}function convertGuidToLocal(guid){return guid?isLocalId(guid)?guid:"local:"+guid:null}function adjustGuidProperties(downloadedItem){downloadedItem.Id=convertGuidToLocal(downloadedItem.Id),downloadedItem.SeriesId=convertGuidToLocal(downloadedItem.SeriesId),downloadedItem.SeasonId=convertGuidToLocal(downloadedItem.SeasonId),downloadedItem.AlbumId=convertGuidToLocal(downloadedItem.AlbumId),downloadedItem.ParentId=convertGuidToLocal(downloadedItem.ParentId),downloadedItem.ParentThumbItemId=convertGuidToLocal(downloadedItem.ParentThumbItemId),downloadedItem.ParentPrimaryImageItemId=convertGuidToLocal(downloadedItem.ParentPrimaryImageItemId),downloadedItem.PrimaryImageItemId=convertGuidToLocal(downloadedItem.PrimaryImageItemId),downloadedItem.ParentLogoItemId=convertGuidToLocal(downloadedItem.ParentLogoItemId),downloadedItem.ParentBackdropItemId=convertGuidToLocal(downloadedItem.ParentBackdropItemId),downloadedItem.ParentBackdropImageTags=null}function getLocalView(instance,serverId,userId){return instance.getLocalFolders(serverId,userId).then(function(views){var localView=null;return views.length>0&&(localView={Name:instance.downloadsTitleText||"Downloads",ServerId:serverId,Id:"localview",Type:"localview",IsFolder:!0}),Promise.resolve(localView)})}function ApiClientEx(serverAddress,clientName,applicationVersion,deviceName,deviceId,devicePixelRatio){ApiClient.call(this,serverAddress,clientName,applicationVersion,deviceName,deviceId,devicePixelRatio)}var localPrefix="local:",localViewPrefix="localview:";return Object.assign(ApiClientEx.prototype,ApiClient.prototype),ApiClientEx.prototype.getPlaybackInfo=function(itemId,options,deviceProfile){var onFailure=function(){return ApiClient.prototype.getPlaybackInfo.call(instance,itemId,options,deviceProfile)};if(isLocalId(itemId))return localassetmanager.getLocalItem(this.serverId(),stripLocalPrefix(itemId)).then(function(item){return{MediaSources:item.Item.MediaSources.map(function(m){return m.SupportsDirectPlay=!0,m.SupportsDirectStream=!1,m.SupportsTranscoding=!1,m.IsLocal=!0,m})}},onFailure);var instance=this;return localassetmanager.getLocalItem(this.serverId(),itemId).then(function(item){if(item){var mediaSources=item.Item.MediaSources.map(function(m){return m.SupportsDirectPlay=!0,m.SupportsDirectStream=!1,m.SupportsTranscoding=!1,m.IsLocal=!0,m});return localassetmanager.fileExists(item.LocalPath).then(function(exists){if(exists){var res={MediaSources:mediaSources};return Promise.resolve(res)}return ApiClient.prototype.getPlaybackInfo.call(instance,itemId,options,deviceProfile)},onFailure)}return ApiClient.prototype.getPlaybackInfo.call(instance,itemId,options,deviceProfile)},onFailure)},ApiClientEx.prototype.getItems=function(userId,options){var i,serverInfo=this.serverInfo();if(serverInfo&&"localview"===options.ParentId)return this.getLocalFolders(serverInfo.Id,userId).then(function(items){var result={Items:items,TotalRecordCount:items.length};return Promise.resolve(result)});if(serverInfo&&options&&(isLocalId(options.ParentId)||isLocalId(options.SeriesId)||isLocalId(options.SeasonId)||isLocalViewId(options.ParentId)))return localassetmanager.getViewItems(serverInfo.Id,userId,options).then(function(items){items.forEach(function(item){adjustGuidProperties(item)}),items.sort(function(a,b){return a.SortName.toLowerCase().localeCompare(b.SortName.toLowerCase())});var result={Items:items,TotalRecordCount:items.length};return Promise.resolve(result)});if(options&&options.ExcludeItemIds&&options.ExcludeItemIds.length){var exItems=options.ExcludeItemIds.split(",");for(i=0;i0?Promise.resolve(views[0]):Promise.reject()}):isLocalId(itemId)&&(serverInfo=this.serverInfo())?localassetmanager.getLocalItem(serverInfo.Id,stripLocalPrefix(itemId)).then(function(item){return adjustGuidProperties(item.Item),Promise.resolve(item.Item)}):ApiClient.prototype.getItem.call(this,userId,itemId)},ApiClientEx.prototype.getLocalFolders=function(userId){var serverInfo=this.serverInfo();return userId=userId||serverInfo.UserId,localassetmanager.getViews(serverInfo.Id,userId)},ApiClientEx.prototype.getNextUpEpisodes=function(options){return options.SeriesId&&isLocalId(options.SeriesId)?Promise.resolve(createEmptyList()):ApiClient.prototype.getNextUpEpisodes.call(this,options)},ApiClientEx.prototype.getSeasons=function(itemId,options){return isLocalId(itemId)?(options.SeriesId=itemId,options.IncludeItemTypes="Season",this.getItems(this.getCurrentUserId(),options)):ApiClient.prototype.getSeasons.call(this,itemId,options)},ApiClientEx.prototype.getEpisodes=function(itemId,options){return isLocalId(options.SeasonId)||isLocalId(options.seasonId)?(options.SeriesId=itemId,options.IncludeItemTypes="Episode",this.getItems(this.getCurrentUserId(),options)):isLocalId(itemId)?(options.SeriesId=itemId,options.IncludeItemTypes="Episode",this.getItems(this.getCurrentUserId(),options)):ApiClient.prototype.getEpisodes.call(this,itemId,options)},ApiClientEx.prototype.getLatestOfflineItems=function(options){options.SortBy="DateCreated",options.SortOrder="Descending";var serverInfo=this.serverInfo();return serverInfo?localassetmanager.getViewItems(serverInfo.Id,null,options).then(function(items){return items.forEach(function(item){adjustGuidProperties(item)}),Promise.resolve(items)}):Promise.resolve([])},ApiClientEx.prototype.getThemeMedia=function(userId,itemId,inherit){return isLocalViewId(itemId)||isLocalId(itemId)||isTopLevelLocalViewId(itemId)?Promise.reject():ApiClient.prototype.getThemeMedia.call(this,userId,itemId,inherit)},ApiClientEx.prototype.getSpecialFeatures=function(userId,itemId){return isLocalId(itemId)?Promise.resolve([]):ApiClient.prototype.getSpecialFeatures.call(this,userId,itemId)},ApiClientEx.prototype.getSimilarItems=function(itemId,options){return isLocalId(itemId)?Promise.resolve(createEmptyList()):ApiClient.prototype.getSimilarItems.call(this,itemId,options)},ApiClientEx.prototype.updateFavoriteStatus=function(userId,itemId,isFavorite){return isLocalId(itemId)?Promise.resolve():ApiClient.prototype.updateFavoriteStatus.call(this,userId,itemId,isFavorite)},ApiClientEx.prototype.getScaledImageUrl=function(itemId,options){if(isLocalId(itemId)||options&&options.itemid&&isLocalId(options.itemid)){var serverInfo=this.serverInfo(),id=stripLocalPrefix(itemId);return localassetmanager.getImageUrl(serverInfo.Id,id,options)}return ApiClient.prototype.getScaledImageUrl.call(this,itemId,options)},ApiClientEx.prototype.reportPlaybackStart=function(options){if(!options)throw new Error("null options");return isLocalId(options.ItemId)?Promise.resolve():ApiClient.prototype.reportPlaybackStart.call(this,options)},ApiClientEx.prototype.reportPlaybackProgress=function(options){if(!options)throw new Error("null options");if(isLocalId(options.ItemId)){var serverInfo=this.serverInfo();return serverInfo?localassetmanager.getLocalItem(serverInfo.Id,stripLocalPrefix(options.ItemId)).then(function(item){var libraryItem=item.Item;return"Video"===libraryItem.MediaType||"AudioBook"===libraryItem.Type?(libraryItem.UserData=libraryItem.UserData||{},libraryItem.UserData.PlaybackPositionTicks=options.PositionTicks,libraryItem.UserData.PlayedPercentage=Math.min(libraryItem.RunTimeTicks?(options.PositionTicks||0)/libraryItem.RunTimeTicks*100:0,100),localassetmanager.addOrUpdateLocalItem(item)):Promise.resolve()}):Promise.resolve()}return ApiClient.prototype.reportPlaybackProgress.call(this,options)},ApiClientEx.prototype.reportPlaybackStopped=function(options){if(!options)throw new Error("null options");if(isLocalId(options.ItemId)){var serverInfo=this.serverInfo(),action={Date:(new Date).getTime(),ItemId:stripLocalPrefix(options.ItemId),PositionTicks:options.PositionTicks,ServerId:serverInfo.Id,Type:0,UserId:this.getCurrentUserId()};return localassetmanager.recordUserAction(action)}return ApiClient.prototype.reportPlaybackStopped.call(this,options)},ApiClientEx.prototype.getIntros=function(itemId){return isLocalId(itemId)?Promise.resolve({Items:[],TotalRecordCount:0}):ApiClient.prototype.getIntros.call(this,itemId)},ApiClientEx.prototype.getInstantMixFromItem=function(itemId,options){return isLocalId(itemId)?Promise.resolve({Items:[],TotalRecordCount:0}):ApiClient.prototype.getInstantMixFromItem.call(this,itemId,options)},ApiClientEx.prototype.getItemDownloadUrl=function(itemId){if(isLocalId(itemId)){var serverInfo=this.serverInfo();if(serverInfo)return localassetmanager.getLocalItem(serverInfo.Id,stripLocalPrefix(itemId)).then(function(item){return Promise.resolve(item.LocalPath)})}return ApiClient.prototype.getItemDownloadUrl.call(this,itemId)},ApiClientEx}); \ No newline at end of file +define(["apiclientcore","localassetmanager"],function(ApiClient,localassetmanager){"use strict";function isLocalId(str){return startsWith(str,localPrefix)}function isLocalViewId(str){return startsWith(str,localViewPrefix)}function isTopLevelLocalViewId(str){return"localview"===str}function stripLocalPrefix(str){var res=stripStart(str,localPrefix);return res=stripStart(res,localViewPrefix)}function startsWith(str,find){return!!(str&&find&&str.length>find.length&&0===str.indexOf(find))}function stripStart(str,find){return startsWith(str,find)?str.substr(find.length):str}function createEmptyList(){return{Items:[],TotalRecordCount:0}}function convertGuidToLocal(guid){return guid?isLocalId(guid)?guid:"local:"+guid:null}function adjustGuidProperties(downloadedItem){downloadedItem.Id=convertGuidToLocal(downloadedItem.Id),downloadedItem.SeriesId=convertGuidToLocal(downloadedItem.SeriesId),downloadedItem.SeasonId=convertGuidToLocal(downloadedItem.SeasonId),downloadedItem.AlbumId=convertGuidToLocal(downloadedItem.AlbumId),downloadedItem.ParentId=convertGuidToLocal(downloadedItem.ParentId),downloadedItem.ParentThumbItemId=convertGuidToLocal(downloadedItem.ParentThumbItemId),downloadedItem.ParentPrimaryImageItemId=convertGuidToLocal(downloadedItem.ParentPrimaryImageItemId),downloadedItem.PrimaryImageItemId=convertGuidToLocal(downloadedItem.PrimaryImageItemId),downloadedItem.ParentLogoItemId=convertGuidToLocal(downloadedItem.ParentLogoItemId),downloadedItem.ParentBackdropItemId=convertGuidToLocal(downloadedItem.ParentBackdropItemId),downloadedItem.ParentBackdropImageTags=null}function getLocalView(instance,serverId,userId){return instance.getLocalFolders(serverId,userId).then(function(views){var localView=null;return views.length>0&&(localView={Name:instance.downloadsTitleText||"Downloads",ServerId:serverId,Id:"localview",Type:"localview",IsFolder:!0}),Promise.resolve(localView)})}function ApiClientEx(serverAddress,clientName,applicationVersion,deviceName,deviceId,devicePixelRatio){ApiClient.call(this,serverAddress,clientName,applicationVersion,deviceName,deviceId,devicePixelRatio)}var localPrefix="local:",localViewPrefix="localview:";return Object.assign(ApiClientEx.prototype,ApiClient.prototype),ApiClientEx.prototype.getPlaybackInfo=function(itemId,options,deviceProfile){var onFailure=function(){return ApiClient.prototype.getPlaybackInfo.call(instance,itemId,options,deviceProfile)};if(isLocalId(itemId))return localassetmanager.getLocalItem(this.serverId(),stripLocalPrefix(itemId)).then(function(item){return{MediaSources:item.Item.MediaSources.map(function(m){return m.SupportsDirectPlay=!0,m.SupportsDirectStream=!1,m.SupportsTranscoding=!1,m.IsLocal=!0,m})}},onFailure);var instance=this;return localassetmanager.getLocalItem(this.serverId(),itemId).then(function(item){if(item){var mediaSources=item.Item.MediaSources.map(function(m){return m.SupportsDirectPlay=!0,m.SupportsDirectStream=!1,m.SupportsTranscoding=!1,m.IsLocal=!0,m});return localassetmanager.fileExists(item.LocalPath).then(function(exists){if(exists){var res={MediaSources:mediaSources};return Promise.resolve(res)}return ApiClient.prototype.getPlaybackInfo.call(instance,itemId,options,deviceProfile)},onFailure)}return ApiClient.prototype.getPlaybackInfo.call(instance,itemId,options,deviceProfile)},onFailure)},ApiClientEx.prototype.getItems=function(userId,options){var i,serverInfo=this.serverInfo();if(serverInfo&&"localview"===options.ParentId)return this.getLocalFolders(serverInfo.Id,userId).then(function(items){var result={Items:items,TotalRecordCount:items.length};return Promise.resolve(result)});if(serverInfo&&options&&(isLocalId(options.ParentId)||isLocalId(options.SeriesId)||isLocalId(options.SeasonId)||isLocalViewId(options.ParentId)||isLocalViewId(options.AlbumIds)))return localassetmanager.getViewItems(serverInfo.Id,userId,options).then(function(items){items.forEach(function(item){adjustGuidProperties(item)}),items.sort(function(a,b){return a.SortName.toLowerCase().localeCompare(b.SortName.toLowerCase())});var result={Items:items,TotalRecordCount:items.length};return Promise.resolve(result)});if(options&&options.ExcludeItemIds&&options.ExcludeItemIds.length){var exItems=options.ExcludeItemIds.split(",");for(i=0;i0?Promise.resolve(views[0]):Promise.reject()}):isLocalId(itemId)&&(serverInfo=this.serverInfo())?localassetmanager.getLocalItem(serverInfo.Id,stripLocalPrefix(itemId)).then(function(item){return adjustGuidProperties(item.Item),Promise.resolve(item.Item)}):ApiClient.prototype.getItem.call(this,userId,itemId)},ApiClientEx.prototype.getLocalFolders=function(userId){var serverInfo=this.serverInfo();return userId=userId||serverInfo.UserId,localassetmanager.getViews(serverInfo.Id,userId)},ApiClientEx.prototype.getNextUpEpisodes=function(options){return options.SeriesId&&isLocalId(options.SeriesId)?Promise.resolve(createEmptyList()):ApiClient.prototype.getNextUpEpisodes.call(this,options)},ApiClientEx.prototype.getSeasons=function(itemId,options){return isLocalId(itemId)?(options.SeriesId=itemId,options.IncludeItemTypes="Season",this.getItems(this.getCurrentUserId(),options)):ApiClient.prototype.getSeasons.call(this,itemId,options)},ApiClientEx.prototype.getEpisodes=function(itemId,options){return isLocalId(options.SeasonId)||isLocalId(options.seasonId)?(options.SeriesId=itemId,options.IncludeItemTypes="Episode",this.getItems(this.getCurrentUserId(),options)):isLocalId(itemId)?(options.SeriesId=itemId,options.IncludeItemTypes="Episode",this.getItems(this.getCurrentUserId(),options)):ApiClient.prototype.getEpisodes.call(this,itemId,options)},ApiClientEx.prototype.getLatestOfflineItems=function(options){options.SortBy="DateCreated",options.SortOrder="Descending";var serverInfo=this.serverInfo();return serverInfo?localassetmanager.getViewItems(serverInfo.Id,null,options).then(function(items){return items.forEach(function(item){adjustGuidProperties(item)}),Promise.resolve(items)}):Promise.resolve([])},ApiClientEx.prototype.getThemeMedia=function(userId,itemId,inherit){return isLocalViewId(itemId)||isLocalId(itemId)||isTopLevelLocalViewId(itemId)?Promise.reject():ApiClient.prototype.getThemeMedia.call(this,userId,itemId,inherit)},ApiClientEx.prototype.getSpecialFeatures=function(userId,itemId){return isLocalId(itemId)?Promise.resolve([]):ApiClient.prototype.getSpecialFeatures.call(this,userId,itemId)},ApiClientEx.prototype.getSimilarItems=function(itemId,options){return isLocalId(itemId)?Promise.resolve(createEmptyList()):ApiClient.prototype.getSimilarItems.call(this,itemId,options)},ApiClientEx.prototype.updateFavoriteStatus=function(userId,itemId,isFavorite){return isLocalId(itemId)?Promise.resolve():ApiClient.prototype.updateFavoriteStatus.call(this,userId,itemId,isFavorite)},ApiClientEx.prototype.getScaledImageUrl=function(itemId,options){if(isLocalId(itemId)||options&&options.itemid&&isLocalId(options.itemid)){var serverInfo=this.serverInfo(),id=stripLocalPrefix(itemId);return localassetmanager.getImageUrl(serverInfo.Id,id,options)}return ApiClient.prototype.getScaledImageUrl.call(this,itemId,options)},ApiClientEx.prototype.reportPlaybackStart=function(options){if(!options)throw new Error("null options");return isLocalId(options.ItemId)?Promise.resolve():ApiClient.prototype.reportPlaybackStart.call(this,options)},ApiClientEx.prototype.reportPlaybackProgress=function(options){if(!options)throw new Error("null options");if(isLocalId(options.ItemId)){var serverInfo=this.serverInfo();return serverInfo?localassetmanager.getLocalItem(serverInfo.Id,stripLocalPrefix(options.ItemId)).then(function(item){var libraryItem=item.Item;return"Video"===libraryItem.MediaType||"AudioBook"===libraryItem.Type?(libraryItem.UserData=libraryItem.UserData||{},libraryItem.UserData.PlaybackPositionTicks=options.PositionTicks,libraryItem.UserData.PlayedPercentage=Math.min(libraryItem.RunTimeTicks?(options.PositionTicks||0)/libraryItem.RunTimeTicks*100:0,100),localassetmanager.addOrUpdateLocalItem(item)):Promise.resolve()}):Promise.resolve()}return ApiClient.prototype.reportPlaybackProgress.call(this,options)},ApiClientEx.prototype.reportPlaybackStopped=function(options){if(!options)throw new Error("null options");if(isLocalId(options.ItemId)){var serverInfo=this.serverInfo(),action={Date:(new Date).getTime(),ItemId:stripLocalPrefix(options.ItemId),PositionTicks:options.PositionTicks,ServerId:serverInfo.Id,Type:0,UserId:this.getCurrentUserId()};return localassetmanager.recordUserAction(action)}return ApiClient.prototype.reportPlaybackStopped.call(this,options)},ApiClientEx.prototype.getIntros=function(itemId){return isLocalId(itemId)?Promise.resolve({Items:[],TotalRecordCount:0}):ApiClient.prototype.getIntros.call(this,itemId)},ApiClientEx.prototype.getInstantMixFromItem=function(itemId,options){return isLocalId(itemId)?Promise.resolve({Items:[],TotalRecordCount:0}):ApiClient.prototype.getInstantMixFromItem.call(this,itemId,options)},ApiClientEx.prototype.getItemDownloadUrl=function(itemId){if(isLocalId(itemId)){var serverInfo=this.serverInfo();if(serverInfo)return localassetmanager.getLocalItem(serverInfo.Id,stripLocalPrefix(itemId)).then(function(item){return Promise.resolve(item.LocalPath)})}return ApiClient.prototype.getItemDownloadUrl.call(this,itemId)},ApiClientEx}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/connectionmanager.js b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/connectionmanager.js index a3f45d9350..3f8a8b1638 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/connectionmanager.js +++ b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/connectionmanager.js @@ -1 +1 @@ -define(["events","apiclient","appStorage"],function(events,apiClientFactory,appStorage){"use strict";function getServerAddress(server,mode){switch(mode){case ConnectionMode.Local:return server.LocalAddress;case ConnectionMode.Manual:return server.ManualAddress;case ConnectionMode.Remote:return server.RemoteAddress;default:return server.ManualAddress||server.LocalAddress||server.RemoteAddress}}function paramsToString(params){var values=[];for(var key in params){var value=params[key];null!==value&&void 0!==value&&""!==value&&values.push(encodeURIComponent(key)+"="+encodeURIComponent(value))}return values.join("&")}function resolveFailure(instance,resolve){resolve({State:"Unavailable",ConnectUser:instance.connectUser()})}function mergeServers(credentialProvider,list1,list2){for(var i=0,length=list2.length;ibVal)return 1}return 0}var defaultTimeout=2e4,ConnectionMode={Local:0,Remote:1,Manual:2},ConnectionManager=function(credentialProvider,appName,appVersion,deviceName,deviceId,capabilities,devicePixelRatio){function onConnectUserSignIn(user){appStorage.removeItem("lastLocalServerId"),connectUser=user,events.trigger(self,"connectusersignedin",[user])}function onAuthenticated(apiClient,result,options,saveCredentials){var credentials=credentialProvider.credentials(),servers=credentials.Servers.filter(function(s){return s.Id===result.ServerId}),server=servers.length?servers[0]:apiClient.serverInfo();return!1!==options.updateDateLastAccessed&&(server.DateLastAccessed=(new Date).getTime()),server.Id=result.ServerId,saveCredentials?(server.UserId=result.User.Id,server.AccessToken=result.AccessToken):(server.UserId=null,server.AccessToken=null),credentialProvider.addOrUpdateServer(credentials.Servers,server),credentialProvider.credentials(credentials),apiClient.enableAutomaticBitrateDetection=options.enableAutomaticBitrateDetection,apiClient.serverInfo(server),afterConnected(apiClient,options),onLocalUserSignIn(server,server.LastConnectionMode,result.User)}function afterConnected(apiClient,options){options=options||{},!1!==options.reportCapabilities&&apiClient.reportCapabilities(capabilities),apiClient.enableAutomaticBitrateDetection=options.enableAutomaticBitrateDetection,!1!==options.enableWebSocket&&(console.log("calling apiClient.ensureWebSocket"),apiClient.ensureWebSocket())}function onLocalUserSignIn(server,connectionMode,user){return self.connectUserId()?appStorage.removeItem("lastLocalServerId"):appStorage.setItem("lastLocalServerId",server.Id),self._getOrAddApiClient(server,connectionMode),(self.onLocalUserSignedIn?self.onLocalUserSignedIn.call(self,user):Promise.resolve()).then(function(){events.trigger(self,"localusersignedin",[user])})}function ensureConnectUser(credentials){return connectUser&&connectUser.Id===credentials.ConnectUserId?Promise.resolve():credentials.ConnectUserId&&credentials.ConnectAccessToken?(connectUser=null,getConnectUser(credentials.ConnectUserId,credentials.ConnectAccessToken).then(function(user){return onConnectUserSignIn(user),Promise.resolve()},function(){return Promise.resolve()})):Promise.resolve()}function getConnectUser(userId,accessToken){if(!userId)throw new Error("null userId");if(!accessToken)throw new Error("null accessToken");return ajax({type:"GET",url:"https://connect.emby.media/service/user?id="+userId,dataType:"json",headers:{"X-Application":appName+"/"+appVersion,"X-Connect-UserToken":accessToken}})}function addAuthenticationInfoFromConnect(server,connectionMode,credentials){if(!server.ExchangeToken)throw new Error("server.ExchangeToken cannot be null");if(!credentials.ConnectUserId)throw new Error("credentials.ConnectUserId cannot be null");var url=getServerAddress(server,connectionMode);url=getEmbyServerUrl(url,"Connect/Exchange?format=json&ConnectUserId="+credentials.ConnectUserId);var auth='MediaBrowser Client="'+appName+'", Device="'+deviceName+'", DeviceId="'+deviceId+'", Version="'+appVersion+'"';return ajax({type:"GET",url:url,dataType:"json",headers:{"X-MediaBrowser-Token":server.ExchangeToken,"X-Emby-Authorization":auth}}).then(function(auth){return server.UserId=auth.LocalUserId,server.AccessToken=auth.AccessToken,auth},function(){return server.UserId=null,server.AccessToken=null,Promise.reject()})}function validateAuthentication(server,connectionMode){var url=getServerAddress(server,connectionMode);return ajax({type:"GET",url:getEmbyServerUrl(url,"System/Info"),dataType:"json",headers:{"X-MediaBrowser-Token":server.AccessToken}}).then(function(systemInfo){return updateServerInfo(server,systemInfo),server.UserId?ajax({type:"GET",url:getEmbyServerUrl(url,"users/"+server.UserId),dataType:"json",headers:{"X-MediaBrowser-Token":server.AccessToken}}).then(function(user){return onLocalUserSignIn(server,connectionMode,user)},function(){return server.UserId=null,server.AccessToken=null,Promise.resolve()}):Promise.resolve()},function(){return server.UserId=null,server.AccessToken=null,Promise.resolve()})}function getImageUrl(localUser){if(connectUser&&connectUser.ImageUrl)return{url:connectUser.ImageUrl};if(localUser&&localUser.PrimaryImageTag){return{url:self.getApiClient(localUser).getUserImageUrl(localUser.Id,{tag:localUser.PrimaryImageTag,type:"Primary"}),supportsParams:!0}}return{url:null,supportsParams:!1}}function logoutOfServer(apiClient){var serverInfo=apiClient.serverInfo()||{},logoutInfo={serverId:serverInfo.Id};return apiClient.logout().then(function(){events.trigger(self,"localusersignedout",[logoutInfo])},function(){events.trigger(self,"localusersignedout",[logoutInfo])})}function getConnectServers(credentials){return console.log("Begin getConnectServers"),credentials.ConnectAccessToken&&credentials.ConnectUserId?ajax({type:"GET",url:"https://connect.emby.media/service/servers?userId="+credentials.ConnectUserId,dataType:"json",headers:{"X-Application":appName+"/"+appVersion,"X-Connect-UserToken":credentials.ConnectAccessToken}}).then(function(servers){return servers.map(function(i){return{ExchangeToken:i.AccessKey,ConnectServerId:i.Id,Id:i.SystemId,Name:i.Name,RemoteAddress:i.Url,LocalAddress:i.LocalAddress,UserLinkType:"guest"===(i.UserType||"").toLowerCase()?"Guest":"LinkedUser"}})},function(){return credentials.Servers.slice(0).filter(function(s){return s.ExchangeToken})}):Promise.resolve([])}function filterServers(servers,connectServers){return servers.filter(function(server){return!server.ExchangeToken||connectServers.filter(function(connectServer){return server.Id===connectServer.Id}).length>0})}function findServers(){return new Promise(function(resolve,reject){var onFinish=function(foundServers){var servers=foundServers.map(function(foundServer){var info={Id:foundServer.Id,LocalAddress:convertEndpointAddressToManualAddress(foundServer)||foundServer.Address,Name:foundServer.Name};return info.LastConnectionMode=info.ManualAddress?ConnectionMode.Manual:ConnectionMode.Local,info});resolve(servers)};require(["serverdiscovery"],function(serverDiscovery){serverDiscovery.findServers(1e3).then(onFinish,function(){onFinish([])})})})}function convertEndpointAddressToManualAddress(info){if(info.Address&&info.EndpointAddress){var address=info.EndpointAddress.split(":")[0],parts=info.Address.split(":");if(parts.length>1){var portString=parts[parts.length-1];isNaN(parseInt(portString))||(address+=":"+portString)}return normalizeAddress(address)}return null}function testNextConnectionMode(tests,index,server,options,resolve){if(index>=tests.length)return console.log("Tested all connection modes. Failing server connection."),void resolveFailure(self,resolve);var mode=tests[index],address=getServerAddress(server,mode),skipTest=!1,timeout=defaultTimeout;if(mode===ConnectionMode.Local?(!0,timeout=8e3,stringEqualsIgnoreCase(address,server.ManualAddress)&&(console.log("skipping LocalAddress test because it is the same as ManualAddress"),skipTest=!0)):mode===ConnectionMode.Manual&&stringEqualsIgnoreCase(address,server.LocalAddress)&&(!0,timeout=8e3),skipTest||!address)return console.log("skipping test at index "+index),void testNextConnectionMode(tests,index+1,server,options,resolve);console.log("testing connection mode "+mode+" with server "+server.Name),tryConnect(address,timeout).then(function(result){1===compareVersions(self.minServerVersion(),result.Version)?(console.log("minServerVersion requirement not met. Server version: "+result.Version),resolve({State:"ServerUpdateNeeded",Servers:[server]})):server.Id&&result.Id!==server.Id?(console.log("http request succeeded, but found a different server Id than what was expected"),resolveFailure(self,resolve)):(console.log("calling onSuccessfulConnection with connection mode "+mode+" with server "+server.Name),onSuccessfulConnection(server,result,mode,options,resolve))},function(){console.log("test failed for connection mode "+mode+" with server "+server.Name),testNextConnectionMode(tests,index+1,server,options,resolve)})}function onSuccessfulConnection(server,systemInfo,connectionMode,options,resolve){var credentials=credentialProvider.credentials();options=options||{},credentials.ConnectAccessToken&&!1!==options.enableAutoLogin?ensureConnectUser(credentials).then(function(){server.ExchangeToken?addAuthenticationInfoFromConnect(server,connectionMode,credentials).then(function(){afterConnectValidated(server,credentials,systemInfo,connectionMode,!0,options,resolve)},function(){afterConnectValidated(server,credentials,systemInfo,connectionMode,!0,options,resolve)}):afterConnectValidated(server,credentials,systemInfo,connectionMode,!0,options,resolve)}):afterConnectValidated(server,credentials,systemInfo,connectionMode,!0,options,resolve)}function afterConnectValidated(server,credentials,systemInfo,connectionMode,verifyLocalAuthentication,options,resolve){if(options=options||{},!1===options.enableAutoLogin)server.UserId=null,server.AccessToken=null;else if(verifyLocalAuthentication&&server.AccessToken&&!1!==options.enableAutoLogin)return void validateAuthentication(server,connectionMode).then(function(){afterConnectValidated(server,credentials,systemInfo,connectionMode,!1,options,resolve)});updateServerInfo(server,systemInfo),server.LastConnectionMode=connectionMode,!1!==options.updateDateLastAccessed&&(server.DateLastAccessed=(new Date).getTime()),credentialProvider.addOrUpdateServer(credentials.Servers,server),credentialProvider.credentials(credentials);var result={Servers:[]};result.ApiClient=self._getOrAddApiClient(server,connectionMode),result.ApiClient.setSystemInfo(systemInfo),result.State=server.AccessToken&&!1!==options.enableAutoLogin?"SignedIn":"ServerSignIn",result.Servers.push(server),result.ApiClient.enableAutomaticBitrateDetection=options.enableAutomaticBitrateDetection,result.ApiClient.updateServerInfo(server,connectionMode),"SignedIn"===result.State&&afterConnected(result.ApiClient,options),resolve(result),events.trigger(self,"connected",[result])}function getCacheKey(feature,apiClient,options){options=options||{};var viewOnly=options.viewOnly,cacheKey="regInfo-"+apiClient.serverId();return viewOnly&&(cacheKey+="-viewonly"),cacheKey}function addAppInfoToConnectRequest(request){request.headers=request.headers||{},request.headers["X-Application"]=appName+"/"+appVersion}function exchangePin(pinInfo){if(!pinInfo)throw new Error("pinInfo cannot be null");var request={type:"POST",url:getConnectUrl("pin/authenticate"),data:{deviceId:pinInfo.DeviceId,pin:pinInfo.Pin},dataType:"json"};return addAppInfoToConnectRequest(request),ajax(request)}console.log("Begin ConnectionManager constructor");var self=this;this._apiClients=[];var connectUser;self.connectUser=function(){return connectUser},self._minServerVersion="3.2.33",self.appVersion=function(){return appVersion},self.appName=function(){return appName},self.capabilities=function(){return capabilities},self.deviceId=function(){return deviceId},self.credentialProvider=function(){return credentialProvider},self.connectUserId=function(){return credentialProvider.credentials().ConnectUserId},self.connectToken=function(){return credentialProvider.credentials().ConnectAccessToken},self.getServerInfo=function(id){return credentialProvider.credentials().Servers.filter(function(s){return s.Id===id})[0]},self.getLastUsedServer=function(){var servers=credentialProvider.credentials().Servers;return servers.sort(function(a,b){return(b.DateLastAccessed||0)-(a.DateLastAccessed||0)}),servers.length?servers[0]:null},self.getLastUsedApiClient=function(){var servers=credentialProvider.credentials().Servers;if(servers.sort(function(a,b){return(b.DateLastAccessed||0)-(a.DateLastAccessed||0)}),!servers.length)return null;var server=servers[0];return self._getOrAddApiClient(server,server.LastConnectionMode)},self.addApiClient=function(apiClient){self._apiClients.push(apiClient);var existingServers=credentialProvider.credentials().Servers.filter(function(s){return stringEqualsIgnoreCase(s.ManualAddress,apiClient.serverAddress())||stringEqualsIgnoreCase(s.LocalAddress,apiClient.serverAddress())||stringEqualsIgnoreCase(s.RemoteAddress,apiClient.serverAddress())}),existingServer=existingServers.length?existingServers[0]:apiClient.serverInfo();if(existingServer.DateLastAccessed=(new Date).getTime(),existingServer.LastConnectionMode=ConnectionMode.Manual,existingServer.ManualAddress=apiClient.serverAddress(),apiClient.serverInfo(existingServer),apiClient.onAuthenticated=function(instance,result){return onAuthenticated(instance,result,{},!0)},!existingServers.length){var credentials=credentialProvider.credentials();credentials.Servers=[existingServer],credentialProvider.credentials(credentials)}events.trigger(self,"apiclientcreated",[apiClient])},self.clearData=function(){console.log("connection manager clearing data"),connectUser=null;var credentials=credentialProvider.credentials();credentials.ConnectAccessToken=null,credentials.ConnectUserId=null,credentials.Servers=[],credentialProvider.credentials(credentials)},self._getOrAddApiClient=function(server,connectionMode){var apiClient=self.getApiClient(server.Id);if(!apiClient){var url=getServerAddress(server,connectionMode);apiClient=new apiClientFactory(url,appName,appVersion,deviceName,deviceId,devicePixelRatio),self._apiClients.push(apiClient),apiClient.serverInfo(server),apiClient.onAuthenticated=function(instance,result){return onAuthenticated(instance,result,{},!0)},events.trigger(self,"apiclientcreated",[apiClient])}return console.log("returning instance from getOrAddApiClient"),apiClient},self.getOrCreateApiClient=function(serverId){var credentials=credentialProvider.credentials(),servers=credentials.Servers.filter(function(s){return stringEqualsIgnoreCase(s.Id,serverId)});if(!servers.length)throw new Error("Server not found: "+serverId);var server=servers[0];return self._getOrAddApiClient(server,server.LastConnectionMode)},self.user=function(apiClient){return new Promise(function(resolve,reject){function onLocalUserDone(e){var image=getImageUrl(localUser);resolve({localUser:localUser,name:connectUser?connectUser.Name:localUser?localUser.Name:null,imageUrl:image.url,supportsImageParams:image.supportsParams,connectUser:connectUser})}function onEnsureConnectUserDone(){apiClient&&apiClient.getCurrentUserId()?apiClient.getCurrentUser().then(function(u){localUser=u,onLocalUserDone()},onLocalUserDone):onLocalUserDone()}var localUser,credentials=credentialProvider.credentials();!credentials.ConnectUserId||!credentials.ConnectAccessToken||apiClient&&apiClient.getCurrentUserId()?onEnsureConnectUserDone():ensureConnectUser(credentials).then(onEnsureConnectUserDone,onEnsureConnectUserDone)})},self.logout=function(){console.log("begin connectionManager loguot");for(var promises=[],i=0,length=self._apiClients.length;ibVal)return 1}return 0}var defaultTimeout=2e4,ConnectionMode={Local:0,Remote:1,Manual:2},ConnectionManager=function(credentialProvider,appName,appVersion,deviceName,deviceId,capabilities,devicePixelRatio){function onConnectUserSignIn(user){connectUser=user,events.trigger(self,"connectusersignedin",[user])}function onAuthenticated(apiClient,result,options,saveCredentials){var credentials=credentialProvider.credentials(),servers=credentials.Servers.filter(function(s){return s.Id===result.ServerId}),server=servers.length?servers[0]:apiClient.serverInfo();return!1!==options.updateDateLastAccessed&&(server.DateLastAccessed=(new Date).getTime()),server.Id=result.ServerId,saveCredentials?(server.UserId=result.User.Id,server.AccessToken=result.AccessToken):(server.UserId=null,server.AccessToken=null),credentialProvider.addOrUpdateServer(credentials.Servers,server),credentialProvider.credentials(credentials),apiClient.enableAutomaticBitrateDetection=options.enableAutomaticBitrateDetection,apiClient.serverInfo(server),afterConnected(apiClient,options),onLocalUserSignIn(server,server.LastConnectionMode,result.User)}function afterConnected(apiClient,options){options=options||{},!1!==options.reportCapabilities&&apiClient.reportCapabilities(capabilities),apiClient.enableAutomaticBitrateDetection=options.enableAutomaticBitrateDetection,!1!==options.enableWebSocket&&(console.log("calling apiClient.ensureWebSocket"),apiClient.ensureWebSocket())}function onLocalUserSignIn(server,connectionMode,user){return self._getOrAddApiClient(server,connectionMode),(self.onLocalUserSignedIn?self.onLocalUserSignedIn.call(self,user):Promise.resolve()).then(function(){events.trigger(self,"localusersignedin",[user])})}function ensureConnectUser(credentials){return connectUser&&connectUser.Id===credentials.ConnectUserId?Promise.resolve():credentials.ConnectUserId&&credentials.ConnectAccessToken?(connectUser=null,getConnectUser(credentials.ConnectUserId,credentials.ConnectAccessToken).then(function(user){return onConnectUserSignIn(user),Promise.resolve()},function(){return Promise.resolve()})):Promise.resolve()}function getConnectUser(userId,accessToken){if(!userId)throw new Error("null userId");if(!accessToken)throw new Error("null accessToken");return ajax({type:"GET",url:"https://connect.emby.media/service/user?id="+userId,dataType:"json",headers:{"X-Application":appName+"/"+appVersion,"X-Connect-UserToken":accessToken}})}function addAuthenticationInfoFromConnect(server,connectionMode,credentials){if(!server.ExchangeToken)throw new Error("server.ExchangeToken cannot be null");if(!credentials.ConnectUserId)throw new Error("credentials.ConnectUserId cannot be null");var url=getServerAddress(server,connectionMode);url=getEmbyServerUrl(url,"Connect/Exchange?format=json&ConnectUserId="+credentials.ConnectUserId);var auth='MediaBrowser Client="'+appName+'", Device="'+deviceName+'", DeviceId="'+deviceId+'", Version="'+appVersion+'"';return ajax({type:"GET",url:url,dataType:"json",headers:{"X-MediaBrowser-Token":server.ExchangeToken,"X-Emby-Authorization":auth}}).then(function(auth){return server.UserId=auth.LocalUserId,server.AccessToken=auth.AccessToken,auth},function(){return server.UserId=null,server.AccessToken=null,Promise.reject()})}function validateAuthentication(server,connectionMode){return ajax({type:"GET",url:getEmbyServerUrl(getServerAddress(server,connectionMode),"System/Info"),dataType:"json",headers:{"X-MediaBrowser-Token":server.AccessToken}}).then(function(systemInfo){return updateServerInfo(server,systemInfo),Promise.resolve()},function(){return server.UserId=null,server.AccessToken=null,Promise.resolve()})}function getImageUrl(localUser){if(connectUser&&connectUser.ImageUrl)return{url:connectUser.ImageUrl};if(localUser&&localUser.PrimaryImageTag){return{url:self.getApiClient(localUser).getUserImageUrl(localUser.Id,{tag:localUser.PrimaryImageTag,type:"Primary"}),supportsParams:!0}}return{url:null,supportsParams:!1}}function logoutOfServer(apiClient){var serverInfo=apiClient.serverInfo()||{},logoutInfo={serverId:serverInfo.Id};return apiClient.logout().then(function(){events.trigger(self,"localusersignedout",[logoutInfo])},function(){events.trigger(self,"localusersignedout",[logoutInfo])})}function getConnectServers(credentials){return console.log("Begin getConnectServers"),credentials.ConnectAccessToken&&credentials.ConnectUserId?ajax({type:"GET",url:"https://connect.emby.media/service/servers?userId="+credentials.ConnectUserId,dataType:"json",headers:{"X-Application":appName+"/"+appVersion,"X-Connect-UserToken":credentials.ConnectAccessToken}}).then(function(servers){return servers.map(function(i){return{ExchangeToken:i.AccessKey,ConnectServerId:i.Id,Id:i.SystemId,Name:i.Name,RemoteAddress:i.Url,LocalAddress:i.LocalAddress,UserLinkType:"guest"===(i.UserType||"").toLowerCase()?"Guest":"LinkedUser"}})},function(){return credentials.Servers.slice(0).filter(function(s){return s.ExchangeToken})}):Promise.resolve([])}function filterServers(servers,connectServers){return servers.filter(function(server){return!server.ExchangeToken||connectServers.filter(function(connectServer){return server.Id===connectServer.Id}).length>0})}function findServers(){return new Promise(function(resolve,reject){var onFinish=function(foundServers){var servers=foundServers.map(function(foundServer){var info={Id:foundServer.Id,LocalAddress:convertEndpointAddressToManualAddress(foundServer)||foundServer.Address,Name:foundServer.Name};return info.LastConnectionMode=info.ManualAddress?ConnectionMode.Manual:ConnectionMode.Local,info});resolve(servers)};require(["serverdiscovery"],function(serverDiscovery){serverDiscovery.findServers(1e3).then(onFinish,function(){onFinish([])})})})}function convertEndpointAddressToManualAddress(info){if(info.Address&&info.EndpointAddress){var address=info.EndpointAddress.split(":")[0],parts=info.Address.split(":");if(parts.length>1){var portString=parts[parts.length-1];isNaN(parseInt(portString))||(address+=":"+portString)}return normalizeAddress(address)}return null}function testNextConnectionMode(tests,index,server,options,resolve){if(index>=tests.length)return console.log("Tested all connection modes. Failing server connection."),void resolveFailure(self,resolve);var mode=tests[index],address=getServerAddress(server,mode),skipTest=!1,timeout=defaultTimeout;if(mode===ConnectionMode.Local?(!0,timeout=8e3,stringEqualsIgnoreCase(address,server.ManualAddress)&&(console.log("skipping LocalAddress test because it is the same as ManualAddress"),skipTest=!0)):mode===ConnectionMode.Manual&&stringEqualsIgnoreCase(address,server.LocalAddress)&&(!0,timeout=8e3),skipTest||!address)return console.log("skipping test at index "+index),void testNextConnectionMode(tests,index+1,server,options,resolve);console.log("testing connection mode "+mode+" with server "+server.Name),tryConnect(address,timeout).then(function(result){1===compareVersions(self.minServerVersion(),result.Version)?(console.log("minServerVersion requirement not met. Server version: "+result.Version),resolve({State:"ServerUpdateNeeded",Servers:[server]})):server.Id&&result.Id!==server.Id?(console.log("http request succeeded, but found a different server Id than what was expected"),resolveFailure(self,resolve)):(console.log("calling onSuccessfulConnection with connection mode "+mode+" with server "+server.Name),onSuccessfulConnection(server,result,mode,options,resolve))},function(){console.log("test failed for connection mode "+mode+" with server "+server.Name),testNextConnectionMode(tests,index+1,server,options,resolve)})}function onSuccessfulConnection(server,systemInfo,connectionMode,options,resolve){var credentials=credentialProvider.credentials();options=options||{},credentials.ConnectAccessToken&&!1!==options.enableAutoLogin?ensureConnectUser(credentials).then(function(){server.ExchangeToken?addAuthenticationInfoFromConnect(server,connectionMode,credentials).then(function(){afterConnectValidated(server,credentials,systemInfo,connectionMode,!0,options,resolve)},function(){afterConnectValidated(server,credentials,systemInfo,connectionMode,!0,options,resolve)}):afterConnectValidated(server,credentials,systemInfo,connectionMode,!0,options,resolve)}):afterConnectValidated(server,credentials,systemInfo,connectionMode,!0,options,resolve)}function afterConnectValidated(server,credentials,systemInfo,connectionMode,verifyLocalAuthentication,options,resolve){if(options=options||{},!1===options.enableAutoLogin)server.UserId=null,server.AccessToken=null;else if(verifyLocalAuthentication&&server.AccessToken&&!1!==options.enableAutoLogin)return void validateAuthentication(server,connectionMode).then(function(){afterConnectValidated(server,credentials,systemInfo,connectionMode,!1,options,resolve)});updateServerInfo(server,systemInfo),server.LastConnectionMode=connectionMode,!1!==options.updateDateLastAccessed&&(server.DateLastAccessed=(new Date).getTime()),credentialProvider.addOrUpdateServer(credentials.Servers,server),credentialProvider.credentials(credentials);var result={Servers:[]};result.ApiClient=self._getOrAddApiClient(server,connectionMode),result.ApiClient.setSystemInfo(systemInfo),result.State=server.AccessToken&&!1!==options.enableAutoLogin?"SignedIn":"ServerSignIn",result.Servers.push(server),result.ApiClient.enableAutomaticBitrateDetection=options.enableAutomaticBitrateDetection,result.ApiClient.updateServerInfo(server,connectionMode);var resolveActions=function(){resolve(result),events.trigger(self,"connected",[result])};"SignedIn"===result.State?(afterConnected(result.ApiClient,options),result.ApiClient.getCurrentUser().then(function(user){onLocalUserSignIn(server,connectionMode,user).then(resolveActions,resolveActions)},resolveActions)):resolveActions()}function getCacheKey(feature,apiClient,options){options=options||{};var viewOnly=options.viewOnly,cacheKey="regInfo-"+apiClient.serverId();return viewOnly&&(cacheKey+="-viewonly"),cacheKey}function addAppInfoToConnectRequest(request){request.headers=request.headers||{},request.headers["X-Application"]=appName+"/"+appVersion}function exchangePin(pinInfo){if(!pinInfo)throw new Error("pinInfo cannot be null");var request={type:"POST",url:getConnectUrl("pin/authenticate"),data:{deviceId:pinInfo.DeviceId,pin:pinInfo.Pin},dataType:"json"};return addAppInfoToConnectRequest(request),ajax(request)}console.log("Begin ConnectionManager constructor");var self=this;this._apiClients=[];var connectUser;self.connectUser=function(){return connectUser},self._minServerVersion="3.2.33",self.appVersion=function(){return appVersion},self.appName=function(){return appName},self.capabilities=function(){return capabilities},self.deviceId=function(){return deviceId},self.credentialProvider=function(){return credentialProvider},self.connectUserId=function(){return credentialProvider.credentials().ConnectUserId},self.connectToken=function(){return credentialProvider.credentials().ConnectAccessToken},self.getServerInfo=function(id){return credentialProvider.credentials().Servers.filter(function(s){return s.Id===id})[0]},self.getLastUsedServer=function(){var servers=credentialProvider.credentials().Servers;return servers.sort(function(a,b){return(b.DateLastAccessed||0)-(a.DateLastAccessed||0)}),servers.length?servers[0]:null},self.getLastUsedApiClient=function(){var servers=credentialProvider.credentials().Servers;if(servers.sort(function(a,b){return(b.DateLastAccessed||0)-(a.DateLastAccessed||0)}),!servers.length)return null;var server=servers[0];return self._getOrAddApiClient(server,server.LastConnectionMode)},self.addApiClient=function(apiClient){self._apiClients.push(apiClient);var existingServers=credentialProvider.credentials().Servers.filter(function(s){return stringEqualsIgnoreCase(s.ManualAddress,apiClient.serverAddress())||stringEqualsIgnoreCase(s.LocalAddress,apiClient.serverAddress())||stringEqualsIgnoreCase(s.RemoteAddress,apiClient.serverAddress())}),existingServer=existingServers.length?existingServers[0]:apiClient.serverInfo();if(existingServer.DateLastAccessed=(new Date).getTime(),existingServer.LastConnectionMode=ConnectionMode.Manual,existingServer.ManualAddress=apiClient.serverAddress(),apiClient.serverInfo(existingServer),apiClient.onAuthenticated=function(instance,result){return onAuthenticated(instance,result,{},!0)},!existingServers.length){var credentials=credentialProvider.credentials();credentials.Servers=[existingServer],credentialProvider.credentials(credentials)}events.trigger(self,"apiclientcreated",[apiClient])},self.clearData=function(){console.log("connection manager clearing data"),connectUser=null;var credentials=credentialProvider.credentials();credentials.ConnectAccessToken=null,credentials.ConnectUserId=null,credentials.Servers=[],credentialProvider.credentials(credentials)},self._getOrAddApiClient=function(server,connectionMode){var apiClient=self.getApiClient(server.Id);if(!apiClient){var url=getServerAddress(server,connectionMode);apiClient=new apiClientFactory(url,appName,appVersion,deviceName,deviceId,devicePixelRatio),self._apiClients.push(apiClient),apiClient.serverInfo(server),apiClient.onAuthenticated=function(instance,result){return onAuthenticated(instance,result,{},!0)},events.trigger(self,"apiclientcreated",[apiClient])}return console.log("returning instance from getOrAddApiClient"),apiClient},self.getOrCreateApiClient=function(serverId){var credentials=credentialProvider.credentials(),servers=credentials.Servers.filter(function(s){return stringEqualsIgnoreCase(s.Id,serverId)});if(!servers.length)throw new Error("Server not found: "+serverId);var server=servers[0];return self._getOrAddApiClient(server,server.LastConnectionMode)},self.user=function(apiClient){return new Promise(function(resolve,reject){function onLocalUserDone(e){var image=getImageUrl(localUser);resolve({localUser:localUser,name:connectUser?connectUser.Name:localUser?localUser.Name:null,imageUrl:image.url,supportsImageParams:image.supportsParams,connectUser:connectUser})}function onEnsureConnectUserDone(){apiClient&&apiClient.getCurrentUserId()?apiClient.getCurrentUser().then(function(u){localUser=u,onLocalUserDone()},onLocalUserDone):onLocalUserDone()}var localUser,credentials=credentialProvider.credentials();!credentials.ConnectUserId||!credentials.ConnectAccessToken||apiClient&&apiClient.getCurrentUserId()?onEnsureConnectUserDone():ensureConnectUser(credentials).then(onEnsureConnectUserDone,onEnsureConnectUserDone)})},self.logout=function(){console.log("begin connectionManager loguot");for(var promises=[],i=0,length=self._apiClients.length;i-1&&(item={Name:"Music",ServerId:serverId,Id:"localview:MusicView",Type:"MusicView",CollectionType:"music",IsFolder:!0},list.push(item)),types.indexOf("Photo")>-1&&(item={Name:"Photos",ServerId:serverId,Id:"localview:PhotosView",Type:"PhotosView",CollectionType:"photos",IsFolder:!0},list.push(item)),types.indexOf("Episode")>-1&&(item={Name:"TV",ServerId:serverId,Id:"localview:TVView",Type:"TVView",CollectionType:"tvshows",IsFolder:!0},list.push(item)),types.indexOf("Movie")>-1&&(item={Name:"Movies",ServerId:serverId,Id:"localview:MoviesView",Type:"MoviesView",CollectionType:"movies",IsFolder:!0},list.push(item)),types.indexOf("Video")>-1&&(item={Name:"Videos",ServerId:serverId,Id:"localview:VideosView",Type:"VideosView",CollectionType:"videos",IsFolder:!0},list.push(item)),types.indexOf("MusicVideo")>-1&&(item={Name:"Music Videos",ServerId:serverId,Id:"localview:MusicVideosView",Type:"MusicVideosView",CollectionType:"videos",IsFolder:!0},list.push(item)),Promise.resolve(list)})}function getTypeFilterForTopLevelView(parentId){var typeFilter=null;switch(parentId){case"localview:MusicView":typeFilter="MusicAlbum";break;case"localview:PhotosView":typeFilter="PhotoAlbum";break;case"localview:TVView":typeFilter="Series";break;case"localview:VideosView":typeFilter="Video";break;case"localview:MoviesView":typeFilter="Movie";break;case"localview:MusicVideosView":typeFilter="MusicVideo"}return typeFilter}function normalizeId(id){return id?(id=stripStart(id,"localview:"),id=stripStart(id,"local:")):null}function getViewItems(serverId,userId,options){var parentId=options.ParentId,typeFilter=getTypeFilterForTopLevelView(parentId);parentId=normalizeId(parentId);var seasonId=normalizeId(options.SeasonId||options.seasonId),seriesId=normalizeId(options.SeriesId||options.seriesId),includeItemTypes=options.IncludeItemTypes?options.IncludeItemTypes.split(","):[];return typeFilter&&(parentId=null,includeItemTypes.push(typeFilter)),getServerItems(serverId).then(function(items){var resultItems=items.filter(function(item){if(item.SyncStatus&&"synced"!==item.SyncStatus)return!1;if(options.MediaType&&item.Item.MediaType!==options.MediaType)return!1;if(seriesId&&item.Item.SeriesId!==seriesId)return!1;if(seasonId&&item.Item.SeasonId!==seasonId)return!1;if("IsNotFolder"===options.Filters&&item.Item.IsFolder)return!1;if("IsFolder"===options.Filters&&!item.Item.IsFolder)return!1;if(includeItemTypes.length&&-1===includeItemTypes.indexOf(item.Item.Type||""))return!1;if(options.Recursive);else if(parentId&&item.Item.ParentId!==parentId)return!1;return!0}).map(function(item2){return item2.Item});return"DateCreated"===options.SortBy&&resultItems.sort(function(a,b){return compareDates(a.DateCreated,b.DateCreated)}),options.Limit&&(resultItems=resultItems.slice(0,options.Limit)),Promise.resolve(resultItems)})}function removeObsoleteContainerItems(serverId){return getServerItems(serverId).then(function(items){var seriesItems=items.filter(function(item){return"series"===(item.Item.Type||"").toLowerCase()}),seasonItems=items.filter(function(item){return"season"===(item.Item.Type||"").toLowerCase()}),albumItems=items.filter(function(item){var type=(item.Item.Type||"").toLowerCase();return"musicalbum"===type||"photoalbum"===type}),requiredSeriesIds=items.filter(function(item){return"episode"===(item.Item.Type||"").toLowerCase()}).map(function(item2){return item2.Item.SeriesId}).filter(filterDistinct),requiredSeasonIds=items.filter(function(item){return"episode"===(item.Item.Type||"").toLowerCase()}).map(function(item2){return item2.Item.SeasonId}).filter(filterDistinct),requiredAlbumIds=items.filter(function(item){var type=(item.Item.Type||"").toLowerCase();return"audio"===type||"photo"===type}).map(function(item2){return item2.Item.AlbumId}).filter(filterDistinct),obsoleteItems=[];seriesItems.forEach(function(item){requiredSeriesIds.indexOf(item.Item.Id)<0&&obsoleteItems.push(item)}),seasonItems.forEach(function(item){requiredSeasonIds.indexOf(item.Item.Id)<0&&obsoleteItems.push(item)}),albumItems.forEach(function(item){requiredAlbumIds.indexOf(item.Item.Id)<0&&obsoleteItems.push(item)});var p=Promise.resolve();return obsoleteItems.forEach(function(item){p=p.then(function(){return itemrepository.remove(item.ServerId,item.Id)})}),p})}function removeLocalItem(localItem){return itemrepository.get(localItem.ServerId,localItem.Id).then(function(item){return filerepository.deleteFile(item.LocalPath).then(function(){var p=Promise.resolve(!0);return item.AdditionalFiles&&item.AdditionalFiles.forEach(function(file){p=p.then(function(){return filerepository.deleteFile(file.Path)})}),p.then(function(file){return itemrepository.remove(localItem.ServerId,localItem.Id)})},function(error){var p=Promise.resolve(!0);return item.AdditionalFiles&&item.AdditionalFiles.forEach(function(file){p=p.then(function(item){return filerepository.deleteFile(file.Path)})}),p.then(function(file){return itemrepository.remove(localItem.ServerId,localItem.Id)})})})}function addOrUpdateLocalItem(localItem){return itemrepository.set(localItem.ServerId,localItem.Id,localItem)}function createLocalItem(libraryItem,serverInfo,jobItem){console.log("[localassetmanager] Begin createLocalItem");var localPath,path=getDirectoryPath(libraryItem),localFolder=filerepository.getFullLocalPath(path,!1);if(jobItem&&(path.push(getLocalFileName(libraryItem,jobItem.OriginalFileName)),localPath=filerepository.getFullLocalPath(path,!0)),libraryItem.MediaSources)for(var i=0;i0&&(fileName=fileName.substring(0,pos)),fileName}function downloadFile(url,localItem){var imageUrl=getImageUrl(localItem.Item.ServerId,localItem.Item.Id,{type:"Primary",index:0});return transfermanager.downloadFile(url,localItem,imageUrl)}function downloadSubtitles(url,fileName){return transfermanager.downloadSubtitles(url,fileName)}function getImageUrl(serverId,itemId,imageOptions){var imageType=imageOptions.type,index=imageOptions.index,pathArray=getImagePath(serverId,itemId,imageType,index);return filerepository.getImageUrl(pathArray)}function hasImage(serverId,itemId,imageType,index){var pathArray=getImagePath(serverId,itemId,imageType,index),localFilePath=filerepository.getFullMetadataPath(pathArray);return filerepository.fileExists(localFilePath).then(function(exists){return Promise.resolve(exists)},function(err){return Promise.resolve(!1)})}function fileExists(localFilePath){return filerepository.fileExists(localFilePath)}function downloadImage(localItem,url,serverId,itemId,imageType,index){var pathArray=getImagePath(serverId,itemId,imageType,index),localFilePath=filerepository.getFullMetadataPath(pathArray);localItem.AdditionalFiles||(localItem.AdditionalFiles=[]);var fileInfo={Path:localFilePath,Type:"Image",Name:imageType+index.toString(),ImageType:imageType};return localItem.AdditionalFiles.push(fileInfo),transfermanager.downloadImage(url,localFilePath)}function isDownloadFileInQueue(path){return transfermanager.isDownloadFileInQueue(path)}function getDownloadItemCount(){return transfermanager.getDownloadItemCount()}function getDirectoryPath(item){var parts=[],itemtype=item.Type.toLowerCase(),mediaType=(item.MediaType||"").toLowerCase();"episode"===itemtype||"series"===itemtype||"season"===itemtype?parts.push("TV"):"video"===mediaType?parts.push("Videos"):"audio"===itemtype||"musicalbum"===itemtype||"musicartist"===itemtype?parts.push("Music"):"photo"===itemtype||"photoalbum"===itemtype?parts.push("Photos"):"game"!==itemtype&&"gamesystem"!==itemtype||parts.push("Games");var albumArtist=item.AlbumArtist;albumArtist&&parts.push(albumArtist);var seriesName=item.SeriesName;seriesName&&parts.push(seriesName);var seasonName=item.SeasonName;seasonName&&parts.push(seasonName),item.Album&&parts.push(item.Album),("video"===mediaType&&"episode"!==itemtype||"game"===itemtype||item.IsFolder)&&parts.push(item.Name);for(var finalParts=[],i=0;ifind.length&&0===str.indexOf(find))}function stripStart(str,find){return startsWith(str,find)?str.substr(find.length):str}function filterDistinct(value,index,self){return self.indexOf(value)===index}function compareDates(a,b){return isFinite(a=a.valueOf())&&isFinite(b=b.valueOf())?(a>b)-(a-1&&(item={Name:"Music",ServerId:serverId,Id:"localview:MusicView",Type:"MusicView",CollectionType:"music",IsFolder:!0},list.push(item)),types.indexOf("Photo")>-1&&(item={Name:"Photos",ServerId:serverId,Id:"localview:PhotosView",Type:"PhotosView",CollectionType:"photos",IsFolder:!0},list.push(item)),types.indexOf("Episode")>-1&&(item={Name:"TV",ServerId:serverId,Id:"localview:TVView",Type:"TVView",CollectionType:"tvshows",IsFolder:!0},list.push(item)),types.indexOf("Movie")>-1&&(item={Name:"Movies",ServerId:serverId,Id:"localview:MoviesView",Type:"MoviesView",CollectionType:"movies",IsFolder:!0},list.push(item)),types.indexOf("Video")>-1&&(item={Name:"Videos",ServerId:serverId,Id:"localview:VideosView",Type:"VideosView",CollectionType:"videos",IsFolder:!0},list.push(item)),types.indexOf("MusicVideo")>-1&&(item={Name:"Music Videos",ServerId:serverId,Id:"localview:MusicVideosView",Type:"MusicVideosView",CollectionType:"videos",IsFolder:!0},list.push(item)),Promise.resolve(list)})}function getTypeFilterForTopLevelView(parentId){var typeFilter=null;switch(parentId){case"localview:MusicView":typeFilter="MusicAlbum";break;case"localview:PhotosView":typeFilter="PhotoAlbum";break;case"localview:TVView":typeFilter="Series";break;case"localview:VideosView":typeFilter="Video";break;case"localview:MoviesView":typeFilter="Movie";break;case"localview:MusicVideosView":typeFilter="MusicVideo"}return typeFilter}function normalizeId(id){return id?(id=stripStart(id,"localview:"),id=stripStart(id,"local:")):null}function normalizeIdList(val){return val?val.split(",").map(normalizeId):[]}function getViewItems(serverId,userId,options){var parentId=options.ParentId,typeFilter=getTypeFilterForTopLevelView(parentId);parentId=normalizeId(parentId);var seasonId=normalizeId(options.SeasonId||options.seasonId),seriesId=normalizeId(options.SeriesId||options.seriesId),albumIds=normalizeIdList(options.AlbumIds||options.albumIds),includeItemTypes=options.IncludeItemTypes?options.IncludeItemTypes.split(","):[];return typeFilter&&(parentId=null,includeItemTypes.push(typeFilter)),getServerItems(serverId).then(function(items){var resultItems=items.filter(function(item){if(item.SyncStatus&&"synced"!==item.SyncStatus)return!1;if(options.MediaType&&item.Item.MediaType!==options.MediaType)return!1;if(seriesId&&item.Item.SeriesId!==seriesId)return!1;if(seasonId&&item.Item.SeasonId!==seasonId)return!1;if(albumIds.length&&-1===albumIds.indexOf(item.Item.AlbumId||""))return!1;if("IsNotFolder"===options.Filters&&item.Item.IsFolder)return!1;if("IsFolder"===options.Filters&&!item.Item.IsFolder)return!1;if(includeItemTypes.length&&-1===includeItemTypes.indexOf(item.Item.Type||""))return!1;if(options.Recursive);else if(parentId&&item.Item.ParentId!==parentId)return!1;return!0}).map(function(item2){return item2.Item});return"DateCreated"===options.SortBy&&resultItems.sort(function(a,b){return compareDates(a.DateCreated,b.DateCreated)}),options.Limit&&(resultItems=resultItems.slice(0,options.Limit)),Promise.resolve(resultItems)})}function removeObsoleteContainerItems(serverId){return getServerItems(serverId).then(function(items){var seriesItems=items.filter(function(item){return"series"===(item.Item.Type||"").toLowerCase()}),seasonItems=items.filter(function(item){return"season"===(item.Item.Type||"").toLowerCase()}),albumItems=items.filter(function(item){var type=(item.Item.Type||"").toLowerCase();return"musicalbum"===type||"photoalbum"===type}),requiredSeriesIds=items.filter(function(item){return"episode"===(item.Item.Type||"").toLowerCase()}).map(function(item2){return item2.Item.SeriesId}).filter(filterDistinct),requiredSeasonIds=items.filter(function(item){return"episode"===(item.Item.Type||"").toLowerCase()}).map(function(item2){return item2.Item.SeasonId}).filter(filterDistinct),requiredAlbumIds=items.filter(function(item){var type=(item.Item.Type||"").toLowerCase();return"audio"===type||"photo"===type}).map(function(item2){return item2.Item.AlbumId}).filter(filterDistinct),obsoleteItems=[];seriesItems.forEach(function(item){requiredSeriesIds.indexOf(item.Item.Id)<0&&obsoleteItems.push(item)}),seasonItems.forEach(function(item){requiredSeasonIds.indexOf(item.Item.Id)<0&&obsoleteItems.push(item)}),albumItems.forEach(function(item){requiredAlbumIds.indexOf(item.Item.Id)<0&&obsoleteItems.push(item)});var p=Promise.resolve();return obsoleteItems.forEach(function(item){p=p.then(function(){return itemrepository.remove(item.ServerId,item.Id)})}),p})}function removeLocalItem(localItem){return itemrepository.get(localItem.ServerId,localItem.Id).then(function(item){var onFileDeletedSuccessOrFail=function(){var p=Promise.resolve(!0);return item.AdditionalFiles&&item.AdditionalFiles.forEach(function(file){p=p.then(function(){return filerepository.deleteFile(file.Path)})}),p.then(function(file){return itemrepository.remove(localItem.ServerId,localItem.Id)})};return item.LocalPath?filerepository.deleteFile(item.LocalPath).then(onFileDeletedSuccessOrFail,onFileDeletedSuccessOrFail):onFileDeletedSuccessOrFail()})}function addOrUpdateLocalItem(localItem){return itemrepository.set(localItem.ServerId,localItem.Id,localItem)}function createLocalItem(libraryItem,serverInfo,jobItem){console.log("[localassetmanager] Begin createLocalItem");var localPath;if(jobItem){var path=getDirectoryPath(libraryItem);path.push(getLocalFileName(libraryItem,jobItem.OriginalFileName)),localPath=filerepository.getFullLocalPath(path,!0)}if(libraryItem.MediaSources)for(var i=0;i0&&(fileName=fileName.substring(0,pos)),fileName}function downloadFile(url,localItem){var imageUrl=getImageUrl(localItem.Item.ServerId,localItem.Item.Id,{type:"Primary",index:0});return transfermanager.downloadFile(url,localItem,imageUrl)}function downloadSubtitles(url,fileName){return transfermanager.downloadSubtitles(url,fileName)}function getImageUrl(serverId,itemId,imageOptions){var imageType=imageOptions.type,index=imageOptions.index,pathArray=getImagePath(serverId,itemId,imageType,index);return filerepository.getImageUrl(pathArray)}function hasImage(serverId,itemId,imageType,index){var pathArray=getImagePath(serverId,itemId,imageType,index),localFilePath=filerepository.getFullMetadataPath(pathArray);return filerepository.fileExists(localFilePath).then(function(exists){return Promise.resolve(exists)},function(err){return Promise.resolve(!1)})}function fileExists(localFilePath){return filerepository.fileExists(localFilePath)}function downloadImage(localItem,url,serverId,itemId,imageType,index){var pathArray=getImagePath(serverId,itemId,imageType,index),localFilePath=filerepository.getFullMetadataPath(pathArray);localItem.AdditionalFiles||(localItem.AdditionalFiles=[]);var fileInfo={Path:localFilePath,Type:"Image",Name:imageType+index.toString(),ImageType:imageType};return localItem.AdditionalFiles.push(fileInfo),transfermanager.downloadImage(url,localFilePath)}function isDownloadFileInQueue(path){return transfermanager.isDownloadFileInQueue(path)}function getDownloadItemCount(){return transfermanager.getDownloadItemCount()}function getDirectoryPath(item){var parts=[],itemtype=item.Type.toLowerCase(),mediaType=(item.MediaType||"").toLowerCase();"episode"===itemtype||"series"===itemtype||"season"===itemtype?parts.push("TV"):"video"===mediaType?parts.push("Videos"):"audio"===itemtype||"musicalbum"===itemtype||"musicartist"===itemtype?parts.push("Music"):"photo"===itemtype||"photoalbum"===itemtype?parts.push("Photos"):"game"!==itemtype&&"gamesystem"!==itemtype||parts.push("Games");var albumArtist=item.AlbumArtist;albumArtist&&parts.push(albumArtist);var seriesName=item.SeriesName;seriesName&&parts.push(seriesName);var seasonName=item.SeasonName;seasonName&&parts.push(seasonName),item.Album&&parts.push(item.Album),("video"===mediaType&&"episode"!==itemtype||"game"===itemtype||item.IsFolder)&&parts.push(item.Name);for(var finalParts=[],i=0;ifind.length&&0===str.indexOf(find))}function stripStart(str,find){return startsWith(str,find)?str.substr(find.length):str}function filterDistinct(value,index,self){return self.indexOf(value)===index}function compareDates(a,b){return isFinite(a=a.valueOf())&&isFinite(b=b.valueOf())?(a>b)-(a0?apiClient.reportSyncJobItemTransferred(item.SyncJobItemId).then(function(){return item.SyncStatus="synced",localassetmanager.addOrUpdateLocalItem(item)},function(error){return console.error("[mediasync] Mediasync error on reportSyncJobItemTransferred",error),item.SyncStatus="synced",localassetmanager.addOrUpdateLocalItem(item)}):localassetmanager.isDownloadFileInQueue(item.LocalPath).then(function(result){return result?Promise.resolve():(console.log("[mediasync] reportTransfer: Size is 0 and download no longer in queue. Deleting item."),localassetmanager.removeLocalItem(item).then(function(){return console.log("[mediasync] reportTransfer: Item deleted."),Promise.resolve()},function(err2){return console.log("[mediasync] reportTransfer: Failed to delete item.",err2),Promise.resolve()}))})},function(error){return console.error("[mediasync] reportTransfer: error on getItemFileSize. Deleting item.",error),localassetmanager.removeLocalItem(item).then(function(){return console.log("[mediasync] reportTransfer: Item deleted."),Promise.resolve()},function(err2){return console.log("[mediasync] reportTransfer: Failed to delete item.",error),Promise.resolve()})})}function reportOfflineActions(apiClient,serverInfo){return console.log("[mediasync] Begin reportOfflineActions"),localassetmanager.getUserActions(serverInfo.Id).then(function(actions){return actions.length?apiClient.reportOfflineActions(actions).then(function(){return localassetmanager.deleteUserActions(actions).then(function(){return console.log("[mediasync] Exit reportOfflineActions (actions reported and deleted.)"),Promise.resolve()})},function(err){return console.error("[mediasync] error on apiClient.reportOfflineActions: "+err.toString()),localassetmanager.deleteUserActions(actions)}):(console.log("[mediasync] Exit reportOfflineActions (no actions)"),Promise.resolve())})}function syncData(apiClient,serverInfo){return console.log("[mediasync] Begin syncData"),localassetmanager.getServerItems(serverInfo.Id).then(function(items){var completedItems=items.filter(function(item){return item&&"synced"===item.SyncStatus}),request={TargetId:apiClient.deviceId(),LocalItemIds:completedItems.map(function(xitem){return xitem.ItemId})};return apiClient.syncData(request).then(function(result){return afterSyncData(apiClient,serverInfo,result).then(function(){return console.log("[mediasync] Exit syncData"),Promise.resolve()},function(err){return console.error("[mediasync] Error in syncData: "+err.toString()),Promise.resolve()})})})}function afterSyncData(apiClient,serverInfo,syncDataResult){console.log("[mediasync] Begin afterSyncData");var p=Promise.resolve();return syncDataResult.ItemIdsToRemove&&syncDataResult.ItemIdsToRemove.length>0&&syncDataResult.ItemIdsToRemove.forEach(function(itemId){p=p.then(function(){return removeLocalItem(itemId,serverInfo.Id)})}),p=p.then(function(){return removeObsoleteContainerItems(serverInfo.Id)}),p.then(function(){return console.log("[mediasync] Exit afterSyncData"),Promise.resolve()})}function removeObsoleteContainerItems(serverId){return console.log("[mediasync] Begin removeObsoleteContainerItems"),localassetmanager.removeObsoleteContainerItems(serverId)}function removeLocalItem(itemId,serverId){return console.log("[mediasync] Begin removeLocalItem"),localassetmanager.getLocalItem(serverId,itemId).then(function(item){return item?localassetmanager.removeLocalItem(item):Promise.resolve()})}function getNewMedia(apiClient,serverInfo,downloadCount){return console.log("[mediasync] Begin getNewMedia"),apiClient.getReadySyncItems(apiClient.deviceId()).then(function(jobItems){var p=Promise.resolve(),currentCount=downloadCount;return jobItems.forEach(function(jobItem){currentCount++<=10&&(p=p.then(function(){return getNewItem(jobItem,apiClient,serverInfo)}))}),p.then(function(){return console.log("[mediasync] Exit getNewMedia"),Promise.resolve()})})}function getNewItem(jobItem,apiClient,serverInfo){console.log("[mediasync] Begin getNewItem");var libraryItem=jobItem.Item;return localassetmanager.getLocalItem(serverInfo.Id,libraryItem.Id).then(function(existingItem){return existingItem&&("queued"===existingItem.SyncStatus||"transferring"===existingItem.SyncStatus||"synced"===existingItem.SyncStatus)&&(console.log("[mediasync] getNewItem: getLocalItem found existing item"),localassetmanager.enableBackgroundCompletion())?Promise.resolve():downloadParentItems(apiClient,jobItem,libraryItem,serverInfo).then(function(){return libraryItem.CanDelete=!1,libraryItem.CanDownload=!1,libraryItem.SupportsSync=!1,libraryItem.People=[],libraryItem.Chapters=[],libraryItem.Studios=[],libraryItem.SpecialFeatureCount=null,libraryItem.LocalTrailerCount=null,libraryItem.RemoteTrailers=[],localassetmanager.createLocalItem(libraryItem,serverInfo,jobItem).then(function(localItem){return localItem.SyncStatus="queued",downloadMedia(apiClient,jobItem,localItem).then(function(){return getImages(apiClient,jobItem,localItem).then(function(){return getSubtitles(apiClient,jobItem,localItem)})})})})})}function downloadParentItems(apiClient,jobItem,libraryItem,serverInfo){var p=Promise.resolve();return libraryItem.SeriesId&&(p=p.then(function(){return downloadItem(apiClient,libraryItem.SeriesId,serverInfo)})),libraryItem.SeasonId&&(p=p.then(function(){return downloadItem(apiClient,libraryItem.SeasonId,serverInfo).then(function(seasonItem){return libraryItem.SeasonPrimaryImageTag=(seasonItem.Item.ImageTags||{}).Primary,Promise.resolve()})})),libraryItem.AlbumId&&(p=p.then(function(){return downloadItem(apiClient,libraryItem.AlbumId,serverInfo)})),p}function downloadItem(apiClient,itemId,serverInfo){return apiClient.getItem(apiClient.getCurrentUserId(),itemId).then(function(downloadedItem){return downloadedItem.CanDelete=!1,downloadedItem.CanDownload=!1,downloadedItem.SupportsSync=!1,downloadedItem.People=[],downloadedItem.SpecialFeatureCount=null,downloadedItem.BackdropImageTags=null,downloadedItem.ParentBackdropImageTags=null,downloadedItem.ParentArtImageTag=null,downloadedItem.ParentLogoImageTag=null,localassetmanager.createLocalItem(downloadedItem,serverInfo,null).then(function(){return localassetmanager.addOrUpdateLocalItem(localItem).then(function(){return Promise.resolve(localItem)})})})}function downloadMedia(apiClient,jobItem,localItem){var url=apiClient.getUrl("Sync/JobItems/"+jobItem.SyncJobItemId+"/File",{api_key:apiClient.accessToken()});return localassetmanager.downloadFile(url,localItem).then(function(result){return result.isComplete?(localItem.SyncStatus="synced",reportTransfer(apiClient,localItem)):(localItem.SyncStatus="transferring",localassetmanager.addOrUpdateLocalItem(localItem))})}function getImages(apiClient,jobItem,localItem){console.log("[mediasync] Begin getImages");var p=Promise.resolve(),libraryItem=localItem.Item,serverId=libraryItem.ServerId,mainImageTag=(libraryItem.ImageTags||{}).Primary;libraryItem.Id&&mainImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,mainImageTag,"Primary")}));var logoImageTag=(libraryItem.ImageTags||{}).Logo;libraryItem.Id&&logoImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,logoImageTag,"Logo")}));var artImageTag=(libraryItem.ImageTags||{}).Art;libraryItem.Id&&artImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,artImageTag,"Art")}));var bannerImageTag=(libraryItem.ImageTags||{}).Banner;libraryItem.Id&&bannerImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,bannerImageTag,"Banner")}));var thumbImageTag=(libraryItem.ImageTags||{}).Thumb;if(libraryItem.Id&&thumbImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,thumbImageTag,"Thumb")})),libraryItem.Id&&libraryItem.BackdropImageTags)for(var i=0;i2?Promise.resolve():reportOfflineActions(apiClient,serverInfo).then(function(){return getNewMedia(apiClient,serverInfo,downloadCount).then(function(){return syncData(apiClient,serverInfo)})})})})})},function(err){console.error(err.toString())})}}}); \ No newline at end of file +define(["localassetmanager"],function(localassetmanager){"use strict";function processDownloadStatus(apiClient,serverInfo,options){return console.log("[mediasync] Begin processDownloadStatus"),localassetmanager.resyncTransfers().then(function(){return localassetmanager.getServerItems(serverInfo.Id).then(function(items){console.log("[mediasync] Begin processDownloadStatus getServerItems completed");var p=Promise.resolve(),cnt=0;return items.filter(function(item){return"transferring"===item.SyncStatus||"queued"===item.SyncStatus}).forEach(function(item){p=p.then(function(){return reportTransfer(apiClient,item)}),cnt++}),p.then(function(){return console.log("[mediasync] Exit processDownloadStatus. Items reported: "+cnt.toString()),Promise.resolve()})})})}function reportTransfer(apiClient,item){return localassetmanager.getItemFileSize(item.LocalPath).then(function(size){return size>0?apiClient.reportSyncJobItemTransferred(item.SyncJobItemId).then(function(){return item.SyncStatus="synced",localassetmanager.addOrUpdateLocalItem(item)},function(error){return console.error("[mediasync] Mediasync error on reportSyncJobItemTransferred",error),item.SyncStatus="synced",localassetmanager.addOrUpdateLocalItem(item)}):localassetmanager.isDownloadFileInQueue(item.LocalPath).then(function(result){return result?Promise.resolve():(console.log("[mediasync] reportTransfer: Size is 0 and download no longer in queue. Deleting item."),localassetmanager.removeLocalItem(item).then(function(){return console.log("[mediasync] reportTransfer: Item deleted."),Promise.resolve()},function(err2){return console.log("[mediasync] reportTransfer: Failed to delete item.",err2),Promise.resolve()}))})},function(error){return console.error("[mediasync] reportTransfer: error on getItemFileSize. Deleting item.",error),localassetmanager.removeLocalItem(item).then(function(){return console.log("[mediasync] reportTransfer: Item deleted."),Promise.resolve()},function(err2){return console.log("[mediasync] reportTransfer: Failed to delete item.",error),Promise.resolve()})})}function reportOfflineActions(apiClient,serverInfo){return console.log("[mediasync] Begin reportOfflineActions"),localassetmanager.getUserActions(serverInfo.Id).then(function(actions){return actions.length?apiClient.reportOfflineActions(actions).then(function(){return localassetmanager.deleteUserActions(actions).then(function(){return console.log("[mediasync] Exit reportOfflineActions (actions reported and deleted.)"),Promise.resolve()})},function(err){return console.error("[mediasync] error on apiClient.reportOfflineActions: "+err.toString()),localassetmanager.deleteUserActions(actions)}):(console.log("[mediasync] Exit reportOfflineActions (no actions)"),Promise.resolve())})}function syncData(apiClient,serverInfo){return console.log("[mediasync] Begin syncData"),localassetmanager.getServerItems(serverInfo.Id).then(function(items){var completedItems=items.filter(function(item){return item&&"synced"===item.SyncStatus}),request={TargetId:apiClient.deviceId(),LocalItemIds:completedItems.map(function(xitem){return xitem.ItemId})};return apiClient.syncData(request).then(function(result){return afterSyncData(apiClient,serverInfo,result).then(function(){return console.log("[mediasync] Exit syncData"),Promise.resolve()},function(err){return console.error("[mediasync] Error in syncData: "+err.toString()),Promise.resolve()})})})}function afterSyncData(apiClient,serverInfo,syncDataResult){console.log("[mediasync] Begin afterSyncData");var p=Promise.resolve();return syncDataResult.ItemIdsToRemove&&syncDataResult.ItemIdsToRemove.length>0&&syncDataResult.ItemIdsToRemove.forEach(function(itemId){p=p.then(function(){return removeLocalItem(itemId,serverInfo.Id)})}),p=p.then(function(){return removeObsoleteContainerItems(serverInfo.Id)}),p.then(function(){return console.log("[mediasync] Exit afterSyncData"),Promise.resolve()})}function removeObsoleteContainerItems(serverId){return console.log("[mediasync] Begin removeObsoleteContainerItems"),localassetmanager.removeObsoleteContainerItems(serverId)}function removeLocalItem(itemId,serverId){return console.log("[mediasync] Begin removeLocalItem"),localassetmanager.getLocalItem(serverId,itemId).then(function(item){return item?localassetmanager.removeLocalItem(item):Promise.resolve()})}function getNewMedia(apiClient,serverInfo,downloadCount){return console.log("[mediasync] Begin getNewMedia"),apiClient.getReadySyncItems(apiClient.deviceId()).then(function(jobItems){var p=Promise.resolve(),currentCount=downloadCount;return jobItems.forEach(function(jobItem){currentCount++<=10&&(p=p.then(function(){return getNewItem(jobItem,apiClient,serverInfo)}))}),p.then(function(){return console.log("[mediasync] Exit getNewMedia"),Promise.resolve()})})}function getNewItem(jobItem,apiClient,serverInfo){console.log("[mediasync] Begin getNewItem");var libraryItem=jobItem.Item;return localassetmanager.getLocalItem(serverInfo.Id,libraryItem.Id).then(function(existingItem){return existingItem&&("queued"===existingItem.SyncStatus||"transferring"===existingItem.SyncStatus||"synced"===existingItem.SyncStatus)&&(console.log("[mediasync] getNewItem: getLocalItem found existing item"),localassetmanager.enableBackgroundCompletion())?Promise.resolve():downloadParentItems(apiClient,jobItem,libraryItem,serverInfo).then(function(){return libraryItem.CanDelete=!1,libraryItem.CanDownload=!1,libraryItem.SupportsSync=!1,libraryItem.People=[],libraryItem.Chapters=[],libraryItem.Studios=[],libraryItem.SpecialFeatureCount=null,libraryItem.LocalTrailerCount=null,libraryItem.RemoteTrailers=[],localassetmanager.createLocalItem(libraryItem,serverInfo,jobItem).then(function(localItem){return localItem.SyncStatus="queued",downloadMedia(apiClient,jobItem,localItem).then(function(){return getImages(apiClient,jobItem,localItem).then(function(){return getSubtitles(apiClient,jobItem,localItem)})})})})})}function downloadParentItems(apiClient,jobItem,libraryItem,serverInfo){var p=Promise.resolve();return libraryItem.SeriesId&&(p=p.then(function(){return downloadItem(apiClient,libraryItem.SeriesId,serverInfo)})),libraryItem.SeasonId&&(p=p.then(function(){return downloadItem(apiClient,libraryItem.SeasonId,serverInfo).then(function(seasonItem){return libraryItem.SeasonPrimaryImageTag=(seasonItem.Item.ImageTags||{}).Primary,Promise.resolve()})})),libraryItem.AlbumId&&(p=p.then(function(){return downloadItem(apiClient,libraryItem.AlbumId,serverInfo)})),p}function downloadItem(apiClient,itemId,serverInfo){return apiClient.getItem(apiClient.getCurrentUserId(),itemId).then(function(downloadedItem){return downloadedItem.CanDelete=!1,downloadedItem.CanDownload=!1,downloadedItem.SupportsSync=!1,downloadedItem.People=[],downloadedItem.SpecialFeatureCount=null,downloadedItem.BackdropImageTags=null,downloadedItem.ParentBackdropImageTags=null,downloadedItem.ParentArtImageTag=null,downloadedItem.ParentLogoImageTag=null,localassetmanager.createLocalItem(downloadedItem,serverInfo,null).then(function(localItem){return localassetmanager.addOrUpdateLocalItem(localItem).then(function(){return Promise.resolve(localItem)})})})}function downloadMedia(apiClient,jobItem,localItem){var url=apiClient.getUrl("Sync/JobItems/"+jobItem.SyncJobItemId+"/File",{api_key:apiClient.accessToken()});return localassetmanager.downloadFile(url,localItem).then(function(result){return result.isComplete?(localItem.SyncStatus="synced",reportTransfer(apiClient,localItem)):(localItem.SyncStatus="transferring",localassetmanager.addOrUpdateLocalItem(localItem))})}function getImages(apiClient,jobItem,localItem){console.log("[mediasync] Begin getImages");var p=Promise.resolve(),libraryItem=localItem.Item,serverId=libraryItem.ServerId,mainImageTag=(libraryItem.ImageTags||{}).Primary;libraryItem.Id&&mainImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,mainImageTag,"Primary")}));var logoImageTag=(libraryItem.ImageTags||{}).Logo;libraryItem.Id&&logoImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,logoImageTag,"Logo")}));var artImageTag=(libraryItem.ImageTags||{}).Art;libraryItem.Id&&artImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,artImageTag,"Art")}));var bannerImageTag=(libraryItem.ImageTags||{}).Banner;libraryItem.Id&&bannerImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,bannerImageTag,"Banner")}));var thumbImageTag=(libraryItem.ImageTags||{}).Thumb;if(libraryItem.Id&&thumbImageTag&&(p=p.then(function(){return downloadImage(localItem,apiClient,serverId,libraryItem.Id,thumbImageTag,"Thumb")})),libraryItem.Id&&libraryItem.BackdropImageTags)for(var i=0;i2?Promise.resolve():reportOfflineActions(apiClient,serverInfo).then(function(){return getNewMedia(apiClient,serverInfo,downloadCount).then(function(){return syncData(apiClient,serverInfo)})})})})})},function(err){console.error(err.toString())})}}}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css index bcce0cb081..bc88696dda 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css +++ b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css @@ -1 +1 @@ -.emby-button,.fab{-webkit-box-sizing:border-box;-webkit-box-align:center}.button-flat,.button-link{background:0 0}.emby-button,.paper-icon-button-light{text-align:center;font-family:inherit;color:inherit;outline:0!important;-webkit-tap-highlight-color:transparent;position:relative}.emby-button{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;box-sizing:border-box;margin:0 .29em;font-size:inherit;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;cursor:pointer;z-index:0;padding:.75em 1em;border:0;vertical-align:middle;-webkit-border-radius:.2em;border-radius:.2em;font-weight:500;text-decoration:none}.emby-button-withripple{overflow:hidden}.emby-button::-moz-focus-inner{border:0}.button-flat:hover{opacity:.5}.button-link{margin:0;padding:0;vertical-align:initial}.button-link-inline{display:inline}.button-link:hover{text-decoration:underline}.emby-button-focusscale{-webkit-transition:-webkit-transform 180ms ease-out!important;-o-transition:transform 180ms ease-out!important;transition:transform 180ms ease-out!important;-webkit-transform-origin:center center;transform-origin:center center}.emby-button-focusscale:focus{-webkit-transform:scale(1.16);transform:scale(1.16);z-index:1}.emby-button>i{font-size:1.36em;width:1em;height:1em}.button-link>i{font-size:1em}.fab{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-border-radius:50%;border-radius:50%;padding:.5em;box-sizing:border-box;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;text-align:center}.emby-button.block{display:block;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;margin:.25em 0;width:100%}.fab,.raised{-webkit-transition:-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);-o-transition:box-shadow .28s cubic-bezier(.4,0,.2,1);transition:box-shadow .28s cubic-bezier(.4,0,.2,1)}.fab:focus,.raised:focus{-webkit-box-shadow:0 .58em .725em .0725em rgba(0,0,0,.14),0 .2175em 1.015em .145em rgba(0,0,0,.12),0 .3625em .3625em -.2175em rgba(0,0,0,.4);box-shadow:0 .58em .725em .0725em rgba(0,0,0,.14),0 .2175em 1.015em .145em rgba(0,0,0,.12),0 .3625em .3625em -.2175em rgba(0,0,0,.4)}.emby-button>i+span{margin-left:.5em;vertical-align:middle}.paper-icon-button-light{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 .29em;background:0 0;font-size:inherit;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;cursor:pointer;z-index:0;min-width:initial;min-height:initial;width:auto;height:auto;padding:8px;border:0;vertical-align:middle;overflow:hidden;-webkit-border-radius:50%;border-radius:50%;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.paper-icon-button-light::-moz-focus-inner{border:0}.paper-icon-button-light[disabled]{opacity:.3}.paper-icon-button-light>i{width:1em;height:1em;font-size:1.66956521739130434em;position:relative;z-index:1;vertical-align:middle}.paper-icon-button-light>img{width:1.72em;max-height:100%;position:relative;z-index:1;vertical-align:middle}.paper-icon-button-light:after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;-webkit-transition:opacity .3s ease-out;-o-transition:opacity .3s ease-out;transition:opacity .3s ease-out;background:currentcolor;opacity:0}.paper-icon-button-light:focus:after{opacity:.2}.emby-button-ripple-effect{position:absolute;-webkit-border-radius:50%;border-radius:50%;width:50px;height:50px;top:50%;left:50%;background:currentcolor;-webkit-animation:ripple-animation .8s;animation:ripple-animation .8s;opacity:.25;-webkit-transform-origin:center center;transform-origin:center center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@-webkit-keyframes ripple-animation{from{-webkit-transform:none;transform:none;opacity:.5}to{-webkit-transform:scale(20);transform:scale(20);opacity:0}}@keyframes ripple-animation{from{-webkit-transform:none;transform:none;opacity:.5}to{-webkit-transform:scale(20);transform:scale(20);opacity:0}}.emby-button-foreground{position:relative;z-index:1}.icon-button-focusscale{-webkit-transition:-webkit-transform 180ms ease-out!important;-o-transition:transform 180ms ease-out!important;transition:transform 180ms ease-out!important;-webkit-transform-origin:center center;transform-origin:center center}.icon-button-focusscale:focus{-webkit-transform:scale(1.3);transform:scale(1.3);z-index:1}.btnFilterWithBubble{position:relative}.filterButtonBubble{color:#fff;position:absolute;top:0;right:0;width:1.6em;height:1.6em;z-index:100000000;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;font-size:82%;-webkit-border-radius:100em;border-radius:100em;-webkit-box-shadow:0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12),0 2px 4px -1px rgba(0,0,0,.2);box-shadow:0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12),0 2px 4px -1px rgba(0,0,0,.2);background:#03A9F4;font-weight:700} \ No newline at end of file +.emby-button,.fab{-webkit-box-sizing:border-box;-webkit-box-align:center}.button-flat,.button-link{background:0 0}.emby-button,.paper-icon-button-light{text-align:center;font-family:inherit;color:inherit;outline:0!important;-webkit-tap-highlight-color:transparent;position:relative}.emby-button{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;box-sizing:border-box;margin:0 .29em;font-size:inherit;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;cursor:pointer;z-index:0;padding:.75em 1em;border:0;vertical-align:middle;-webkit-border-radius:.2em;border-radius:.2em;font-weight:500;text-decoration:none}.emby-button-withripple{overflow:hidden}.emby-button::-moz-focus-inner{border:0}.button-flat:hover{opacity:.5}.button-link{margin:0;padding:0;vertical-align:initial}.button-link-inline{display:inline}.button-link:hover{text-decoration:underline}.emby-button-focusscale{-webkit-transition:-webkit-transform 180ms ease-out!important;-o-transition:transform 180ms ease-out!important;transition:transform 180ms ease-out!important;-webkit-transform-origin:center center;transform-origin:center center}.emby-button-focusscale:focus{-webkit-transform:scale(1.16);transform:scale(1.16);z-index:1}.emby-button>i{font-size:1.36em;width:1em;height:1em}.button-link>i{font-size:1em}.fab{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-border-radius:50%;border-radius:50%;padding:.5em;box-sizing:border-box;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;text-align:center}.emby-button.block{display:block;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;margin:.25em 0;width:100%}.fab,.raised{-webkit-transition:-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);-o-transition:box-shadow .28s cubic-bezier(.4,0,.2,1);transition:box-shadow .28s cubic-bezier(.4,0,.2,1)}.fab:focus,.raised:focus{-webkit-box-shadow:0 .58em .725em .0725em rgba(0,0,0,.14),0 .2175em 1.015em .145em rgba(0,0,0,.12),0 .3625em .3625em -.2175em rgba(0,0,0,.4);box-shadow:0 .58em .725em .0725em rgba(0,0,0,.14),0 .2175em 1.015em .145em rgba(0,0,0,.12),0 .3625em .3625em -.2175em rgba(0,0,0,.4)}.emby-button>i+span{margin-left:.5em;vertical-align:middle}.paper-icon-button-light{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 .29em;background:0 0;font-size:inherit;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;cursor:pointer;z-index:0;min-width:initial;min-height:initial;width:auto;height:auto;padding:.556em;border:0;vertical-align:middle;overflow:hidden;-webkit-border-radius:50%;border-radius:50%;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.paper-icon-button-light::-moz-focus-inner{border:0}.paper-icon-button-light[disabled]{opacity:.3}.paper-icon-button-light>i{width:1em;height:1em;font-size:1.66956521739130434em;position:relative;z-index:1;vertical-align:middle}.paper-icon-button-light>img{width:1.72em;max-height:100%;position:relative;z-index:1;vertical-align:middle}.paper-icon-button-light:after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;-webkit-transition:opacity .3s ease-out;-o-transition:opacity .3s ease-out;transition:opacity .3s ease-out;background:currentcolor;opacity:0}.paper-icon-button-light:focus:after{opacity:.2}.emby-button-ripple-effect{position:absolute;-webkit-border-radius:50%;border-radius:50%;width:50px;height:50px;top:50%;left:50%;background:currentcolor;-webkit-animation:ripple-animation .8s;animation:ripple-animation .8s;opacity:.25;-webkit-transform-origin:center center;transform-origin:center center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@-webkit-keyframes ripple-animation{from{-webkit-transform:none;transform:none;opacity:.5}to{-webkit-transform:scale(20);transform:scale(20);opacity:0}}@keyframes ripple-animation{from{-webkit-transform:none;transform:none;opacity:.5}to{-webkit-transform:scale(20);transform:scale(20);opacity:0}}.emby-button-foreground{position:relative;z-index:1}.icon-button-focusscale{-webkit-transition:-webkit-transform 180ms ease-out!important;-o-transition:transform 180ms ease-out!important;transition:transform 180ms ease-out!important;-webkit-transform-origin:center center;transform-origin:center center}.icon-button-focusscale:focus{-webkit-transform:scale(1.3);transform:scale(1.3);z-index:1}.btnFilterWithBubble{position:relative}.filterButtonBubble{color:#fff;position:absolute;top:0;right:0;width:1.6em;height:1.6em;z-index:100000000;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;font-size:82%;-webkit-border-radius:100em;border-radius:100em;-webkit-box-shadow:0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12),0 2px 4px -1px rgba(0,0,0,.2);box-shadow:0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12),0 2px 4px -1px rgba(0,0,0,.2);background:#03A9F4;font-weight:700} \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/fonts/fonts.css b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/fonts/fonts.css index e099b369dc..cf0ad07b8e 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/fonts/fonts.css +++ b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/fonts/fonts.css @@ -1 +1 @@ -h1,h2,h3{font-weight:500}html{font-family:-apple-system,Helvetica,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",'Open Sans',sans-serif;font-size:90%}h1{font-size:1.8em}.layout-desktop h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.17em}.layout-tv{font-size:2.5vh} \ No newline at end of file +h1,h2,h3{font-weight:500}html{font-family:-apple-system,Helvetica,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",'Open Sans',sans-serif;font-size:90%}h1,h2,h3{font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",'Open Sans',sans-serif}h1{font-size:1.8em}.layout-desktop h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.17em}.layout-tv{font-size:2.5vh} \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/playback/playbackmanager.js b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/playback/playbackmanager.js index f6aa5a62d5..b168a67e89 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/playback/playbackmanager.js +++ b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/playback/playbackmanager.js @@ -1,3 +1,3 @@ -define(["events","datetime","appSettings","itemHelper","pluginManager","playQueueManager","userSettings","globalize","connectionManager","loading","apphost","fullscreenManager"],function(events,datetime,appSettings,itemHelper,pluginManager,PlayQueueManager,userSettings,globalize,connectionManager,loading,apphost,fullscreenManager){"use strict";function enableLocalPlaylistManagement(player){return!player.getPlaylist&&!!player.isLocalPlayer}function bindToFullscreenChange(player){events.on(fullscreenManager,"fullscreenchange",function(){events.trigger(player,"fullscreenchange")})}function triggerPlayerChange(playbackManagerInstance,newPlayer,newTarget,previousPlayer,previousTargetInfo){(newPlayer||previousPlayer)&&(newTarget&&previousTargetInfo&&newTarget.id===previousTargetInfo.id||events.trigger(playbackManagerInstance,"playerchange",[newPlayer,newTarget,previousPlayer]))}function reportPlayback(state,serverId,method,progressEventName){if(serverId){var info=Object.assign({},state.PlayState);info.ItemId=state.NowPlayingItem.Id,progressEventName&&(info.EventName=progressEventName);connectionManager.getApiClient(serverId)[method](info)}}function normalizeName(t){return t.toLowerCase().replace(" ","")}function getItemsForPlayback(serverId,query){var apiClient=connectionManager.getApiClient(serverId);if(query.Ids&&1===query.Ids.split(",").length){var itemId=query.Ids.split(",");return apiClient.getItem(apiClient.getCurrentUserId(),itemId).then(function(item){return{Items:[item],TotalRecordCount:1}})}return query.Limit=query.Limit||200,query.Fields="Chapters",query.ExcludeLocationTypes="Virtual",query.EnableTotalRecordCount=!1,query.CollapseBoxSetItems=!1,apiClient.getItems(apiClient.getCurrentUserId(),query)}function createStreamInfoFromUrlItem(item){return{url:item.Url||item.Path,playMethod:"DirectPlay",item:item,textTracks:[],mediaType:item.MediaType}}function mergePlaybackQueries(obj1,obj2){var query=Object.assign(obj1,obj2),filters=query.Filters?query.Filters.split(","):[];return-1===filters.indexOf("IsNotFolder")&&filters.push("IsNotFolder"),query.Filters=filters.join(","),query}function backdropImageUrl(apiClient,item,options){return options=options||{},options.type=options.type||"Backdrop",options.maxWidth||options.width||options.maxHeight||options.height||(options.quality=100),item.BackdropImageTags&&item.BackdropImageTags.length?(options.tag=item.BackdropImageTags[0],apiClient.getScaledImageUrl(item.Id,options)):item.ParentBackdropImageTags&&item.ParentBackdropImageTags.length?(options.tag=item.ParentBackdropImageTags[0],apiClient.getScaledImageUrl(item.ParentBackdropItemId,options)):null}function getMimeType(type,container){if(container=(container||"").toLowerCase(),"audio"===type){if("opus"===container)return"audio/ogg";if("webma"===container)return"audio/webm";if("m4a"===container)return"audio/mp4"}else if("video"===type){if("mkv"===container)return"video/x-matroska";if("m4v"===container)return"video/mp4";if("mov"===container)return"video/quicktime";if("mpg"===container)return"video/mpeg";if("flv"===container)return"video/x-flv"}return type+"/"+container}function getParam(name,url){name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+name+"=([^&#]*)",regex=new RegExp(regexS,"i"),results=regex.exec(url);return null==results?"":decodeURIComponent(results[1].replace(/\+/g," "))}function isAutomaticPlayer(player){return!!player.isLocalPlayer}function getAutomaticPlayers(instance){var player=instance._currentPlayer;return player&&!isAutomaticPlayer(player)?[player]:instance.getPlayers().filter(isAutomaticPlayer)}function isServerItem(item){return!!item.Id}function enableIntros(item){return"Video"===item.MediaType&&("TvChannel"!==item.Type&&("InProgress"!==item.Status&&isServerItem(item)))}function getIntros(firstItem,apiClient,options){return options.startPositionTicks||options.startIndex||!1===options.fullscreen||!enableIntros(firstItem)||!userSettings.enableCinemaMode()?Promise.resolve({Items:[]}):apiClient.getIntros(firstItem.Id)}function getAudioMaxValues(deviceProfile){var maxAudioSampleRate=null,maxAudioBitDepth=null;return deviceProfile.CodecProfiles.map(function(codecProfile){"Audio"===codecProfile.Type&&(codecProfile.Conditions||[]).map(function(condition){"LessThanEqual"===condition.Condition&&"AudioBitDepth"===condition.Property&&(maxAudioBitDepth=condition.Value),"LessThanEqual"===condition.Condition&&"AudioSampleRate"===condition.Property&&(maxAudioSampleRate=condition.Value)})}),{maxAudioSampleRate:maxAudioSampleRate,maxAudioBitDepth:maxAudioBitDepth}}function getAudioStreamUrl(item,transcodingProfile,directPlayContainers,maxBitrate,apiClient,maxAudioSampleRate,maxAudioBitDepth,startPosition){var url="Audio/"+item.Id+"/universal";return startingPlaySession++,apiClient.getUrl(url,{UserId:apiClient.getCurrentUserId(),DeviceId:apiClient.deviceId(),MaxStreamingBitrate:maxBitrate,Container:directPlayContainers,TranscodingContainer:transcodingProfile.Container||null,TranscodingProtocol:transcodingProfile.Protocol||null,AudioCodec:transcodingProfile.AudioCodec,MaxAudioSampleRate:maxAudioSampleRate,MaxAudioBitDepth:maxAudioBitDepth,api_key:apiClient.accessToken(),PlaySessionId:startingPlaySession,StartTimeTicks:startPosition||0,EnableRedirection:!0,EnableRemoteMedia:apphost.supports("remoteaudio")})}function getAudioStreamUrlFromDeviceProfile(item,deviceProfile,maxBitrate,apiClient,startPosition){var transcodingProfile=deviceProfile.TranscodingProfiles.filter(function(p){return"Audio"===p.Type&&"Streaming"===p.Context})[0],directPlayContainers="";deviceProfile.DirectPlayProfiles.map(function(p){"Audio"===p.Type&&(directPlayContainers?directPlayContainers+=","+p.Container:directPlayContainers=p.Container,p.AudioCodec&&(directPlayContainers+="|"+p.AudioCodec))});var maxValues=getAudioMaxValues(deviceProfile);return getAudioStreamUrl(item,transcodingProfile,directPlayContainers,maxBitrate,apiClient,maxValues.maxAudioSampleRate,maxValues.maxAudioBitDepth,startPosition)}function getStreamUrls(items,deviceProfile,maxBitrate,apiClient,startPosition){var audioTranscodingProfile=deviceProfile.TranscodingProfiles.filter(function(p){return"Audio"===p.Type&&"Streaming"===p.Context})[0],audioDirectPlayContainers="";deviceProfile.DirectPlayProfiles.map(function(p){"Audio"===p.Type&&(audioDirectPlayContainers?audioDirectPlayContainers+=","+p.Container:audioDirectPlayContainers=p.Container,p.AudioCodec&&(audioDirectPlayContainers+="|"+p.AudioCodec))});for(var maxValues=getAudioMaxValues(deviceProfile),streamUrls=[],i=0,length=items.length;i=interceptors.length)return void resolve();interceptors[index].intercept(options).then(function(){runNextPrePlay(interceptors,index+1,options,resolve,reject)},reject)}function sendPlaybackListToPlayer(player,items,deviceProfile,maxBitrate,apiClient,startPositionTicks,mediaSourceId,audioStreamIndex,subtitleStreamIndex,startIndex){return setStreamUrls(items,deviceProfile,maxBitrate,apiClient,startPositionTicks).then(function(){return loading.hide(),player.play({items:items,startPositionTicks:startPositionTicks||0,mediaSourceId:mediaSourceId,audioStreamIndex:audioStreamIndex,subtitleStreamIndex:subtitleStreamIndex,startIndex:startIndex})})}function playAfterBitrateDetect(maxBitrate,item,playOptions,onPlaybackStartedFn){var promise,startPosition=playOptions.startPositionTicks,player=getPlayer(item,playOptions),activePlayer=self._currentPlayer;return activePlayer?(self._playNextAfterEnded=!1,promise=onPlaybackChanging(activePlayer,player,item)):promise=Promise.resolve(),isServerItem(item)&&"Game"!==item.MediaType?Promise.all([promise,player.getDeviceProfile(item)]).then(function(responses){var deviceProfile=responses[1],apiClient=connectionManager.getApiClient(item.ServerId),mediaSourceId=playOptions.mediaSourceId,audioStreamIndex=playOptions.audioStreamIndex,subtitleStreamIndex=playOptions.subtitleStreamIndex;return player&&!enableLocalPlaylistManagement(player)?sendPlaybackListToPlayer(player,playOptions.items,deviceProfile,maxBitrate,apiClient,startPosition,mediaSourceId,audioStreamIndex,subtitleStreamIndex,playOptions.startIndex):(playOptions.items=null,getPlaybackMediaSource(player,apiClient,deviceProfile,maxBitrate,item,startPosition,mediaSourceId,audioStreamIndex,subtitleStreamIndex).then(function(mediaSource){var streamInfo=createStreamInfo(apiClient,item.MediaType,item,mediaSource,startPosition);return streamInfo.fullscreen=playOptions.fullscreen,getPlayerData(player).isChangingStream=!1,getPlayerData(player).maxStreamingBitrate=maxBitrate,player.play(streamInfo).then(function(){loading.hide(),onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo,mediaSource)},function(err){onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo,mediaSource),setTimeout(function(){onPlaybackError.call(player,err,{type:"mediadecodeerror",streamInfo:streamInfo})},100)})}))}):promise.then(function(){var streamInfo=createStreamInfoFromUrlItem(item);return streamInfo.fullscreen=playOptions.fullscreen,getPlayerData(player).isChangingStream=!1,player.play(streamInfo).then(function(){loading.hide(),onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo)},function(){self.stop(player)})})}function createStreamInfo(apiClient,type,item,mediaSource,startPosition,forceTranscoding){var mediaUrl,contentType,directOptions,transcodingOffsetTicks=0,playerStartPositionTicks=startPosition,liveStreamId=mediaSource.LiveStreamId,playMethod="Transcode",mediaSourceContainer=(mediaSource.Container||"").toLowerCase();"Video"===type?(contentType=getMimeType("video",mediaSourceContainer),mediaSource.enableDirectPlay&&!forceTranscoding?(mediaUrl=mediaSource.Path,playMethod="DirectPlay"):mediaSource.SupportsDirectStream&&!forceTranscoding?(directOptions={Static:!0,mediaSourceId:mediaSource.Id,deviceId:apiClient.deviceId(),api_key:apiClient.accessToken()},mediaSource.ETag&&(directOptions.Tag=mediaSource.ETag),mediaSource.LiveStreamId&&(directOptions.LiveStreamId=mediaSource.LiveStreamId),mediaUrl=apiClient.getUrl("Videos/"+item.Id+"/stream."+mediaSourceContainer,directOptions),playMethod="DirectStream"):mediaSource.SupportsTranscoding&&(mediaUrl=apiClient.getUrl(mediaSource.TranscodingUrl),"hls"===mediaSource.TranscodingSubProtocol?contentType="application/x-mpegURL":(playerStartPositionTicks=null,contentType=getMimeType("video",mediaSource.TranscodingContainer),-1===mediaUrl.toLowerCase().indexOf("copytimestamps=true")&&(transcodingOffsetTicks=startPosition||0)))):"Audio"===type?(contentType=getMimeType("audio",mediaSourceContainer),mediaSource.enableDirectPlay&&!forceTranscoding?(mediaUrl=mediaSource.Path,playMethod="DirectPlay"):mediaSource.StreamUrl?(playMethod="Transcode",mediaUrl=mediaSource.StreamUrl):mediaSource.SupportsDirectStream&&!forceTranscoding?(directOptions={Static:!0,mediaSourceId:mediaSource.Id,deviceId:apiClient.deviceId(),api_key:apiClient.accessToken()},mediaSource.ETag&&(directOptions.Tag=mediaSource.ETag),mediaSource.LiveStreamId&&(directOptions.LiveStreamId=mediaSource.LiveStreamId),mediaUrl=apiClient.getUrl("Audio/"+item.Id+"/stream."+mediaSourceContainer,directOptions),playMethod="DirectStream"):mediaSource.SupportsTranscoding&&(mediaUrl=apiClient.getUrl(mediaSource.TranscodingUrl),"hls"===mediaSource.TranscodingSubProtocol?contentType="application/x-mpegURL":(transcodingOffsetTicks=startPosition||0,playerStartPositionTicks=null,contentType=getMimeType("audio",mediaSource.TranscodingContainer)))):"Game"===type&&(mediaUrl=mediaSource.Path,playMethod="DirectPlay"),!mediaUrl&&mediaSource.SupportsDirectPlay&&(mediaUrl=mediaSource.Path,playMethod="DirectPlay");var resultInfo={url:mediaUrl,mimeType:contentType,transcodingOffsetTicks:transcodingOffsetTicks,playMethod:playMethod,playerStartPositionTicks:playerStartPositionTicks,item:item,mediaSource:mediaSource,textTracks:getTextTracks(apiClient,item,mediaSource),tracks:getTextTracks(apiClient,item,mediaSource),mediaType:type,liveStreamId:liveStreamId,playSessionId:getParam("playSessionId",mediaUrl),title:item.Name},backdropUrl=backdropImageUrl(apiClient,item,{});return backdropUrl&&(resultInfo.backdropUrl=backdropUrl),resultInfo}function getTextTracks(apiClient,item,mediaSource){for(var subtitleStreams=mediaSource.MediaStreams.filter(function(s){return"Subtitle"===s.Type}),textStreams=subtitleStreams.filter(function(s){return"External"===s.DeliveryMethod}),tracks=[],i=0,length=textStreams.length;i=6e5&&getLiveStreamMediaInfo(player,streamInfo,self.currentMediaSource(player),streamInfo.liveStreamId,serverId)}}function getLiveStreamMediaInfo(player,streamInfo,mediaSource,liveStreamId,serverId){console.log("getLiveStreamMediaInfo"),streamInfo.lastMediaInfoQuery=(new Date).getTime(),connectionManager.getApiClient(serverId).isMinServerVersion("3.2.70.7")&&connectionManager.getApiClient(serverId).getLiveStreamMediaInfo(liveStreamId).then(function(info){mediaSource.MediaStreams=info.MediaStreams,events.trigger(player,"mediastreamschange")},function(){})}var currentTargetInfo,lastLocalPlayer,self=this,players=[],currentPairingId=null;this._playNextAfterEnded=!0;var playerStates={};this._playQueueManager=new PlayQueueManager,self.currentItem=function(player){if(!player)throw new Error("player cannot be null");if(player.currentItem)return player.currentItem();var data=getPlayerData(player);return data.streamInfo?data.streamInfo.item:null},self.currentMediaSource=function(player){if(!player)throw new Error("player cannot be null");if(player.currentMediaSource)return player.currentMediaSource();var data=getPlayerData(player);return data.streamInfo?data.streamInfo.mediaSource:null},self.playMethod=function(player){if(!player)throw new Error("player cannot be null");if(player.playMethod)return player.playMethod();var data=getPlayerData(player);return data.streamInfo?data.streamInfo.playMethod:null},self.playSessionId=function(player){if(!player)throw new Error("player cannot be null");if(player.playSessionId)return player.playSessionId();var data=getPlayerData(player);return data.streamInfo?data.streamInfo.playSessionId:null},self.getPlayerInfo=function(){var player=self._currentPlayer;if(!player)return null;var target=currentTargetInfo||{};return{name:player.name,isLocalPlayer:player.isLocalPlayer,id:target.id,deviceName:target.deviceName,playableMediaTypes:target.playableMediaTypes,supportedCommands:target.supportedCommands}},self.setActivePlayer=function(player,targetInfo){if("localplayer"===player||"localplayer"===player.name){if(self._currentPlayer&&self._currentPlayer.isLocalPlayer)return;return void setCurrentPlayerInternal(null,null)}if("string"==typeof player&&(player=players.filter(function(p){return p.name===player})[0]),!player)throw new Error("null player");setCurrentPlayerInternal(player,targetInfo)},self.trySetActivePlayer=function(player,targetInfo){if("localplayer"===player||"localplayer"===player.name)return void(self._currentPlayer&&self._currentPlayer.isLocalPlayer);if("string"==typeof player&&(player=players.filter(function(p){return p.name===player})[0]),!player)throw new Error("null player");if(currentPairingId!==targetInfo.id){currentPairingId=targetInfo.id;var promise=player.tryPair?player.tryPair(targetInfo):Promise.resolve();events.trigger(self,"pairing"),promise.then(function(){events.trigger(self,"paired"),setCurrentPlayerInternal(player,targetInfo)},function(){events.trigger(self,"pairerror"),currentPairingId===targetInfo.id&&(currentPairingId=null)})}},self.getTargets=function(){var promises=players.filter(displayPlayerIndividually).map(getPlayerTargets);return Promise.all(promises).then(function(responses){return connectionManager.currentApiClient().getCurrentUser().then(function(user){var targets=[];targets.push({name:globalize.translate("sharedcomponents#HeaderMyDevice"),id:"localplayer",playerName:"localplayer",playableMediaTypes:["Audio","Video","Game","Photo","Book"],isLocalPlayer:!0,supportedCommands:self.getSupportedCommands({isLocalPlayer:!0}),user:user});for(var i=0;i0},self.isPlayingVideo=function(player){return self.isPlayingMediaType("Video",player)},self.isPlayingAudio=function(player){return self.isPlayingMediaType("Audio",player)},self.getPlayers=function(){return players},self.canPlay=function(item){var itemType=item.Type;if("PhotoAlbum"===itemType||"MusicGenre"===itemType||"Season"===itemType||"Series"===itemType||"BoxSet"===itemType||"MusicAlbum"===itemType||"MusicArtist"===itemType||"Playlist"===itemType)return!0;if("Virtual"===item.LocationType&&"Program"!==itemType)return!1;if("Program"===itemType){if(!item.EndDate||!item.StartDate)return!1;if((new Date).getTime()>datetime.parseISO8601Date(item.EndDate).getTime()||(new Date).getTime()=supported.length&&(index=0),self.setAspectRatio(supported[index].id,player)}},self.setAspectRatio=function(val,player){(player=player||self._currentPlayer)&&player.setAspectRatio&&player.setAspectRatio(val)},self.getSupportedAspectRatios=function(player){return player=player||self._currentPlayer,player&&player.getSupportedAspectRatios?player.getSupportedAspectRatios():[]},self.getAspectRatio=function(player){if((player=player||self._currentPlayer)&&player.getAspectRatio)return player.getAspectRatio()};var brightnessOsdLoaded;self.setBrightness=function(val,player){(player=player||self._currentPlayer)&&(brightnessOsdLoaded||(brightnessOsdLoaded=!0,require(["brightnessOsd"])),player.setBrightness(val))},self.getBrightness=function(player){if(player=player||self._currentPlayer)return player.getBrightness()},self.setVolume=function(val,player){(player=player||self._currentPlayer)&&player.setVolume(val)},self.getVolume=function(player){if(player=player||self._currentPlayer)return player.getVolume()},self.volumeUp=function(player){(player=player||self._currentPlayer)&&player.volumeUp()},self.volumeDown=function(player){(player=player||self._currentPlayer)&&player.volumeDown()},self.changeAudioStream=function(player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.changeAudioStream();if(player){var i,length,currentMediaSource=self.currentMediaSource(player),mediaStreams=[];for(i=0,length=currentMediaSource.MediaStreams.length;i=mediaStreams.length&&(nextIndex=0),nextIndex=-1===nextIndex?-1:mediaStreams[nextIndex].Index,self.setAudioStreamIndex(nextIndex,player)}}},self.changeSubtitleStream=function(player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.changeSubtitleStream();if(player){var i,length,currentMediaSource=self.currentMediaSource(player),mediaStreams=[];for(i=0,length=currentMediaSource.MediaStreams.length;i=mediaStreams.length&&(nextIndex=-1),nextIndex=-1===nextIndex?-1:mediaStreams[nextIndex].Index,self.setSubtitleStreamIndex(nextIndex,player)}}},self.getAudioStreamIndex=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getAudioStreamIndex():getPlayerData(player).audioStreamIndex},self.setAudioStreamIndex=function(index,player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.setAudioStreamIndex(index);"Transcode"!==self.playMethod(player)&&player.canSetAudioStreamIndex()?(player.setAudioStreamIndex(index),getPlayerData(player).audioStreamIndex=index):(changeStream(player,getCurrentTicks(player),{AudioStreamIndex:index}),getPlayerData(player).audioStreamIndex=index)},self.getMaxStreamingBitrate=function(player){if((player=player||self._currentPlayer)&&player.getMaxStreamingBitrate)return player.getMaxStreamingBitrate();var playerData=getPlayerData(player);if(playerData.maxStreamingBitrate)return playerData.maxStreamingBitrate;var mediaType=playerData.streamInfo?playerData.streamInfo.mediaType:null,currentItem=self.currentItem(player);return getSavedMaxStreamingBitrate(currentItem?connectionManager.getApiClient(currentItem.ServerId):connectionManager.currentApiClient(),mediaType)},self.enableAutomaticBitrateDetection=function(player){if((player=player||self._currentPlayer)&&player.enableAutomaticBitrateDetection)return player.enableAutomaticBitrateDetection();var playerData=getPlayerData(player),mediaType=playerData.streamInfo?playerData.streamInfo.mediaType:null,currentItem=self.currentItem(player),apiClient=currentItem?connectionManager.getApiClient(currentItem.ServerId):connectionManager.currentApiClient(),endpointInfo=apiClient.getSavedEndpointInfo()||{};return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork,mediaType)},self.setMaxStreamingBitrate=function(options,player){if((player=player||self._currentPlayer)&&player.setMaxStreamingBitrate)return player.setMaxStreamingBitrate(options);var apiClient=connectionManager.getApiClient(self.currentItem(player).ServerId);apiClient.getEndpointInfo().then(function(endpointInfo){var promise,playerData=getPlayerData(player),mediaType=playerData.streamInfo?playerData.streamInfo.mediaType:null;options.enableAutomaticBitrateDetection?(appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork,mediaType,!0),promise=apiClient.detectBitrate(!0)):(appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork,mediaType,!1),promise=Promise.resolve(options.maxBitrate)),promise.then(function(bitrate){appSettings.maxStreamingBitrate(endpointInfo.IsInNetwork,mediaType,bitrate),changeStream(player,getCurrentTicks(player),{MaxStreamingBitrate:bitrate})})})},self.isFullscreen=function(player){return player=player||self._currentPlayer,!player.isLocalPlayer||player.isFullscreen?player.isFullscreen():fullscreenManager.isFullScreen()},self.toggleFullscreen=function(player){if(player=player||self._currentPlayer,!player.isLocalPlayer||player.toggleFulscreen)return player.toggleFulscreen();fullscreenManager.isFullScreen()?fullscreenManager.exitFullscreen():fullscreenManager.requestFullscreen()},self.togglePictureInPicture=function(player){return player=player||self._currentPlayer,player.togglePictureInPicture()},self.getSubtitleStreamIndex=function(player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.getSubtitleStreamIndex();if(!player)throw new Error("player cannot be null");return getPlayerData(player).subtitleStreamIndex},self.setSubtitleStreamIndex=function(index,player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.setSubtitleStreamIndex(index);var currentStream=getCurrentSubtitleStream(player),newStream=getSubtitleStream(player,index);if(currentStream||newStream){var selectedTrackElementIndex=-1,currentPlayMethod=self.playMethod(player);currentStream&&!newStream?("Encode"===getDeliveryMethod(currentStream)||"Embed"===getDeliveryMethod(currentStream)&&"Transcode"===currentPlayMethod)&&changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:-1}):!currentStream&&newStream?"External"===getDeliveryMethod(newStream)?selectedTrackElementIndex=index:"Embed"===getDeliveryMethod(newStream)&&"Transcode"!==currentPlayMethod?selectedTrackElementIndex=index:changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:index}):currentStream&&newStream&&("External"===getDeliveryMethod(newStream)||"Embed"===getDeliveryMethod(newStream)&&"Transcode"!==currentPlayMethod?(selectedTrackElementIndex=index,"External"!==getDeliveryMethod(currentStream)&&"Embed"!==getDeliveryMethod(currentStream)&&changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:-1})):changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:index})),player.setSubtitleStreamIndex(selectedTrackElementIndex),getPlayerData(player).subtitleStreamIndex=index}},self.seek=function(ticks,player){if(ticks=Math.max(0,ticks),(player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.isLocalPlayer?player.seek((ticks||0)/1e4):player.seek(ticks);changeStream(player,ticks)},self.seekRelative=function(offsetTicks,player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player)&&player.seekRelative)return player.isLocalPlayer?player.seekRelative((ticks||0)/1e4):player.seekRelative(ticks);var ticks=getCurrentTicks(player)+offsetTicks;return this.seek(ticks,player)},self.play=function(options){if(normalizePlayOptions(options),self._currentPlayer){if(!1===options.enableRemotePlayers&&!self._currentPlayer.isLocalPlayer)return Promise.reject();if(!self._currentPlayer.isLocalPlayer)return self._currentPlayer.play(options)}if(options.fullscreen&&loading.show(),options.items)return translateItemsForPlayback(options.items,options).then(function(items){return playWithIntros(items,options)});if(!options.serverId)throw new Error("serverId required!");return getItemsForPlayback(options.serverId,{Ids:options.ids.join(",")}).then(function(result){return translateItemsForPlayback(result.Items,options).then(function(items){return playWithIntros(items,options)})})},self.getPlayerState=function(player,item,mediaSource){if(!(player=player||self._currentPlayer))throw new Error("player cannot be null");if(!enableLocalPlaylistManagement(player)&&player.getPlayerState)return player.getPlayerState();item=item||self.currentItem(player),mediaSource=mediaSource||self.currentMediaSource(player);var state={PlayState:{}};return player&&(state.PlayState.VolumeLevel=player.getVolume(),state.PlayState.IsMuted=player.isMuted(),state.PlayState.IsPaused=player.paused(),state.PlayState.RepeatMode=self.getRepeatMode(player),state.PlayState.MaxStreamingBitrate=self.getMaxStreamingBitrate(player),state.PlayState.PositionTicks=getCurrentTicks(player),state.PlayState.PlaybackStartTimeTicks=self.playbackStartTime(player),state.PlayState.SubtitleStreamIndex=self.getSubtitleStreamIndex(player),state.PlayState.AudioStreamIndex=self.getAudioStreamIndex(player),state.PlayState.BufferedRanges=self.getBufferedRanges(player),state.PlayState.PlayMethod=self.playMethod(player),mediaSource&&(state.PlayState.LiveStreamId=mediaSource.LiveStreamId),state.PlayState.PlaySessionId=self.playSessionId(player)),mediaSource&&(state.PlayState.MediaSourceId=mediaSource.Id,state.NowPlayingItem={RunTimeTicks:mediaSource.RunTimeTicks},state.PlayState.CanSeek=(mediaSource.RunTimeTicks||0)>0||canPlayerSeek(player)),item&&(state.NowPlayingItem=getNowPlayingItemForReporting(player,item,mediaSource)),state.MediaSource=mediaSource,state},self.duration=function(player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player)&&!player.isLocalPlayer)return player.duration();if(!player)throw new Error("player cannot be null");var mediaSource=self.currentMediaSource(player);if(mediaSource&&mediaSource.RunTimeTicks)return mediaSource.RunTimeTicks;var playerDuration=player.duration();return playerDuration&&(playerDuration*=1e4),playerDuration},self.getCurrentTicks=getCurrentTicks,self.getPlaybackInfo=function(item,options){options=options||{};var startPosition=options.startPositionTicks||0,mediaType=options.mediaType||item.MediaType,player=getPlayer(item,options),apiClient=connectionManager.getApiClient(item.ServerId),maxBitrate=getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId),mediaType);return player.getDeviceProfile(item).then(function(deviceProfile){return getPlaybackMediaSource(player,apiClient,deviceProfile,maxBitrate,item,startPosition,options.mediaSourceId,options.audioStreamIndex,options.subtitleStreamIndex).then(function(mediaSource){return createStreamInfo(apiClient,item.MediaType,item,mediaSource,startPosition)})})},self.getPlaybackMediaSources=function(item,options){options=options||{};var startPosition=options.startPositionTicks||0,mediaType=options.mediaType||item.MediaType,player=getPlayer(item,options),apiClient=connectionManager.getApiClient(item.ServerId),maxBitrate=getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId),mediaType);return player.getDeviceProfile(item).then(function(deviceProfile){return getPlaybackInfo(player,apiClient,item,deviceProfile,maxBitrate,startPosition,!1,null,null,null,null).then(function(playbackInfoResult){return playbackInfoResult.MediaSources})})},self.setCurrentPlaylistItem=function(playlistItemId,player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.setCurrentPlaylistItem(playlistItemId);for(var newItem,newItemIndex,playlist=self._playQueueManager.getPlaylist(),i=0,length=playlist.length;i=0){var playlist=self._playQueueManager.getPlaylist(),newItem=playlist[newIndex];if(newItem){var newItemPlayOptions=newItem.playOptions||{};newItemPlayOptions.startPositionTicks=0,playInternal(newItem,newItemPlayOptions,function(){setPlaylistState(newItem.PlaylistItemId,newIndex)})}}},self.queue=function(options,player){queue(options,"",player)},self.queueNext=function(options,player){queue(options,"next",player)},events.on(pluginManager,"registered",function(e,plugin){"mediaplayer"===plugin.type&&initMediaPlayer(plugin)}),pluginManager.ofType("mediaplayer").map(initMediaPlayer),self.onAppClose=function(){var player=this._currentPlayer;player&&this.isPlaying(player)&&(this._playNextAfterEnded=!1,onPlaybackStopped.call(player))},self.playbackStartTime=function(player){if((player=player||this._currentPlayer)&&!enableLocalPlaylistManagement(player)&&!player.isLocalPlayer)return player.playbackStartTime();var streamInfo=getPlayerData(player).streamInfo;return streamInfo?streamInfo.playbackStartTimeTicks:null},apphost.supports("remotecontrol")&&require(["serverNotifications"],function(serverNotifications){events.on(serverNotifications,"ServerShuttingDown",self.setDefaultPlayerActive.bind(self)),events.on(serverNotifications,"ServerRestarting",self.setDefaultPlayerActive.bind(self))})}var startingPlaySession=(new Date).getTime();return PlaybackManager.prototype.getCurrentPlayer=function(){return this._currentPlayer},PlaybackManager.prototype.currentTime=function(player){return player=player||this._currentPlayer,!player||enableLocalPlaylistManagement(player)||player.isLocalPlayer?this.getCurrentTicks(player):player.currentTime()},PlaybackManager.prototype.nextItem=function(player){ -if((player=player||this._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.nextItem();var nextItem=this._playQueueManager.getNextItemInfo();if(!nextItem||!nextItem.item)return Promise.reject();var apiClient=connectionManager.getApiClient(nextItem.item.ServerId);return apiClient.getItem(apiClient.getCurrentUserId(),nextItem.item.Id)},PlaybackManager.prototype.canQueue=function(item){return"MusicAlbum"===item.Type||"MusicArtist"===item.Type||"MusicGenre"===item.Type?this.canQueueMediaType("Audio"):this.canQueueMediaType(item.MediaType)},PlaybackManager.prototype.canQueueMediaType=function(mediaType){return!!this._currentPlayer&&this._currentPlayer.canPlayMediaType(mediaType)},PlaybackManager.prototype.isMuted=function(player){return!!(player=player||this._currentPlayer)&&player.isMuted()},PlaybackManager.prototype.setMute=function(mute,player){(player=player||this._currentPlayer)&&player.setMute(mute)},PlaybackManager.prototype.toggleMute=function(mute,player){(player=player||this._currentPlayer)&&(player.toggleMute?player.toggleMute():player.setMute(!player.isMuted()))},PlaybackManager.prototype.toggleDisplayMirroring=function(){this.enableDisplayMirroring(!this.enableDisplayMirroring())},PlaybackManager.prototype.enableDisplayMirroring=function(enabled){if(null!=enabled){var val=enabled?"1":"0";return void appSettings.set("displaymirror",val)}return"0"!==(appSettings.get("displaymirror")||"")},PlaybackManager.prototype.nextChapter=function(player){player=player||this._currentPlayer;var item=this.currentItem(player),ticks=this.getCurrentTicks(player),nextChapter=(item.Chapters||[]).filter(function(i){return i.StartPositionTicks>ticks})[0];nextChapter?this.seek(nextChapter.StartPositionTicks,player):this.nextTrack(player)},PlaybackManager.prototype.previousChapter=function(player){player=player||this._currentPlayer;var item=this.currentItem(player),ticks=this.getCurrentTicks(player);ticks-=1e8,0===this.getCurrentPlaylistIndex(player)&&(ticks=Math.max(ticks,0));var previousChapters=(item.Chapters||[]).filter(function(i){return i.StartPositionTicks<=ticks});previousChapters.length?this.seek(previousChapters[previousChapters.length-1].StartPositionTicks,player):this.previousTrack(player)},PlaybackManager.prototype.fastForward=function(player){if(player=player||this._currentPlayer,null!=player.fastForward)return void player.fastForward(userSettings.skipForwardLength());var offsetTicks=1e4*userSettings.skipForwardLength();this.seekRelative(offsetTicks,player)},PlaybackManager.prototype.rewind=function(player){if(player=player||this._currentPlayer,null!=player.rewind)return void player.rewind(userSettings.skipBackLength());var offsetTicks=0-1e4*userSettings.skipBackLength();this.seekRelative(offsetTicks,player)},PlaybackManager.prototype.seekPercent=function(percent,player){player=player||this._currentPlayer;var ticks=this.duration(player)||0;percent/=100,ticks*=percent,this.seek(parseInt(ticks),player)},PlaybackManager.prototype.playTrailers=function(item){var apiClient=connectionManager.getApiClient(item.ServerId),instance=this;if(item.LocalTrailerCount)return apiClient.getLocalTrailers(apiClient.getCurrentUserId(),item.Id).then(function(result){return instance.play({items:result})});var remoteTrailers=item.RemoteTrailers||[];return remoteTrailers.length?this.play({items:remoteTrailers.map(function(t){return{Name:t.Name||item.Name+" Trailer",Url:t.Url,MediaType:"Video",Type:"Trailer",ServerId:apiClient.serverId()}})}):Promise.reject()},PlaybackManager.prototype.getSubtitleUrl=function(textStream,serverId){var apiClient=connectionManager.getApiClient(serverId);return textStream.IsExternalUrl?textStream.DeliveryUrl:apiClient.getUrl(textStream.DeliveryUrl)},PlaybackManager.prototype.stop=function(player){return player=player||this._currentPlayer,player?(enableLocalPlaylistManagement(player)&&(this._playNextAfterEnded=!1),player.stop(!0,!0)):Promise.resolve()},PlaybackManager.prototype.getBufferedRanges=function(player){return player=player||this._currentPlayer,player&&player.getBufferedRanges?player.getBufferedRanges():[]},PlaybackManager.prototype.playPause=function(player){if(player=player||this._currentPlayer)return player.playPause?player.playPause():player.paused()?this.unpause(player):this.pause(player)},PlaybackManager.prototype.paused=function(player){if(player=player||this._currentPlayer)return player.paused()},PlaybackManager.prototype.pause=function(player){(player=player||this._currentPlayer)&&player.pause()},PlaybackManager.prototype.unpause=function(player){(player=player||this._currentPlayer)&&player.unpause()},PlaybackManager.prototype.instantMix=function(item,player){if((player=player||this._currentPlayer)&&player.instantMix)return player.instantMix(item);var apiClient=connectionManager.getApiClient(item.ServerId),options={};options.UserId=apiClient.getCurrentUserId(),options.Limit=200;var instance=this;apiClient.getInstantMixFromItem(item.Id,options).then(function(result){instance.play({items:result.Items})})},PlaybackManager.prototype.shuffle=function(shuffleItem,player,queryOptions){return player=player||this._currentPlayer,player&&player.shuffle?player.shuffle(shuffleItem):this.play({items:[shuffleItem],shuffle:!0})},PlaybackManager.prototype.audioTracks=function(player){if(player=player||this._currentPlayer,player.audioTracks){var result=player.audioTracks();if(result)return result}return((this.currentMediaSource(player)||{}).MediaStreams||[]).filter(function(s){return"Audio"===s.Type})},PlaybackManager.prototype.subtitleTracks=function(player){if(player=player||this._currentPlayer,player.subtitleTracks){var result=player.subtitleTracks();if(result)return result}return((this.currentMediaSource(player)||{}).MediaStreams||[]).filter(function(s){return"Subtitle"===s.Type})},PlaybackManager.prototype.getSupportedCommands=function(player){if(player=player||this._currentPlayer||{isLocalPlayer:!0},player.isLocalPlayer){var list=["GoHome","GoToSettings","VolumeUp","VolumeDown","Mute","Unmute","ToggleMute","SetVolume","SetAudioStreamIndex","SetSubtitleStreamIndex","SetMaxStreamingBitrate","DisplayContent","GoToSearch","DisplayMessage","SetRepeatMode","PlayMediaSource"];return apphost.supports("fullscreenchange")&&list.push("ToggleFullscreen"),player.supports&&(player.supports("PictureInPicture")&&list.push("PictureInPicture"),player.supports("SetBrightness")&&list.push("SetBrightness"),player.supports("SetAspectRatio")&&list.push("SetAspectRatio")),list}var info=this.getPlayerInfo();return info?info.supportedCommands:[]},PlaybackManager.prototype.setRepeatMode=function(value,player){if((player=player||this._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.setRepeatMode(value);this._playQueueManager.setRepeatMode(value),events.trigger(player,"repeatmodechange")},PlaybackManager.prototype.getRepeatMode=function(player){return player=player||this._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getRepeatMode():this._playQueueManager.getRepeatMode()},PlaybackManager.prototype.trySetActiveDeviceName=function(name){name=normalizeName(name);var instance=this;instance.getTargets().then(function(result){var target=result.filter(function(p){return normalizeName(p.name)===name})[0];target&&instance.trySetActivePlayer(target.playerName,target)})},PlaybackManager.prototype.displayContent=function(options,player){(player=player||this._currentPlayer)&&player.displayContent&&player.displayContent(options)},PlaybackManager.prototype.beginPlayerUpdates=function(player){player.beginPlayerUpdates&&player.beginPlayerUpdates()},PlaybackManager.prototype.endPlayerUpdates=function(player){player.endPlayerUpdates&&player.endPlayerUpdates()},PlaybackManager.prototype.setDefaultPlayerActive=function(){this.setActivePlayer("localplayer")},PlaybackManager.prototype.removeActivePlayer=function(name){var playerInfo=this.getPlayerInfo();playerInfo&&playerInfo.name===name&&this.setDefaultPlayerActive()},PlaybackManager.prototype.removeActiveTarget=function(id){var playerInfo=this.getPlayerInfo();playerInfo&&playerInfo.id===id&&this.setDefaultPlayerActive()},PlaybackManager.prototype.sendCommand=function(cmd,player){switch(console.log("MediaController received command: "+cmd.Name),cmd.Name){case"SetRepeatMode":this.setRepeatMode(cmd.Arguments.RepeatMode,player);break;case"VolumeUp":this.volumeUp(player);break;case"VolumeDown":this.volumeDown(player);break;case"Mute":this.setMute(!0,player);break;case"Unmute":this.setMute(!1,player);break;case"ToggleMute":this.toggleMute(player);break;case"SetVolume":this.setVolume(cmd.Arguments.Volume,player);break;case"SetAspectRatio":this.setAspectRatio(cmd.Arguments.AspectRatio,player);break;case"SetBrightness":this.setBrightness(cmd.Arguments.Brightness,player);break;case"SetAudioStreamIndex":this.setAudioStreamIndex(parseInt(cmd.Arguments.Index),player);break;case"SetSubtitleStreamIndex":this.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index),player);break;case"SetMaxStreamingBitrate":break;case"ToggleFullscreen":this.toggleFullscreen(player);break;default:player.sendCommand&&player.sendCommand(cmd)}},new PlaybackManager}); \ No newline at end of file +define(["events","datetime","appSettings","itemHelper","pluginManager","playQueueManager","userSettings","globalize","connectionManager","loading","apphost","fullscreenManager"],function(events,datetime,appSettings,itemHelper,pluginManager,PlayQueueManager,userSettings,globalize,connectionManager,loading,apphost,fullscreenManager){"use strict";function enableLocalPlaylistManagement(player){return!player.getPlaylist&&!!player.isLocalPlayer}function bindToFullscreenChange(player){events.on(fullscreenManager,"fullscreenchange",function(){events.trigger(player,"fullscreenchange")})}function triggerPlayerChange(playbackManagerInstance,newPlayer,newTarget,previousPlayer,previousTargetInfo){(newPlayer||previousPlayer)&&(newTarget&&previousTargetInfo&&newTarget.id===previousTargetInfo.id||events.trigger(playbackManagerInstance,"playerchange",[newPlayer,newTarget,previousPlayer]))}function reportPlayback(state,serverId,method,progressEventName){if(serverId){var info=Object.assign({},state.PlayState);info.ItemId=state.NowPlayingItem.Id,progressEventName&&(info.EventName=progressEventName);connectionManager.getApiClient(serverId)[method](info)}}function normalizeName(t){return t.toLowerCase().replace(" ","")}function getItemsForPlayback(serverId,query){var apiClient=connectionManager.getApiClient(serverId);if(query.Ids&&1===query.Ids.split(",").length){var itemId=query.Ids.split(",");return apiClient.getItem(apiClient.getCurrentUserId(),itemId).then(function(item){return{Items:[item],TotalRecordCount:1}})}return query.Limit=query.Limit||200,query.Fields="Chapters",query.ExcludeLocationTypes="Virtual",query.EnableTotalRecordCount=!1,query.CollapseBoxSetItems=!1,apiClient.getItems(apiClient.getCurrentUserId(),query)}function createStreamInfoFromUrlItem(item){return{url:item.Url||item.Path,playMethod:"DirectPlay",item:item,textTracks:[],mediaType:item.MediaType}}function mergePlaybackQueries(obj1,obj2){var query=Object.assign(obj1,obj2),filters=query.Filters?query.Filters.split(","):[];return-1===filters.indexOf("IsNotFolder")&&filters.push("IsNotFolder"),query.Filters=filters.join(","),query}function backdropImageUrl(apiClient,item,options){return options=options||{},options.type=options.type||"Backdrop",options.maxWidth||options.width||options.maxHeight||options.height||(options.quality=100),item.BackdropImageTags&&item.BackdropImageTags.length?(options.tag=item.BackdropImageTags[0],apiClient.getScaledImageUrl(item.Id,options)):item.ParentBackdropImageTags&&item.ParentBackdropImageTags.length?(options.tag=item.ParentBackdropImageTags[0],apiClient.getScaledImageUrl(item.ParentBackdropItemId,options)):null}function getMimeType(type,container){if(container=(container||"").toLowerCase(),"audio"===type){if("opus"===container)return"audio/ogg";if("webma"===container)return"audio/webm";if("m4a"===container)return"audio/mp4"}else if("video"===type){if("mkv"===container)return"video/x-matroska";if("m4v"===container)return"video/mp4";if("mov"===container)return"video/quicktime";if("mpg"===container)return"video/mpeg";if("flv"===container)return"video/x-flv"}return type+"/"+container}function getParam(name,url){name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+name+"=([^&#]*)",regex=new RegExp(regexS,"i"),results=regex.exec(url);return null==results?"":decodeURIComponent(results[1].replace(/\+/g," "))}function isAutomaticPlayer(player){return!!player.isLocalPlayer}function getAutomaticPlayers(instance,forceLocalPlayer){if(!forceLocalPlayer){var player=instance._currentPlayer;if(player&&!isAutomaticPlayer(player))return[player]}return instance.getPlayers().filter(isAutomaticPlayer)}function isServerItem(item){return!!item.Id}function enableIntros(item){return"Video"===item.MediaType&&("TvChannel"!==item.Type&&("InProgress"!==item.Status&&isServerItem(item)))}function getIntros(firstItem,apiClient,options){return options.startPositionTicks||options.startIndex||!1===options.fullscreen||!enableIntros(firstItem)||!userSettings.enableCinemaMode()?Promise.resolve({Items:[]}):apiClient.getIntros(firstItem.Id)}function getAudioMaxValues(deviceProfile){var maxAudioSampleRate=null,maxAudioBitDepth=null;return deviceProfile.CodecProfiles.map(function(codecProfile){"Audio"===codecProfile.Type&&(codecProfile.Conditions||[]).map(function(condition){"LessThanEqual"===condition.Condition&&"AudioBitDepth"===condition.Property&&(maxAudioBitDepth=condition.Value),"LessThanEqual"===condition.Condition&&"AudioSampleRate"===condition.Property&&(maxAudioSampleRate=condition.Value)})}),{maxAudioSampleRate:maxAudioSampleRate,maxAudioBitDepth:maxAudioBitDepth}}function getAudioStreamUrl(item,transcodingProfile,directPlayContainers,maxBitrate,apiClient,maxAudioSampleRate,maxAudioBitDepth,startPosition){var url="Audio/"+item.Id+"/universal";return startingPlaySession++,apiClient.getUrl(url,{UserId:apiClient.getCurrentUserId(),DeviceId:apiClient.deviceId(),MaxStreamingBitrate:maxBitrate,Container:directPlayContainers,TranscodingContainer:transcodingProfile.Container||null,TranscodingProtocol:transcodingProfile.Protocol||null,AudioCodec:transcodingProfile.AudioCodec,MaxAudioSampleRate:maxAudioSampleRate,MaxAudioBitDepth:maxAudioBitDepth,api_key:apiClient.accessToken(),PlaySessionId:startingPlaySession,StartTimeTicks:startPosition||0,EnableRedirection:!0,EnableRemoteMedia:apphost.supports("remoteaudio")})}function getAudioStreamUrlFromDeviceProfile(item,deviceProfile,maxBitrate,apiClient,startPosition){var transcodingProfile=deviceProfile.TranscodingProfiles.filter(function(p){return"Audio"===p.Type&&"Streaming"===p.Context})[0],directPlayContainers="";deviceProfile.DirectPlayProfiles.map(function(p){"Audio"===p.Type&&(directPlayContainers?directPlayContainers+=","+p.Container:directPlayContainers=p.Container,p.AudioCodec&&(directPlayContainers+="|"+p.AudioCodec))});var maxValues=getAudioMaxValues(deviceProfile);return getAudioStreamUrl(item,transcodingProfile,directPlayContainers,maxBitrate,apiClient,maxValues.maxAudioSampleRate,maxValues.maxAudioBitDepth,startPosition)}function getStreamUrls(items,deviceProfile,maxBitrate,apiClient,startPosition){var audioTranscodingProfile=deviceProfile.TranscodingProfiles.filter(function(p){return"Audio"===p.Type&&"Streaming"===p.Context})[0],audioDirectPlayContainers="";deviceProfile.DirectPlayProfiles.map(function(p){"Audio"===p.Type&&(audioDirectPlayContainers?audioDirectPlayContainers+=","+p.Container:audioDirectPlayContainers=p.Container,p.AudioCodec&&(audioDirectPlayContainers+="|"+p.AudioCodec))});for(var maxValues=getAudioMaxValues(deviceProfile),streamUrls=[],i=0,length=items.length;i=interceptors.length)return void resolve();interceptors[index].intercept(options).then(function(){runNextPrePlay(interceptors,index+1,options,resolve,reject)},reject)}function sendPlaybackListToPlayer(player,items,deviceProfile,maxBitrate,apiClient,startPositionTicks,mediaSourceId,audioStreamIndex,subtitleStreamIndex,startIndex){return setStreamUrls(items,deviceProfile,maxBitrate,apiClient,startPositionTicks).then(function(){return loading.hide(),player.play({items:items,startPositionTicks:startPositionTicks||0,mediaSourceId:mediaSourceId,audioStreamIndex:audioStreamIndex,subtitleStreamIndex:subtitleStreamIndex,startIndex:startIndex})})}function playAfterBitrateDetect(maxBitrate,item,playOptions,onPlaybackStartedFn){var promise,startPosition=playOptions.startPositionTicks,player=getPlayer(item,playOptions),activePlayer=self._currentPlayer;return activePlayer?(self._playNextAfterEnded=!1,promise=onPlaybackChanging(activePlayer,player,item)):promise=Promise.resolve(),isServerItem(item)&&"Game"!==item.MediaType&&"Book"!==item.MediaType?Promise.all([promise,player.getDeviceProfile(item)]).then(function(responses){var deviceProfile=responses[1],apiClient=connectionManager.getApiClient(item.ServerId),mediaSourceId=playOptions.mediaSourceId,audioStreamIndex=playOptions.audioStreamIndex,subtitleStreamIndex=playOptions.subtitleStreamIndex;return player&&!enableLocalPlaylistManagement(player)?sendPlaybackListToPlayer(player,playOptions.items,deviceProfile,maxBitrate,apiClient,startPosition,mediaSourceId,audioStreamIndex,subtitleStreamIndex,playOptions.startIndex):(playOptions.items=null,getPlaybackMediaSource(player,apiClient,deviceProfile,maxBitrate,item,startPosition,mediaSourceId,audioStreamIndex,subtitleStreamIndex).then(function(mediaSource){var streamInfo=createStreamInfo(apiClient,item.MediaType,item,mediaSource,startPosition);return streamInfo.fullscreen=playOptions.fullscreen,getPlayerData(player).isChangingStream=!1,getPlayerData(player).maxStreamingBitrate=maxBitrate,player.play(streamInfo).then(function(){loading.hide(),onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo,mediaSource)},function(err){onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo,mediaSource),setTimeout(function(){onPlaybackError.call(player,err,{type:"mediadecodeerror",streamInfo:streamInfo})},100)})}))}):promise.then(function(){var streamInfo=createStreamInfoFromUrlItem(item);return streamInfo.fullscreen=playOptions.fullscreen,getPlayerData(player).isChangingStream=!1,player.play(streamInfo).then(function(){loading.hide(),onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo)},function(){self.stop(player)})})}function createStreamInfo(apiClient,type,item,mediaSource,startPosition){var mediaUrl,contentType,directOptions,transcodingOffsetTicks=0,playerStartPositionTicks=startPosition,liveStreamId=mediaSource.LiveStreamId,playMethod="Transcode",mediaSourceContainer=(mediaSource.Container||"").toLowerCase();if("Video"===type||"Audio"===type)if(contentType=getMimeType(type.toLowerCase(),mediaSourceContainer),mediaSource.enableDirectPlay)mediaUrl=mediaSource.Path,playMethod="DirectPlay";else if(mediaSource.StreamUrl)playMethod="Transcode",mediaUrl=mediaSource.StreamUrl;else if(mediaSource.SupportsDirectStream){directOptions={Static:!0,mediaSourceId:mediaSource.Id,deviceId:apiClient.deviceId(),api_key:apiClient.accessToken()},mediaSource.ETag&&(directOptions.Tag=mediaSource.ETag),mediaSource.LiveStreamId&&(directOptions.LiveStreamId=mediaSource.LiveStreamId);var prefix="Video"===type?"Videos":"Audio";mediaUrl=apiClient.getUrl(prefix+"/"+item.Id+"/stream."+mediaSourceContainer,directOptions),playMethod="DirectStream"}else mediaSource.SupportsTranscoding&&(mediaUrl=apiClient.getUrl(mediaSource.TranscodingUrl),"hls"===mediaSource.TranscodingSubProtocol?contentType="application/x-mpegURL":(playerStartPositionTicks=null,contentType=getMimeType(type.toLowerCase(),mediaSource.TranscodingContainer),-1===mediaUrl.toLowerCase().indexOf("copytimestamps=true")&&(transcodingOffsetTicks=startPosition||0)));else mediaUrl=mediaSource.Path,playMethod="DirectPlay";!mediaUrl&&mediaSource.SupportsDirectPlay&&(mediaUrl=mediaSource.Path,playMethod="DirectPlay");var resultInfo={url:mediaUrl,mimeType:contentType,transcodingOffsetTicks:transcodingOffsetTicks,playMethod:playMethod,playerStartPositionTicks:playerStartPositionTicks,item:item,mediaSource:mediaSource,textTracks:getTextTracks(apiClient,item,mediaSource),tracks:getTextTracks(apiClient,item,mediaSource),mediaType:type,liveStreamId:liveStreamId,playSessionId:getParam("playSessionId",mediaUrl),title:item.Name},backdropUrl=backdropImageUrl(apiClient,item,{});return backdropUrl&&(resultInfo.backdropUrl=backdropUrl),resultInfo}function getTextTracks(apiClient,item,mediaSource){for(var subtitleStreams=mediaSource.MediaStreams.filter(function(s){return"Subtitle"===s.Type}),textStreams=subtitleStreams.filter(function(s){return"External"===s.DeliveryMethod}),tracks=[],i=0,length=textStreams.length;i=6e5&&getLiveStreamMediaInfo(player,streamInfo,self.currentMediaSource(player),streamInfo.liveStreamId,serverId)}}function getLiveStreamMediaInfo(player,streamInfo,mediaSource,liveStreamId,serverId){console.log("getLiveStreamMediaInfo"),streamInfo.lastMediaInfoQuery=(new Date).getTime(),connectionManager.getApiClient(serverId).isMinServerVersion("3.2.70.7")&&connectionManager.getApiClient(serverId).getLiveStreamMediaInfo(liveStreamId).then(function(info){mediaSource.MediaStreams=info.MediaStreams,events.trigger(player,"mediastreamschange")},function(){})}var currentTargetInfo,lastLocalPlayer,self=this,players=[],currentPairingId=null;this._playNextAfterEnded=!0;var playerStates={};this._playQueueManager=new PlayQueueManager,self.currentItem=function(player){if(!player)throw new Error("player cannot be null");if(player.currentItem)return player.currentItem();var data=getPlayerData(player);return data.streamInfo?data.streamInfo.item:null},self.currentMediaSource=function(player){if(!player)throw new Error("player cannot be null");if(player.currentMediaSource)return player.currentMediaSource();var data=getPlayerData(player);return data.streamInfo?data.streamInfo.mediaSource:null},self.playMethod=function(player){if(!player)throw new Error("player cannot be null");if(player.playMethod)return player.playMethod();var data=getPlayerData(player);return data.streamInfo?data.streamInfo.playMethod:null},self.playSessionId=function(player){if(!player)throw new Error("player cannot be null");if(player.playSessionId)return player.playSessionId();var data=getPlayerData(player);return data.streamInfo?data.streamInfo.playSessionId:null},self.getPlayerInfo=function(){var player=self._currentPlayer;if(!player)return null;var target=currentTargetInfo||{};return{name:player.name,isLocalPlayer:player.isLocalPlayer,id:target.id,deviceName:target.deviceName,playableMediaTypes:target.playableMediaTypes,supportedCommands:target.supportedCommands}},self.setActivePlayer=function(player,targetInfo){if("localplayer"===player||"localplayer"===player.name){if(self._currentPlayer&&self._currentPlayer.isLocalPlayer)return;return void setCurrentPlayerInternal(null,null)}if("string"==typeof player&&(player=players.filter(function(p){return p.name===player})[0]),!player)throw new Error("null player");setCurrentPlayerInternal(player,targetInfo)},self.trySetActivePlayer=function(player,targetInfo){if("localplayer"===player||"localplayer"===player.name)return void(self._currentPlayer&&self._currentPlayer.isLocalPlayer);if("string"==typeof player&&(player=players.filter(function(p){return p.name===player})[0]),!player)throw new Error("null player");if(currentPairingId!==targetInfo.id){currentPairingId=targetInfo.id;var promise=player.tryPair?player.tryPair(targetInfo):Promise.resolve();events.trigger(self,"pairing"),promise.then(function(){events.trigger(self,"paired"),setCurrentPlayerInternal(player,targetInfo)},function(){events.trigger(self,"pairerror"),currentPairingId===targetInfo.id&&(currentPairingId=null)})}},self.getTargets=function(){var promises=players.filter(displayPlayerIndividually).map(getPlayerTargets);return Promise.all(promises).then(function(responses){return connectionManager.currentApiClient().getCurrentUser().then(function(user){var targets=[];targets.push({name:globalize.translate("sharedcomponents#HeaderMyDevice"),id:"localplayer",playerName:"localplayer",playableMediaTypes:["Audio","Video","Game","Photo","Book"],isLocalPlayer:!0,supportedCommands:self.getSupportedCommands({isLocalPlayer:!0}),user:user});for(var i=0;i0},self.isPlayingVideo=function(player){return self.isPlayingMediaType("Video",player)},self.isPlayingAudio=function(player){return self.isPlayingMediaType("Audio",player)},self.getPlayers=function(){return players},self.canPlay=function(item){var itemType=item.Type;if("PhotoAlbum"===itemType||"MusicGenre"===itemType||"Season"===itemType||"Series"===itemType||"BoxSet"===itemType||"MusicAlbum"===itemType||"MusicArtist"===itemType||"Playlist"===itemType)return!0;if("Virtual"===item.LocationType&&"Program"!==itemType)return!1;if("Program"===itemType){if(!item.EndDate||!item.StartDate)return!1;if((new Date).getTime()>datetime.parseISO8601Date(item.EndDate).getTime()||(new Date).getTime()=supported.length&&(index=0),self.setAspectRatio(supported[index].id,player)}},self.setAspectRatio=function(val,player){(player=player||self._currentPlayer)&&player.setAspectRatio&&player.setAspectRatio(val)},self.getSupportedAspectRatios=function(player){return player=player||self._currentPlayer,player&&player.getSupportedAspectRatios?player.getSupportedAspectRatios():[]},self.getAspectRatio=function(player){if((player=player||self._currentPlayer)&&player.getAspectRatio)return player.getAspectRatio()};var brightnessOsdLoaded;self.setBrightness=function(val,player){(player=player||self._currentPlayer)&&(brightnessOsdLoaded||(brightnessOsdLoaded=!0,require(["brightnessOsd"])),player.setBrightness(val))},self.getBrightness=function(player){if(player=player||self._currentPlayer)return player.getBrightness()},self.setVolume=function(val,player){(player=player||self._currentPlayer)&&player.setVolume(val)},self.getVolume=function(player){if(player=player||self._currentPlayer)return player.getVolume()},self.volumeUp=function(player){(player=player||self._currentPlayer)&&player.volumeUp()},self.volumeDown=function(player){(player=player||self._currentPlayer)&&player.volumeDown()},self.changeAudioStream=function(player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.changeAudioStream();if(player){var i,length,currentMediaSource=self.currentMediaSource(player),mediaStreams=[];for(i=0,length=currentMediaSource.MediaStreams.length;i=mediaStreams.length&&(nextIndex=0),nextIndex=-1===nextIndex?-1:mediaStreams[nextIndex].Index,self.setAudioStreamIndex(nextIndex,player)}}},self.changeSubtitleStream=function(player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.changeSubtitleStream();if(player){var i,length,currentMediaSource=self.currentMediaSource(player),mediaStreams=[];for(i=0,length=currentMediaSource.MediaStreams.length;i=mediaStreams.length&&(nextIndex=-1),nextIndex=-1===nextIndex?-1:mediaStreams[nextIndex].Index,self.setSubtitleStreamIndex(nextIndex,player)}}},self.getAudioStreamIndex=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getAudioStreamIndex():getPlayerData(player).audioStreamIndex},self.setAudioStreamIndex=function(index,player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.setAudioStreamIndex(index);"Transcode"!==self.playMethod(player)&&player.canSetAudioStreamIndex()?(player.setAudioStreamIndex(index),getPlayerData(player).audioStreamIndex=index):(changeStream(player,getCurrentTicks(player),{AudioStreamIndex:index}),getPlayerData(player).audioStreamIndex=index)},self.getMaxStreamingBitrate=function(player){if((player=player||self._currentPlayer)&&player.getMaxStreamingBitrate)return player.getMaxStreamingBitrate();var playerData=getPlayerData(player);if(playerData.maxStreamingBitrate)return playerData.maxStreamingBitrate;var mediaType=playerData.streamInfo?playerData.streamInfo.mediaType:null,currentItem=self.currentItem(player);return getSavedMaxStreamingBitrate(currentItem?connectionManager.getApiClient(currentItem.ServerId):connectionManager.currentApiClient(),mediaType)},self.enableAutomaticBitrateDetection=function(player){if((player=player||self._currentPlayer)&&player.enableAutomaticBitrateDetection)return player.enableAutomaticBitrateDetection();var playerData=getPlayerData(player),mediaType=playerData.streamInfo?playerData.streamInfo.mediaType:null,currentItem=self.currentItem(player),apiClient=currentItem?connectionManager.getApiClient(currentItem.ServerId):connectionManager.currentApiClient(),endpointInfo=apiClient.getSavedEndpointInfo()||{};return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork,mediaType)},self.setMaxStreamingBitrate=function(options,player){if((player=player||self._currentPlayer)&&player.setMaxStreamingBitrate)return player.setMaxStreamingBitrate(options);var apiClient=connectionManager.getApiClient(self.currentItem(player).ServerId);apiClient.getEndpointInfo().then(function(endpointInfo){var promise,playerData=getPlayerData(player),mediaType=playerData.streamInfo?playerData.streamInfo.mediaType:null;options.enableAutomaticBitrateDetection?(appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork,mediaType,!0),promise=apiClient.detectBitrate(!0)):(appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork,mediaType,!1),promise=Promise.resolve(options.maxBitrate)),promise.then(function(bitrate){appSettings.maxStreamingBitrate(endpointInfo.IsInNetwork,mediaType,bitrate),changeStream(player,getCurrentTicks(player),{MaxStreamingBitrate:bitrate})})})},self.isFullscreen=function(player){return player=player||self._currentPlayer,!player.isLocalPlayer||player.isFullscreen?player.isFullscreen():fullscreenManager.isFullScreen()},self.toggleFullscreen=function(player){if(player=player||self._currentPlayer,!player.isLocalPlayer||player.toggleFulscreen)return player.toggleFulscreen();fullscreenManager.isFullScreen()?fullscreenManager.exitFullscreen():fullscreenManager.requestFullscreen()},self.togglePictureInPicture=function(player){return player=player||self._currentPlayer,player.togglePictureInPicture()},self.getSubtitleStreamIndex=function(player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.getSubtitleStreamIndex();if(!player)throw new Error("player cannot be null");return getPlayerData(player).subtitleStreamIndex},self.setSubtitleStreamIndex=function(index,player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.setSubtitleStreamIndex(index);var currentStream=getCurrentSubtitleStream(player),newStream=getSubtitleStream(player,index);if(currentStream||newStream){var selectedTrackElementIndex=-1,currentPlayMethod=self.playMethod(player);currentStream&&!newStream?("Encode"===getDeliveryMethod(currentStream)||"Embed"===getDeliveryMethod(currentStream)&&"Transcode"===currentPlayMethod)&&changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:-1}):!currentStream&&newStream?"External"===getDeliveryMethod(newStream)?selectedTrackElementIndex=index:"Embed"===getDeliveryMethod(newStream)&&"Transcode"!==currentPlayMethod?selectedTrackElementIndex=index:changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:index}):currentStream&&newStream&&("External"===getDeliveryMethod(newStream)||"Embed"===getDeliveryMethod(newStream)&&"Transcode"!==currentPlayMethod?(selectedTrackElementIndex=index,"External"!==getDeliveryMethod(currentStream)&&"Embed"!==getDeliveryMethod(currentStream)&&changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:-1})):changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:index})),player.setSubtitleStreamIndex(selectedTrackElementIndex),getPlayerData(player).subtitleStreamIndex=index}},self.seek=function(ticks,player){if(ticks=Math.max(0,ticks),(player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.isLocalPlayer?player.seek((ticks||0)/1e4):player.seek(ticks);changeStream(player,ticks)},self.seekRelative=function(offsetTicks,player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player)&&player.seekRelative)return player.isLocalPlayer?player.seekRelative((ticks||0)/1e4):player.seekRelative(ticks);var ticks=getCurrentTicks(player)+offsetTicks;return this.seek(ticks,player)},self.play=function(options){if(normalizePlayOptions(options),self._currentPlayer){if(!1===options.enableRemotePlayers&&!self._currentPlayer.isLocalPlayer)return Promise.reject();if(!self._currentPlayer.isLocalPlayer)return self._currentPlayer.play(options)}if(options.fullscreen&&loading.show(),options.items)return translateItemsForPlayback(options.items,options).then(function(items){return playWithIntros(items,options)});if(!options.serverId)throw new Error("serverId required!");return getItemsForPlayback(options.serverId,{Ids:options.ids.join(",")}).then(function(result){return translateItemsForPlayback(result.Items,options).then(function(items){return playWithIntros(items,options)})})},self.getPlayerState=function(player,item,mediaSource){if(!(player=player||self._currentPlayer))throw new Error("player cannot be null");if(!enableLocalPlaylistManagement(player)&&player.getPlayerState)return player.getPlayerState();item=item||self.currentItem(player),mediaSource=mediaSource||self.currentMediaSource(player);var state={PlayState:{}};return player&&(state.PlayState.VolumeLevel=player.getVolume(),state.PlayState.IsMuted=player.isMuted(),state.PlayState.IsPaused=player.paused(),state.PlayState.RepeatMode=self.getRepeatMode(player),state.PlayState.MaxStreamingBitrate=self.getMaxStreamingBitrate(player),state.PlayState.PositionTicks=getCurrentTicks(player),state.PlayState.PlaybackStartTimeTicks=self.playbackStartTime(player),state.PlayState.SubtitleStreamIndex=self.getSubtitleStreamIndex(player),state.PlayState.AudioStreamIndex=self.getAudioStreamIndex(player),state.PlayState.BufferedRanges=self.getBufferedRanges(player),state.PlayState.PlayMethod=self.playMethod(player),mediaSource&&(state.PlayState.LiveStreamId=mediaSource.LiveStreamId),state.PlayState.PlaySessionId=self.playSessionId(player)),mediaSource&&(state.PlayState.MediaSourceId=mediaSource.Id,state.NowPlayingItem={RunTimeTicks:mediaSource.RunTimeTicks},state.PlayState.CanSeek=(mediaSource.RunTimeTicks||0)>0||canPlayerSeek(player)),item&&(state.NowPlayingItem=getNowPlayingItemForReporting(player,item,mediaSource)),state.MediaSource=mediaSource,state},self.duration=function(player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player)&&!player.isLocalPlayer)return player.duration();if(!player)throw new Error("player cannot be null");var mediaSource=self.currentMediaSource(player);if(mediaSource&&mediaSource.RunTimeTicks)return mediaSource.RunTimeTicks;var playerDuration=player.duration();return playerDuration&&(playerDuration*=1e4),playerDuration},self.getCurrentTicks=getCurrentTicks,self.getPlaybackInfo=function(item,options){options=options||{};var startPosition=options.startPositionTicks||0,mediaType=options.mediaType||item.MediaType,player=getPlayer(item,options),apiClient=connectionManager.getApiClient(item.ServerId),maxBitrate=getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId),mediaType);return player.getDeviceProfile(item).then(function(deviceProfile){return getPlaybackMediaSource(player,apiClient,deviceProfile,maxBitrate,item,startPosition,options.mediaSourceId,options.audioStreamIndex,options.subtitleStreamIndex).then(function(mediaSource){return createStreamInfo(apiClient,item.MediaType,item,mediaSource,startPosition)})})},self.getPlaybackMediaSources=function(item,options){options=options||{};var startPosition=options.startPositionTicks||0,mediaType=options.mediaType||item.MediaType,player=getPlayer(item,options,!0),apiClient=connectionManager.getApiClient(item.ServerId),maxBitrate=getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId),mediaType);return player.getDeviceProfile(item).then(function(deviceProfile){return getPlaybackInfo(player,apiClient,item,deviceProfile,maxBitrate,startPosition,!1,null,null,null,null).then(function(playbackInfoResult){return playbackInfoResult.MediaSources})})},self.setCurrentPlaylistItem=function(playlistItemId,player){if((player=player||self._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.setCurrentPlaylistItem(playlistItemId);for(var newItem,newItemIndex,playlist=self._playQueueManager.getPlaylist(),i=0,length=playlist.length;i=0){var playlist=self._playQueueManager.getPlaylist(),newItem=playlist[newIndex];if(newItem){var newItemPlayOptions=newItem.playOptions||{};newItemPlayOptions.startPositionTicks=0,playInternal(newItem,newItemPlayOptions,function(){setPlaylistState(newItem.PlaylistItemId,newIndex)})}}},self.queue=function(options,player){queue(options,"",player)},self.queueNext=function(options,player){queue(options,"next",player)},events.on(pluginManager,"registered",function(e,plugin){"mediaplayer"===plugin.type&&initMediaPlayer(plugin)}),pluginManager.ofType("mediaplayer").map(initMediaPlayer),self.onAppClose=function(){var player=this._currentPlayer;player&&this.isPlaying(player)&&(this._playNextAfterEnded=!1,onPlaybackStopped.call(player))},self.playbackStartTime=function(player){if((player=player||this._currentPlayer)&&!enableLocalPlaylistManagement(player)&&!player.isLocalPlayer)return player.playbackStartTime();var streamInfo=getPlayerData(player).streamInfo;return streamInfo?streamInfo.playbackStartTimeTicks:null},apphost.supports("remotecontrol")&&require(["serverNotifications"],function(serverNotifications){events.on(serverNotifications,"ServerShuttingDown",self.setDefaultPlayerActive.bind(self)),events.on(serverNotifications,"ServerRestarting",self.setDefaultPlayerActive.bind(self))})}var startingPlaySession=(new Date).getTime();return PlaybackManager.prototype.getCurrentPlayer=function(){return this._currentPlayer},PlaybackManager.prototype.currentTime=function(player){return player=player||this._currentPlayer,!player||enableLocalPlaylistManagement(player)||player.isLocalPlayer?this.getCurrentTicks(player):player.currentTime()},PlaybackManager.prototype.nextItem=function(player){if((player=player||this._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.nextItem();var nextItem=this._playQueueManager.getNextItemInfo();if(!nextItem||!nextItem.item)return Promise.reject();var apiClient=connectionManager.getApiClient(nextItem.item.ServerId);return apiClient.getItem(apiClient.getCurrentUserId(),nextItem.item.Id)},PlaybackManager.prototype.canQueue=function(item){return"MusicAlbum"===item.Type||"MusicArtist"===item.Type||"MusicGenre"===item.Type?this.canQueueMediaType("Audio"):this.canQueueMediaType(item.MediaType)},PlaybackManager.prototype.canQueueMediaType=function(mediaType){return!!this._currentPlayer&&this._currentPlayer.canPlayMediaType(mediaType)},PlaybackManager.prototype.isMuted=function(player){ +return!!(player=player||this._currentPlayer)&&player.isMuted()},PlaybackManager.prototype.setMute=function(mute,player){(player=player||this._currentPlayer)&&player.setMute(mute)},PlaybackManager.prototype.toggleMute=function(mute,player){(player=player||this._currentPlayer)&&(player.toggleMute?player.toggleMute():player.setMute(!player.isMuted()))},PlaybackManager.prototype.toggleDisplayMirroring=function(){this.enableDisplayMirroring(!this.enableDisplayMirroring())},PlaybackManager.prototype.enableDisplayMirroring=function(enabled){if(null!=enabled){var val=enabled?"1":"0";return void appSettings.set("displaymirror",val)}return"0"!==(appSettings.get("displaymirror")||"")},PlaybackManager.prototype.nextChapter=function(player){player=player||this._currentPlayer;var item=this.currentItem(player),ticks=this.getCurrentTicks(player),nextChapter=(item.Chapters||[]).filter(function(i){return i.StartPositionTicks>ticks})[0];nextChapter?this.seek(nextChapter.StartPositionTicks,player):this.nextTrack(player)},PlaybackManager.prototype.previousChapter=function(player){player=player||this._currentPlayer;var item=this.currentItem(player),ticks=this.getCurrentTicks(player);ticks-=1e8,0===this.getCurrentPlaylistIndex(player)&&(ticks=Math.max(ticks,0));var previousChapters=(item.Chapters||[]).filter(function(i){return i.StartPositionTicks<=ticks});previousChapters.length?this.seek(previousChapters[previousChapters.length-1].StartPositionTicks,player):this.previousTrack(player)},PlaybackManager.prototype.fastForward=function(player){if(player=player||this._currentPlayer,null!=player.fastForward)return void player.fastForward(userSettings.skipForwardLength());var offsetTicks=1e4*userSettings.skipForwardLength();this.seekRelative(offsetTicks,player)},PlaybackManager.prototype.rewind=function(player){if(player=player||this._currentPlayer,null!=player.rewind)return void player.rewind(userSettings.skipBackLength());var offsetTicks=0-1e4*userSettings.skipBackLength();this.seekRelative(offsetTicks,player)},PlaybackManager.prototype.seekPercent=function(percent,player){player=player||this._currentPlayer;var ticks=this.duration(player)||0;percent/=100,ticks*=percent,this.seek(parseInt(ticks),player)},PlaybackManager.prototype.playTrailers=function(item){var apiClient=connectionManager.getApiClient(item.ServerId),instance=this;if(item.LocalTrailerCount)return apiClient.getLocalTrailers(apiClient.getCurrentUserId(),item.Id).then(function(result){return instance.play({items:result})});var remoteTrailers=item.RemoteTrailers||[];return remoteTrailers.length?this.play({items:remoteTrailers.map(function(t){return{Name:t.Name||item.Name+" Trailer",Url:t.Url,MediaType:"Video",Type:"Trailer",ServerId:apiClient.serverId()}})}):Promise.reject()},PlaybackManager.prototype.getSubtitleUrl=function(textStream,serverId){var apiClient=connectionManager.getApiClient(serverId);return textStream.IsExternalUrl?textStream.DeliveryUrl:apiClient.getUrl(textStream.DeliveryUrl)},PlaybackManager.prototype.stop=function(player){return player=player||this._currentPlayer,player?(enableLocalPlaylistManagement(player)&&(this._playNextAfterEnded=!1),player.stop(!0,!0)):Promise.resolve()},PlaybackManager.prototype.getBufferedRanges=function(player){return player=player||this._currentPlayer,player&&player.getBufferedRanges?player.getBufferedRanges():[]},PlaybackManager.prototype.playPause=function(player){if(player=player||this._currentPlayer)return player.playPause?player.playPause():player.paused()?this.unpause(player):this.pause(player)},PlaybackManager.prototype.paused=function(player){if(player=player||this._currentPlayer)return player.paused()},PlaybackManager.prototype.pause=function(player){(player=player||this._currentPlayer)&&player.pause()},PlaybackManager.prototype.unpause=function(player){(player=player||this._currentPlayer)&&player.unpause()},PlaybackManager.prototype.instantMix=function(item,player){if((player=player||this._currentPlayer)&&player.instantMix)return player.instantMix(item);var apiClient=connectionManager.getApiClient(item.ServerId),options={};options.UserId=apiClient.getCurrentUserId(),options.Limit=200;var instance=this;apiClient.getInstantMixFromItem(item.Id,options).then(function(result){instance.play({items:result.Items})})},PlaybackManager.prototype.shuffle=function(shuffleItem,player,queryOptions){return player=player||this._currentPlayer,player&&player.shuffle?player.shuffle(shuffleItem):this.play({items:[shuffleItem],shuffle:!0})},PlaybackManager.prototype.audioTracks=function(player){if(player=player||this._currentPlayer,player.audioTracks){var result=player.audioTracks();if(result)return result}return((this.currentMediaSource(player)||{}).MediaStreams||[]).filter(function(s){return"Audio"===s.Type})},PlaybackManager.prototype.subtitleTracks=function(player){if(player=player||this._currentPlayer,player.subtitleTracks){var result=player.subtitleTracks();if(result)return result}return((this.currentMediaSource(player)||{}).MediaStreams||[]).filter(function(s){return"Subtitle"===s.Type})},PlaybackManager.prototype.getSupportedCommands=function(player){if(player=player||this._currentPlayer||{isLocalPlayer:!0},player.isLocalPlayer){var list=["GoHome","GoToSettings","VolumeUp","VolumeDown","Mute","Unmute","ToggleMute","SetVolume","SetAudioStreamIndex","SetSubtitleStreamIndex","SetMaxStreamingBitrate","DisplayContent","GoToSearch","DisplayMessage","SetRepeatMode","PlayMediaSource"];return apphost.supports("fullscreenchange")&&list.push("ToggleFullscreen"),player.supports&&(player.supports("PictureInPicture")&&list.push("PictureInPicture"),player.supports("SetBrightness")&&list.push("SetBrightness"),player.supports("SetAspectRatio")&&list.push("SetAspectRatio")),list}var info=this.getPlayerInfo();return info?info.supportedCommands:[]},PlaybackManager.prototype.setRepeatMode=function(value,player){if((player=player||this._currentPlayer)&&!enableLocalPlaylistManagement(player))return player.setRepeatMode(value);this._playQueueManager.setRepeatMode(value),events.trigger(player,"repeatmodechange")},PlaybackManager.prototype.getRepeatMode=function(player){return player=player||this._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getRepeatMode():this._playQueueManager.getRepeatMode()},PlaybackManager.prototype.trySetActiveDeviceName=function(name){name=normalizeName(name);var instance=this;instance.getTargets().then(function(result){var target=result.filter(function(p){return normalizeName(p.name)===name})[0];target&&instance.trySetActivePlayer(target.playerName,target)})},PlaybackManager.prototype.displayContent=function(options,player){(player=player||this._currentPlayer)&&player.displayContent&&player.displayContent(options)},PlaybackManager.prototype.beginPlayerUpdates=function(player){player.beginPlayerUpdates&&player.beginPlayerUpdates()},PlaybackManager.prototype.endPlayerUpdates=function(player){player.endPlayerUpdates&&player.endPlayerUpdates()},PlaybackManager.prototype.setDefaultPlayerActive=function(){this.setActivePlayer("localplayer")},PlaybackManager.prototype.removeActivePlayer=function(name){var playerInfo=this.getPlayerInfo();playerInfo&&playerInfo.name===name&&this.setDefaultPlayerActive()},PlaybackManager.prototype.removeActiveTarget=function(id){var playerInfo=this.getPlayerInfo();playerInfo&&playerInfo.id===id&&this.setDefaultPlayerActive()},PlaybackManager.prototype.sendCommand=function(cmd,player){switch(console.log("MediaController received command: "+cmd.Name),cmd.Name){case"SetRepeatMode":this.setRepeatMode(cmd.Arguments.RepeatMode,player);break;case"VolumeUp":this.volumeUp(player);break;case"VolumeDown":this.volumeDown(player);break;case"Mute":this.setMute(!0,player);break;case"Unmute":this.setMute(!1,player);break;case"ToggleMute":this.toggleMute(player);break;case"SetVolume":this.setVolume(cmd.Arguments.Volume,player);break;case"SetAspectRatio":this.setAspectRatio(cmd.Arguments.AspectRatio,player);break;case"SetBrightness":this.setBrightness(cmd.Arguments.Brightness,player);break;case"SetAudioStreamIndex":this.setAudioStreamIndex(parseInt(cmd.Arguments.Index),player);break;case"SetSubtitleStreamIndex":this.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index),player);break;case"SetMaxStreamingBitrate":break;case"ToggleFullscreen":this.toggleFullscreen(player);break;default:player.sendCommand&&player.sendCommand(cmd)}},new PlaybackManager}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/playback/remotecontrolautoplay.js b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/playback/remotecontrolautoplay.js index d32371bca9..bbe8735f9a 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/playback/remotecontrolautoplay.js +++ b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/playback/remotecontrolautoplay.js @@ -1 +1 @@ -define(["events","playbackManager"],function(events,playbackManager){"use strict";function transferPlayback(oldPlayer,newPlayer){var state=playbackManager.getPlayerState(oldPlayer),item=state.NowPlayingItem;if(item){var playState=state.PlayState||{};playbackManager.stop(oldPlayer).then(function(){var resumePositionTicks=playState.PositionTicks||0;playbackManager.play({ids:[item.Id],serverId:item.ServerId,startPositionTicks:resumePositionTicks},newPlayer)})}}events.on(playbackManager,"playerchange",function(e,newPlayer,newTarget,oldPlayer){if(oldPlayer&&newPlayer)return oldPlayer.isLocalPlayer?newPlayer.isLocalPlayer?void console.log("Skipping remote control autoplay because newPlayer is a local player"):void transferPlayback(oldPlayer,newPlayer):void console.log("Skipping remote control autoplay because oldPlayer is not a local player")})}); \ No newline at end of file +define(["events","playbackManager"],function(events,playbackManager){"use strict";function transferPlayback(oldPlayer,newPlayer){var state=playbackManager.getPlayerState(oldPlayer),item=state.NowPlayingItem;if(item){var playState=state.PlayState||{},resumePositionTicks=playState.PositionTicks||0;playbackManager.stop(oldPlayer).then(function(){playbackManager.play({ids:[item.Id],serverId:item.ServerId,startPositionTicks:resumePositionTicks},newPlayer)})}}events.on(playbackManager,"playerchange",function(e,newPlayer,newTarget,oldPlayer){if(oldPlayer&&newPlayer)return oldPlayer.isLocalPlayer?newPlayer.isLocalPlayer?void console.log("Skipping remote control autoplay because newPlayer is a local player"):void transferPlayback(oldPlayer,newPlayer):void console.log("Skipping remote control autoplay because oldPlayer is not a local player")})}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/recordingcreator/recordingfields.css b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/recordingcreator/recordingfields.css index 2e74beedb1..67bae22751 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/recordingcreator/recordingfields.css +++ b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/recordingcreator/recordingfields.css @@ -1 +1 @@ -.recordingButton{margin-left:0;min-width:10em}.recordingIcon{font-size:1.3em!important}.recordingIcon-active{color:#c33}.recordSeriesContainer{margin-bottom:.8em} \ No newline at end of file +.recordingButton{margin-left:0;min-width:10em}.recordingIcon-active{color:#c33}.recordSeriesContainer{margin-bottom:.8em} \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/sync/syncjoblist.js b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/sync/syncjoblist.js index f3b2f485d8..cc08ae8d98 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/sync/syncjoblist.js +++ b/MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/sync/syncjoblist.js @@ -1 +1 @@ -define(["serverNotifications","events","loading","connectionManager","imageLoader","dom","globalize","registrationServices","layoutManager","listViewStyle"],function(serverNotifications,events,loading,connectionManager,imageLoader,dom,globalize,registrationServices,layoutManager){"use strict";function onSyncJobsUpdated(e,apiClient,data){renderList(this,data,apiClient)}function refreshList(listInstance,jobs){for(var i=0,length=jobs.length;i0&&progress<100&&(progress=progress.toFixed(1)),html+=progress+"%"}return html}function getSyncJobHtml(listInstance,job,apiClient){var html="",tagName=layoutManager.tv?"button":"div",typeAttribute="button"===tagName?' type="button"':"",listItemClass="listItem listItem-shaded";layoutManager.tv&&(listItemClass+=" listItem-button listItem-focusscale",listItemClass+=" btnJobMenu");var canEdit=(job.ItemCount||1)>1||"Queued"===job.Status;html+="<"+tagName+typeAttribute+' class="'+listItemClass+'" data-canedit="'+canEdit+'" data-id="'+job.Id+'" data-status="'+job.Status+'">';var imgUrl;job.PrimaryImageItemId&&(imgUrl=apiClient.getImageUrl(job.PrimaryImageItemId,{type:"Primary",width:80,tag:job.PrimaryImageTag,minScale:1.5})),imgUrl?(html+='
',html+="
"):html+='file_download';var textLines=[],name=job.Name;job.ParentName&&(name+=" - "+job.ParentName),textLines.push(name),1===job.ItemCount||textLines.push(globalize.translate("sharedcomponents#ItemCount",job.ItemCount)),html+='
';for(var i=0,length=textLines.length;i',html+=textLines[i],html+=""):(html+='
',html+=textLines[i],html+="
");return html+='
',html+=getProgressText(job),html+="
",html+="
",layoutManager.tv||(html+=canEdit?'':''),html+=""}function renderList(listInstance,jobs,apiClient){if((new Date).getTime()-listInstance.lastDataLoad<6e4)return void refreshList(listInstance,jobs);listInstance.lastDataLoad=(new Date).getTime();for(var html="",lastTargetName="",isLocalSync=listInstance.options.isLocalSync,showTargetName=!isLocalSync,hasOpenSection=!1,i=0,length=jobs.length;i",html+="
",hasOpenSection=!1),lastTargetName=targetName,html+='
',html+='
',html+='

'+targetName+"

",html+="
",html+='
',hasOpenSection=!0)}html+=getSyncJobHtml(listInstance,job,apiClient)}hasOpenSection&&(html+="
",html+="
");var elem=listInstance.options.element.querySelector(".syncJobListContent");html||(html=isLocalSync?'
'+globalize.translate("sharedcomponents#MessageNoDownloadsFound")+"
":'
'+globalize.translate("sharedcomponents#MessageNoSyncJobsFound")+"
"),elem.innerHTML=html,imageLoader.lazyChildren(elem)}function fetchData(listInstance){listInstance.lastDataLoad=0,loading.show();var options={},apiClient=getApiClient(listInstance);return listInstance.options.userId&&(options.UserId=listInstance.options.userId),listInstance.options.isLocalSync&&(options.TargetId=apiClient.deviceId()),apiClient.getJSON(apiClient.getUrl("Sync/Jobs",options)).then(function(response){renderList(listInstance,response.Items,apiClient),loading.hide()})}function startListening(listInstance){var startParams="0,1500",apiClient=getApiClient(listInstance);listInstance.options.userId&&(startParams+=","+listInstance.options.userId),listInstance.options.isLocalSync?startParams+=","+apiClient.deviceId():!1===listInstance.options.enableRemoteSyncManagement&&(startParams+=",true"),apiClient.sendMessage("SyncJobsStart",startParams)}function stopListening(listInstance){getApiClient(listInstance).sendMessage("SyncJobsStop","")}function getApiClient(listInstance){return connectionManager.getApiClient(listInstance.options.serverId)}function showJobMenu(listInstance,elem){var item=dom.parentWithClass(elem,"listItem"),jobId=item.getAttribute("data-id"),menuItems=(item.getAttribute("data-status"),[]);"true"===item.getAttribute("data-canedit")&&menuItems.push({name:globalize.translate("sharedcomponents#Edit"),id:"edit"});var txt=globalize.translate("sharedcomponents#RemoveDownload");menuItems.push({name:txt,id:"cancel"}),require(["actionsheet"],function(actionsheet){actionsheet.show({items:menuItems,positionTo:elem,callback:function(id){switch(id){case"delete":case"cancel":cancelJob(listInstance,jobId);break;case"edit":showJobEditor(listInstance,elem)}}})})}function onElementClick(e){var listInstance=this,btnJobMenu=dom.parentWithClass(e.target,"btnJobMenu");if(btnJobMenu)return void showJobMenu(listInstance,btnJobMenu);var btnCancelJob=dom.parentWithClass(e.target,"btnCancelJob");if(btnCancelJob){var listItem=dom.parentWithClass(btnCancelJob,"listItem");if(listItem){cancelJob(listInstance,listItem.getAttribute("data-id"))}}else showJobEditor(listInstance,e.target)}function showJobEditor(listInstance,elem){var listItem=dom.parentWithClass(elem,"listItem");if(listItem&&"true"===listItem.getAttribute("data-canedit")){var jobId=listItem.getAttribute("data-id");require(["syncJobEditor"],function(syncJobEditor){syncJobEditor.show({serverId:listInstance.options.serverId,jobId:jobId,isLocalSync:listInstance.options.isLocalSync}).then(function(){fetchData(listInstance)})})}}function syncJobList(options){this.options=options;var onSyncJobsUpdatedHandler=onSyncJobsUpdated.bind(this);this.onSyncJobsUpdatedHandler=onSyncJobsUpdatedHandler,events.on(serverNotifications,"SyncJobs",onSyncJobsUpdatedHandler);var onClickHandler=onElementClick.bind(this);options.element.addEventListener("click",onClickHandler),this.onClickHandler=onClickHandler,options.element.innerHTML='
',fetchData(this),startListening(this),initSupporterInfo(options.element,getApiClient(this))}function showSupporterInfo(context){var html='':''),html+=""}function renderList(listInstance,jobs,apiClient){if((new Date).getTime()-listInstance.lastDataLoad<6e4)return void refreshList(listInstance,jobs);listInstance.lastDataLoad=(new Date).getTime();for(var html="",lastTargetName="",isLocalSync=listInstance.options.isLocalSync,showTargetName=!isLocalSync,hasOpenSection=!1,i=0,length=jobs.length;i",html+="
",hasOpenSection=!1),lastTargetName=targetName,html+='
',html+='
',html+='

'+targetName+"

",html+="
",html+='
',hasOpenSection=!0)}html+=getSyncJobHtml(listInstance,job,apiClient)}hasOpenSection&&(html+="
",html+="
");var elem=listInstance.options.element.querySelector(".syncJobListContent");html||(html=isLocalSync?'
'+globalize.translate("sharedcomponents#MessageNoDownloadsFound")+"
":'
'+globalize.translate("sharedcomponents#MessageNoSyncJobsFound")+"
"),elem.innerHTML=html,imageLoader.lazyChildren(elem)}function fetchData(listInstance){listInstance.lastDataLoad=0,loading.show();var options={},apiClient=getApiClient(listInstance);return listInstance.options.userId&&(options.UserId=listInstance.options.userId),listInstance.options.isLocalSync&&(options.TargetId=apiClient.deviceId()),apiClient.getJSON(apiClient.getUrl("Sync/Jobs",options)).then(function(response){renderList(listInstance,response.Items,apiClient),loading.hide()})}function startListening(listInstance){var startParams="0,1500",apiClient=getApiClient(listInstance);listInstance.options.userId&&(startParams+=","+listInstance.options.userId),listInstance.options.isLocalSync?startParams+=","+apiClient.deviceId():!1===listInstance.options.enableRemoteSyncManagement&&(startParams+=",true"),apiClient.sendMessage("SyncJobsStart",startParams)}function stopListening(listInstance){getApiClient(listInstance).sendMessage("SyncJobsStop","")}function getApiClient(listInstance){return connectionManager.getApiClient(listInstance.options.serverId)}function showJobMenu(listInstance,elem){var item=dom.parentWithClass(elem,"listItem"),jobId=item.getAttribute("data-id"),menuItems=(item.getAttribute("data-status"),[]);"true"===item.getAttribute("data-canedit")&&menuItems.push({name:globalize.translate("sharedcomponents#Edit"),id:"edit"});var txt=globalize.translate("sharedcomponents#RemoveDownload");menuItems.push({name:txt,id:"cancel"}),require(["actionsheet"],function(actionsheet){actionsheet.show({items:menuItems,positionTo:elem,callback:function(id){switch(id){case"delete":case"cancel":cancelJob(listInstance,jobId);break;case"edit":showJobEditor(listInstance,elem)}}})})}function onElementClick(e){var listInstance=this,btnJobMenu=dom.parentWithClass(e.target,"btnJobMenu");if(btnJobMenu)return void showJobMenu(listInstance,btnJobMenu);var btnCancelJob=dom.parentWithClass(e.target,"btnCancelJob");if(btnCancelJob){var listItem=dom.parentWithClass(btnCancelJob,"listItem");if(listItem){cancelJob(listInstance,listItem.getAttribute("data-id"))}}else showJobEditor(listInstance,e.target)}function showJobEditor(listInstance,elem){var listItem=dom.parentWithClass(elem,"listItem");if(listItem&&"true"===listItem.getAttribute("data-canedit")){var jobId=listItem.getAttribute("data-id");require(["syncJobEditor"],function(syncJobEditor){syncJobEditor.show({serverId:listInstance.options.serverId,jobId:jobId,isLocalSync:listInstance.options.isLocalSync}).then(function(){fetchData(listInstance)})})}}function syncJobList(options){this.options=options;var onSyncJobsUpdatedHandler=onSyncJobsUpdated.bind(this);this.onSyncJobsUpdatedHandler=onSyncJobsUpdatedHandler,events.on(serverNotifications,"SyncJobs",onSyncJobsUpdatedHandler);var onClickHandler=onElementClick.bind(this);options.element.addEventListener("click",onClickHandler),this.onClickHandler=onClickHandler,options.element.innerHTML='
',fetchData(this),startListening(this),initSupporterInfo(options.element,getApiClient(this))}function showSupporterInfo(context){var html='':plugins.length>1&&(html+=''),html+=""}return html+="",html+='
'+globalize.translate("LabelMetadataReadersHelp")+"
",elem.innerHTML=html,elem.classList.remove("hide"),!0}function renderMetadataSavers(page,metadataSavers){var html="",elem=page.querySelector(".metadataSavers");if(!metadataSavers.length)return elem.innerHTML="",elem.classList.add("hide"),!1;html+='

'+globalize.translate("LabelMetadataSavers")+"

",html+='
';for(var i=0,length=metadataSavers.length;i"+plugin.Name+""}return html+="
",html+='
'+globalize.translate("LabelMetadataSaversHelp")+"
",elem.innerHTML=html,elem.classList.remove("hide"),!0}function getMetadataFetchersForTypeHtml(availableTypeOptions,libraryOptionsForType){var html="",plugins=availableTypeOptions.MetadataFetchers;if(plugins=getOrderedPlugins(plugins,libraryOptionsForType.MetadataFetcherOrder||[]),!plugins.length)return html;html+='
',html+='

'+availableTypeOptions.Type+" "+globalize.translate("LabelMetadataDownloaders")+"

",html+='
';for(var i=0,length=plugins.length;i';var isChecked=libraryOptionsForType.MetadataFetchers?-1!==libraryOptionsForType.MetadataFetchers.indexOf(plugin.Name):plugin.DefaultEnabled,checkedHtml=isChecked?' checked="checked"':"";html+='",html+='
',html+='

',html+=plugin.Name,html+="

",html+="
",i>0?html+='':plugins.length>1&&(html+=''),html+="
"}return html+="
",html+='
'+globalize.translate("LabelMetadataDownloadersHelp")+"
",html+=""}function getTypeOptions(allOptions,type){for(var allTypeOptions=allOptions.TypeOptions||[],i=0,length=allTypeOptions.length;i",html+='
';for(var i=0,length=plugins.length;i';var isChecked=libraryOptions.DisabledSubtitleFetchers?-1===libraryOptions.DisabledSubtitleFetchers.indexOf(plugin.Name):plugin.DefaultEnabled,checkedHtml=isChecked?' checked="checked"':"";html+='",html+='
',html+='

',html+=plugin.Name,html+="

",html+="
",i>0?html+='':plugins.length>1&&(html+=''),html+="
"}html+="",html+='
'+globalize.translate("SubtitleDownloadersHelp")+"
",elem.innerHTML=html}catch(err){alert(err)}}function getImageFetchersForTypeHtml(availableTypeOptions,libraryOptionsForType){var html="",plugins=availableTypeOptions.ImageFetchers;if(plugins=getOrderedPlugins(plugins,libraryOptionsForType.ImageFetcherOrder||[]),!plugins.length)return html;html+='
',html+='

'+availableTypeOptions.Type+" "+globalize.translate("LabelImageFetchers")+"

",html+='
';for(var i=0,length=plugins.length;i';var isChecked=libraryOptionsForType.ImageFetchers?-1!==libraryOptionsForType.ImageFetchers.indexOf(plugin.Name):plugin.DefaultEnabled,checkedHtml=isChecked?' checked="checked"':"";html+='",html+='
',html+='

',html+=plugin.Name,html+="

",html+="
",i>0?html+='':plugins.length>1&&(html+=''),html+="
"}return html+="
",html+='
'+globalize.translate("LabelImageFetchersHelp")+"
",html+=""}function renderImageFetchers(page,availableOptions,libraryOptions){for(var html="",elem=page.querySelector(".imageFetchers"),i=0,length=availableOptions.TypeOptions.length;ib?1:0}),plugins}function setLibraryOptions(parent,options){parent.querySelector("#selectLanguage").value=options.PreferredMetadataLanguage||"",parent.querySelector("#selectCountry").value=options.MetadataCountryCode||"",parent.querySelector("#selectAutoRefreshInterval").value=options.AutomaticRefreshIntervalDays||"0",parent.querySelector("#txtSeasonZeroName").value=options.SeasonZeroDisplayName||"Specials",parent.querySelector(".chkEnablePhotos").checked=options.EnablePhotos,parent.querySelector(".chkEnableRealtimeMonitor").checked=options.EnableRealtimeMonitor,parent.querySelector(".chkExtractChaptersDuringLibraryScan").checked=options.ExtractChapterImagesDuringLibraryScan,parent.querySelector(".chkExtractChapterImages").checked=options.EnableChapterImageExtraction,parent.querySelector("#chkDownloadImagesInAdvance").checked=options.DownloadImagesInAdvance,parent.querySelector("#chkSaveLocal").checked=options.SaveLocalMetadata,parent.querySelector("#chkImportMissingEpisodes").checked=options.ImportMissingEpisodes,parent.querySelector(".chkAutomaticallyGroupSeries").checked=options.EnableAutomaticSeriesGrouping,parent.querySelector("#chkEnableEmbeddedTitles").checked=options.EnableEmbeddedTitles,parent.querySelector("#chkSkipIfGraphicalSubsPresent").checked=options.SkipSubtitlesIfEmbeddedSubtitlesPresent,parent.querySelector("#chkSkipIfAudioTrackPresent").checked=options.SkipSubtitlesIfAudioTrackMatches,parent.querySelector("#chkRequirePerfectMatch").checked=options.RequirePerfectSubtitleMatch,Array.prototype.forEach.call(parent.querySelectorAll(".chkMetadataSaver"),function(elem){elem.checked=options.MetadataSavers?-1!==options.MetadataSavers.indexOf(elem.getAttribute("data-pluginname")):"true"===elem.getAttribute("data-defaultenabled")}),Array.prototype.forEach.call(parent.querySelectorAll(".chkSubtitleLanguage"),function(elem){elem.checked=!!options.SubtitleDownloadLanguages&&-1!==options.SubtitleDownloadLanguages.indexOf(elem.getAttribute("data-lang"))}),renderMetadataReaders(parent,getOrderedPlugins(parent.availableOptions.MetadataReaders,options.LocalMetadataReaderOrder||[])),renderMetadataFetchers(parent,parent.availableOptions,options),renderImageFetchers(parent,parent.availableOptions,options),renderSubtitleFetchers(parent,parent.availableOptions,options)}return{embed:embed,setContentType:setContentType,getLibraryOptions:getLibraryOptions,setLibraryOptions:setLibraryOptions}}); \ No newline at end of file +define(["globalize","dom","emby-checkbox","emby-select","emby-input"],function(globalize,dom){"use strict";function populateLanguages(parent){return ApiClient.getCultures().then(function(languages){populateLanguagesIntoSelect(parent.querySelector("#selectLanguage"),languages),populateLanguagesIntoList(parent.querySelector(".subtitleDownloadLanguages"),languages)})}function populateLanguagesIntoSelect(select,languages){var html="";html+="";for(var i=0,length=languages.length;i"+culture.DisplayName+""}select.innerHTML=html}function populateLanguagesIntoList(element,languages){for(var html="",i=0,length=languages.length;i'+culture.DisplayName+""}element.innerHTML=html}function populateCountries(select){return ApiClient.getCountries().then(function(allCountries){var html="";html+="";for(var i=0,length=allCountries.length;i"+culture.DisplayName+""}select.innerHTML=html})}function populateRefreshInterval(select){var html="";html+="",html+=[30,60,90].map(function(val){return""}).join(""),select.innerHTML=html}function renderMetadataReaders(page,plugins){var html="",elem=page.querySelector(".metadataReaders");if(plugins.length<2)return elem.innerHTML="",elem.classList.add("hide"),!1;html+='

'+globalize.translate("LabelMetadataReaders")+"

",html+='
';for(var i=0,length=plugins.length;i',html+='live_tv',html+='
',html+='

',html+=plugin.Name,html+="

",html+="
",i>0?html+='':plugins.length>1&&(html+=''),html+="
"}return html+="",html+='
'+globalize.translate("LabelMetadataReadersHelp")+"
",elem.innerHTML=html,elem.classList.remove("hide"),!0}function renderMetadataSavers(page,metadataSavers){var html="",elem=page.querySelector(".metadataSavers");if(!metadataSavers.length)return elem.innerHTML="",elem.classList.add("hide"),!1;html+='

'+globalize.translate("LabelMetadataSavers")+"

",html+='
';for(var i=0,length=metadataSavers.length;i"+plugin.Name+""}return html+="
",html+='
'+globalize.translate("LabelMetadataSaversHelp")+"
",elem.innerHTML=html,elem.classList.remove("hide"),!0}function getMetadataFetchersForTypeHtml(availableTypeOptions,libraryOptionsForType){var html="",plugins=availableTypeOptions.MetadataFetchers;if(plugins=getOrderedPlugins(plugins,libraryOptionsForType.MetadataFetcherOrder||[]),!plugins.length)return html;html+='
',html+='

'+availableTypeOptions.Type+" "+globalize.translate("LabelMetadataDownloaders")+"

",html+='
';for(var i=0,length=plugins.length;i';var isChecked=libraryOptionsForType.MetadataFetchers?-1!==libraryOptionsForType.MetadataFetchers.indexOf(plugin.Name):plugin.DefaultEnabled,checkedHtml=isChecked?' checked="checked"':"";html+='",html+='
',html+='

',html+=plugin.Name,html+="

",html+="
",i>0?html+='':plugins.length>1&&(html+=''),html+="
"}return html+="
",html+='
'+globalize.translate("LabelMetadataDownloadersHelp")+"
",html+=""}function getTypeOptions(allOptions,type){for(var allTypeOptions=allOptions.TypeOptions||[],i=0,length=allTypeOptions.length;i",html+='
';for(var i=0,length=plugins.length;i';var isChecked=libraryOptions.DisabledSubtitleFetchers?-1===libraryOptions.DisabledSubtitleFetchers.indexOf(plugin.Name):plugin.DefaultEnabled,checkedHtml=isChecked?' checked="checked"':"";html+='",html+='
',html+='

',html+=plugin.Name,html+="

","Open Subtitles"===plugin.Name&&(html+='
',html+=globalize.translate("OpenSubtitleInstructions"),html+="
"),html+="
",i>0?html+='':plugins.length>1&&(html+=''),html+="
"}html+="",html+='
'+globalize.translate("SubtitleDownloadersHelp")+"
",elem.innerHTML=html}catch(err){alert(err)}}function getImageFetchersForTypeHtml(availableTypeOptions,libraryOptionsForType){var html="",plugins=availableTypeOptions.ImageFetchers;if(plugins=getOrderedPlugins(plugins,libraryOptionsForType.ImageFetcherOrder||[]),!plugins.length)return html;html+='
',html+='

'+availableTypeOptions.Type+" "+globalize.translate("LabelImageFetchers")+"

",html+='
';for(var i=0,length=plugins.length;i';var isChecked=libraryOptionsForType.ImageFetchers?-1!==libraryOptionsForType.ImageFetchers.indexOf(plugin.Name):plugin.DefaultEnabled,checkedHtml=isChecked?' checked="checked"':"";html+='",html+='
',html+='

',html+=plugin.Name,html+="

",html+="
",i>0?html+='':plugins.length>1&&(html+=''),html+="
"}return html+="
",html+='
'+globalize.translate("LabelImageFetchersHelp")+"
",html+=""}function renderImageFetchers(page,availableOptions,libraryOptions){for(var html="",elem=page.querySelector(".imageFetchers"),i=0,length=availableOptions.TypeOptions.length;ib?1:0}),plugins}function setLibraryOptions(parent,options){parent.querySelector("#selectLanguage").value=options.PreferredMetadataLanguage||"",parent.querySelector("#selectCountry").value=options.MetadataCountryCode||"",parent.querySelector("#selectAutoRefreshInterval").value=options.AutomaticRefreshIntervalDays||"0",parent.querySelector("#txtSeasonZeroName").value=options.SeasonZeroDisplayName||"Specials",parent.querySelector(".chkEnablePhotos").checked=options.EnablePhotos,parent.querySelector(".chkEnableRealtimeMonitor").checked=options.EnableRealtimeMonitor,parent.querySelector(".chkExtractChaptersDuringLibraryScan").checked=options.ExtractChapterImagesDuringLibraryScan,parent.querySelector(".chkExtractChapterImages").checked=options.EnableChapterImageExtraction,parent.querySelector("#chkDownloadImagesInAdvance").checked=options.DownloadImagesInAdvance,parent.querySelector("#chkSaveLocal").checked=options.SaveLocalMetadata,parent.querySelector("#chkImportMissingEpisodes").checked=options.ImportMissingEpisodes,parent.querySelector(".chkAutomaticallyGroupSeries").checked=options.EnableAutomaticSeriesGrouping,parent.querySelector("#chkEnableEmbeddedTitles").checked=options.EnableEmbeddedTitles,parent.querySelector("#chkSkipIfGraphicalSubsPresent").checked=options.SkipSubtitlesIfEmbeddedSubtitlesPresent,parent.querySelector("#chkSaveSubtitlesLocally").checked=options.SaveSubtitlesWithMedia,parent.querySelector("#chkSkipIfAudioTrackPresent").checked=options.SkipSubtitlesIfAudioTrackMatches,parent.querySelector("#chkRequirePerfectMatch").checked=options.RequirePerfectSubtitleMatch,Array.prototype.forEach.call(parent.querySelectorAll(".chkMetadataSaver"),function(elem){elem.checked=options.MetadataSavers?-1!==options.MetadataSavers.indexOf(elem.getAttribute("data-pluginname")):"true"===elem.getAttribute("data-defaultenabled")}),Array.prototype.forEach.call(parent.querySelectorAll(".chkSubtitleLanguage"),function(elem){elem.checked=!!options.SubtitleDownloadLanguages&&-1!==options.SubtitleDownloadLanguages.indexOf(elem.getAttribute("data-lang"))}),renderMetadataReaders(parent,getOrderedPlugins(parent.availableOptions.MetadataReaders,options.LocalMetadataReaderOrder||[])),renderMetadataFetchers(parent,parent.availableOptions,options),renderImageFetchers(parent,parent.availableOptions,options),renderSubtitleFetchers(parent,parent.availableOptions,options)}return{embed:embed,setContentType:setContentType,getLibraryOptions:getLibraryOptions,setLibraryOptions:setLibraryOptions}}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.template.html b/MediaBrowser.WebDashboard/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.template.html index 37576c2f50..59ba2bfe5f 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.template.html +++ b/MediaBrowser.WebDashboard/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -129,4 +129,12 @@

${LabelDownloadLanguages}

${LabelSkipIfGraphicalSubsPresentHelp}
+ +
+ +
${SaveSubtitlesIntoMediaFoldersHelp}
+
\ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/css/librarybrowser.css b/MediaBrowser.WebDashboard/dashboard-ui/css/librarybrowser.css index 60d4f1ef0e..08325272dd 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/css/librarybrowser.css +++ b/MediaBrowser.WebDashboard/dashboard-ui/css/librarybrowser.css @@ -1 +1 @@ -.headerUserImage,.navMenuOption,.pageTitle{vertical-align:middle}.detailButton-mobile,.itemLinks,.listPaging,.sectionTabs,.viewSettings{text-align:center}.headerSelectedPlayer,.itemMiscInfo{-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden}.libraryPage{padding-top:7.5em!important}.itemDetailPage{padding-top:4em!important}.standalonePage{padding-top:5.5em!important}.wizardPage{padding-top:7em!important}.libraryPage:not(.noSecondaryNavPage){padding-top:9.2em!important}.absolutePageTabContent{position:absolute;left:0;right:0;bottom:0;z-index:1;margin:0!important;top:6.9em!important;-webkit-transition:-webkit-transform .2s ease-out;-o-transition:transform .2s ease-out;transition:transform .2s ease-out}.pageTabContent:not(.is-active){display:none!important}.navMenuDivider{height:1px;margin:.5em 0;display:none}.headerUserImage{-webkit-background-size:contain;background-size:contain;background-repeat:no-repeat;background-position:center center;-webkit-border-radius:100em;border-radius:100em;display:inline-block}.headerUserButtonRound img{-webkit-border-radius:100em;border-radius:100em}.headerButton{-webkit-flex-shrink:0;flex-shrink:0;font-size:108%}.hideMainDrawer .mainDrawerButton{display:none}.noHeaderRight .headerRight,.noHomeButtonHeader .headerHomeButton{display:none!important}.pageTitle{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;margin:0 0 0 .5em;height:1.7em;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-flex-shrink:1;flex-shrink:1}.detailButton-mobile,.skinHeader{-webkit-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal}.pageTitleWithLogo{background-position:left center;-webkit-background-size:contain;background-size:contain;background-repeat:no-repeat;width:13.2em}.pageTitleWithDefaultLogo{height:1.22em}.skinHeader{position:fixed;right:0;left:0;z-index:999;top:0;border:0;display:-webkit-box;display:-webkit-flex;display:flex;flex-direction:column;background-color:#121212;color:#ccc;contain:layout style paint}.mainAnimatedPages,.pageTabContent{contain:layout style}.hiddenViewMenuBar .skinHeader{display:none}.headerLeft,.headerRight{display:-webkit-box;display:-webkit-flex;-webkit-box-align:center}.headerTop{padding:.865em 0}.headerLeft{display:flex;-webkit-align-items:center;align-items:center;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;overflow:hidden}.sectionTabs{width:100%}.headerRight{display:flex;-webkit-align-items:center;align-items:center;-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.selectedMediaFolder{background-color:#f2f2f2!important}.navMenuOption{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-decoration:none;color:inherit;padding:.9em 0 .9em 2.4em;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.layout-desktop .searchTabButton,.layout-mobile .searchTabButton,.layout-tv .headerSearchButton,body:not(.dashboardDocument) .btnNotifications{display:none!important}.navMenuOptionIcon{margin-right:1em;-webkit-flex-shrink:0;flex-shrink:0}.sidebarHeader{padding-left:1.2em;margin:1em 0 .5em}.dashboardDocument .skinBody{-webkit-transition:left ease-in-out .3s,padding ease-in-out .3s;-o-transition:left ease-in-out .3s,padding ease-in-out .3s;transition:left ease-in-out .3s,padding ease-in-out .3s;position:absolute;top:0;right:0;bottom:0;left:0}@media all and (max-width:40em){.navMenuOption{font-size:110%}}.mainDrawer-scrollContainer{padding-bottom:10vh}@media all and (min-width:40em){.dashboardDocument .adminDrawerLogo,.dashboardDocument .mainDrawerButton{display:none!important}.dashboardDocument .mainDrawer{z-index:inherit!important;left:0!important;top:0!important;-webkit-transform:none!important;transform:none!important;-webkit-box-shadow:none!important;box-shadow:none!important;width:20.07em!important;font-size:92%}.dashboardDocument .mainDrawer-scrollContainer{margin-top:5em!important}.dashboardDocument.withSectionTabs .mainDrawer-scrollContainer{margin-top:8.7em!important}.dashboardDocument .skinBody{left:20em}}@media all and (min-width:40em) and (max-width:84em){.dashboardDocument.withSectionTabs .mainDrawer-scrollContainer{margin-top:8.4em!important}}@media all and (max-width:60em){.libraryDocument .mainDrawerButton{display:none}}@media all and (max-width:84em){.withSectionTabs .headerTop{padding-bottom:.2em}.sectionTabs{font-size:83.5%}}@media all and (min-width:84em){.headerTop{padding:1.489em 0}.headerTabs{-webkit-align-self:center;align-self:center;width:auto;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;margin-top:-3.34em;position:relative;top:-1em}.libraryPage:not(.noSecondaryNavPage){padding-top:6.3em!important}.pageWithAbsoluteTabs:not(.noSecondaryNavPage){padding-top:8.4em!important}.absolutePageTabContent{top:5.7em!important}.dashboardDocument.withSectionTabs .mainDrawer-scrollContainer{margin-top:6.1em!important}.dashboardDocument .mainDrawer-scrollContainer{margin-top:6.3em!important}}.headerSelectedPlayer{max-width:10em;white-space:nowrap}@media all and (max-width:37.5em){.headerSelectedPlayer{display:none}}.hidingAnimatedTab{visibility:hidden}.headerArrowImage{height:20px;margin-left:.5em}.backdropContainer{position:fixed;top:0;left:0;right:0;bottom:0;z-index:-1}.libraryPage .header{padding-bottom:0}.flexPageTabContent.is-active{display:-webkit-box!important;display:-webkit-flex!important;display:flex!important}.viewSettings{margin:0 0 .25em}.viewControls+.listTopPaging{margin-left:.5em!important}.criticReview{margin:1.5em 0;background:#222;padding:.8em .8em .8em 3em;-webkit-border-radius:.3em;border-radius:.3em;position:relative}.detailLogo,.itemBackdrop{background-repeat:no-repeat;background-position:center center}.criticReview:first-child{margin-top:.5em}.criticReview img{width:2.4em}.criticRatingScore{margin-bottom:.5em}.itemTag{display:inline-block;margin-right:1em}.itemOverview{white-space:pre-wrap}.itemLinks{padding:0}.itemLinks p{margin:.5em 0}.reviewLink,.reviewerName{margin-top:.5em}.reviewerName{color:#ccc}.reviewDate{margin-left:1em}.reviewScore{position:absolute;left:.8em}.itemBackdrop{-webkit-background-size:cover;background-size:cover;height:50vh;position:relative}.itemBackdropProgressBar{position:absolute!important;bottom:0;left:0;right:0}.itemBackdropFader{position:absolute;bottom:-1px;left:0;right:0;height:15vh}.desktopMiscInfoContainer{position:absolute;bottom:.75em}.detailImageContainer{margin-right:2em;width:280px;-webkit-flex-shrink:0;flex-shrink:0}.detailPagePrimaryContent{position:relative;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.detailLogo{width:21.3em;height:5em;position:absolute;top:13.5%;right:19.5%;-webkit-background-size:contain;background-size:contain}@media all and (max-width:87.5em){.detailLogo{right:5%}}@media all and (max-width:75em){.detailLogo{right:2%}}@media all and (max-width:68.75em){.detailLogo{width:14.91em;height:3.5em;right:5%;bottom:5%;top:auto;background-position:center right;display:none}}.itemDetailImage{width:100%}.thumbDetailImageContainer{width:400px}.itemDetailImage.loaded{-webkit-box-shadow:0 .0725em .29em 0 rgba(0,0,0,.37);box-shadow:0 .0725em .29em 0 rgba(0,0,0,.37)}@media all and (max-width:62.5em){.detailPageContent{position:relative}.detailImageContainer{position:absolute;top:-90px;left:5%;width:auto}.itemDetailImage{height:120px;width:auto!important}.btnPlaySimple{display:none!important}}@media all and (min-width:62.5em){.itemBackdrop{display:none}.detailPagePrimaryContainer{display:-webkit-box;display:-webkit-flex;display:flex;margin-bottom:3.6em}}@media all and (max-width:75em){.lnkSibling{display:none!important}}.parentName{display:block;margin-bottom:.5em}.emby-button.detailFloatingButton{position:absolute;background-color:rgba(0,0,0,.5)!important;z-index:1;top:50%;left:50%;margin:-2.2em 0 0 -2.2em;border:2.7px solid rgba(255,255,255,.6);padding:.38em!important;color:rgba(255,255,255,.76)}.emby-button.detailFloatingButton i{font-size:3.5em}@media all and (max-width:62.5em){.parentName{margin-bottom:1em}.itemDetailPage{padding-top:0!important}.detailimg-hidemobile{display:none}}@media all and (min-width:31.25em){.mobileDetails{display:none}}@media all and (max-width:31.25em){.desktopDetails{display:none!important}}.detailButton-mobile,.mainDetailButtons{display:-webkit-box;display:-webkit-flex}.itemName{margin:.5em 0}.empty{margin:0}.detailCollapsibleSection:not(.hide)+.detailCollapsibleSection{margin-top:-2em}.detailPageCollabsible{margin-top:0}.mainDetailButtons{display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-flex-wrap:wrap;flex-wrap:wrap;margin:1em 0}.recordingFields button{margin-left:0;margin-right:.5em;-webkit-flex-shrink:0;flex-shrink:0}.mainDetailButtons.hide+.recordingFields{margin-top:1.5em!important}.mainDetailButtons>.raised{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.detailButton-mobile{display:flex;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center;margin:0!important;padding-top:.5em!important;padding-bottom:.5em!important}@media all and (min-width:29em){.detailButton-mobile{margin-right:.1em!important}}@media all and (min-width:32em){.detailButton-mobile{margin-right:.2em!important}}@media all and (min-width:35em){.detailButton-mobile{margin-right:.3em!important}}.detailButton-mobile-content{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.detailButton-mobile-icon{font-size:1.6em!important;width:1em;height:1em}.detailImageProgressContainer{position:absolute;bottom:4px;right:1px;left:1px;text-align:center}@media all and (max-width:62.5em){.detailButton-mobile-text{margin-top:.7em;font-size:80%;font-weight:400}.mainDetailButtons{margin-left:-.5em}}@media all and (min-width:62.5em){.detailButton-mobile-icon:not(.always),.detailButton-mobile-text.texthide{display:none!important}.detailButton-mobile{padding-top:0!important;padding-bottom:0!important;height:3em}.mainDetailButtons{font-size:108%;margin:1.25em 0}.detailButton-mobile-icon:not(.notext){margin-right:.25em}.detailButton-mobile-icon.playstatebutton-icon-unplayed{opacity:.2}.detailButton-mobile-content{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}}.listTopPaging,.viewControls{display:inline-block}@media all and (max-width:50em){.editorMenuLink{display:none}}.itemMiscInfo{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-webkit-align-items:center;align-items:center}@media all and (max-width:31.25em){.mobileDetails .itemMiscInfo{text-align:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.itemMiscInfo .endsAt{display:none}}.layout-tv .detailVerticalSection{margin-bottom:3.4em!important}.detailPageContent{border-spacing:0;border-collapse:collapse;padding-top:3em}@media all and (max-width:62.5em){.detailPageContent-nodetailimg{padding-top:0;margin-top:-3em}}@media all and (min-width:75em){.itemDetailPage .padded-left{padding-left:4%!important}.itemDetailPage .padded-right{padding-right:4%!important}}.mediaInfoContent{line-height:1.5em}.mediaInfoStream{margin:0 3em 0 0;display:inline-block;vertical-align:top}.mediaInfoStreamType{display:block;margin:1em 0}.mediaInfoAttribute,.mediaInfoLabel{display:inline-block}.mediaInfoLabel{margin-right:1em;font-weight:600}.recordingProgressBar::-moz-progress-bar{background-color:#c33}.recordingProgressBar::-webkit-progress-value{background-color:#c33}.recordingProgressBar[aria-valuenow]:before{background-color:#c33}.timelineHeader{margin-bottom:.25em;line-height:1.25em;line-height:initial}.itemsContainer{margin:0 auto}@media all and (max-height:31.25em){.itemBackdrop{height:52vh}}@media all and (max-width:75em){.listViewUserDataButtons{display:none!important}}@media all and (max-width:62.5em){.detailsHiddenOnMobile{display:none}}.btnSyncComplete{background:#673AB7!important}.btnSyncComplete i{-webkit-border-radius:1000px;border-radius:1000px}.bulletSeparator{margin:0 .35em}.mediaInfoIcons{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;margin:1em 0;-webkit-flex-wrap:wrap;flex-wrap:wrap}.sectionTitleButton,.sectionTitleIconButton{margin-right:0!important;display:inline-block;vertical-align:middle}.verticalSection{margin-bottom:1.7em}@media all and (max-width:500px),(max-height:720px){.verticalSection{margin-bottom:1em}}.verticalSection-extrabottompadding{margin-bottom:2.7em}.sectionTitleContainer{margin-bottom:.4em}.sectionTitle{margin-bottom:1em}.sectionTitle-cards{margin-bottom:.3em;margin-left:.16em;margin-top:0}.layout-tv .sectionTitle-cards{margin-left:.4em;margin-bottom:.1em}.sectionTitleContainer>.sectionTitle{margin-top:0;margin-bottom:0;display:inline-block;vertical-align:middle}.sectionTitleButton{margin-left:1.5em!important;-webkit-flex-shrink:0;flex-shrink:0}.sectionTitleButton+.sectionTitleButton{margin-left:.5em!important}.sectionTitleIconButton{margin-left:1.5em!important;-webkit-flex-shrink:0;flex-shrink:0;color:#aaa!important;font-size:84%!important;padding:.5em!important}.horizontalItemsContainer{display:-webkit-box;display:-webkit-flex;display:flex}.sectionTitleTextButton{margin:0!important;display:-webkit-inline-box!important;display:-webkit-inline-flex!important;display:inline-flex!important;color:inherit!important}.sectionTitleTextButton:not(.padded-left){padding:0!important}.sectionTitleTextButton.padded-left{padding-bottom:0!important;padding-right:0!important;padding-top:0!important}.sectionTitleTextButton>.sectionTitle{margin-bottom:0}.padded-left{padding-left:2%}.padded-right{padding-right:2%}.padded-top{padding-top:1em}.padded-bottom{padding-bottom:1em}.layout-tv .padded-top-focusscale{padding-top:1.6em;margin-top:-1.6em}.layout-tv .padded-bottom-focusscale{padding-bottom:1.6em;margin-bottom:-1.6em}@media all and (min-height:500px){.padded-left-withalphapicker{padding-left:7.5%}.padded-right-withalphapicker{padding-right:7.5%}}@media all and (min-height:500px) and (min-width:400px){.padded-left-withalphapicker{padding-left:7%}.padded-right-withalphapicker{padding-right:7%}}@media all and (min-width:500px){.padded-left{padding-left:6%}.padded-right{padding-right:6%}}@media all and (min-width:600px){.padded-left{padding-left:4%}.padded-right{padding-right:4%}}@media all and (min-width:800px){.padded-left{padding-left:3.2%}.padded-right{padding-right:3.2%}}@media all and (min-width:1280px){.padded-left{padding-left:3.3%}.padded-right{padding-right:3.3%}}@media all and (min-width:800px){.layout-tv .padded-left-withalphapicker{padding-left:4.5%}.layout-tv .padded-right-withalphapicker{padding-right:4.5%}}.searchfields-icon{color:#aaa}.button-accent-flat{color:#52B54B!important}.clearLink{text-decoration:none;font-weight:inherit!important;vertical-align:middle;color:inherit!important}.itemsViewSettingsContainer{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}@media all and (min-width:40em){.listIconButton-autohide{display:none!important}}@media all and (max-width:40em){.listTextButton-autohide{display:none!important}}.layout-tv .itemsViewSettingsContainer{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;font-size:92%;padding:0 .75em 2em 0}.viewSettingsButtonIcon{font-size:1.1em!important} \ No newline at end of file +.headerUserImage,.navMenuOption,.pageTitle{vertical-align:middle}.detailButton-mobile,.itemLinks,.listPaging,.sectionTabs,.viewSettings{text-align:center}.headerSelectedPlayer,.itemMiscInfo{-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden}.libraryPage{padding-top:7.5em!important}.itemDetailPage{padding-top:4em!important}.standalonePage{padding-top:5.5em!important}.wizardPage{padding-top:7em!important}.libraryPage:not(.noSecondaryNavPage){padding-top:9.2em!important}.absolutePageTabContent{position:absolute;left:0;right:0;bottom:0;z-index:1;margin:0!important;top:6.9em!important;-webkit-transition:-webkit-transform .2s ease-out;-o-transition:transform .2s ease-out;transition:transform .2s ease-out}.pageTabContent:not(.is-active){display:none!important}.navMenuDivider{height:1px;margin:.5em 0;display:none}.headerUserImage{-webkit-background-size:contain;background-size:contain;background-repeat:no-repeat;background-position:center center;-webkit-border-radius:100em;border-radius:100em;display:inline-block}.headerUserButtonRound img{-webkit-border-radius:100em;border-radius:100em}.headerButton{-webkit-flex-shrink:0;flex-shrink:0;font-size:108%}.hideMainDrawer .mainDrawerButton{display:none}.noHeaderRight .headerRight,.noHomeButtonHeader .headerHomeButton{display:none!important}.pageTitle{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;margin:0 0 0 .5em;height:1.7em;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-flex-shrink:1;flex-shrink:1}.detailButton-mobile,.skinHeader{-webkit-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal}.pageTitleWithLogo{background-position:left center;-webkit-background-size:contain;background-size:contain;background-repeat:no-repeat;width:13.2em}.pageTitleWithDefaultLogo{height:1.22em}.skinHeader{position:fixed;right:0;left:0;z-index:999;top:0;border:0;display:-webkit-box;display:-webkit-flex;display:flex;flex-direction:column;background-color:#121212;color:#ccc;contain:layout style paint}.mainAnimatedPages,.pageTabContent{contain:layout style}.hiddenViewMenuBar .skinHeader{display:none}.headerLeft,.headerRight{display:-webkit-box;display:-webkit-flex;-webkit-box-align:center}.headerTop{padding:.865em 0}.headerLeft{display:flex;-webkit-align-items:center;align-items:center;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;overflow:hidden}.sectionTabs{width:100%}.headerRight{display:flex;-webkit-align-items:center;align-items:center;-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.selectedMediaFolder{background-color:#f2f2f2!important}.navMenuOption{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-decoration:none;color:inherit;padding:.9em 0 .9em 2.4em;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.layout-desktop .searchTabButton,.layout-mobile .searchTabButton,.layout-tv .headerSearchButton,body:not(.dashboardDocument) .btnNotifications{display:none!important}.navMenuOptionIcon{margin-right:1em;-webkit-flex-shrink:0;flex-shrink:0}.sidebarHeader{padding-left:1.2em;margin:1em 0 .5em}.dashboardDocument .skinBody{-webkit-transition:left ease-in-out .3s,padding ease-in-out .3s;-o-transition:left ease-in-out .3s,padding ease-in-out .3s;transition:left ease-in-out .3s,padding ease-in-out .3s;position:absolute;top:0;right:0;bottom:0;left:0}@media all and (max-width:40em){.navMenuOption{font-size:110%}}.mainDrawer-scrollContainer{padding-bottom:10vh}@media all and (min-width:40em){.dashboardDocument .adminDrawerLogo,.dashboardDocument .mainDrawerButton{display:none!important}.dashboardDocument .mainDrawer{z-index:inherit!important;left:0!important;top:0!important;-webkit-transform:none!important;transform:none!important;-webkit-box-shadow:none!important;box-shadow:none!important;width:20.07em!important;font-size:92%}.dashboardDocument .mainDrawer-scrollContainer{margin-top:5em!important}.dashboardDocument.withSectionTabs .mainDrawer-scrollContainer{margin-top:8.7em!important}.dashboardDocument .skinBody{left:20em}}@media all and (min-width:40em) and (max-width:84em){.dashboardDocument.withSectionTabs .mainDrawer-scrollContainer{margin-top:8.4em!important}}@media all and (max-width:60em){.libraryDocument .mainDrawerButton{display:none}}@media all and (max-width:84em){.withSectionTabs .headerTop{padding-bottom:.2em}.sectionTabs{font-size:83.5%}}@media all and (min-width:84em){.headerTop{padding:1.489em 0}.headerTabs{-webkit-align-self:center;align-self:center;width:auto;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;margin-top:-3.34em;position:relative;top:-1.05em}.libraryPage:not(.noSecondaryNavPage){padding-top:6.3em!important}.pageWithAbsoluteTabs:not(.noSecondaryNavPage){padding-top:8.4em!important}.absolutePageTabContent{top:5.7em!important}.dashboardDocument.withSectionTabs .mainDrawer-scrollContainer{margin-top:6.1em!important}.dashboardDocument .mainDrawer-scrollContainer{margin-top:6.3em!important}}.headerSelectedPlayer{max-width:10em;white-space:nowrap}@media all and (max-width:37.5em){.headerSelectedPlayer{display:none}}.hidingAnimatedTab{visibility:hidden}.headerArrowImage{height:20px;margin-left:.5em}.backdropContainer{position:fixed;top:0;left:0;right:0;bottom:0;z-index:-1}.libraryPage .header{padding-bottom:0}.flexPageTabContent.is-active{display:-webkit-box!important;display:-webkit-flex!important;display:flex!important}.viewSettings{margin:0 0 .25em}.viewControls+.listTopPaging{margin-left:.5em!important}.criticReview{margin:1.5em 0;background:#222;padding:.8em .8em .8em 3em;-webkit-border-radius:.3em;border-radius:.3em;position:relative}.detailLogo,.itemBackdrop{background-repeat:no-repeat;background-position:center center}.criticReview:first-child{margin-top:.5em}.criticReview img{width:2.4em}.criticRatingScore{margin-bottom:.5em}.itemTag{display:inline-block;margin-right:1em}.itemOverview{white-space:pre-wrap}.itemLinks{padding:0}.itemLinks p{margin:.5em 0}.reviewLink,.reviewerName{margin-top:.5em}.reviewerName{color:#ccc}.reviewDate{margin-left:1em}.reviewScore{position:absolute;left:.8em}.itemBackdrop{-webkit-background-size:cover;background-size:cover;height:50vh;position:relative}.itemBackdropProgressBar{position:absolute!important;bottom:0;left:0;right:0}.itemBackdropFader{position:absolute;bottom:-1px;left:0;right:0;height:15vh}.desktopMiscInfoContainer{position:absolute;bottom:.75em}.detailImageContainer{margin-right:2em;width:280px;-webkit-flex-shrink:0;flex-shrink:0}.detailPagePrimaryContent{position:relative;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.detailLogo{width:21.3em;height:5em;position:absolute;top:13.5%;right:19.5%;-webkit-background-size:contain;background-size:contain}@media all and (max-width:87.5em){.detailLogo{right:5%}}@media all and (max-width:75em){.detailLogo{right:2%}}@media all and (max-width:68.75em){.detailLogo{width:14.91em;height:3.5em;right:5%;bottom:5%;top:auto;background-position:center right;display:none}}.itemDetailImage{width:100%}.thumbDetailImageContainer{width:400px}.itemDetailImage.loaded{-webkit-box-shadow:0 .0725em .29em 0 rgba(0,0,0,.37);box-shadow:0 .0725em .29em 0 rgba(0,0,0,.37)}@media all and (max-width:62.5em){.detailPageContent{position:relative}.detailImageContainer{position:absolute;top:-90px;left:5%;width:auto}.itemDetailImage{height:120px;width:auto!important}.btnPlaySimple{display:none!important}}@media all and (min-width:62.5em){.itemBackdrop{display:none}.detailPagePrimaryContainer{display:-webkit-box;display:-webkit-flex;display:flex;margin-bottom:3.6em}}@media all and (max-width:75em){.lnkSibling{display:none!important}}.parentName{display:block;margin-bottom:.5em}.emby-button.detailFloatingButton{position:absolute;background-color:rgba(0,0,0,.5)!important;z-index:1;top:50%;left:50%;margin:-2.2em 0 0 -2.2em;border:2.7px solid rgba(255,255,255,.6);padding:.38em!important;color:rgba(255,255,255,.76)}.emby-button.detailFloatingButton i{font-size:3.5em}@media all and (max-width:62.5em){.parentName{margin-bottom:1em}.itemDetailPage{padding-top:0!important}.detailimg-hidemobile{display:none}}@media all and (min-width:31.25em){.mobileDetails{display:none}}@media all and (max-width:31.25em){.desktopDetails{display:none!important}}.detailButton-mobile,.mainDetailButtons{display:-webkit-box;display:-webkit-flex}.itemName{margin:.5em 0}.empty{margin:0}.detailCollapsibleSection:not(.hide)+.detailCollapsibleSection{margin-top:-2em}.detailPageCollabsible{margin-top:0}.mainDetailButtons{display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-flex-wrap:wrap;flex-wrap:wrap;margin:1em 0}.recordingFields button{margin-left:0;margin-right:.5em;-webkit-flex-shrink:0;flex-shrink:0}.mainDetailButtons.hide+.recordingFields{margin-top:1.5em!important}.mainDetailButtons>.raised{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.detailButton-mobile{display:flex;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center;margin:0!important;padding-top:.5em!important;padding-bottom:.5em!important}@media all and (min-width:29em){.detailButton-mobile{margin-right:.1em!important}}@media all and (min-width:32em){.detailButton-mobile{margin-right:.2em!important}}@media all and (min-width:35em){.detailButton-mobile{margin-right:.3em!important}}.detailButton-mobile-content{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.detailButton-mobile-icon{font-size:1.6em!important;width:1em;height:1em}.detailImageProgressContainer{position:absolute;bottom:4px;right:1px;left:1px;text-align:center}@media all and (max-width:62.5em){.detailButton-mobile-text{margin-top:.7em;font-size:80%;font-weight:400}.mainDetailButtons{margin-left:-.5em}}@media all and (min-width:62.5em){.detailButton-mobile-icon:not(.always),.detailButton-mobile-text.texthide{display:none!important}.detailButton-mobile{padding-top:0!important;padding-bottom:0!important;height:3em}.mainDetailButtons{font-size:108%;margin:1.25em 0}.detailButton-mobile-icon:not(.notext){margin-right:.25em}.detailButton-mobile-icon.playstatebutton-icon-unplayed{opacity:.2}.detailButton-mobile-content{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}}.listTopPaging,.viewControls{display:inline-block}@media all and (max-width:50em){.editorMenuLink{display:none}}.itemMiscInfo{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-webkit-align-items:center;align-items:center}@media all and (max-width:31.25em){.mobileDetails .itemMiscInfo{text-align:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.itemMiscInfo .endsAt{display:none}}.layout-tv .detailVerticalSection{margin-bottom:3.4em!important}.detailPageContent{border-spacing:0;border-collapse:collapse;padding-top:3em}@media all and (max-width:62.5em){.detailPageContent-nodetailimg{padding-top:0;margin-top:-3em}}@media all and (min-width:75em){.itemDetailPage .padded-left{padding-left:4%!important}.itemDetailPage .padded-right{padding-right:4%!important}}.mediaInfoContent{line-height:1.5em}.mediaInfoStream{margin:0 3em 0 0;display:inline-block;vertical-align:top}.mediaInfoStreamType{display:block;margin:1em 0}.mediaInfoAttribute,.mediaInfoLabel{display:inline-block}.mediaInfoLabel{margin-right:1em;font-weight:600}.recordingProgressBar::-moz-progress-bar{background-color:#c33}.recordingProgressBar::-webkit-progress-value{background-color:#c33}.recordingProgressBar[aria-valuenow]:before{background-color:#c33}.timelineHeader{margin-bottom:.25em;line-height:1.25em;line-height:initial}.itemsContainer{margin:0 auto}@media all and (max-height:31.25em){.itemBackdrop{height:52vh}}@media all and (max-width:75em){.listViewUserDataButtons{display:none!important}}@media all and (max-width:62.5em){.detailsHiddenOnMobile{display:none}}.btnSyncComplete{background:#673AB7!important}.btnSyncComplete i{-webkit-border-radius:1000px;border-radius:1000px}.bulletSeparator{margin:0 .35em}.mediaInfoIcons{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;margin:1em 0;-webkit-flex-wrap:wrap;flex-wrap:wrap}.sectionTitleButton,.sectionTitleIconButton{margin-right:0!important;display:inline-block;vertical-align:middle}.verticalSection{margin-bottom:1.7em}@media all and (max-width:500px),(max-height:720px){.verticalSection{margin-bottom:1em}}.verticalSection-extrabottompadding{margin-bottom:2.7em}.sectionTitleContainer{margin-bottom:.4em}.sectionTitle{margin-bottom:1em}.sectionTitle-cards{margin-bottom:.3em;margin-left:.16em;margin-top:0}.layout-tv .sectionTitle-cards{margin-left:.4em;margin-bottom:.1em}.sectionTitleContainer>.sectionTitle{margin-top:0;margin-bottom:0;display:inline-block;vertical-align:middle}.sectionTitleButton{margin-left:1.5em!important;-webkit-flex-shrink:0;flex-shrink:0}.sectionTitleButton+.sectionTitleButton{margin-left:.5em!important}.sectionTitleIconButton{margin-left:1.5em!important;-webkit-flex-shrink:0;flex-shrink:0;color:#aaa!important;font-size:84%!important;padding:.5em!important}.horizontalItemsContainer{display:-webkit-box;display:-webkit-flex;display:flex}.sectionTitleTextButton{margin:0!important;display:-webkit-inline-box!important;display:-webkit-inline-flex!important;display:inline-flex!important;color:inherit!important}.sectionTitleTextButton:not(.padded-left){padding:0!important}.sectionTitleTextButton.padded-left{padding-bottom:0!important;padding-right:0!important;padding-top:0!important}.sectionTitleTextButton>.sectionTitle{margin-bottom:0}.padded-left{padding-left:2%}.padded-right{padding-right:2%}.padded-top{padding-top:1em}.padded-bottom{padding-bottom:1em}.layout-tv .padded-top-focusscale{padding-top:1.6em;margin-top:-1.6em}.layout-tv .padded-bottom-focusscale{padding-bottom:1.6em;margin-bottom:-1.6em}@media all and (min-height:500px){.padded-left-withalphapicker{padding-left:7.5%}.padded-right-withalphapicker{padding-right:7.5%}}@media all and (min-width:500px){.padded-left{padding-left:6%}.padded-right{padding-right:6%}}@media all and (min-width:600px){.padded-left{padding-left:4%}.padded-right{padding-right:4%}}@media all and (min-width:800px){.padded-left{padding-left:3.2%}.padded-right{padding-right:3.2%}}@media all and (min-width:1280px){.padded-left{padding-left:3.3%}.padded-right{padding-right:3.3%}}@media all and (min-width:800px){.layout-tv .padded-left-withalphapicker{padding-left:4.5%}.layout-tv .padded-right-withalphapicker{padding-right:4.5%}}.searchfields-icon{color:#aaa}.button-accent-flat{color:#52B54B!important}.clearLink{text-decoration:none;font-weight:inherit!important;vertical-align:middle;color:inherit!important}.itemsViewSettingsContainer{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}@media all and (min-width:40em){.listIconButton-autohide{display:none!important}}@media all and (max-width:40em){.listTextButton-autohide{display:none!important}}.layout-tv .itemsViewSettingsContainer{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;font-size:92%;padding:0 .75em 2em 0}.viewSettingsButtonIcon{font-size:1.1em!important} \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/list/list.js b/MediaBrowser.WebDashboard/dashboard-ui/list/list.js index 8a0823dffb..f9601e8e1b 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/list/list.js +++ b/MediaBrowser.WebDashboard/dashboard-ui/list/list.js @@ -1 +1 @@ -define(["globalize","listView","layoutManager","userSettings","focusManager","cardBuilder","loading","connectionManager","alphaNumericShortcuts","scroller","playbackManager","alphaPicker","emby-itemscontainer","emby-scroller"],function(globalize,listView,layoutManager,userSettings,focusManager,cardBuilder,loading,connectionManager,AlphaNumericShortcuts,scroller,playbackManager,alphaPicker){"use strict";function getInitialLiveTvQuery(instance,params){var query={UserId:connectionManager.getApiClient(params.serverId).getCurrentUserId(),StartIndex:0,Fields:"ChannelInfo,PrimaryImageAspectRatio",Limit:300};return"Recordings"===params.type?(query.IsInProgress=!1,params.groupId&&(query.GroupId=params.groupId)):query.HasAired=!1,"true"===params.IsMovie?query.IsMovie=!0:"false"===params.IsMovie&&(query.IsMovie=!1),"true"===params.IsSeries?query.IsSeries=!0:"false"===params.IsSeries&&(query.IsSeries=!1),"true"===params.IsNews?query.IsNews=!0:"false"===params.IsNews&&(query.IsNews=!1),"true"===params.IsSports?query.IsSports=!0:"false"===params.IsSports&&(query.IsSports=!1),"true"===params.IsKids?query.IsKids=!0:"false"===params.IsKids&&(query.IsKids=!1),"true"===params.IsAiring?query.IsAiring=!0:"false"===params.IsAiring&&(query.IsAiring=!1),modifyQueryWithFilters(instance,query)}function modifyQueryWithFilters(instance,query){var sortValues=instance.getSortValues();query.SortBy||(query.SortBy=sortValues.sortBy,query.SortOrder=sortValues.sortOrder),query.Fields=query.Fields?query.Fields+",PrimaryImageAspectRatio":"PrimaryImageAspectRatio",query.ImageTypeLimit=1;var hasFilters,queryFilters=[],filters=instance.getFilters();return filters.IsPlayed&&(queryFilters.push("IsPlayed"),hasFilters=!0),filters.IsUnplayed&&(queryFilters.push("IsUnplayed"),hasFilters=!0),filters.IsFavorite&&(queryFilters.push("IsFavorite"),hasFilters=!0),filters.IsResumable&&(queryFilters.push("IsResumable"),hasFilters=!0),filters.VideoTypes&&(hasFilters=!0,query.VideoTypes=filters.VideoTypes),filters.GenreIds&&(hasFilters=!0,query.GenreIds=filters.GenreIds),filters.IsHD&&(query.IsHD=!0,hasFilters=!0),filters.IsSD&&(query.IsHD=!1,hasFilters=!0),filters.Is3D&&(query.Is3D=!0,hasFilters=!0),filters.HasSubtitles&&(query.HasSubtitles=!0,hasFilters=!0),filters.HasTrailer&&(query.HasTrailer=!0,hasFilters=!0),filters.HasSpecialFeature&&(query.HasSpecialFeature=!0,hasFilters=!0),filters.HasThemeSong&&(query.HasThemeSong=!0,hasFilters=!0),filters.HasThemeVideo&&(query.HasThemeVideo=!0,hasFilters=!0),query.Filters=queryFilters.length?queryFilters.join(","):null,instance.setFilterStatus(hasFilters),instance.alphaPicker&&(query.NameStartsWithOrGreater=instance.alphaPicker.value()),query}function updateSortText(instance){var btnSortText=instance.btnSortText;if(btnSortText){for(var options=instance.getSortMenuOptions(),values=instance.getSortValues(),sortBy=values.sortBy,i=0,length=options.length;i40?(alphaPicker.classList.remove("hide"),layoutManager.tv?instance.itemsContainer.parentNode.classList.add("padded-left-withalphapicker"):instance.itemsContainer.parentNode.classList.add("padded-right-withalphapicker")):(alphaPicker.classList.add("hide"),instance.itemsContainer.parentNode.classList.remove("padded-left-withalphapicker"),instance.itemsContainer.parentNode.classList.remove("padded-right-withalphapicker"))}}}function getItems(instance,params,item,sortBy,startIndex,limit){var apiClient=connectionManager.getApiClient(params.serverId);if(instance.queryRecursive=!1,"Recordings"===params.type)return apiClient.getLiveTvRecordings(getInitialLiveTvQuery(instance,params));if("Programs"===params.type)return"true"===params.IsAiring?apiClient.getLiveTvRecommendedPrograms(getInitialLiveTvQuery(instance,params)):apiClient.getLiveTvPrograms(getInitialLiveTvQuery(instance,params));if("nextup"===params.type)return apiClient.getNextUpEpisodes(modifyQueryWithFilters(instance,{Limit:limit,Fields:"PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo",UserId:apiClient.getCurrentUserId(),ImageTypeLimit:1,EnableImageTypes:"Primary,Backdrop,Thumb",EnableTotalRecordCount:!1,SortBy:sortBy}));if(!item)return instance.queryRecursive=!0,apiClient.getItems(apiClient.getCurrentUserId(),modifyQueryWithFilters(instance,{StartIndex:startIndex,Limit:limit,Fields:"PrimaryImageAspectRatio,SortName",ImageTypeLimit:1,IncludeItemTypes:params.type,Recursive:!0,IsFavorite:"true"===params.IsFavorite||null,ArtistIds:params.artistId||null,SortBy:sortBy}));if("Genre"===item.Type||"GameGenre"===item.Type||"MusicGenre"===item.Type||"Studio"===item.Type||"Person"===item.Type){instance.queryRecursive=!0;var query={StartIndex:startIndex,Limit:limit,Fields:"PrimaryImageAspectRatio,SortName",Recursive:!0,parentId:params.parentId,SortBy:sortBy};return"Studio"===item.Type?query.StudioIds=item.Id:"Genre"===item.Type||"GameGenre"===item.Type||"MusicGenre"===item.Type?query.GenreIds=item.Id:"Person"===item.Type&&(query.PersonIds=item.Id),"MusicGenre"===item.Type?query.IncludeItemTypes="MusicAlbum":"GameGenre"===item.Type?query.IncludeItemTypes="Game":"movies"===item.CollectionType?query.IncludeItemTypes="Movie":"tvshows"===item.CollectionType?query.IncludeItemTypes="Series":"Genre"===item.Type?query.IncludeItemTypes="Movie,Series":"Person"===item.Type&&(query.IncludeItemTypes=params.type),apiClient.getItems(apiClient.getCurrentUserId(),modifyQueryWithFilters(instance,query))}return apiClient.getItems(apiClient.getCurrentUserId(),modifyQueryWithFilters(instance,{StartIndex:startIndex,Limit:limit,Fields:"PrimaryImageAspectRatio,SortName",ImageTypeLimit:1,ParentId:item.Id,SortBy:sortBy}))}function getItem(params){if("Recordings"===params.type)return Promise.resolve(null);if("Programs"===params.type)return Promise.resolve(null);if("nextup"===params.type)return Promise.resolve(null);var apiClient=connectionManager.getApiClient(params.serverId),itemId=params.genreId||params.gameGenreId||params.musicGenreId||params.studioId||params.personId||params.parentId;return itemId?apiClient.getItem(apiClient.getCurrentUserId(),itemId):Promise.resolve(null)}function showViewSettingsMenu(){var instance=this;require(["viewSettings"],function(ViewSettings){(new ViewSettings).show({settingsKey:instance.getSettingsKey(),settings:instance.getViewSettings(),visibleSettings:instance.getVisibleViewSettings()}).then(function(){updateItemsContainerForViewType(instance),instance.itemsContainer.refreshItems()})})}function showFilterMenu(){var instance=this;require(["filterMenu"],function(FilterMenu){(new FilterMenu).show({settingsKey:instance.getSettingsKey(),settings:instance.getFilters(),visibleSettings:instance.getVisibleFilters(),onChange:instance.itemsContainer.refreshItems.bind(instance.itemsContainer),parentId:instance.params.parentId,itemTypes:instance.getItemTypes(),serverId:instance.params.serverId,filterMenuOptions:instance.getFilterMenuOptions()}).then(function(){instance.itemsContainer.refreshItems()})})}function showSortMenu(){var instance=this;require(["sortMenu"],function(SortMenu){(new SortMenu).show({settingsKey:instance.getSettingsKey(),settings:instance.getSortValues(),onChange:instance.itemsContainer.refreshItems.bind(instance.itemsContainer),serverId:instance.params.serverId,sortOptions:instance.getSortMenuOptions()}).then(function(){updateSortText(instance),updateAlphaPickerState(instance),instance.itemsContainer.refreshItems()})})}function onNewItemClick(){var instance=this;require(["playlistEditor"],function(playlistEditor){(new playlistEditor).show({items:[],serverId:instance.params.serverId})})}function hideOrShowAll(elems,hide){for(var i=0,length=elems.length;i!'),btnFilter.classList.add("btnFilterWithBubble"),bubble=btnFilter.querySelector(".filterButtonBubble")}hasFilters?bubble.classList.remove("hide"):bubble.classList.add("hide")}},ItemsView.prototype.getFilterMenuOptions=function(){var params=this.params;return{IsAiring:params.IsAiring,IsMovie:params.IsMovie,IsSports:params.IsSports,IsKids:params.IsKids,IsNews:params.IsNews,IsSeries:params.IsSeries,Recursive:this.queryRecursive}},ItemsView.prototype.getVisibleViewSettings=function(){var item=(this.params,this.currentItem),fields=["showTitle"];return(!item||"PhotoAlbum"!==item.Type&&"ChannelFolderItem"!==item.Type)&&fields.push("imageType"),fields.push("viewType"),fields},ItemsView.prototype.getViewSettings=function(){var basekey=this.getSettingsKey(),params=this.params,item=this.currentItem,showTitle=userSettings.get(basekey+"-showTitle");"true"===showTitle?showTitle=!0:"false"===showTitle?showTitle=!1:"Programs"===params.type||"Recordings"===params.type||"nextup"===params.type||"Audio"===params.type||"MusicAlbum"===params.type||"MusicArtist"===params.type?showTitle=!0:item&&"PhotoAlbum"!==item.Type&&(showTitle=!0);var imageType=userSettings.get(basekey+"-imageType");return imageType||"nextup"===params.type&&(imageType="thumb"),{showTitle:showTitle,showYear:"false"!==userSettings.get(basekey+"-showYear"),imageType:imageType||"primary",viewType:userSettings.get(basekey+"-viewType")||"images"}},ItemsView.prototype.getItemTypes=function(){var params=this.params;return"nextup"===params.type?["Episode"]:"Programs"===params.type?["Program"]:[]},ItemsView.prototype.getSettingsKey=function(){var values=[];values.push("items");var params=this.params;return params.type?values.push(params.type):params.parentId&&values.push(params.parentId),params.IsAiring&&values.push("IsAiring"),params.IsMovie&&values.push("IsMovie"),params.IsKids&&values.push("IsKids"),params.IsSports&&values.push("IsSports"),params.IsNews&&values.push("IsNews"),params.IsSeries&&values.push("IsSeries"),params.IsFavorite&&values.push("IsFavorite"),params.genreId&&values.push("Genre"),params.gameGenreId&&values.push("GameGenre"),params.musicGenreId&&values.push("MusicGenre"),params.studioId&&values.push("Studio"),params.personId&&values.push("Person"),params.parentId&&values.push("Folder"),values.join("-")},ItemsView}); \ No newline at end of file +define(["globalize","listView","layoutManager","userSettings","focusManager","cardBuilder","loading","connectionManager","alphaNumericShortcuts","scroller","playbackManager","alphaPicker","emby-itemscontainer","emby-scroller"],function(globalize,listView,layoutManager,userSettings,focusManager,cardBuilder,loading,connectionManager,AlphaNumericShortcuts,scroller,playbackManager,alphaPicker){"use strict";function getInitialLiveTvQuery(instance,params){var query={UserId:connectionManager.getApiClient(params.serverId).getCurrentUserId(),StartIndex:0,Fields:"ChannelInfo,PrimaryImageAspectRatio",Limit:300};return"Recordings"===params.type?(query.IsInProgress=!1,params.groupId&&(query.GroupId=params.groupId)):query.HasAired=!1,"true"===params.IsMovie?query.IsMovie=!0:"false"===params.IsMovie&&(query.IsMovie=!1),"true"===params.IsSeries?query.IsSeries=!0:"false"===params.IsSeries&&(query.IsSeries=!1),"true"===params.IsNews?query.IsNews=!0:"false"===params.IsNews&&(query.IsNews=!1),"true"===params.IsSports?query.IsSports=!0:"false"===params.IsSports&&(query.IsSports=!1),"true"===params.IsKids?query.IsKids=!0:"false"===params.IsKids&&(query.IsKids=!1),"true"===params.IsAiring?query.IsAiring=!0:"false"===params.IsAiring&&(query.IsAiring=!1),modifyQueryWithFilters(instance,query)}function modifyQueryWithFilters(instance,query){var sortValues=instance.getSortValues();query.SortBy||(query.SortBy=sortValues.sortBy,query.SortOrder=sortValues.sortOrder),query.Fields=query.Fields?query.Fields+",PrimaryImageAspectRatio":"PrimaryImageAspectRatio",query.ImageTypeLimit=1;var hasFilters,queryFilters=[],filters=instance.getFilters();return filters.IsPlayed&&(queryFilters.push("IsPlayed"),hasFilters=!0),filters.IsUnplayed&&(queryFilters.push("IsUnplayed"),hasFilters=!0),filters.IsFavorite&&(queryFilters.push("IsFavorite"),hasFilters=!0),filters.IsResumable&&(queryFilters.push("IsResumable"),hasFilters=!0),filters.VideoTypes&&(hasFilters=!0,query.VideoTypes=filters.VideoTypes),filters.GenreIds&&(hasFilters=!0,query.GenreIds=filters.GenreIds),filters.IsHD&&(query.IsHD=!0,hasFilters=!0),filters.IsSD&&(query.IsHD=!1,hasFilters=!0),filters.Is3D&&(query.Is3D=!0,hasFilters=!0),filters.HasSubtitles&&(query.HasSubtitles=!0,hasFilters=!0),filters.HasTrailer&&(query.HasTrailer=!0,hasFilters=!0),filters.HasSpecialFeature&&(query.HasSpecialFeature=!0,hasFilters=!0),filters.HasThemeSong&&(query.HasThemeSong=!0,hasFilters=!0),filters.HasThemeVideo&&(query.HasThemeVideo=!0,hasFilters=!0),query.Filters=queryFilters.length?queryFilters.join(","):null,instance.setFilterStatus(hasFilters),instance.alphaPicker&&(query.NameStartsWithOrGreater=instance.alphaPicker.value()),query}function updateSortText(instance){var btnSortText=instance.btnSortText;if(btnSortText){for(var options=instance.getSortMenuOptions(),values=instance.getSortValues(),sortBy=values.sortBy,i=0,length=options.length;i40?(alphaPicker.classList.remove("hide"),layoutManager.tv?instance.itemsContainer.parentNode.classList.add("padded-left-withalphapicker"):instance.itemsContainer.parentNode.classList.add("padded-right-withalphapicker")):(alphaPicker.classList.add("hide"),instance.itemsContainer.parentNode.classList.remove("padded-left-withalphapicker"),instance.itemsContainer.parentNode.classList.remove("padded-right-withalphapicker"))}}}function getItems(instance,params,item,sortBy,startIndex,limit){var apiClient=connectionManager.getApiClient(params.serverId);if(instance.queryRecursive=!1,"Recordings"===params.type)return apiClient.getLiveTvRecordings(getInitialLiveTvQuery(instance,params));if("Programs"===params.type)return"true"===params.IsAiring?apiClient.getLiveTvRecommendedPrograms(getInitialLiveTvQuery(instance,params)):apiClient.getLiveTvPrograms(getInitialLiveTvQuery(instance,params));if("nextup"===params.type)return apiClient.getNextUpEpisodes(modifyQueryWithFilters(instance,{Limit:limit,Fields:"PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo",UserId:apiClient.getCurrentUserId(),ImageTypeLimit:1,EnableImageTypes:"Primary,Backdrop,Thumb",EnableTotalRecordCount:!1,SortBy:sortBy}));if(!item)return instance.queryRecursive=!0,apiClient.getItems(apiClient.getCurrentUserId(),modifyQueryWithFilters(instance,{StartIndex:startIndex,Limit:limit,Fields:"PrimaryImageAspectRatio,SortName",ImageTypeLimit:1,IncludeItemTypes:params.type,Recursive:!0,IsFavorite:"true"===params.IsFavorite||null,ArtistIds:params.artistId||null,SortBy:sortBy}));if("Genre"===item.Type||"GameGenre"===item.Type||"MusicGenre"===item.Type||"Studio"===item.Type||"Person"===item.Type){instance.queryRecursive=!0;var query={StartIndex:startIndex,Limit:limit,Fields:"PrimaryImageAspectRatio,SortName",Recursive:!0,parentId:params.parentId,SortBy:sortBy};return"Studio"===item.Type?query.StudioIds=item.Id:"Genre"===item.Type||"GameGenre"===item.Type||"MusicGenre"===item.Type?query.GenreIds=item.Id:"Person"===item.Type&&(query.PersonIds=item.Id),"MusicGenre"===item.Type?query.IncludeItemTypes="MusicAlbum":"GameGenre"===item.Type?query.IncludeItemTypes="Game":"movies"===item.CollectionType?query.IncludeItemTypes="Movie":"tvshows"===item.CollectionType?query.IncludeItemTypes="Series":"Genre"===item.Type?query.IncludeItemTypes="Movie,Series":"Person"===item.Type&&(query.IncludeItemTypes=params.type),apiClient.getItems(apiClient.getCurrentUserId(),modifyQueryWithFilters(instance,query))}return apiClient.getItems(apiClient.getCurrentUserId(),modifyQueryWithFilters(instance,{StartIndex:startIndex,Limit:limit,Fields:"PrimaryImageAspectRatio,SortName",ImageTypeLimit:1,ParentId:item.Id,SortBy:sortBy}))}function getItem(params){if("Recordings"===params.type)return Promise.resolve(null);if("Programs"===params.type)return Promise.resolve(null);if("nextup"===params.type)return Promise.resolve(null);var apiClient=connectionManager.getApiClient(params.serverId),itemId=params.genreId||params.gameGenreId||params.musicGenreId||params.studioId||params.personId||params.parentId;return itemId?apiClient.getItem(apiClient.getCurrentUserId(),itemId):Promise.resolve(null)}function showViewSettingsMenu(){var instance=this;require(["viewSettings"],function(ViewSettings){(new ViewSettings).show({settingsKey:instance.getSettingsKey(),settings:instance.getViewSettings(),visibleSettings:instance.getVisibleViewSettings()}).then(function(){updateItemsContainerForViewType(instance),instance.itemsContainer.refreshItems()})})}function showFilterMenu(){var instance=this;require(["filterMenu"],function(FilterMenu){(new FilterMenu).show({settingsKey:instance.getSettingsKey(),settings:instance.getFilters(),visibleSettings:instance.getVisibleFilters(),onChange:instance.itemsContainer.refreshItems.bind(instance.itemsContainer),parentId:instance.params.parentId,itemTypes:instance.getItemTypes(),serverId:instance.params.serverId,filterMenuOptions:instance.getFilterMenuOptions()}).then(function(){instance.itemsContainer.refreshItems()})})}function showSortMenu(){var instance=this;require(["sortMenu"],function(SortMenu){(new SortMenu).show({settingsKey:instance.getSettingsKey(),settings:instance.getSortValues(),onChange:instance.itemsContainer.refreshItems.bind(instance.itemsContainer),serverId:instance.params.serverId,sortOptions:instance.getSortMenuOptions()}).then(function(){updateSortText(instance),updateAlphaPickerState(instance),instance.itemsContainer.refreshItems()})})}function onNewItemClick(){var instance=this;require(["playlistEditor"],function(playlistEditor){(new playlistEditor).show({items:[],serverId:instance.params.serverId})})}function hideOrShowAll(elems,hide){for(var i=0,length=elems.length;i!'),btnFilter.classList.add("btnFilterWithBubble"),bubble=btnFilter.querySelector(".filterButtonBubble")}hasFilters?bubble.classList.remove("hide"):bubble.classList.add("hide")}},ItemsView.prototype.getFilterMenuOptions=function(){var params=this.params;return{IsAiring:params.IsAiring,IsMovie:params.IsMovie,IsSports:params.IsSports,IsKids:params.IsKids,IsNews:params.IsNews,IsSeries:params.IsSeries,Recursive:this.queryRecursive}},ItemsView.prototype.getVisibleViewSettings=function(){var item=(this.params,this.currentItem),fields=["showTitle"];return(!item||"PhotoAlbum"!==item.Type&&"ChannelFolderItem"!==item.Type)&&fields.push("imageType"),fields.push("viewType"),fields},ItemsView.prototype.getViewSettings=function(){var basekey=this.getSettingsKey(),params=this.params,item=this.currentItem,showTitle=userSettings.get(basekey+"-showTitle");"true"===showTitle?showTitle=!0:"false"===showTitle?showTitle=!1:"Programs"===params.type||"Recordings"===params.type||"nextup"===params.type||"Audio"===params.type||"MusicAlbum"===params.type||"MusicArtist"===params.type?showTitle=!0:item&&"PhotoAlbum"!==item.Type&&(showTitle=!0);var imageType=userSettings.get(basekey+"-imageType");return imageType||"nextup"===params.type&&(imageType="thumb"),{showTitle:showTitle,showYear:"false"!==userSettings.get(basekey+"-showYear"),imageType:imageType||"primary",viewType:userSettings.get(basekey+"-viewType")||"images"}},ItemsView.prototype.getItemTypes=function(){var params=this.params;return"nextup"===params.type?["Episode"]:"Programs"===params.type?["Program"]:[]},ItemsView.prototype.getSettingsKey=function(){var values=[];values.push("items");var params=this.params;return params.type?values.push(params.type):params.parentId&&values.push(params.parentId),params.IsAiring&&values.push("IsAiring"),params.IsMovie&&values.push("IsMovie"),params.IsKids&&values.push("IsKids"),params.IsSports&&values.push("IsSports"),params.IsNews&&values.push("IsNews"),params.IsSeries&&values.push("IsSeries"),params.IsFavorite&&values.push("IsFavorite"),params.genreId&&values.push("Genre"),params.gameGenreId&&values.push("GameGenre"),params.musicGenreId&&values.push("MusicGenre"),params.studioId&&values.push("Studio"),params.personId&&values.push("Person"),params.parentId&&values.push("Folder"),values.join("-")},ItemsView}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/metadatasubtitles.html b/MediaBrowser.WebDashboard/dashboard-ui/opensubtitles.html similarity index 88% rename from MediaBrowser.WebDashboard/dashboard-ui/metadatasubtitles.html rename to MediaBrowser.WebDashboard/dashboard-ui/opensubtitles.html index 789de844a1..444244c1c4 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/metadatasubtitles.html +++ b/MediaBrowser.WebDashboard/dashboard-ui/opensubtitles.html @@ -1,4 +1,4 @@ -
+
@@ -12,6 +12,7 @@
+
@@ -27,6 +28,7 @@
+
${SubtitleDownloadInstructions}
diff --git a/MediaBrowser.WebDashboard/dashboard-ui/scripts/librarymenu.js b/MediaBrowser.WebDashboard/dashboard-ui/scripts/librarymenu.js index 9be9755973..08cff76a77 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/scripts/librarymenu.js +++ b/MediaBrowser.WebDashboard/dashboard-ui/scripts/librarymenu.js @@ -1 +1 @@ -define(["layoutManager","inputManager","connectionManager","events","viewManager","libraryBrowser","appRouter","apphost","playbackManager","browser","globalize","paper-icon-button-light","material-icons","scrollStyles","flexStyles"],function(layoutManager,inputManager,connectionManager,events,viewManager,libraryBrowser,appRouter,appHost,playbackManager,browser,globalize){"use strict";function getCurrentApiClient(){return currentUser&¤tUser.localUser?connectionManager.getApiClient(currentUser.localUser.ServerId):connectionManager.currentApiClient()}function lazyLoadViewMenuBarImages(){require(["imageLoader"],function(imageLoader){imageLoader.lazyChildren(skinHeader)})}function onBackClick(){appRouter.back()}function updateUserInHeader(user){var hasImage;if(user&&user.name){if(user.imageUrl){var url=user.imageUrl;user.supportsImageParams&&(url+="&height="+Math.round(26*Math.max(window.devicePixelRatio||1,2))),updateHeaderUserButton(url),hasImage=!0}headerUserButton.classList.remove("hide")}else headerUserButton.classList.add("hide");hasImage||updateHeaderUserButton(null),user&&user.localUser?(headerHomeButton&&headerHomeButton.classList.remove("hide"),headerSearchButton&&headerSearchButton.classList.remove("hide"),headerSettingsButton&&(user.localUser.Policy.IsAdministrator?headerSettingsButton.classList.remove("hide"):headerSettingsButton.classList.add("hide")),headerCastButton.classList.remove("hide")):(headerHomeButton.classList.add("hide"),headerCastButton.classList.add("hide"),headerSearchButton&&headerSearchButton.classList.add("hide"),headerSettingsButton&&headerSettingsButton.classList.add("hide")),requiresUserRefresh=!1}function updateHeaderUserButton(src){src?(headerUserButton.classList.add("headerUserButtonRound"),headerUserButton.innerHTML=''):(headerUserButton.classList.remove("headerUserButtonRound"),headerUserButton.innerHTML='')}function showSearch(){inputManager.trigger("search")}function onHeaderUserButtonClick(e){Dashboard.showUserFlyout(e.target)}function onHeaderHomeButtonClick(){Dashboard.navigate("home.html")}function bindMenuEvents(){(mainDrawerButton=document.querySelector(".mainDrawerButton"))&&mainDrawerButton.addEventListener("click",toggleMainDrawer);var headerBackButton=document.querySelector(".headerBackButton");headerBackButton&&headerBackButton.addEventListener("click",onBackClick),headerSearchButton&&headerSearchButton.addEventListener("click",showSearch),headerUserButton.addEventListener("click",onHeaderUserButtonClick),headerHomeButton.addEventListener("click",onHeaderHomeButtonClick),initHeadRoom(skinHeader),skinHeader.querySelector(".btnNotifications").addEventListener("click",function(){Dashboard.navigate("notifications.html")}),headerCastButton.addEventListener("click",onCastButtonClicked)}function onCastButtonClicked(){var btn=this;require(["playerSelectionMenu"],function(playerSelectionMenu){playerSelectionMenu.show(btn)})}function getItemHref(item,context){return appRouter.getRouteUrl(item,{context:context})}function toggleMainDrawer(){navDrawerInstance.isVisible?closeMainDrawer():openMainDrawer()}function openMainDrawer(){navDrawerInstance.open(),lastOpenTime=(new Date).getTime()}function onMainDrawerOpened(){layoutManager.mobile&&document.body.classList.add("bodyWithPopupOpen")}function closeMainDrawer(){navDrawerInstance.close()}function onMainDrawerSelect(e){navDrawerInstance.isVisible?onMainDrawerOpened():document.body.classList.remove("bodyWithPopupOpen")}function refreshLibraryInfoInDrawer(user,drawer){var html="";html+='
',html+=''+globalize.translate("ButtonHome")+"",html+='
',html+='',html+='

',html+=globalize.translate("sharedcomponents#HeaderMyDownloads"),html+="

",html+=''+globalize.translate("sharedcomponents#Browse")+"",html+=''+globalize.translate("sharedcomponents#Manage")+"",html+="
",html+='',html+='
',html+="
";var localUser=user.localUser;localUser&&localUser.Policy.IsAdministrator&&(html+='
',html+='',html+='

',html+=globalize.translate("HeaderAdmin"),html+="

",html+=''+globalize.translate("ButtonManageServer")+"",html+=''+globalize.translate("MetadataManager")+"",html+="
"),html+='
',html+='',user.localUser&&(html+=''+globalize.translate("ButtonSettings")+""),html+=''+globalize.translate("sharedcomponents#Sync")+"",Dashboard.isConnectMode()&&(html+=''+globalize.translate("ButtonSelectServer")+""),!user.localUser||user.localUser.EnableAutoLogin&&!user.connectUser||(html+=''+globalize.translate("ButtonSignOut")+""),html+="
",navDrawerScrollContainer.innerHTML=html;var lnkManageServer=navDrawerScrollContainer.querySelector(".lnkManageServer");lnkManageServer&&lnkManageServer.addEventListener("click",onManageServerClicked)}function refreshDashboardInfoInDrawer(apiClient){currentDrawerType="admin",loadNavDrawer(),navDrawerScrollContainer.querySelector(".adminDrawerLogo")?updateDashboardMenuSelectedItem():createDashboardMenu(apiClient)}function isUrlInCurrentView(url){return-1!==window.location.href.toString().toLowerCase().indexOf(url.toLowerCase())}function updateDashboardMenuSelectedItem(){for(var links=navDrawerScrollContainer.querySelectorAll(".navMenuOption"),currentViewId=viewManager.currentView().id,i=0,length=links.length;i0),selected){link.classList.add("navMenuOption-selected");var title="";link=link.querySelector("span")||link;title+=(link.innerText||link.textContent).trim(),LibraryMenu.setTitle(title)}else link.classList.remove("navMenuOption-selected")}}function createToolsMenuList(pluginItems){var links=[{name:globalize.translate("TabServer")},{name:globalize.translate("TabDashboard"),href:"dashboard.html",pageIds:["dashboardPage"],icon:"dashboard"},{name:globalize.translate("TabSettings"),href:"dashboardgeneral.html",pageIds:["dashboardGeneralPage"],icon:"settings"},{name:globalize.translate("TabUsers"),href:"userprofiles.html",pageIds:["userProfilesPage","newUserPage","editUserPage","userLibraryAccessPage","userParentalControlPage","userPasswordPage"],icon:"people"},{name:"Emby Premiere",href:"supporterkey.html",pageIds:["supporterKeyPage"],icon:"star"},{name:globalize.translate("TabLibrary"),href:"library.html",pageIds:["mediaLibraryPage","librarySettingsPage","libraryDisplayPage","metadataImagesConfigurationPage","metadataNfoPage"],icon:"folder",color:"#38c"},{name:globalize.translate("TabSubtitles"),href:"metadatasubtitles.html",pageIds:["metadataSubtitlesPage"],icon:"closed_caption"},{name:globalize.translate("TabPlayback"),icon:"play_circle_filled",color:"#E5342E",href:"cinemamodeconfiguration.html",pageIds:["cinemaModeConfigurationPage","playbackConfigurationPage","streamingSettingsPage"]},{name:globalize.translate("TabTranscoding"),icon:"transform",href:"encodingsettings.html",pageIds:["encodingSettingsPage"]},{divider:!0,name:globalize.translate("TabDevices")},{name:globalize.translate("TabDevices"),href:"devices.html",pageIds:["devicesPage","devicePage"],icon:"tablet"},{name:globalize.translate("HeaderDownloadSync"),icon:"file_download",href:"syncactivity.html",pageIds:["syncActivityPage","syncJobPage","syncSettingsPage"],color:"#009688"},{name:globalize.translate("TabCameraUpload"),href:"devicesupload.html",pageIds:["devicesUploadPage"],icon:"photo_camera"},{name:globalize.translate("DLNA"),href:"dlnasettings.html",pageIds:["dlnaSettingsPage","dlnaProfilesPage","dlnaProfilePage"],icon:""},{divider:!0,name:globalize.translate("HeaderLiveTV")},{name:globalize.translate("TabLiveTV"),href:"livetvstatus.html",pageIds:["liveTvStatusPage","liveTvTunerPage"],icon:""},{name:globalize.translate("DVR"),href:"livetvsettings.html",pageIds:["liveTvSettingsPage"],icon:"dvr"}];links.push({divider:!0,name:globalize.translate("TabExpert")}),links.push({name:globalize.translate("TabAdvanced"),icon:"settings",href:"dashboardhosting.html",color:"#F16834",pageIds:["dashboardHostingPage","serverSecurityPage"]}),links.push({name:globalize.translate("TabLogs"),href:"log.html",pageIds:["logPage"],icon:"folder_open"}),links.push({name:globalize.translate("TabNotifications"),icon:"notifications",color:"brown",href:"notificationsettings.html",pageIds:["notificationSettingsPage","notificationSettingPage"]}),links.push({name:globalize.translate("TabPlugins"),icon:"add_shopping_cart",color:"#9D22B1",href:"plugins.html",pageIds:["pluginsPage","pluginCatalogPage"]}),links.push({name:globalize.translate("TabScheduledTasks"),href:"scheduledtasks.html",pageIds:["scheduledTasksPage","scheduledTaskPage"],icon:"schedule"}),links.push({name:globalize.translate("MetadataManager"),href:"edititemmetadata.html",pageIds:[],icon:"mode_edit"});for(var i=0,length=pluginItems.length;i",item.icon&&(menuHtml+=''+item.icon+""),menuHtml+="",menuHtml+=item.name,menuHtml+="",menuHtml+=""}function getToolsMenuHtml(apiClient){return getToolsMenuLinks(apiClient).then(function(items){var i,length,item,menuHtml="";for(menuHtml+='
',i=0,length=items.length;i
"),item.href?menuHtml+=getToolsLinkHtml(item):item.name&&(menuHtml+='

',menuHtml+=item.name,menuHtml+="

");return menuHtml+="
"})}function createDashboardMenu(apiClient){return getToolsMenuHtml(apiClient).then(function(toolsMenuHtml){var html="";html+='",html+=toolsMenuHtml,html=html.split("href=").join('onclick="return LibraryMenu.onLinkClicked(event, this);" href='),navDrawerScrollContainer.innerHTML=html,updateDashboardMenuSelectedItem()})}function onSidebarLinkClick(){var section=this.getElementsByClassName("sectionName")[0],text=section?section.innerHTML:this.innerHTML;LibraryMenu.setTitle(text)}function getUserViews(apiClient,userId){return apiClient.getUserViews({},userId).then(function(result){for(var items=result.Items,list=[],i=0,length=items.length;i',html+=globalize.translate("HeaderMedia"),html+="",html+=items.map(function(i){var icon="folder",itemId=i.Id;return"channels"==i.CollectionType?itemId="channels":"livetv"==i.CollectionType&&(itemId="livetv"),"photos"==i.CollectionType?(icon="photo_library","#009688"):"music"==i.CollectionType||"musicvideos"==i.CollectionType?(icon="library_music","#FB8521"):"books"==i.CollectionType?(icon="library_books","#1AA1E1"):"playlists"==i.CollectionType?(icon="view_list","#795548"):"games"==i.CollectionType?(icon="games","#F44336"):"movies"==i.CollectionType?(icon="video_library","#CE5043"):"channels"==i.CollectionType||"Channel"==i.Type?(icon="videocam","#E91E63"):"tvshows"==i.CollectionType?(icon="tv","#4CAF50"):"livetv"==i.CollectionType&&(icon="live_tv","#293AAE"),icon=i.icon||icon,''+icon+''+i.Name+""}).join(""),libraryMenuOptions.innerHTML=html;for(var elem=libraryMenuOptions,sidebarLinks=elem.querySelectorAll(".navMenuOption"),i=0,length=sidebarLinks.length;i200&&setTimeout(function(){closeMainDrawer(),setTimeout(function(){action?action():Dashboard.navigate(link.href)},getNavigateDelay())},50),event.stopPropagation(),event.preventDefault(),!1)},onLogoutClicked:function(){return(new Date).getTime()-lastOpenTime>200&&(closeMainDrawer(),setTimeout(function(){Dashboard.logout()},getNavigateDelay())),!1},onHardwareMenuButtonClick:function(){toggleMainDrawer()},onSettingsClicked:function(event){return 1!=event.which||(Dashboard.navigate("dashboard.html"),!1)},setTabs:function(type,selectedIndex,builder){require(["mainTabsManager"],function(mainTabsManager){type?mainTabsManager.setTabs(viewManager.currentView(),selectedIndex,builder,function(){return[]}):mainTabsManager.setTabs(null)})},setDefaultTitle:function(){pageTitleElement||(pageTitleElement=document.querySelector(".pageTitle")),pageTitleElement&&(pageTitleElement.classList.add("pageTitleWithLogo"),pageTitleElement.classList.add("pageTitleWithDefaultLogo"),pageTitleElement.style.backgroundImage=null,pageTitleElement.innerHTML=""),document.title="Emby"},setTitle:function(title){if(null==title)return void LibraryMenu.setDefaultTitle();"-"===title&&(title="");var html=title,page=viewManager.currentView();if(page){var helpUrl=page.getAttribute("data-helpurl");helpUrl&&(html+=''+globalize.translate("ButtonHelp")+"")}pageTitleElement||(pageTitleElement=document.querySelector(".pageTitle")),pageTitleElement&&(pageTitleElement.classList.remove("pageTitleWithLogo"),pageTitleElement.classList.remove("pageTitleWithDefaultLogo"),pageTitleElement.style.backgroundImage=null,pageTitleElement.innerHTML=html||""),document.title=title||"Emby"},setTransparentMenu:function(transparent){transparent?skinHeader.classList.add("semiTransparent"):skinHeader.classList.remove("semiTransparent")}};var currentPageType;return pageClassOn("pagebeforeshow","page",function(e){this.classList.contains("withTabs")||LibraryMenu.setTabs(null)}),pageClassOn("pageshow","page",function(e){var page=this,isDashboardPage=page.classList.contains("type-interior"),isLibraryPage=!isDashboardPage&&page.classList.contains("libraryPage"),apiClient=getCurrentApiClient();isDashboardPage?(mainDrawerButton&&mainDrawerButton.classList.remove("hide"),refreshDashboardInfoInDrawer(apiClient)):(mainDrawerButton&&(enableLibraryNavDrawer?mainDrawerButton.classList.remove("hide"):mainDrawerButton.classList.add("hide")),"library"!==currentDrawerType&&refreshLibraryDrawer()),updateMenuForPageType(isDashboardPage,isLibraryPage),e.detail.isRestored||window.scrollTo(0,0),updateTitle(page),updateBackButton(page),updateLibraryNavLinks(page)}),function(){var html="";html+='
',html+='
',html+='",html+='',html+='',html+='

',html+="
",html+='
',html+='',html+='',html+='',html+='',html+='',layoutManager.mobile||(html+=''),html+="
",html+="
",html+='
',html+="
",skinHeader.classList.add("skinHeader-withBackground"),skinHeader.innerHTML=html,headerHomeButton=skinHeader.querySelector(".headerHomeButton"),headerUserButton=skinHeader.querySelector(".headerUserButton"),headerSettingsButton=skinHeader.querySelector(".headerSettingsButton"),headerCastButton=skinHeader.querySelector(".headerCastButton"),headerSearchButton=skinHeader.querySelector(".headerSearchButton"),browser.chrome||skinHeader.classList.add("skinHeader-blurred"),lazyLoadViewMenuBarImages(),bindMenuEvents()}(),events.on(connectionManager,"localusersignedin",function(e,user){currentDrawerType=null,currentUser={localUser:user},loadNavDrawer(),connectionManager.user(connectionManager.getApiClient(user.ServerId)).then(function(user){currentUser=user,updateUserInHeader(user)})}),events.on(connectionManager,"localusersignedout",function(){currentUser={},updateUserInHeader()}),events.on(playbackManager,"playerchange",updateCastIcon),loadNavDrawer(),LibraryMenu}); \ No newline at end of file +define(["layoutManager","inputManager","connectionManager","events","viewManager","libraryBrowser","appRouter","apphost","playbackManager","browser","globalize","paper-icon-button-light","material-icons","scrollStyles","flexStyles"],function(layoutManager,inputManager,connectionManager,events,viewManager,libraryBrowser,appRouter,appHost,playbackManager,browser,globalize){"use strict";function getCurrentApiClient(){return currentUser&¤tUser.localUser?connectionManager.getApiClient(currentUser.localUser.ServerId):connectionManager.currentApiClient()}function lazyLoadViewMenuBarImages(){require(["imageLoader"],function(imageLoader){imageLoader.lazyChildren(skinHeader)})}function onBackClick(){appRouter.back()}function updateUserInHeader(user){var hasImage;if(user&&user.name){if(user.imageUrl){var url=user.imageUrl;user.supportsImageParams&&(url+="&height="+Math.round(26*Math.max(window.devicePixelRatio||1,2))),updateHeaderUserButton(url),hasImage=!0}headerUserButton.classList.remove("hide")}else headerUserButton.classList.add("hide");hasImage||updateHeaderUserButton(null),user&&user.localUser?(headerHomeButton&&headerHomeButton.classList.remove("hide"),headerSearchButton&&headerSearchButton.classList.remove("hide"),headerSettingsButton&&(user.localUser.Policy.IsAdministrator?headerSettingsButton.classList.remove("hide"):headerSettingsButton.classList.add("hide")),headerCastButton.classList.remove("hide")):(headerHomeButton.classList.add("hide"),headerCastButton.classList.add("hide"),headerSearchButton&&headerSearchButton.classList.add("hide"),headerSettingsButton&&headerSettingsButton.classList.add("hide")),requiresUserRefresh=!1}function updateHeaderUserButton(src){src?(headerUserButton.classList.add("headerUserButtonRound"),headerUserButton.innerHTML=''):(headerUserButton.classList.remove("headerUserButtonRound"),headerUserButton.innerHTML='')}function showSearch(){inputManager.trigger("search")}function onHeaderUserButtonClick(e){Dashboard.showUserFlyout(e.target)}function onHeaderHomeButtonClick(){Dashboard.navigate("home.html")}function bindMenuEvents(){(mainDrawerButton=document.querySelector(".mainDrawerButton"))&&mainDrawerButton.addEventListener("click",toggleMainDrawer);var headerBackButton=document.querySelector(".headerBackButton");headerBackButton&&headerBackButton.addEventListener("click",onBackClick),headerSearchButton&&headerSearchButton.addEventListener("click",showSearch),headerUserButton.addEventListener("click",onHeaderUserButtonClick),headerHomeButton.addEventListener("click",onHeaderHomeButtonClick),initHeadRoom(skinHeader),skinHeader.querySelector(".btnNotifications").addEventListener("click",function(){Dashboard.navigate("notifications.html")}),headerCastButton.addEventListener("click",onCastButtonClicked)}function onCastButtonClicked(){var btn=this;require(["playerSelectionMenu"],function(playerSelectionMenu){playerSelectionMenu.show(btn)})}function getItemHref(item,context){return appRouter.getRouteUrl(item,{context:context})}function toggleMainDrawer(){navDrawerInstance.isVisible?closeMainDrawer():openMainDrawer()}function openMainDrawer(){navDrawerInstance.open(),lastOpenTime=(new Date).getTime()}function onMainDrawerOpened(){layoutManager.mobile&&document.body.classList.add("bodyWithPopupOpen")}function closeMainDrawer(){navDrawerInstance.close()}function onMainDrawerSelect(e){navDrawerInstance.isVisible?onMainDrawerOpened():document.body.classList.remove("bodyWithPopupOpen")}function refreshLibraryInfoInDrawer(user,drawer){var html="";html+='
',html+=''+globalize.translate("ButtonHome")+"",html+='
',html+='',html+='

',html+=globalize.translate("sharedcomponents#HeaderMyDownloads"),html+="

",html+=''+globalize.translate("sharedcomponents#Browse")+"",html+=''+globalize.translate("sharedcomponents#Manage")+"",html+="
",html+='',html+='
',html+="
";var localUser=user.localUser;localUser&&localUser.Policy.IsAdministrator&&(html+='
',html+='',html+='

',html+=globalize.translate("HeaderAdmin"),html+="

",html+=''+globalize.translate("ButtonManageServer")+"",html+=''+globalize.translate("MetadataManager")+"",html+="
"),html+='
',html+='',user.localUser&&(html+=''+globalize.translate("ButtonSettings")+""),html+=''+globalize.translate("sharedcomponents#Sync")+"",Dashboard.isConnectMode()&&(html+=''+globalize.translate("ButtonSelectServer")+""),!user.localUser||user.localUser.EnableAutoLogin&&!user.connectUser||(html+=''+globalize.translate("ButtonSignOut")+""),html+="
",navDrawerScrollContainer.innerHTML=html;var lnkManageServer=navDrawerScrollContainer.querySelector(".lnkManageServer");lnkManageServer&&lnkManageServer.addEventListener("click",onManageServerClicked)}function refreshDashboardInfoInDrawer(apiClient){currentDrawerType="admin",loadNavDrawer(),navDrawerScrollContainer.querySelector(".adminDrawerLogo")?updateDashboardMenuSelectedItem():createDashboardMenu(apiClient)}function isUrlInCurrentView(url){return-1!==window.location.href.toString().toLowerCase().indexOf(url.toLowerCase())}function updateDashboardMenuSelectedItem(){for(var links=navDrawerScrollContainer.querySelectorAll(".navMenuOption"),currentViewId=viewManager.currentView().id,i=0,length=links.length;i0),selected){link.classList.add("navMenuOption-selected");var title="";link=link.querySelector("span")||link;title+=(link.innerText||link.textContent).trim(),LibraryMenu.setTitle(title)}else link.classList.remove("navMenuOption-selected")}}function createToolsMenuList(pluginItems){var links=[{name:globalize.translate("TabServer")},{name:globalize.translate("TabDashboard"),href:"dashboard.html",pageIds:["dashboardPage"],icon:"dashboard"},{name:globalize.translate("TabSettings"),href:"dashboardgeneral.html",pageIds:["dashboardGeneralPage"],icon:"settings"},{name:globalize.translate("TabUsers"),href:"userprofiles.html",pageIds:["userProfilesPage","newUserPage","editUserPage","userLibraryAccessPage","userParentalControlPage","userPasswordPage"],icon:"people"},{name:"Emby Premiere",href:"supporterkey.html",pageIds:["supporterKeyPage"],icon:"star"},{name:globalize.translate("TabLibrary"),href:"library.html",pageIds:["mediaLibraryPage","librarySettingsPage","libraryDisplayPage","metadataImagesConfigurationPage","metadataNfoPage"],icon:"folder",color:"#38c"},{name:globalize.translate("TabPlayback"),icon:"play_circle_filled",color:"#E5342E",href:"cinemamodeconfiguration.html",pageIds:["cinemaModeConfigurationPage","playbackConfigurationPage","streamingSettingsPage"]},{name:globalize.translate("TabTranscoding"),icon:"transform",href:"encodingsettings.html",pageIds:["encodingSettingsPage"]},{name:"Open Subtitles",href:"opensubtitles.html",pageIds:["openSubtitlesPage"],icon:"closed_caption"},{divider:!0,name:globalize.translate("TabDevices")},{name:globalize.translate("TabDevices"),href:"devices.html",pageIds:["devicesPage","devicePage"],icon:"tablet"},{name:globalize.translate("HeaderDownloadSync"),icon:"file_download",href:"syncactivity.html",pageIds:["syncActivityPage","syncJobPage","syncSettingsPage"],color:"#009688"},{name:globalize.translate("TabCameraUpload"),href:"devicesupload.html",pageIds:["devicesUploadPage"],icon:"photo_camera"},{name:globalize.translate("DLNA"),href:"dlnasettings.html",pageIds:["dlnaSettingsPage","dlnaProfilesPage","dlnaProfilePage"],icon:""},{divider:!0,name:globalize.translate("HeaderLiveTV")},{name:globalize.translate("TabLiveTV"),href:"livetvstatus.html",pageIds:["liveTvStatusPage","liveTvTunerPage"],icon:""},{name:globalize.translate("DVR"),href:"livetvsettings.html",pageIds:["liveTvSettingsPage"],icon:"dvr"}];links.push({divider:!0,name:globalize.translate("TabExpert")}),links.push({name:globalize.translate("TabAdvanced"),icon:"settings",href:"dashboardhosting.html",color:"#F16834",pageIds:["dashboardHostingPage","serverSecurityPage"]}),links.push({name:globalize.translate("TabLogs"),href:"log.html",pageIds:["logPage"],icon:"folder_open"}),links.push({name:globalize.translate("TabNotifications"),icon:"notifications",color:"brown",href:"notificationsettings.html",pageIds:["notificationSettingsPage","notificationSettingPage"]}),links.push({name:globalize.translate("TabPlugins"),icon:"add_shopping_cart",color:"#9D22B1",href:"plugins.html",pageIds:["pluginsPage","pluginCatalogPage"]}),links.push({name:globalize.translate("TabScheduledTasks"),href:"scheduledtasks.html",pageIds:["scheduledTasksPage","scheduledTaskPage"],icon:"schedule"}),links.push({name:globalize.translate("MetadataManager"),href:"edititemmetadata.html",pageIds:[],icon:"mode_edit"});for(var i=0,length=pluginItems.length;i",item.icon&&(menuHtml+=''+item.icon+""),menuHtml+="",menuHtml+=item.name,menuHtml+="",menuHtml+=""}function getToolsMenuHtml(apiClient){return getToolsMenuLinks(apiClient).then(function(items){var i,length,item,menuHtml="";for(menuHtml+='
',i=0,length=items.length;i
"),item.href?menuHtml+=getToolsLinkHtml(item):item.name&&(menuHtml+='

',menuHtml+=item.name,menuHtml+="

");return menuHtml+="
"})}function createDashboardMenu(apiClient){return getToolsMenuHtml(apiClient).then(function(toolsMenuHtml){var html="";html+='",html+=toolsMenuHtml,html=html.split("href=").join('onclick="return LibraryMenu.onLinkClicked(event, this);" href='),navDrawerScrollContainer.innerHTML=html,updateDashboardMenuSelectedItem()})}function onSidebarLinkClick(){var section=this.getElementsByClassName("sectionName")[0],text=section?section.innerHTML:this.innerHTML;LibraryMenu.setTitle(text)}function getUserViews(apiClient,userId){return apiClient.getUserViews({},userId).then(function(result){for(var items=result.Items,list=[],i=0,length=items.length;i',html+=globalize.translate("HeaderMedia"),html+="",html+=items.map(function(i){var icon="folder",itemId=i.Id;return"channels"==i.CollectionType?itemId="channels":"livetv"==i.CollectionType&&(itemId="livetv"),"photos"==i.CollectionType?(icon="photo_library","#009688"):"music"==i.CollectionType||"musicvideos"==i.CollectionType?(icon="library_music","#FB8521"):"books"==i.CollectionType?(icon="library_books","#1AA1E1"):"playlists"==i.CollectionType?(icon="view_list","#795548"):"games"==i.CollectionType?(icon="games","#F44336"):"movies"==i.CollectionType?(icon="video_library","#CE5043"):"channels"==i.CollectionType||"Channel"==i.Type?(icon="videocam","#E91E63"):"tvshows"==i.CollectionType?(icon="tv","#4CAF50"):"livetv"==i.CollectionType&&(icon="live_tv","#293AAE"),icon=i.icon||icon,''+icon+''+i.Name+""}).join(""),libraryMenuOptions.innerHTML=html;for(var elem=libraryMenuOptions,sidebarLinks=elem.querySelectorAll(".navMenuOption"),i=0,length=sidebarLinks.length;i200&&setTimeout(function(){closeMainDrawer(),setTimeout(function(){action?action():Dashboard.navigate(link.href)},getNavigateDelay())},50),event.stopPropagation(),event.preventDefault(),!1)},onLogoutClicked:function(){return(new Date).getTime()-lastOpenTime>200&&(closeMainDrawer(),setTimeout(function(){Dashboard.logout()},getNavigateDelay())),!1},onHardwareMenuButtonClick:function(){toggleMainDrawer()},onSettingsClicked:function(event){return 1!=event.which||(Dashboard.navigate("dashboard.html"),!1)},setTabs:function(type,selectedIndex,builder){require(["mainTabsManager"],function(mainTabsManager){type?mainTabsManager.setTabs(viewManager.currentView(),selectedIndex,builder,function(){return[]}):mainTabsManager.setTabs(null)})},setDefaultTitle:function(){pageTitleElement||(pageTitleElement=document.querySelector(".pageTitle")),pageTitleElement&&(pageTitleElement.classList.add("pageTitleWithLogo"),pageTitleElement.classList.add("pageTitleWithDefaultLogo"),pageTitleElement.style.backgroundImage=null,pageTitleElement.innerHTML=""),document.title="Emby"},setTitle:function(title){if(null==title)return void LibraryMenu.setDefaultTitle();"-"===title&&(title="");var html=title,page=viewManager.currentView();if(page){var helpUrl=page.getAttribute("data-helpurl");helpUrl&&(html+=''+globalize.translate("ButtonHelp")+"")}pageTitleElement||(pageTitleElement=document.querySelector(".pageTitle")),pageTitleElement&&(pageTitleElement.classList.remove("pageTitleWithLogo"),pageTitleElement.classList.remove("pageTitleWithDefaultLogo"),pageTitleElement.style.backgroundImage=null,pageTitleElement.innerHTML=html||""),document.title=title||"Emby"},setTransparentMenu:function(transparent){transparent?skinHeader.classList.add("semiTransparent"):skinHeader.classList.remove("semiTransparent")}};var currentPageType;return pageClassOn("pagebeforeshow","page",function(e){this.classList.contains("withTabs")||LibraryMenu.setTabs(null)}),pageClassOn("pageshow","page",function(e){var page=this,isDashboardPage=page.classList.contains("type-interior"),isLibraryPage=!isDashboardPage&&page.classList.contains("libraryPage"),apiClient=getCurrentApiClient();isDashboardPage?(mainDrawerButton&&mainDrawerButton.classList.remove("hide"),refreshDashboardInfoInDrawer(apiClient)):(mainDrawerButton&&(enableLibraryNavDrawer?mainDrawerButton.classList.remove("hide"):mainDrawerButton.classList.add("hide")),"library"!==currentDrawerType&&refreshLibraryDrawer()),updateMenuForPageType(isDashboardPage,isLibraryPage),e.detail.isRestored||window.scrollTo(0,0),updateTitle(page),updateBackButton(page),updateLibraryNavLinks(page)}),function(){var html="";html+='
',html+='
',html+='",html+='',html+='',html+='

',html+="
",html+='
',html+='',html+='',html+='',html+='',html+='',layoutManager.mobile||(html+=''),html+="
",html+="
",html+='
',html+="
",skinHeader.classList.add("skinHeader-withBackground"),skinHeader.innerHTML=html,headerHomeButton=skinHeader.querySelector(".headerHomeButton"),headerUserButton=skinHeader.querySelector(".headerUserButton"),headerSettingsButton=skinHeader.querySelector(".headerSettingsButton"),headerCastButton=skinHeader.querySelector(".headerCastButton"),headerSearchButton=skinHeader.querySelector(".headerSearchButton"),browser.chrome||skinHeader.classList.add("skinHeader-blurred"),lazyLoadViewMenuBarImages(),bindMenuEvents()}(),events.on(connectionManager,"localusersignedin",function(e,user){currentDrawerType=null,currentUser={localUser:user},loadNavDrawer(),connectionManager.user(connectionManager.getApiClient(user.ServerId)).then(function(user){currentUser=user,updateUserInHeader(user)})}),events.on(connectionManager,"localusersignedout",function(){currentUser={},updateUserInHeader()}),events.on(playbackManager,"playerchange",updateCastIcon),loadNavDrawer(),LibraryMenu}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/scripts/metadatasubtitles.js b/MediaBrowser.WebDashboard/dashboard-ui/scripts/metadatasubtitles.js deleted file mode 100644 index cad63ca453..0000000000 --- a/MediaBrowser.WebDashboard/dashboard-ui/scripts/metadatasubtitles.js +++ /dev/null @@ -1 +0,0 @@ -define(["jQuery","loading","fnchecked","emby-linkbutton"],function($,loading){"use strict";function loadPage(page,config,languages){$("#txtOpenSubtitleUsername",page).val(config.OpenSubtitlesUsername),$("#txtOpenSubtitlePassword",page).val(config.OpenSubtitlesPasswordHash||""),populateLanguages(page,config,languages),loading.hide()}function populateLanguages(page,config,languages){for(var html="",i=0,length=languages.length;i'+culture.DisplayName+""}$(".downloadLanguages",page).html(html);var langs=config.DownloadLanguages||[];$(".chkLang",page).each(function(){this.checked=-1!=langs.indexOf(this.getAttribute("data-lang"))})}function onSubmit(){loading.show();var form=this;return ApiClient.getNamedConfiguration("subtitles").then(function(config){config.OpenSubtitlesUsername=$("#txtOpenSubtitleUsername",form).val();var newPassword=$("#txtOpenSubtitlePassword",form).val();newPassword&&(config.OpenSubtitlesPasswordHash=newPassword),ApiClient.updateNamedConfiguration("subtitles",config).then(Dashboard.processServerConfigurationUpdateResult)}),!1}$(document).on("pageinit","#metadataSubtitlesPage",function(){$(".metadataSubtitlesForm").off("submit",onSubmit).on("submit",onSubmit)}).on("pageshow","#metadataSubtitlesPage",function(){loading.show();var page=this,promise1=ApiClient.getNamedConfiguration("subtitles"),promise2=ApiClient.getCultures();Promise.all([promise1,promise2]).then(function(responses){loadPage(page,responses[0],responses[1])})})}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/scripts/opensubtitles.js b/MediaBrowser.WebDashboard/dashboard-ui/scripts/opensubtitles.js new file mode 100644 index 0000000000..9c60142ab3 --- /dev/null +++ b/MediaBrowser.WebDashboard/dashboard-ui/scripts/opensubtitles.js @@ -0,0 +1 @@ +define(["loading","fnchecked","emby-linkbutton","emby-input","emby-checkbox","emby-button"],function(loading){"use strict";function loadPage(page,config){page.querySelector("#txtOpenSubtitleUsername").value=config.OpenSubtitlesUsername,page.querySelector("#txtOpenSubtitlePassword").value=config.OpenSubtitlesPasswordHash||"",loading.hide()}function onSubmit(e){e.preventDefault(),loading.show();var form=this;return ApiClient.getNamedConfiguration("subtitles").then(function(config){config.OpenSubtitlesUsername=form.querySelector("#txtOpenSubtitleUsername").value;var newPassword=form.querySelector("#txtOpenSubtitlePassword").value;newPassword&&(config.OpenSubtitlesPasswordHash=newPassword),ApiClient.updateNamedConfiguration("subtitles",config).then(Dashboard.processServerConfigurationUpdateResult)}),!1}return function(view,params){view.querySelector("form").addEventListener("submit",onSubmit),view.addEventListener("viewshow",function(){loading.show();var page=this;ApiClient.getNamedConfiguration("subtitles").then(function(response){loadPage(page,response)})})}}); \ No newline at end of file diff --git a/MediaBrowser.WebDashboard/dashboard-ui/scripts/site.js b/MediaBrowser.WebDashboard/dashboard-ui/scripts/site.js index 0bcf97d70b..5d9d4e071e 100644 --- a/MediaBrowser.WebDashboard/dashboard-ui/scripts/site.js +++ b/MediaBrowser.WebDashboard/dashboard-ui/scripts/site.js @@ -1,2 +1,2 @@ -function getWindowLocationSearch(win){"use strict";var search=(win||window).location.search;if(!search){var index=window.location.href.indexOf("?");-1!=index&&(search=window.location.href.substring(index))}return search||""}function getParameterByName(name,url){"use strict";name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+name+"=([^&#]*)",regex=new RegExp(regexS,"i"),results=regex.exec(url||getWindowLocationSearch());return null==results?"":decodeURIComponent(results[1].replace(/\+/g," "))}function pageClassOn(eventName,className,fn){"use strict";document.addEventListener(eventName,function(e){var target=e.target;target.classList.contains(className)&&fn.call(target,e)})}function pageIdOn(eventName,id,fn){"use strict";document.addEventListener(eventName,function(e){var target=e.target;target.id===id&&fn.call(target,e)})}var Dashboard={isConnectMode:function(){if(AppInfo.isNativeApp)return!0;var url=window.location.href.toLowerCase();return-1!=url.indexOf("mediabrowser.tv")||-1!=url.indexOf("emby.media")},isRunningInCordova:function(){return"cordova"==window.appMode},allowPluginPages:function(pluginId){var allowedPluginConfigs=["14f5f69e-4c8d-491b-8917-8e90e8317530","e711475e-efad-431b-8527-033ba9873a34","dc372f99-4e0e-4c6b-8c18-2b887ca4530c","0417264b-5a93-4ad0-a1f0-b87569b7cf80","899c12c7-5b40-4c4e-9afd-afd74a685eb1","830fc68f-b964-4d2f-b139-48e22cd143c7","b9f0c474-e9a8-4292-ae41-eb3c1542f4cd","b0daa30f-2e09-4083-a6ce-459d9fecdd80","7cfbb821-e8fd-40ab-b64e-a7749386a6b2","4C2FDA1C-FD5E-433A-AD2B-718E0B73E9A9","cd5a19be-7676-48ef-b64f-a17c98f2b889","b2ff6a63-303a-4a84-b937-6e12f87e3eb9","9574ac10-bf23-49bc-949f-924f23cfa48f","66fd72a4-7e8e-4f22-8d1c-022ce4b9b0d5","8e791e2a-058a-4b12-8493-8bf69d92d685","577f89eb-58a7-4013-be06-9a970ddb1377","6153FDF0-40CC-4457-8730-3B4A19512BAE","de228f12-e43e-4bd9-9fc0-2830819c3b92","6C3B6965-C257-47C2-AA02-64457AE21D91","2FE79C34-C9DC-4D94-9DF2-2F3F36764414","AB95885A-1D0E-445E-BDBF-80C1912C98C5","986a7283-205a-4436-862d-23135c067f8a","8abc6789-fde2-4705-8592-4028806fa343","2850d40d-9c66-4525-aa46-968e8ef04e97"];return!(AppInfo.isNativeApp&&-1===allowedPluginConfigs.indexOf((pluginId||"").toLowerCase()))},getCurrentUser:function(){return window.ApiClient.getCurrentUser(!1)},serverAddress:function(){if(Dashboard.isConnectMode()){var apiClient=window.ApiClient;return apiClient?apiClient.serverAddress():null}var urlLower=window.location.href.toLowerCase(),index=urlLower.lastIndexOf("/web");if(-1!=index)return urlLower.substring(0,index);var loc=window.location,address=loc.protocol+"//"+loc.hostname;return loc.port&&(address+=":"+loc.port),address},getCurrentUserId:function(){var apiClient=window.ApiClient;return apiClient?apiClient.getCurrentUserId():null},onServerChanged:function(userId,accessToken,apiClient){apiClient=apiClient||window.ApiClient,window.ApiClient=apiClient},logout:function(logoutWithServer){function onLogoutDone(){var loginPage;Dashboard.isConnectMode()?(loginPage="connectlogin.html",window.ApiClient=null):loginPage="login.html",Dashboard.navigate(loginPage)}!1===logoutWithServer?onLogoutDone():ConnectionManager.logout().then(onLogoutDone)},getConfigurationPageUrl:function(name){return Dashboard.isConnectMode()?"configurationpageext?name="+encodeURIComponent(name):"configurationpage?name="+encodeURIComponent(name)},getConfigurationResourceUrl:function(name){return Dashboard.isConnectMode()?ApiClient.getUrl("web/ConfigurationPage",{name:name}):Dashboard.getConfigurationPageUrl(name)},navigate:function(url,preserveQueryString){if(!url)throw new Error("url cannot be null or empty");var queryString=getWindowLocationSearch();return preserveQueryString&&queryString&&(url+=queryString),new Promise(function(resolve,reject){require(["appRouter"],function(appRouter){return appRouter.show(url).then(resolve,reject)})})},processPluginConfigurationUpdateResult:function(){require(["loading","toast"],function(loading,toast){loading.hide(),toast(Globalize.translate("MessageSettingsSaved"))})},processServerConfigurationUpdateResult:function(result){require(["loading","toast"],function(loading,toast){loading.hide(),toast(Globalize.translate("MessageSettingsSaved"))})},processErrorResponse:function(response){require(["loading"],function(loading){loading.hide()});var status=""+response.status;response.statusText&&(status=response.statusText),Dashboard.alert({title:status,message:response.headers?response.headers.get("X-Application-Error-Code"):null})},alert:function(options){if("string"==typeof options)return void require(["toast"],function(toast){toast({text:options})});require(["alert"],function(alert){alert({title:options.title||Globalize.translate("HeaderAlert"),text:options.message}).then(options.callback||function(){})})},restartServer:function(){var apiClient=window.ApiClient;apiClient&&require(["serverRestartDialog","events"],function(ServerRestartDialog,events){var dialog=new ServerRestartDialog({apiClient:apiClient});events.on(dialog,"restarted",function(){Dashboard.isConnectMode()?apiClient.ensureWebSocket():window.location.reload(!0)}),dialog.show()})},showUserFlyout:function(){Dashboard.navigate("mypreferencesmenu.html")},capabilities:function(appHost){var caps={PlayableMediaTypes:["Audio","Video"],SupportedCommands:["MoveUp","MoveDown","MoveLeft","MoveRight","PageUp","PageDown","PreviousLetter","NextLetter","ToggleOsd","ToggleContextMenu","Select","Back","SendKey","SendString","GoHome","GoToSettings","VolumeUp","VolumeDown","Mute","Unmute","ToggleMute","SetVolume","SetAudioStreamIndex","SetSubtitleStreamIndex","DisplayContent","GoToSearch","DisplayMessage","SetRepeatMode","ChannelUp","ChannelDown","PlayMediaSource"],SupportsPersistentIdentifier:Dashboard.isRunningInCordova(),SupportsMediaControl:!0};if(caps.SupportsSync=appHost.supports("sync"),caps.SupportsContentUploading=appHost.supports("cameraupload"),self.MainActivity){var fcmToken=MainActivity.getFcmToken();fcmToken&&(caps.PushToken=fcmToken,caps.PushTokenType="firebase")}return caps}},AppInfo={};!function(){"use strict";function initializeApiClient(apiClient){Dashboard.isRunningInCordova()&&(apiClient.getAvailablePlugins=function(){return Promise.resolve([])})}function onApiClientCreated(e,newApiClient){initializeApiClient(newApiClient),window.$&&($.ajax=newApiClient.ajax)}function defineConnectionManager(connectionManager){window.ConnectionManager=connectionManager,define("connectionManager",[],function(){return connectionManager})}function bindConnectionManagerEvents(connectionManager,events,userSettings){window.Events=events,events.on(ConnectionManager,"apiclientcreated",onApiClientCreated),connectionManager.currentApiClient=function(){if(!localApiClient){var server=connectionManager.getLastUsedServer();server&&(localApiClient=connectionManager.getApiClient(server.Id))}return localApiClient},connectionManager.onLocalUserSignedIn=function(user){return localApiClient=connectionManager.getApiClient(user.ServerId),window.ApiClient=localApiClient,userSettings.setUserInfo(user.Id,localApiClient)},events.on(connectionManager,"localusersignedout",function(){userSettings.setUserInfo(null,null)})}function createConnectionManager(){return new Promise(function(resolve,reject){require(["connectionManagerFactory","apphost","credentialprovider","events","userSettings"],function(ConnectionManager,apphost,credentialProvider,events,userSettings){var credentialProviderInstance=new credentialProvider,promises=[apphost.getSyncProfile(),apphost.appInfo()];Promise.all(promises).then(function(responses){var deviceProfile=responses[0],appInfo=responses[1],capabilities=Dashboard.capabilities(apphost);capabilities.DeviceProfile=deviceProfile;var connectionManager=new ConnectionManager(credentialProviderInstance,appInfo.appName,appInfo.appVersion,appInfo.deviceName,appInfo.deviceId,capabilities,window.devicePixelRatio);if(defineConnectionManager(connectionManager),bindConnectionManagerEvents(connectionManager,events,userSettings),!Dashboard.isConnectMode())return console.log("loading ApiClient singleton"),getRequirePromise(["apiclient"]).then(function(apiClientFactory){console.log("creating ApiClient singleton");var apiClient=new apiClientFactory(Dashboard.serverAddress(),appInfo.appName,appInfo.appVersion,appInfo.deviceName,appInfo.deviceId,window.devicePixelRatio);apiClient.enableAutomaticNetworking=!1,connectionManager.addApiClient(apiClient),window.ApiClient=apiClient,localApiClient=apiClient,console.log("loaded ApiClient singleton"),resolve()});resolve()})})})}function setDocumentClasses(browser){var elem=document.documentElement;AppInfo.enableSupporterMembership||elem.classList.add("supporterMembershipDisabled")}function returnFirstDependency(obj){return obj}function getSettingsBuilder(UserSettings,layoutManager,browser){return UserSettings.prototype.enableThemeVideos=function(val){return null!=val?this.set("enableThemeVideos",val.toString(),!1):(val=this.get("enableThemeVideos",!1),val?"false"!==val:!layoutManager.mobile&&!browser.slow)},UserSettings}function getBowerPath(){return"bower_components"}function getPlaybackManager(playbackManager){return window.addEventListener("beforeunload",function(e){try{playbackManager.onAppClose()}catch(err){console.log("error in onAppClose: "+err)}}),playbackManager}function getLayoutManager(layoutManager,appHost){return appHost.getDefaultLayout&&(layoutManager.defaultLayout=appHost.getDefaultLayout()),layoutManager.init(),layoutManager}function getAppStorage(basePath){try{return localStorage.setItem("_test","0"),localStorage.removeItem("_test"),basePath+"/appstorage-localstorage"}catch(e){return basePath+"/appstorage-memory"}}function createWindowHeadroom(Headroom){var headroom=new Headroom([],{});return headroom.init(),headroom}function getCastSenderApiLoader(){var ccLoaded=!1;return{load:function(){return ccLoaded?Promise.resolve():new Promise(function(resolve,reject){var fileref=document.createElement("script");fileref.setAttribute("type","text/javascript"),fileref.onload=function(){ccLoaded=!0,resolve()},fileref.setAttribute("src","https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"),document.querySelector("head").appendChild(fileref)})}}}function getDummyCastSenderApiLoader(){return{load:function(){return window.chrome=window.chrome||{},Promise.resolve()}}}function createSharedAppFooter(appFooter){return new appFooter({})}function onRequireJsError(requireType,requireModules){console.log("RequireJS error: "+(requireType||"unknown")+". Failed modules: "+(requireModules||[]).join(","))}function defineResizeObserver(){self.ResizeObserver?define("ResizeObserver",[],function(){return self.ResizeObserver}):define("ResizeObserver",["bower_components/resize-observer-polyfill/dist/ResizeObserver"],returnFirstDependency)}function initRequireWithBrowser(browser){var bowerPath=getBowerPath(),apiClientBowerPath=bowerPath+"/emby-apiclient",embyWebComponentsBowerPath=bowerPath+"/emby-webcomponents";Dashboard.isRunningInCordova()&&browser.android?define("iapManager",["cordova/iap"],returnFirstDependency):Dashboard.isRunningInCordova()&&browser.iOS?define("iapManager",["cordova/iap"],returnFirstDependency):define("iapManager",["components/iap"],returnFirstDependency),Dashboard.isRunningInCordova()&&browser.android?(define("filesystem",["cordova/filesystem"],returnFirstDependency),define("cameraRoll",["cordova/cameraroll"],returnFirstDependency)):(define("filesystem",[embyWebComponentsBowerPath+"/filesystem"],returnFirstDependency),define("cameraRoll",[apiClientBowerPath+"/cameraroll"],returnFirstDependency)),window.IntersectionObserver&&!browser.edge?define("lazyLoader",[embyWebComponentsBowerPath+"/lazyloader/lazyloader-intersectionobserver"],returnFirstDependency):define("lazyLoader",[embyWebComponentsBowerPath+"/lazyloader/lazyloader-scroll"],returnFirstDependency),Dashboard.isRunningInCordova()&&browser.android?define("shell",["cordova/shell"],returnFirstDependency):define("shell",[embyWebComponentsBowerPath+"/shell"],returnFirstDependency),Dashboard.isRunningInCordova()&&browser.android?(define("apiclientcore",["bower_components/emby-apiclient/apiclient"],returnFirstDependency),define("apiclient",["bower_components/emby-apiclient/apiclientex"],returnFirstDependency),define("wakeOnLan",["cordova/wakeonlan"],returnFirstDependency)):Dashboard.isRunningInCordova()&&browser.safari?(define("apiclient",["bower_components/emby-apiclient/apiclient"],returnFirstDependency),define("wakeOnLan",["cordova/wakeonlan"],returnFirstDependency)):(define("apiclient",["bower_components/emby-apiclient/apiclient"],returnFirstDependency),define("wakeOnLan",["bower_components/emby-apiclient/wakeonlan"],returnFirstDependency)),define("actionsheet",["webActionSheet"],returnFirstDependency),"registerElement"in document?define("registerElement",[]):browser.msie?define("registerElement",[bowerPath+"/webcomponentsjs/webcomponents-lite.min.js"],returnFirstDependency):define("registerElement",[bowerPath+"/document-register-element/build/document-register-element"],returnFirstDependency),window.chrome&&window.chrome.sockets?define("serverdiscovery",[apiClientBowerPath+"/serverdiscovery-chrome"],returnFirstDependency):Dashboard.isRunningInCordova()&&browser.android?define("serverdiscovery",["cordova/serverdiscovery"],returnFirstDependency):Dashboard.isRunningInCordova()&&browser.safari?define("serverdiscovery",[apiClientBowerPath+"/serverdiscovery-chrome"],returnFirstDependency):define("serverdiscovery",[apiClientBowerPath+"/serverdiscovery"],returnFirstDependency),Dashboard.isRunningInCordova()&&browser.iOSVersion&&browser.iOSVersion<11?define("imageFetcher",["cordova/imagestore"],returnFirstDependency):define("imageFetcher",[embyWebComponentsBowerPath+"/images/basicimagefetcher"],returnFirstDependency);var preferNativeAlerts=browser.tv;preferNativeAlerts&&window.alert?define("alert",[embyWebComponentsBowerPath+"/alert/nativealert"],returnFirstDependency):define("alert",[embyWebComponentsBowerPath+"/alert/alert"],returnFirstDependency),defineResizeObserver(),define("dialog",[embyWebComponentsBowerPath+"/dialog/dialog"],returnFirstDependency),preferNativeAlerts&&window.confirm?define("confirm",[embyWebComponentsBowerPath+"/confirm/nativeconfirm"],returnFirstDependency):define("confirm",[embyWebComponentsBowerPath+"/confirm/confirm"],returnFirstDependency),(preferNativeAlerts||browser.xboxOne)&&window.confirm?define("prompt",[embyWebComponentsBowerPath+"/prompt/nativeprompt"],returnFirstDependency):define("prompt",[embyWebComponentsBowerPath+"/prompt/prompt"],returnFirstDependency),browser.tizen||browser.operaTv||browser.chromecast||browser.orsay||browser.web0s||browser.ps4?define("loading",[embyWebComponentsBowerPath+"/loading/loading-legacy"],returnFirstDependency):define("loading",[embyWebComponentsBowerPath+"/loading/loading-lite"],returnFirstDependency),define("multi-download",[embyWebComponentsBowerPath+"/multidownload"],returnFirstDependency),Dashboard.isRunningInCordova()&&browser.android?define("fileDownloader",["cordova/filedownloader"],returnFirstDependency):define("fileDownloader",[embyWebComponentsBowerPath+"/filedownloader"],returnFirstDependency),define("localassetmanager",[apiClientBowerPath+"/localassetmanager"],returnFirstDependency),Dashboard.isRunningInCordova()?define("castSenderApiLoader",[],getDummyCastSenderApiLoader):define("castSenderApiLoader",[],getCastSenderApiLoader),self.Windows?(define("bgtaskregister",["environments/windows-uwp/bgtaskregister"],returnFirstDependency),define("transfermanager",["environments/windows-uwp/transfermanager"],returnFirstDependency),define("filerepository",["environments/windows-uwp/filerepository"],returnFirstDependency)):Dashboard.isRunningInCordova()&&browser.iOS?(define("filerepository",["cordova/filerepository"],returnFirstDependency),define("transfermanager",["filerepository"],returnFirstDependency)):Dashboard.isRunningInCordova()&&browser.android?(define("transfermanager",["cordova/transfermanager"],returnFirstDependency),define("filerepository",["cordova/filerepository"],returnFirstDependency)):(define("transfermanager",[apiClientBowerPath+"/sync/transfermanager"],returnFirstDependency),define("filerepository",[apiClientBowerPath+"/sync/filerepository"],returnFirstDependency)),Dashboard.isRunningInCordova()&&browser.android?define("localsync",["cordova/localsync"],returnFirstDependency):define("localsync",[apiClientBowerPath+"/sync/localsync"],returnFirstDependency)}function getRequirePromise(deps){return new Promise(function(resolve,reject){require(deps,resolve)})}function init(){Dashboard.isRunningInCordova()&&browserInfo.android&&define("nativedirectorychooser",["cordova/nativedirectorychooser"],returnFirstDependency),define("livetvcss",["css!css/livetv.css"],returnFirstDependency),define("detailtablecss",["css!css/detailtable.css"],returnFirstDependency),define("buttonenabled",["legacy/buttonenabled"],returnFirstDependency);var list=[];window.fetch||list.push("fetch"),"function"!=typeof Object.assign&&list.push("objectassign"),Array.prototype.filter||list.push("arraypolyfills"),Function.prototype.bind||list.push("functionbind"),window.requestAnimationFrame||list.push("raf"),require(list,function(){createConnectionManager().then(function(){console.log("initAfterDependencies promises resolved"),require(["globalize"],function(globalize){window.Globalize=globalize,Promise.all([loadCoreDictionary(globalize),loadSharedComponentsDictionary(globalize)]).then(onGlobalizeInit)})})})}function loadSharedComponentsDictionary(globalize){var languages=["ar","be-by","bg-bg","ca","cs","da","de","el","en-gb","en-us","es-ar","es-mx","es","fi","fr","gsw","he","hr","hu","id","it","kk","ko","lt-lt","ms","nb","nl","pl","pt-br","pt-pt","ro","ru","sk","sl-si","sv","tr","uk","vi","zh-cn","zh-hk","zh-tw"],translations=languages.map(function(i){return{lang:i,path:"bower_components/emby-webcomponents/strings/"+i+".json"}});globalize.loadStrings({name:"sharedcomponents",translations:translations})}function loadCoreDictionary(globalize){var languages=["ar","be-BY","bg-BG","ca","cs","da","de","el","en-GB","en-US","es","es-AR","es-MX","fa","fi","fr","fr-CA","gsw","he","hi-IN","hr","hu","id","it","kk","ko","lt-LT","ms","nb","nl","pl","pt-BR","pt-PT","ro","ru","sk","sl-SI","sv","tr","uk","vi","zh-CN","zh-HK","zh-TW"],translations=languages.map(function(i){return{lang:i,path:"strings/"+i+".json"}});return globalize.defaultModule("core"),globalize.loadStrings({name:"core",translations:translations})}function onGlobalizeInit(){document.title=Globalize.translateDocument(document.title,"core");var deps=["apphost"];browserInfo.tv&&!browserInfo.android?(console.log("Using system fonts with explicit sizes"),deps.push("systemFontsSizedCss")):(console.log("Using default fonts"),deps.push("systemFontsCss")),deps.push("css!css/librarybrowser"),require(deps,function(appHost){loadPlugins([],appHost,browserInfo).then(onAppReady)})}function defineRoute(newRoute,dictionary){var baseRoute=Emby.Page.baseUrl(),path=newRoute.path;path=path.replace(baseRoute,""),console.log("Defining route: "+path),newRoute.dictionary=newRoute.dictionary||dictionary||"core",Emby.Page.addRoute(path,newRoute)}function defineCoreRoutes(appHost){console.log("Defining core routes"),defineRoute({path:"/addplugin.html",dependencies:[],autoFocus:!1,roles:"admin",controller:"scripts/addpluginpage"}),defineRoute({path:"/appservices.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/autoorganizelog.html",dependencies:[],roles:"admin"}),defineRoute({path:"/channelsettings.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/cinemamodeconfiguration.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/connectlogin.html",dependencies:["emby-button","emby-input"],autoFocus:!1,anonymous:!0,startup:!0,controller:"scripts/connectlogin"}),defineRoute({path:"/dashboard.html",dependencies:[],autoFocus:!1,roles:"admin",controller:"scripts/dashboardpage"}),defineRoute({path:"/dashboardgeneral.html",controller:"dashboard/dashboardgeneral",autoFocus:!1,roles:"admin"}),defineRoute({path:"/dashboardhosting.html",dependencies:["emby-input","emby-button"],autoFocus:!1,roles:"admin",controller:"dashboard/dashboardhosting"}),defineRoute({path:"/device.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/devices.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/devicesupload.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/dlnaprofile.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/dlnaprofiles.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/dlnaserversettings.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/dlnasettings.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/edititemmetadata.html",dependencies:[],controller:"scripts/edititemmetadata",autoFocus:!1}),defineRoute({path:"/encodingsettings.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/forgotpassword.html",dependencies:["emby-input","emby-button"],anonymous:!0,startup:!0,controller:"scripts/forgotpassword"}),defineRoute({path:"/forgotpasswordpin.html",dependencies:["emby-input","emby-button"],autoFocus:!1,anonymous:!0,startup:!0,controller:"scripts/forgotpasswordpin"}),defineRoute({path:"/home.html",dependencies:[],autoFocus:!1,controller:"home/home",transition:"fade",type:"home"}),defineRoute({path:"/list.html",dependencies:[],autoFocus:!1,controller:"list/list",transition:"fade"}),defineRoute({path:"/index.html",dependencies:[],autoFocus:!1,isDefaultRoute:!0}),defineRoute({path:"/itemdetails.html",dependencies:["emby-button","scripts/livetvcomponents","paper-icon-button-light","emby-itemscontainer"],controller:"scripts/itemdetailpage",autoFocus:!1,transition:"fade"}),defineRoute({path:"/library.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/librarydisplay.html",dependencies:[],autoFocus:!1,roles:"admin",controller:"dashboard/librarydisplay"}),defineRoute({path:"/librarysettings.html",dependencies:["emby-collapse","emby-input","emby-button","emby-select"],autoFocus:!1,roles:"admin",controller:"dashboard/librarysettings"}),defineRoute({path:"/livetv.html",dependencies:["emby-button","livetvcss"],controller:"scripts/livetvsuggested",autoFocus:!1,transition:"fade"}),defineRoute({path:"/livetvguideprovider.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/livetvseriestimer.html",dependencies:["emby-checkbox","emby-input","emby-button","emby-collapse","scripts/livetvcomponents","scripts/livetvseriestimer","livetvcss"],autoFocus:!1,controller:"scripts/livetvseriestimer"}),defineRoute({path:"/livetvsettings.html",dependencies:[],autoFocus:!1}),defineRoute({path:"/livetvstatus.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/livetvtuner.html",dependencies:[],autoFocus:!1,roles:"admin",controller:"dashboard/livetvtuner"}),defineRoute({path:"/log.html",dependencies:["emby-checkbox"],roles:"admin",controller:"dashboard/logpage"}),defineRoute({path:"/login.html",dependencies:["emby-button","emby-input"],autoFocus:!1,anonymous:!0,startup:!0,controller:"scripts/loginpage"}),defineRoute({path:"/metadataadvanced.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/metadataimages.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/metadatanfo.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/metadatasubtitles.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/movies.html",dependencies:["emby-button"],autoFocus:!1,controller:"scripts/moviesrecommended",transition:"fade"}),defineRoute({path:"/music.html",dependencies:[],controller:"scripts/musicrecommended",autoFocus:!1,transition:"fade"}),defineRoute({path:"/mypreferencesdisplay.html",dependencies:["emby-checkbox","emby-button","emby-select"],autoFocus:!1,transition:"fade",controller:"scripts/mypreferencesdisplay"}),defineRoute({path:"/mypreferenceshome.html",dependencies:[],autoFocus:!1,transition:"fade",controller:"scripts/mypreferenceshome"}),defineRoute({path:"/mypreferencessubtitles.html",dependencies:[],autoFocus:!1,transition:"fade",controller:"scripts/mypreferencessubtitles"}),defineRoute({path:"/mypreferenceslanguages.html",dependencies:["emby-button","emby-checkbox","emby-select"],autoFocus:!1,transition:"fade",controller:"scripts/mypreferenceslanguages"}),defineRoute({path:"/mypreferencesmenu.html",dependencies:["emby-button"],autoFocus:!1,transition:"fade",controller:"scripts/mypreferencescommon"}),defineRoute({path:"/myprofile.html",dependencies:["emby-button","emby-collapse","emby-checkbox","emby-input"],autoFocus:!1,transition:"fade",controller:"scripts/myprofile"}),defineRoute({path:"/offline/offline.html",transition:"fade",controller:"offline/offline",dependencies:[],anonymous:!0,startup:!1}),defineRoute({path:"/managedownloads.html",transition:"fade",controller:"scripts/managedownloads",dependencies:[]}),defineRoute({path:"/mysync.html",dependencies:[],autoFocus:!1,transition:"fade",controller:"scripts/mysync"}),defineRoute({path:"/camerauploadsettings.html",dependencies:[],autoFocus:!1,transition:"fade",controller:"scripts/camerauploadsettings"}),defineRoute({path:"/mysyncjob.html",dependencies:[],autoFocus:!1,transition:"fade",controller:"scripts/syncjob"}),defineRoute({path:"/mysyncsettings.html",dependencies:["emby-checkbox","emby-input","emby-button","paper-icon-button-light"],autoFocus:!1,transition:"fade",controller:"scripts/mysyncsettings"}),defineRoute({path:"/notifications.html",dependencies:[],autoFocus:!1,controller:"scripts/notifications"}),defineRoute({path:"/notificationsetting.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/notificationsettings.html",controller:"scripts/notificationsettings",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/nowplaying.html",dependencies:["paper-icon-button-light","emby-slider","emby-button","emby-input","emby-itemscontainer"],controller:"scripts/nowplayingpage",autoFocus:!1,transition:"fade",fullscreen:!0,supportsThemeMedia:!0,enableMediaControl:!1}),defineRoute({path:"/playbackconfiguration.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/plugincatalog.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/plugins.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/scheduledtask.html",dependencies:[],autoFocus:!1,roles:"admin",controller:"scripts/scheduledtaskpage"}),defineRoute({path:"/scheduledtasks.html",dependencies:[],autoFocus:!1,roles:"admin",controller:"scripts/scheduledtaskspage"}),defineRoute({path:"/search.html",dependencies:[],controller:"scripts/searchpage"}),defineRoute({path:"/selectserver.html",dependencies:["listViewStyle","emby-button"],autoFocus:!1,anonymous:!0,startup:!0,controller:"scripts/selectserver"}),defineRoute({path:"/serversecurity.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/streamingsettings.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/support.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/supporterkey.html",dependencies:[],controller:"scripts/supporterkeypage",autoFocus:!1,roles:"admin"}),defineRoute({path:"/syncactivity.html",dependencies:[],autoFocus:!1,controller:"scripts/syncactivity"}),defineRoute({path:"/syncsettings.html",dependencies:[],autoFocus:!1}),defineRoute({path:"/tv.html",dependencies:["paper-icon-button-light","emby-button"],autoFocus:!1,controller:"scripts/tvrecommended",transition:"fade"}),defineRoute({path:"/useredit.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/userlibraryaccess.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/usernew.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/userparentalcontrol.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/userpassword.html",dependencies:["emby-input","emby-button","emby-checkbox"],autoFocus:!1,controller:"scripts/userpasswordpage"}),defineRoute({path:"/userprofiles.html",dependencies:[],autoFocus:!1,roles:"admin"}),defineRoute({path:"/wizardagreement.html",dependencies:["dashboardcss"],autoFocus:!1,anonymous:!0,controller:"scripts/wizardagreement"}),defineRoute({path:"/wizardremoteaccess.html",dependencies:["dashboardcss"],autoFocus:!1,anonymous:!0,controller:"dashboard/wizardremoteaccess"}),defineRoute({path:"/wizardcomponents.html",dependencies:["dashboardcss","emby-button","emby-input","emby-select"],autoFocus:!1,anonymous:!0,controller:"dashboard/wizardcomponents"}),defineRoute({path:"/wizardfinish.html",dependencies:["emby-button","dashboardcss"],autoFocus:!1,anonymous:!0,controller:"dashboard/wizardfinishpage"}),defineRoute({path:"/wizardlibrary.html",dependencies:["dashboardcss"],autoFocus:!1,anonymous:!0}),defineRoute({path:"/wizardsettings.html",dependencies:["dashboardcss"],autoFocus:!1,anonymous:!0,controller:"dashboard/wizardsettings"}),defineRoute({path:"/wizardstart.html",dependencies:["dashboardcss"],autoFocus:!1,anonymous:!0,controller:"dashboard/wizardstart"}),defineRoute({path:"/wizarduser.html",dependencies:["dashboardcss","emby-input"],controller:"scripts/wizarduserpage",autoFocus:!1,anonymous:!0}),defineRoute({path:"/videoosd.html",dependencies:[],transition:"fade",controller:"scripts/videoosd",autoFocus:!1,type:"video-osd",supportsThemeMedia:!0,fullscreen:!0,enableMediaControl:!1}),defineRoute(Dashboard.isConnectMode()?{path:"/configurationpageext",dependencies:[],autoFocus:!1,enableCache:!1,enableContentQueryString:!0,roles:"admin",contentPath:getPluginPageContentPath}:{path:"/configurationpage",dependencies:[],autoFocus:!1,enableCache:!1,enableContentQueryString:!0,roles:"admin"}),defineRoute({path:"/",isDefaultRoute:!0,autoFocus:!1,dependencies:[]})}function getPluginPageContentPath(){return window.ApiClient?ApiClient.getUrl("web/ConfigurationPage"):null}function loadPlugins(externalPlugins,appHost,browser,shell){console.log("Loading installed plugins");var list=["bower_components/emby-webcomponents/playback/playbackvalidation","bower_components/emby-webcomponents/playback/playaccessvalidation","bower_components/emby-webcomponents/playback/experimentalwarnings"];Dashboard.isRunningInCordova()&&window.MainActivity?MainActivity.enableVlcPlayer()&&list.push("cordova/vlcplayer"):Dashboard.isRunningInCordova()&&browser.safari&&(list.push("cordova/audioplayer"),(browser.iOSVersion||0)>=11&&list.push("cordova/mpvplayer")),list.push("bower_components/emby-webcomponents/htmlaudioplayer/plugin"),Dashboard.isRunningInCordova()&&browser.safari&&list.push("cordova/chromecast"),Dashboard.isRunningInCordova()&&browser.android&&list.push("cordova/externalplayer"),list.push("bower_components/emby-webcomponents/htmlvideoplayer/plugin"),list.push("bower_components/emby-webcomponents/photoplayer/plugin"),appHost.supports("remotecontrol")&&(list.push("bower_components/emby-webcomponents/sessionplayer"),(browser.chrome||browser.opera)&&list.push("bower_components/emby-webcomponents/chromecast/chromecastplayer")),list.push("bower_components/emby-webcomponents/youtubeplayer/plugin");for(var i=0,length=externalPlugins.length;i=11&&list.push("cordova/mpvplayer")),list.push("bower_components/emby-webcomponents/htmlaudioplayer/plugin"),Dashboard.isRunningInCordova()&&browser.safari&&list.push("cordova/chromecast"),Dashboard.isRunningInCordova()&&browser.android&&list.push("cordova/externalplayer"),list.push("bower_components/emby-webcomponents/htmlvideoplayer/plugin"),list.push("bower_components/emby-webcomponents/photoplayer/plugin"),appHost.supports("remotecontrol")&&(list.push("bower_components/emby-webcomponents/sessionplayer"),(browser.chrome||browser.opera)&&list.push("bower_components/emby-webcomponents/chromecast/chromecastplayer")),list.push("bower_components/emby-webcomponents/youtubeplayer/plugin");for(var i=0,length=externalPlugins.length;i