Przeglądaj źródła

add more reporting data

Luke Pulverenti 11 lat temu
rodzic
commit
9396f16aed

+ 23 - 1
MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs

@@ -35,6 +35,7 @@ namespace MediaBrowser.Controller.Resolvers
             // If the path is a file check for a matching extensions
             // If the path is a file check for a matching extensions
             if (!args.IsDirectory)
             if (!args.IsDirectory)
             {
             {
+                // http://wiki.xbmc.org/index.php?title=Media_stubs
                 var isPlaceHolder = EntityResolutionHelper.IsVideoPlaceHolder(args.Path);
                 var isPlaceHolder = EntityResolutionHelper.IsVideoPlaceHolder(args.Path);
 
 
                 if (EntityResolutionHelper.IsVideoFile(args.Path) || isPlaceHolder)
                 if (EntityResolutionHelper.IsVideoFile(args.Path) || isPlaceHolder)
@@ -44,13 +45,34 @@ namespace MediaBrowser.Controller.Resolvers
                     var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
                     var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
                         VideoType.Iso : VideoType.VideoFile;
                         VideoType.Iso : VideoType.VideoFile;
 
 
-                    return new TVideoType
+                    var video = new TVideoType
                     {
                     {
                         VideoType = type,
                         VideoType = type,
                         Path = args.Path,
                         Path = args.Path,
                         IsInMixedFolder = true,
                         IsInMixedFolder = true,
                         IsPlaceHolder = isPlaceHolder
                         IsPlaceHolder = isPlaceHolder
                     };
                     };
+
+                    if (isPlaceHolder)
+                    {
+                        if (args.Path.EndsWith("dvd.disc", StringComparison.OrdinalIgnoreCase))
+                        {
+                            video.VideoType = VideoType.Dvd;
+                        }
+                        else if (args.Path.EndsWith("hddvd.disc", StringComparison.OrdinalIgnoreCase))
+                        {
+                            video.VideoType = VideoType.HdDvd;
+                        }
+                        else if (args.Path.EndsWith("bluray.disc", StringComparison.OrdinalIgnoreCase) ||
+                            args.Path.EndsWith("brrip.disc", StringComparison.OrdinalIgnoreCase) ||
+                            args.Path.EndsWith("bd25.disc", StringComparison.OrdinalIgnoreCase) ||
+                            args.Path.EndsWith("bd50.disc", StringComparison.OrdinalIgnoreCase))
+                        {
+                            video.VideoType = VideoType.BluRay;
+                        }
+                    }
+
+                    return video;
                 }
                 }
             }
             }
 
 

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

@@ -210,6 +210,7 @@ namespace MediaBrowser.Model.Configuration
         public PathSubstitution[] PathSubstitutions { get; set; }
         public PathSubstitution[] PathSubstitutions { get; set; }
 
 
         public string ServerName { get; set; }
         public string ServerName { get; set; }
+        public string WanDdns { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.

+ 51 - 41
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -53,9 +53,18 @@ namespace MediaBrowser.Providers.MediaInfo
         {
         {
             var isoMount = await MountIsoIfNeeded(item, cancellationToken).ConfigureAwait(false);
             var isoMount = await MountIsoIfNeeded(item, cancellationToken).ConfigureAwait(false);
 
 
+            BlurayDiscInfo blurayDiscInfo = null;
+
             try
             try
             {
             {
-                OnPreFetch(item, isoMount);
+                if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay))
+                {
+                    var inputPath = isoMount != null ? isoMount.MountedPath : item.Path;
+
+                    blurayDiscInfo = GetBDInfo(inputPath);
+                }
+
+                OnPreFetch(item, isoMount, blurayDiscInfo);
 
 
                 // If we didn't find any satisfying the min length, just take them all
                 // If we didn't find any satisfying the min length, just take them all
                 if (item.VideoType == VideoType.Dvd || (item.IsoType.HasValue && item.IsoType == IsoType.Dvd))
                 if (item.VideoType == VideoType.Dvd || (item.IsoType.HasValue && item.IsoType == IsoType.Dvd))
@@ -67,6 +76,15 @@ namespace MediaBrowser.Providers.MediaInfo
                     }
                     }
                 }
                 }
 
 
+                if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay))
+                {
+                    if (item.PlayableStreamFileNames.Count == 0)
+                    {
+                        _logger.Error("No playable vobs found in bluray structure, skipping ffprobe.");
+                        return ItemUpdateType.MetadataImport;
+                    }
+                }
+
                 var result = await GetMediaInfo(item, isoMount, cancellationToken).ConfigureAwait(false);
                 var result = await GetMediaInfo(item, isoMount, cancellationToken).ConfigureAwait(false);
 
 
                 cancellationToken.ThrowIfCancellationRequested();
                 cancellationToken.ThrowIfCancellationRequested();
@@ -75,7 +93,7 @@ namespace MediaBrowser.Providers.MediaInfo
 
 
                 cancellationToken.ThrowIfCancellationRequested();
                 cancellationToken.ThrowIfCancellationRequested();
 
 
-                await Fetch(item, cancellationToken, result, isoMount, directoryService).ConfigureAwait(false);
+                await Fetch(item, cancellationToken, result, isoMount, blurayDiscInfo, directoryService).ConfigureAwait(false);
 
 
             }
             }
             finally
             finally
@@ -128,7 +146,7 @@ namespace MediaBrowser.Providers.MediaInfo
             return result;
             return result;
         }
         }
 
 
-        protected async Task Fetch(Video video, CancellationToken cancellationToken, InternalMediaInfoResult data, IIsoMount isoMount, IDirectoryService directoryService)
+        protected async Task Fetch(Video video, CancellationToken cancellationToken, InternalMediaInfoResult data, IIsoMount isoMount, BlurayDiscInfo blurayInfo, IDirectoryService directoryService)
         {
         {
             if (data.format != null)
             if (data.format != null)
             {
             {
@@ -147,8 +165,7 @@ namespace MediaBrowser.Providers.MediaInfo
 
 
             if (video.VideoType == VideoType.BluRay || (video.IsoType.HasValue && video.IsoType.Value == IsoType.BluRay))
             if (video.VideoType == VideoType.BluRay || (video.IsoType.HasValue && video.IsoType.Value == IsoType.BluRay))
             {
             {
-                var inputPath = isoMount != null ? isoMount.MountedPath : video.Path;
-                FetchBdInfo(video, chapters, mediaStreams, inputPath, cancellationToken);
+                FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
             }
             }
 
 
             AddExternalSubtitles(video, mediaStreams, directoryService);
             AddExternalSubtitles(video, mediaStreams, directoryService);
@@ -183,14 +200,10 @@ namespace MediaBrowser.Providers.MediaInfo
             await _itemRepo.SaveChapters(video.Id, chapters, cancellationToken).ConfigureAwait(false);
             await _itemRepo.SaveChapters(video.Id, chapters, cancellationToken).ConfigureAwait(false);
         }
         }
 
 
-        private void FetchBdInfo(BaseItem item, List<ChapterInfo> chapters, List<MediaStream> mediaStreams, string inputPath, CancellationToken cancellationToken)
+        private void FetchBdInfo(BaseItem item, List<ChapterInfo> chapters, List<MediaStream> mediaStreams, BlurayDiscInfo blurayInfo)
         {
         {
             var video = (Video)item;
             var video = (Video)item;
 
 
-            var result = GetBDInfo(inputPath);
-
-            cancellationToken.ThrowIfCancellationRequested();
-
             int? currentHeight = null;
             int? currentHeight = null;
             int? currentWidth = null;
             int? currentWidth = null;
             int? currentBitRate = null;
             int? currentBitRate = null;
@@ -206,51 +219,43 @@ namespace MediaBrowser.Providers.MediaInfo
             }
             }
 
 
             // Fill video properties from the BDInfo result
             // Fill video properties from the BDInfo result
-            Fetch(video, mediaStreams, result, chapters);
-
-            videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
-
-            // Use the ffprobe values if these are empty
-            if (videoStream != null)
-            {
-                videoStream.BitRate = IsEmpty(videoStream.BitRate) ? currentBitRate : videoStream.BitRate;
-                videoStream.Width = IsEmpty(videoStream.Width) ? currentWidth : videoStream.Width;
-                videoStream.Height = IsEmpty(videoStream.Height) ? currentHeight : videoStream.Height;
-            }
-        }
-
-        private bool IsEmpty(int? num)
-        {
-            return !num.HasValue || num.Value == 0;
-        }
-
-        /// <param name="chapters">The chapters.</param>
-        private void Fetch(Video video, List<MediaStream> mediaStreams, BlurayDiscInfo stream, List<ChapterInfo> chapters)
-        {
-            // Check all input for null/empty/zero
-
             mediaStreams.Clear();
             mediaStreams.Clear();
-            mediaStreams.AddRange(stream.MediaStreams);
+            mediaStreams.AddRange(blurayInfo.MediaStreams);
 
 
-            video.MainFeaturePlaylistName = stream.PlaylistName;
+            video.MainFeaturePlaylistName = blurayInfo.PlaylistName;
 
 
-            if (stream.RunTimeTicks.HasValue && stream.RunTimeTicks.Value > 0)
+            if (blurayInfo.RunTimeTicks.HasValue && blurayInfo.RunTimeTicks.Value > 0)
             {
             {
-                video.RunTimeTicks = stream.RunTimeTicks;
+                video.RunTimeTicks = blurayInfo.RunTimeTicks;
             }
             }
 
 
-            video.PlayableStreamFileNames = stream.Files.ToList();
+            video.PlayableStreamFileNames = blurayInfo.Files.ToList();
 
 
-            if (stream.Chapters != null)
+            if (blurayInfo.Chapters != null)
             {
             {
                 chapters.Clear();
                 chapters.Clear();
 
 
-                chapters.AddRange(stream.Chapters.Select(c => new ChapterInfo
+                chapters.AddRange(blurayInfo.Chapters.Select(c => new ChapterInfo
                 {
                 {
                     StartPositionTicks = TimeSpan.FromSeconds(c).Ticks
                     StartPositionTicks = TimeSpan.FromSeconds(c).Ticks
 
 
                 }));
                 }));
             }
             }
+
+            videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
+
+            // Use the ffprobe values if these are empty
+            if (videoStream != null)
+            {
+                videoStream.BitRate = IsEmpty(videoStream.BitRate) ? currentBitRate : videoStream.BitRate;
+                videoStream.Width = IsEmpty(videoStream.Width) ? currentWidth : videoStream.Width;
+                videoStream.Height = IsEmpty(videoStream.Height) ? currentHeight : videoStream.Height;
+            }
+        }
+
+        private bool IsEmpty(int? num)
+        {
+            return !num.HasValue || num.Value == 0;
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -498,7 +503,7 @@ namespace MediaBrowser.Providers.MediaInfo
         /// </summary>
         /// </summary>
         /// <param name="item">The item.</param>
         /// <param name="item">The item.</param>
         /// <param name="mount">The mount.</param>
         /// <param name="mount">The mount.</param>
-        private void OnPreFetch(Video item, IIsoMount mount)
+        private void OnPreFetch(Video item, IIsoMount mount, BlurayDiscInfo blurayDiscInfo)
         {
         {
             if (item.VideoType == VideoType.Iso)
             if (item.VideoType == VideoType.Iso)
             {
             {
@@ -509,6 +514,11 @@ namespace MediaBrowser.Providers.MediaInfo
             {
             {
                 FetchFromDvdLib(item, mount);
                 FetchFromDvdLib(item, mount);
             }
             }
+
+            if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType.Value == IsoType.BluRay))
+            {
+                item.PlayableStreamFileNames = blurayDiscInfo.Files.ToList();
+            }
         }
         }
 
 
         private void FetchFromDvdLib(Video item, IIsoMount mount)
         private void FetchFromDvdLib(Video item, IIsoMount mount)

+ 3 - 0
MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs

@@ -45,6 +45,9 @@ namespace MediaBrowser.Providers.TV
 
 
             if (!string.IsNullOrEmpty(seriesTvdbId))
             if (!string.IsNullOrEmpty(seriesTvdbId))
             {
             {
+                await TvdbSeriesProvider.Current.EnsureSeriesInfo(seriesTvdbId, searchInfo.MetadataLanguage,
+                        cancellationToken).ConfigureAwait(false);
+
                 var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesTvdbId);
                 var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesTvdbId);
 
 
                 try
                 try

+ 1 - 1
MediaBrowser.Providers/TV/TvdbSeriesProvider.cs

@@ -1005,7 +1005,7 @@ namespace MediaBrowser.Providers.TV
         /// <returns>System.String.</returns>
         /// <returns>System.String.</returns>
         internal static string GetSeriesDataPath(IApplicationPaths appPaths)
         internal static string GetSeriesDataPath(IApplicationPaths appPaths)
         {
         {
-            var dataPath = Path.Combine(appPaths.DataPath, "tvdb-v3");
+            var dataPath = Path.Combine(appPaths.CachePath, "tvdb");
 
 
             return dataPath;
             return dataPath;
         }
         }

+ 22 - 2
MediaBrowser.ServerApplication/ApplicationHost.cs

@@ -372,6 +372,15 @@ namespace MediaBrowser.ServerApplication
                 {
                 {
                     // Not there, no big deal
                     // Not there, no big deal
                 }
                 }
+
+                try
+                {
+                    Directory.Delete(Path.Combine(ApplicationPaths.DataPath, "tvdb-v3"), true);
+                }
+                catch (IOException)
+                {
+                    // Not there, no big deal
+                }
             });
             });
         }
         }
 
 
@@ -856,11 +865,22 @@ namespace MediaBrowser.ServerApplication
         private readonly CultureInfo _usCulture = new CultureInfo("en-US");
         private readonly CultureInfo _usCulture = new CultureInfo("en-US");
         private string GetWanAddress()
         private string GetWanAddress()
         {
         {
-            var ip = WanAddressEntryPoint.WanAddress;
+            var ip = ServerConfigurationManager.Configuration.WanDdns;
+
+            if (string.IsNullOrWhiteSpace(ip))
+            {
+                ip = WanAddressEntryPoint.WanAddress;
+            }
 
 
             if (!string.IsNullOrEmpty(ip))
             if (!string.IsNullOrEmpty(ip))
             {
             {
-                return "http://" + ip + ":" + ServerConfigurationManager.Configuration.HttpServerPortNumber.ToString(_usCulture);
+                if (!ip.StartsWith("http://", StringComparison.OrdinalIgnoreCase) &&
+                    !ip.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
+                {
+                    ip = "http://" + ip;
+                }
+
+                return ip + ":" + ServerConfigurationManager.Configuration.HttpServerPortNumber.ToString(_usCulture);
             }
             }
 
 
             return null;
             return null;