Browse Source

Merge pull request #3051 from MediaBrowser/dev

Dev
Luke 7 years ago
parent
commit
70a73984b8

+ 30 - 7
Emby.Server.Implementations/ApplicationHost.cs

@@ -148,6 +148,34 @@ namespace Emby.Server.Implementations
             }
         }
 
+        public virtual bool CanLaunchWebBrowser
+        {
+            get
+            {
+                if (!Environment.UserInteractive)
+                {
+                    return false;
+                }
+
+                if (StartupOptions.ContainsOption("-service"))
+                {
+                    return false;
+                }
+
+                if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
+                {
+                    return true;
+                }
+
+                if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX)
+                {
+                    return true;
+                }
+
+                return false;
+            }
+        }
+
         /// <summary>
         /// Occurs when [has pending restart changed].
         /// </summary>
@@ -1936,6 +1964,7 @@ namespace Emby.Server.Implementations
                 OperatingSystemDisplayName = OperatingSystemDisplayName,
                 CanSelfRestart = CanSelfRestart,
                 CanSelfUpdate = CanSelfUpdate,
+                CanLaunchWebBrowser = CanLaunchWebBrowser,
                 WanAddress = ConnectManager.WanApiAddress,
                 HasUpdateAvailable = HasUpdateAvailable,
                 SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
@@ -2358,13 +2387,7 @@ namespace Emby.Server.Implementations
 
         public virtual void LaunchUrl(string url)
         {
-            if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&
-                EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.OSX)
-            {
-                throw new NotSupportedException();
-            }
-
-            if (!Environment.UserInteractive)
+            if (!CanLaunchWebBrowser)
             {
                 throw new NotSupportedException();
             }

+ 18 - 0
Emby.Server.Implementations/Archiving/ZipClient.cs

@@ -89,6 +89,24 @@ namespace Emby.Server.Implementations.Archiving
             }
         }
 
+        public void ExtractFirstFileFromGz(Stream source, string targetPath, string defaultFileName)
+        {
+            using (var reader = GZipReader.Open(source))
+            {
+                if (reader.MoveToNextEntry())
+                {
+                    var entry = reader.Entry;
+
+                    var filename = entry.Key;
+                    if (string.IsNullOrWhiteSpace(filename))
+                    {
+                        filename = defaultFileName;
+                    }
+                    reader.WriteEntryToFile(Path.Combine(targetPath, filename));
+                }
+            }
+        }
+
         /// <summary>
         /// Extracts all from7z.
         /// </summary>

+ 7 - 1
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -5264,7 +5264,13 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
                 ItemIds = query.ItemIds,
                 TopParentIds = query.TopParentIds,
                 ParentId = query.ParentId,
-                IsPlayed = query.IsPlayed
+                IsPlayed = query.IsPlayed,
+                IsAiring = query.IsAiring,
+                IsMovie = query.IsMovie,
+                IsSports = query.IsSports,
+                IsKids = query.IsKids,
+                IsNews = query.IsNews,
+                IsSeries = query.IsSeries
             };
 
             var innerWhereClauses = GetWhereClauses(innerQuery, null);

+ 7 - 2
Emby.Server.Implementations/EntryPoints/StartupWizard.cs

@@ -35,15 +35,20 @@ namespace Emby.Server.Implementations.EntryPoints
         /// </summary>
         public void Run()
         {
+            if (!_appHost.CanLaunchWebBrowser)
+            {
+                return;
+            }
+
             if (_appHost.IsFirstRun)
             {
                 BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);
             }
-            else if (_config.Configuration.IsStartupWizardCompleted)
+            else if (_config.Configuration.IsStartupWizardCompleted && _config.Configuration.AutoRunWebApp)
             {
                 var options = ((ApplicationHost)_appHost).StartupOptions;
 
-                if (!options.ContainsOption("-service") && !options.ContainsOption("-nobrowser"))
+                if (!options.ContainsOption("-noautorunwebapp"))
                 {
                     BrowserLauncher.OpenDashboardPage("index.html", _appHost);
                 }

+ 53 - 17
Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs

@@ -105,31 +105,64 @@ namespace Emby.Server.Implementations.LiveTv.Listings
 
             if (string.Equals(ext, ".gz", StringComparison.OrdinalIgnoreCase))
             {
-                using (var stream = _fileSystem.OpenRead(file))
+                try
                 {
-                    var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
-                    _fileSystem.CreateDirectory(tempFolder);
-
-                    try
-                    {
-                        _zipClient.ExtractAllFromGz(stream, tempFolder, true);
-                    }
-                    catch
-                    {
-                        // If the extraction fails just return the original file, it could be a gz
-                        return file;
-                    }
+                    var tempFolder = ExtractGz(file);
+                    return FindXmlFile(tempFolder);
+                }
+                catch (Exception ex)
+                {
+                    //_logger.ErrorException("Error extracting from gz file {0}", ex, file);
+                }
 
-                    return _fileSystem.GetFiles(tempFolder, true)
-                        .Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
-                        .Select(i => i.FullName)
-                        .FirstOrDefault();
+                try
+                {
+                    var tempFolder = ExtractFirstFileFromGz(file);
+                    return FindXmlFile(tempFolder);
+                }
+                catch (Exception ex)
+                {
+                    //_logger.ErrorException("Error extracting from zip file {0}", ex, file);
                 }
             }
 
             return file;
         }
 
+        private string ExtractFirstFileFromGz(string file)
+        {
+            using (var stream = _fileSystem.OpenRead(file))
+            {
+                var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
+                _fileSystem.CreateDirectory(tempFolder);
+
+                _zipClient.ExtractFirstFileFromGz(stream, tempFolder, "data.xml");
+
+                return tempFolder;
+            }
+        }
+
+        private string ExtractGz(string file)
+        {
+            using (var stream = _fileSystem.OpenRead(file))
+            {
+                var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
+                _fileSystem.CreateDirectory(tempFolder);
+
+                _zipClient.ExtractAllFromGz(stream, tempFolder, true);
+
+                return tempFolder;
+            }
+        }
+
+        private string FindXmlFile(string directory)
+        {
+            return _fileSystem.GetFiles(directory, true)
+                .Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
+                .Select(i => i.FullName)
+                .FirstOrDefault();
+        }
+
         public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
         {
             if (string.IsNullOrWhiteSpace(channelId))
@@ -149,6 +182,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
             _logger.Debug("Getting xmltv programs for channel {0}", channelId);
 
             var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
+            _logger.Debug("Opening XmlTvReader for {0}", path);
             var reader = new XmlTvReader(path, GetLanguage(info));
 
             var results = reader.GetProgrammes(channelId, startDateUtc, endDateUtc, cancellationToken);
@@ -251,6 +285,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
         {
             // In theory this should never be called because there is always only one lineup
             var path = await GetXml(info.Path, CancellationToken.None).ConfigureAwait(false);
+            _logger.Debug("Opening XmlTvReader for {0}", path);
             var reader = new XmlTvReader(path, GetLanguage(info));
             var results = reader.GetChannels();
 
@@ -262,6 +297,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
         {
             // In theory this should never be called because there is always only one lineup
             var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
+            _logger.Debug("Opening XmlTvReader for {0}", path);
             var reader = new XmlTvReader(path, GetLanguage(info));
             var results = reader.GetChannels();
 

+ 2 - 1
Emby.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.LiveTv
         public void AddParts(IEnumerable<ILiveTvService> services, IEnumerable<ITunerHost> tunerHosts, IEnumerable<IListingsProvider> listingProviders)
         {
             _services = services.ToArray();
-            _tunerHosts.AddRange(tunerHosts);
+            _tunerHosts.AddRange(tunerHosts.Where(i => i.IsSupported));
             _listingProviders.AddRange(listingProviders);
 
             foreach (var service in _services)
@@ -947,6 +947,7 @@ namespace Emby.Server.Implementations.LiveTv
                 IsKids = query.IsKids,
                 IsNews = query.IsNews,
                 Genres = query.Genres,
+                GenreIds = query.GenreIds,
                 StartIndex = query.StartIndex,
                 Limit = query.Limit,
                 OrderBy = query.OrderBy,

+ 8 - 0
Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs

@@ -39,6 +39,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
             FileSystem = fileSystem;
         }
 
+        public virtual bool IsSupported
+        {
+            get
+            {
+                return true;
+            }
+        }
+
         protected abstract Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);
         public abstract string Type { get; }
 

+ 15 - 10
Emby.Server.Implementations/MediaEncoder/EncodingManager.cs

@@ -76,6 +76,21 @@ namespace Emby.Server.Implementations.MediaEncoder
                 return false;
             }
 
+            if (video.VideoType == VideoType.Iso)
+            {
+                return false;
+            }
+
+            if (video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd)
+            {
+                return false;
+            }
+
+            if (video.IsShortcut)
+            {
+                return false;
+            }
+
             if (!video.IsCompleteMedia)
             {
                 return false;
@@ -118,16 +133,6 @@ namespace Emby.Server.Implementations.MediaEncoder
                 {
                     if (extractImages)
                     {
-                        if (video.VideoType == VideoType.Iso)
-                        {
-                            continue;
-                        }
-
-                        if (video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd)
-                        {
-                            continue;
-                        }
-
                         try
                         {
                             // Add some time for the first chapter to make sure we don't end up with a black image

+ 120 - 4
MediaBrowser.Api/FilterService.cs

@@ -2,6 +2,7 @@
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Net;
 using MediaBrowser.Model.Querying;
+using MediaBrowser.Model.Dto;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -11,6 +12,36 @@ using MediaBrowser.Model.Services;
 namespace MediaBrowser.Api
 {
     [Route("/Items/Filters", "GET", Summary = "Gets branding configuration")]
+    public class GetQueryFiltersLegacy : IReturn<QueryFiltersLegacy>
+    {
+        /// <summary>
+        /// Gets or sets the user id.
+        /// </summary>
+        /// <value>The user id.</value>
+        [ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+        public string UserId { get; set; }
+
+        [ApiMember(Name = "ParentId", Description = "Specify this to localize the search to a specific item or folder. Omit to use the root", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+        public string ParentId { get; set; }
+
+        [ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
+        public string IncludeItemTypes { get; set; }
+
+        [ApiMember(Name = "MediaTypes", Description = "Optional filter by MediaType. Allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
+        public string MediaTypes { get; set; }
+
+        public string[] GetMediaTypes()
+        {
+            return (MediaTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+        }
+
+        public string[] GetIncludeItemTypes()
+        {
+            return (IncludeItemTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+        }
+    }
+
+    [Route("/Items/Filters2", "GET", Summary = "Gets branding configuration")]
     public class GetQueryFilters : IReturn<QueryFilters>
     {
         /// <summary>
@@ -38,6 +69,13 @@ namespace MediaBrowser.Api
         {
             return (IncludeItemTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
         }
+
+        public bool? IsAiring { get; set; }
+        public bool? IsMovie { get; set; }
+        public bool? IsSports { get; set; }
+        public bool? IsKids { get; set; }
+        public bool? IsNews { get; set; }
+        public bool? IsSeries { get; set; }
     }
 
     [Authenticated]
@@ -57,18 +95,96 @@ namespace MediaBrowser.Api
             var parentItem = string.IsNullOrEmpty(request.ParentId) ? null : _libraryManager.GetItemById(request.ParentId);
             var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
 
+            if (string.Equals(request.IncludeItemTypes, "BoxSet", StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, "Playlist", StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, typeof(Trailer).Name, StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, "Program", StringComparison.OrdinalIgnoreCase))
+            {
+                parentItem = null;
+            }
+
+            var filters = new QueryFilters();
+
+            var genreQuery = new InternalItemsQuery(user)
+            {
+                AncestorIds = parentItem == null ? new string[] { } : new string[] { parentItem.Id.ToString("N") },
+                IncludeItemTypes = request.GetIncludeItemTypes(),
+                DtoOptions = new Controller.Dto.DtoOptions
+                {
+                    Fields = new ItemFields[] { },
+                    EnableImages = false,
+                    EnableUserData = false
+                },
+                IsAiring = request.IsAiring,
+                IsMovie = request.IsMovie,
+                IsSports = request.IsSports,
+                IsKids = request.IsKids,
+                IsNews = request.IsNews,
+                IsSeries = request.IsSeries
+            };
+
+            if (string.Equals(request.IncludeItemTypes, "MusicAlbum", StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, "MusicVideo", StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, "MusicArtist", StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, "Audio", StringComparison.OrdinalIgnoreCase))
+            {
+                filters.Genres = _libraryManager.GetMusicGenres(genreQuery).Items.Select(i => new NameIdPair
+                {
+                    Name = i.Item1.Name,
+                    Id = i.Item1.Id.ToString("N")
+
+                }).ToArray();
+            }
+            else if (string.Equals(request.IncludeItemTypes, "Game", StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, "GameSystem", StringComparison.OrdinalIgnoreCase))
+            {
+                filters.Genres = _libraryManager.GetGameGenres(genreQuery).Items.Select(i => new NameIdPair
+                {
+                    Name = i.Item1.Name,
+                    Id = i.Item1.Id.ToString("N")
+
+                }).ToArray();
+            }
+            else
+            {
+                filters.Genres = _libraryManager.GetGenres(genreQuery).Items.Select(i => new NameIdPair
+                {
+                    Name = i.Item1.Name,
+                    Id = i.Item1.Id.ToString("N")
+
+                }).ToArray();
+            }
+
+            return ToOptimizedResult(filters);
+        }
+
+        public object Get(GetQueryFiltersLegacy request)
+        {
+            var parentItem = string.IsNullOrEmpty(request.ParentId) ? null : _libraryManager.GetItemById(request.ParentId);
+            var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
+
+            if (string.Equals(request.IncludeItemTypes, "BoxSet", StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, "Playlist", StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, typeof(Trailer).Name, StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(request.IncludeItemTypes, "Program", StringComparison.OrdinalIgnoreCase))
+            {
+                parentItem = null;
+            }
+
             var item = string.IsNullOrEmpty(request.ParentId) ?
                user == null ? _libraryManager.RootFolder : user.RootFolder :
                parentItem;
 
             var result = ((Folder)item).GetItemList(GetItemsQuery(request, user));
 
-            return ToOptimizedResult(GetFilters(result));
+            var filters = GetFilters(result);
+
+            return ToOptimizedResult(filters);
         }
 
-        private QueryFilters GetFilters(BaseItem[] items)
+        private QueryFiltersLegacy GetFilters(BaseItem[] items)
         {
-            var result = new QueryFilters();
+            var result = new QueryFiltersLegacy();
 
             result.Years = items.Select(i => i.ProductionYear ?? -1)
                 .Where(i => i > 0)
@@ -97,7 +213,7 @@ namespace MediaBrowser.Api
             return result;
         }
 
-        private InternalItemsQuery GetItemsQuery(GetQueryFilters request, User user)
+        private InternalItemsQuery GetItemsQuery(GetQueryFiltersLegacy request, User user)
         {
             var query = new InternalItemsQuery
             {

+ 4 - 0
MediaBrowser.Api/LiveTv/LiveTvService.cs

@@ -379,6 +379,9 @@ namespace MediaBrowser.Api.LiveTv
         [ApiMember(Name = "Genres", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
         public string Genres { get; set; }
 
+        [ApiMember(Name = "GenreIds", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
+        public string GenreIds { get; set; }
+
         [ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
         public bool? EnableImages { get; set; }
 
@@ -1003,6 +1006,7 @@ namespace MediaBrowser.Api.LiveTv
             query.IsSports = request.IsSports;
             query.SeriesTimerId = request.SeriesTimerId;
             query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+            query.GenreIds = (request.GenreIds ?? String.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
 
             if (!string.IsNullOrWhiteSpace(request.LibrarySeriesId))
             {

+ 1 - 0
MediaBrowser.Api/StartupWizardService.cs

@@ -67,6 +67,7 @@ namespace MediaBrowser.Api
         public void Post(ReportStartupWizardComplete request)
         {
             _config.Configuration.IsStartupWizardCompleted = true;
+            _config.Configuration.AutoRunWebApp = true;
             _config.SetOptimalValues();
             _config.SaveConfiguration();
 

+ 3 - 1
MediaBrowser.Controller/IServerApplicationHost.cs

@@ -29,7 +29,9 @@ namespace MediaBrowser.Controller
         /// </summary>
         /// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
         bool SupportsAutoRunAtStartup { get; }
-        
+
+        bool CanLaunchWebBrowser { get; }
+
         /// <summary>
         /// Gets the HTTP server port.
         /// </summary>

+ 4 - 0
MediaBrowser.Controller/LiveTv/ITunerHost.cs

@@ -46,6 +46,10 @@ namespace MediaBrowser.Controller.LiveTv
         Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);
 
         Task<List<TunerHostInfo>> DiscoverDevices(int discoveryDurationMs, CancellationToken cancellationToken);
+        bool IsSupported
+        {
+            get;
+        }
     }
     public interface IConfigurableTunerHost
     {

+ 2 - 0
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -61,6 +61,8 @@ namespace MediaBrowser.Model.Configuration
         /// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
         public bool IsPortAuthorized { get; set; }
 
+        public bool AutoRunWebApp { get; set; }
+
         /// <summary>
         /// Gets or sets a value indicating whether [enable case sensitive item ids].
         /// </summary>

+ 1 - 0
MediaBrowser.Model/IO/IZipClient.cs

@@ -24,6 +24,7 @@ namespace MediaBrowser.Model.IO
         void ExtractAll(Stream source, string targetPath, bool overwriteExistingFiles);
 
         void ExtractAllFromGz(Stream source, string targetPath, bool overwriteExistingFiles);
+        void ExtractFirstFileFromGz(Stream source, string targetPath, string defaultFileName);
 
         /// <summary>
         /// Extracts all from zip.

+ 2 - 0
MediaBrowser.Model/LiveTv/ProgramQuery.cs

@@ -14,6 +14,7 @@ namespace MediaBrowser.Model.LiveTv
             ChannelIds = new string[] { };
             OrderBy = new Tuple<string, SortOrder>[] { };
             Genres = new string[] { };
+            GenreIds = new string[] { };
             EnableTotalRecordCount = true;
             EnableUserData = true;
         }
@@ -110,6 +111,7 @@ namespace MediaBrowser.Model.LiveTv
         /// Limit results to items containing specific genres
         /// </summary>
         /// <value>The genres.</value>
+        public string[] GenreIds { get; set; }
         public string[] Genres { get; set; }
     }
 }

+ 15 - 3
MediaBrowser.Model/Querying/QueryFilters.cs

@@ -1,14 +1,15 @@
-
+using MediaBrowser.Model.Dto;
+
 namespace MediaBrowser.Model.Querying
 {
-    public class QueryFilters
+    public class QueryFiltersLegacy
     {
         public string[] Genres { get; set; }
         public string[] Tags { get; set; }
         public string[] OfficialRatings { get; set; }
         public int[] Years { get; set; }
 
-        public QueryFilters()
+        public QueryFiltersLegacy()
         {
             Genres = new string[] { };
             Tags = new string[] { };
@@ -16,4 +17,15 @@ namespace MediaBrowser.Model.Querying
             Years = new int[] { };
         }
     }
+    public class QueryFilters
+    {
+        public NameIdPair[] Genres { get; set; }
+        public string[] Tags { get; set; }
+
+        public QueryFilters()
+        {
+            Tags = new string[] { };
+            Genres = new NameIdPair[] { };
+        }
+    }
 }

+ 2 - 0
MediaBrowser.Model/System/SystemInfo.cs

@@ -68,6 +68,8 @@ namespace MediaBrowser.Model.System
         /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
         public bool CanSelfUpdate { get; set; }
 
+        public bool CanLaunchWebBrowser { get; set; }
+
         /// <summary>
         /// Gets or sets plugin assemblies that failed to load.
         /// </summary>

+ 0 - 1
MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs

@@ -153,7 +153,6 @@ namespace MediaBrowser.Providers.MediaInfo
             if (item.IsShortcut)
             {
                 FetchShortcutInfo(item);
-                return Task.FromResult(ItemUpdateType.MetadataImport);
             }
 
             var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager, _libraryManager);

+ 74 - 55
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -75,49 +75,54 @@ namespace MediaBrowser.Providers.MediaInfo
 
             try
             {
-                string[] streamFileNames = null;
+                Model.MediaInfo.MediaInfo mediaInfoResult = null;
 
-                if (item.VideoType == VideoType.Iso)
+                if (!item.IsShortcut)
                 {
-                    item.IsoType = DetermineIsoType(isoMount);
-                }
+                    string[] streamFileNames = null;
 
-                if (item.VideoType == VideoType.Dvd || (item.IsoType.HasValue && item.IsoType == IsoType.Dvd))
-                {
-                    streamFileNames = FetchFromDvdLib(item, isoMount);
+                    if (item.VideoType == VideoType.Iso)
+                    {
+                        item.IsoType = DetermineIsoType(isoMount);
+                    }
 
-                    if (streamFileNames.Length == 0)
+                    if (item.VideoType == VideoType.Dvd || (item.IsoType.HasValue && item.IsoType == IsoType.Dvd))
                     {
-                        _logger.Error("No playable vobs found in dvd structure, skipping ffprobe.");
-                        return ItemUpdateType.MetadataImport;
+                        streamFileNames = FetchFromDvdLib(item, isoMount);
+
+                        if (streamFileNames.Length == 0)
+                        {
+                            _logger.Error("No playable vobs found in dvd structure, skipping ffprobe.");
+                            return ItemUpdateType.MetadataImport;
+                        }
                     }
-                }
 
-                else if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay))
-                {
-                    var inputPath = isoMount != null ? isoMount.MountedPath : item.Path;
+                    else if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay))
+                    {
+                        var inputPath = isoMount != null ? isoMount.MountedPath : item.Path;
 
-                    blurayDiscInfo = GetBDInfo(inputPath);
+                        blurayDiscInfo = GetBDInfo(inputPath);
 
-                    streamFileNames = blurayDiscInfo.Files;
+                        streamFileNames = blurayDiscInfo.Files;
 
-                    if (streamFileNames.Length == 0)
-                    {
-                        _logger.Error("No playable vobs found in bluray structure, skipping ffprobe.");
-                        return ItemUpdateType.MetadataImport;
+                        if (streamFileNames.Length == 0)
+                        {
+                            _logger.Error("No playable vobs found in bluray structure, skipping ffprobe.");
+                            return ItemUpdateType.MetadataImport;
+                        }
                     }
-                }
 
-                if (streamFileNames == null)
-                {
-                    streamFileNames = new string[] { };
-                }
+                    if (streamFileNames == null)
+                    {
+                        streamFileNames = new string[] { };
+                    }
 
-                var result = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);
+                    mediaInfoResult = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);
 
-                cancellationToken.ThrowIfCancellationRequested();
+                    cancellationToken.ThrowIfCancellationRequested();
+                }
 
-                await Fetch(item, cancellationToken, result, isoMount, blurayDiscInfo, options).ConfigureAwait(false);
+                await Fetch(item, cancellationToken, mediaInfoResult, isoMount, blurayDiscInfo, options).ConfigureAwait(false);
 
             }
             finally
@@ -162,43 +167,60 @@ namespace MediaBrowser.Providers.MediaInfo
             BlurayDiscInfo blurayInfo,
             MetadataRefreshOptions options)
         {
-            var mediaStreams = mediaInfo.MediaStreams;
+            List<MediaStream> mediaStreams;
+            List<ChapterInfo> chapters;
 
-            video.TotalBitrate = mediaInfo.Bitrate;
-            //video.FormatName = (mediaInfo.Container ?? string.Empty)
-            //    .Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase);
+            if (mediaInfo != null)
+            {
+                mediaStreams = mediaInfo.MediaStreams;
 
-            // For dvd's this may not always be accurate, so don't set the runtime if the item already has one
-            var needToSetRuntime = video.VideoType != VideoType.Dvd || video.RunTimeTicks == null || video.RunTimeTicks.Value == 0;
+                video.TotalBitrate = mediaInfo.Bitrate;
+                //video.FormatName = (mediaInfo.Container ?? string.Empty)
+                //    .Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase);
 
-            if (needToSetRuntime)
-            {
-                video.RunTimeTicks = mediaInfo.RunTimeTicks;
-            }
+                // For dvd's this may not always be accurate, so don't set the runtime if the item already has one
+                var needToSetRuntime = video.VideoType != VideoType.Dvd || video.RunTimeTicks == null || video.RunTimeTicks.Value == 0;
 
-            if (video.VideoType == VideoType.VideoFile)
-            {
-                var extension = (Path.GetExtension(video.Path) ?? string.Empty).TrimStart('.');
+                if (needToSetRuntime)
+                {
+                    video.RunTimeTicks = mediaInfo.RunTimeTicks;
+                }
+
+                if (video.VideoType == VideoType.VideoFile)
+                {
+                    var extension = (Path.GetExtension(video.Path) ?? string.Empty).TrimStart('.');
+
+                    video.Container = extension;
+                }
+                else
+                {
+                    video.Container = null;
+                }
+                video.Container = mediaInfo.Container;
 
-                video.Container = extension;
+                chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();
+                if (blurayInfo != null)
+                {
+                    FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
+                }
             }
             else
             {
-                video.Container = null;
-            }
-            video.Container = mediaInfo.Container;
-
-            var chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();
-            if (blurayInfo != null)
-            {
-                FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
+                mediaStreams = new List<MediaStream>();
+                chapters = new List<ChapterInfo>();
             }
 
             await AddExternalSubtitles(video, mediaStreams, options, cancellationToken).ConfigureAwait(false);
+
             var libraryOptions = _libraryManager.GetLibraryOptions(video);
 
-            FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions);
-            FetchPeople(video, mediaInfo, options);
+            if (mediaInfo != null)
+            {
+                FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions);
+                FetchPeople(video, mediaInfo, options);
+                video.Timestamp = mediaInfo.Timestamp;
+                video.Video3DFormat = video.Video3DFormat ?? mediaInfo.Video3DFormat;
+            }
 
             video.IsHD = mediaStreams.Any(i => i.Type == MediaStreamType.Video && i.Width.HasValue && i.Width.Value >= 1260);
 
@@ -207,9 +229,6 @@ namespace MediaBrowser.Providers.MediaInfo
             video.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index;
 
             video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
-            video.Timestamp = mediaInfo.Timestamp;
-
-            video.Video3DFormat = video.Video3DFormat ?? mediaInfo.Video3DFormat;
 
             _itemRepo.SaveMediaStreams(video.Id, mediaStreams, cancellationToken);
 

+ 1 - 1
MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs

@@ -262,7 +262,7 @@ namespace MediaBrowser.Providers.Movies
                 var keepTypes = new[]
                 {
                     PersonType.Director,
-                    PersonType.Writer,
+                    //PersonType.Writer,
                     //PersonType.Producer
                 };
 

+ 1 - 1
SharedVersion.cs

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