Browse Source

add setting to control import of missing episodes

Luke Pulverenti 8 years ago
parent
commit
3f68882fa8
35 changed files with 29 additions and 21 deletions
  1. 4 2
      Emby.Dlna/DlnaManager.cs
  2. 2 2
      Emby.Dlna/Profiles/DefaultProfile.cs
  3. 0 0
      Emby.Dlna/Profiles/Json/BubbleUPnp.json
  4. 0 0
      Emby.Dlna/Profiles/Json/Default.json
  5. 0 0
      Emby.Dlna/Profiles/Json/Denon AVR.json
  6. 0 0
      Emby.Dlna/Profiles/Json/DirecTV HD-DVR.json
  7. 0 0
      Emby.Dlna/Profiles/Json/Dish Hopper-Joey.json
  8. 0 0
      Emby.Dlna/Profiles/Json/Kodi.json
  9. 0 0
      Emby.Dlna/Profiles/Json/LG Smart TV.json
  10. 0 0
      Emby.Dlna/Profiles/Json/Linksys DMA2100.json
  11. 0 0
      Emby.Dlna/Profiles/Json/MediaMonkey.json
  12. 0 0
      Emby.Dlna/Profiles/Json/Panasonic Viera.json
  13. 0 0
      Emby.Dlna/Profiles/Json/Popcorn Hour.json
  14. 0 0
      Emby.Dlna/Profiles/Json/Samsung Smart TV.json
  15. 0 0
      Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2013.json
  16. 0 0
      Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2014.json
  17. 0 0
      Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2015.json
  18. 0 0
      Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2016.json
  19. 0 0
      Emby.Dlna/Profiles/Json/Sony Blu-ray Player.json
  20. 0 0
      Emby.Dlna/Profiles/Json/Sony Bravia (2010).json
  21. 0 0
      Emby.Dlna/Profiles/Json/Sony Bravia (2011).json
  22. 0 0
      Emby.Dlna/Profiles/Json/Sony Bravia (2012).json
  23. 0 0
      Emby.Dlna/Profiles/Json/Sony Bravia (2013).json
  24. 0 0
      Emby.Dlna/Profiles/Json/Sony Bravia (2014).json
  25. 0 0
      Emby.Dlna/Profiles/Json/Sony PlayStation 3.json
  26. 0 0
      Emby.Dlna/Profiles/Json/Sony PlayStation 4.json
  27. 0 0
      Emby.Dlna/Profiles/Json/Vlc.json
  28. 0 0
      Emby.Dlna/Profiles/Json/WDTV Live.json
  29. 0 0
      Emby.Dlna/Profiles/Json/Xbox 360.json
  30. 0 0
      Emby.Dlna/Profiles/Json/Xbox One.json
  31. 0 0
      Emby.Dlna/Profiles/Json/foobar2000.json
  32. 7 7
      Emby.Server.Implementations/Data/SqliteItemRepository.cs
  33. 1 0
      MediaBrowser.Model/Configuration/LibraryOptions.cs
  34. 1 0
      MediaBrowser.Model/Configuration/UserConfiguration.cs
  35. 14 10
      MediaBrowser.Providers/TV/MissingEpisodeProvider.cs

+ 4 - 2
Emby.Dlna/DlnaManager.cs

@@ -289,7 +289,9 @@ namespace Emby.Dlna
                 var allFiles = _fileSystem.GetFiles(path)
                     .ToList();
 
-                var xmlFies = allFiles
+                var xmlFies = type == DeviceProfileType.System ? 
+                    new List<FileSystemMetadata>() : 
+                    allFiles
                     .Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
                     .ToList();
 
@@ -332,7 +334,7 @@ namespace Emby.Dlna
 
                     if (string.Equals(Path.GetExtension(path), ".xml", StringComparison.OrdinalIgnoreCase))
                     {
-                        var tempProfile = (Emby.Dlna.ProfileSerialization.DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(Emby.Dlna.ProfileSerialization.DeviceProfile), path);
+                        var tempProfile = (ProfileSerialization.DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(Emby.Dlna.ProfileSerialization.DeviceProfile), path);
 
                         var json = _jsonSerializer.SerializeToString(tempProfile);
                         profile = (DeviceProfile)_jsonSerializer.DeserializeFromString<DeviceProfile>(json);

+ 2 - 2
Emby.Dlna/Profiles/DefaultProfile.cs

@@ -30,8 +30,8 @@ namespace Emby.Dlna.Profiles
             MaxIconWidth = 48;
             MaxIconHeight = 48;
 
-            MaxStreamingBitrate = 20000000;
-            MaxStaticBitrate = 20000000;
+            MaxStreamingBitrate = 24000000;
+            MaxStaticBitrate = 24000000;
             MusicStreamingTranscodingBitrate = 192000;
 
             EnableAlbumArtInDidl = false;

File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/BubbleUPnp.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Default.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Denon AVR.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/DirecTV HD-DVR.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Dish Hopper-Joey.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Kodi.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/LG Smart TV.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Linksys DMA2100.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/MediaMonkey.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Panasonic Viera.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Popcorn Hour.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Samsung Smart TV.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2013.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2014.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2015.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2016.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Blu-ray Player.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Bravia (2010).json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Bravia (2011).json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Bravia (2012).json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Bravia (2013).json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony Bravia (2014).json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony PlayStation 3.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Sony PlayStation 4.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Vlc.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/WDTV Live.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Xbox 360.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/Xbox One.json


File diff suppressed because it is too large
+ 0 - 0
Emby.Dlna/Profiles/Json/foobar2000.json


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

@@ -95,13 +95,13 @@ namespace Emby.Server.Implementations.Data
             DbFilePath = Path.Combine(_config.ApplicationPaths.DataPath, "library.db");
         }
 
-        //protected override bool AllowLockRecursion
-        //{
-        //    get
-        //    {
-        //        return true;
-        //    }
-        //}
+        protected override bool AllowLockRecursion
+        {
+            get
+            {
+                return true;
+            }
+        }
 
         private const string ChaptersTableName = "Chapters2";
 

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

@@ -13,6 +13,7 @@
 
         public bool SaveLocalMetadata { get; set; }
         public bool EnableInternetProviders { get; set; }
+        public bool ImportMissingEpisodes { get; set; }
 
         public LibraryOptions()
         {

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

@@ -57,6 +57,7 @@ namespace MediaBrowser.Model.Configuration
 
             HidePlayedInLatest = true;
             PlayDefaultAudioTrack = true;
+            DisplayMissingEpisodes = true;
 
             LatestItemsExcludes = new string[] { };
             OrderedViews = new string[] { };

+ 14 - 10
MediaBrowser.Providers/TV/MissingEpisodeProvider.cs

@@ -120,10 +120,13 @@ namespace MediaBrowser.Providers.TV
 
             var hasBadData = HasInvalidContent(seriesList);
 
+            // Be conservative here to avoid creating missing episodes for ones they already have
+            var addMissingEpisodes = !hasBadData && seriesList.All(i => _libraryManager.GetLibraryOptions(i).ImportMissingEpisodes);
+
             var anySeasonsRemoved = await RemoveObsoleteOrMissingSeasons(seriesList, episodeLookup)
                 .ConfigureAwait(false);
 
-            var anyEpisodesRemoved = await RemoveObsoleteOrMissingEpisodes(seriesList, episodeLookup)
+            var anyEpisodesRemoved = await RemoveObsoleteOrMissingEpisodes(seriesList, episodeLookup, addMissingEpisodes)
                 .ConfigureAwait(false);
 
             var hasNewEpisodes = false;
@@ -134,7 +137,7 @@ namespace MediaBrowser.Providers.TV
 
                 if (seriesConfig == null || !seriesConfig.DisabledMetadataFetchers.Contains(TvdbSeriesProvider.Current.Name, StringComparer.OrdinalIgnoreCase))
                 {
-                    hasNewEpisodes = await AddMissingEpisodes(seriesList, hasBadData, seriesDataPath, episodeLookup, cancellationToken)
+                    hasNewEpisodes = await AddMissingEpisodes(seriesList, addMissingEpisodes, seriesDataPath, episodeLookup, cancellationToken)
                         .ConfigureAwait(false);
                 }
             }
@@ -180,13 +183,9 @@ namespace MediaBrowser.Providers.TV
         /// Adds the missing episodes.
         /// </summary>
         /// <param name="series">The series.</param>
-        /// <param name="seriesHasBadData">if set to <c>true</c> [series has bad data].</param>
-        /// <param name="seriesDataPath">The series data path.</param>
-        /// <param name="episodeLookup">The episode lookup.</param>
-        /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task.</returns>
         private async Task<bool> AddMissingEpisodes(List<Series> series,
-            bool seriesHasBadData,
+            bool addMissingEpisodes,
             string seriesDataPath,
             IEnumerable<Tuple<int, int>> episodeLookup,
             CancellationToken cancellationToken)
@@ -240,8 +239,7 @@ namespace MediaBrowser.Providers.TV
 
                 if (airDate.Value < now)
                 {
-                    // Be conservative here to avoid creating missing episodes for ones they already have
-                    if (!seriesHasBadData)
+                    if (addMissingEpisodes)
                     {
                         // tvdb has a lot of nearly blank episodes
                         _logger.Info("Creating virtual missing episode {0} {1}x{2}", targetSeries.Name, tuple.Item1, tuple.Item2);
@@ -278,7 +276,8 @@ namespace MediaBrowser.Providers.TV
         /// Removes the virtual entry after a corresponding physical version has been added
         /// </summary>
         private async Task<bool> RemoveObsoleteOrMissingEpisodes(IEnumerable<Series> series,
-            IEnumerable<Tuple<int, int>> episodeLookup)
+            IEnumerable<Tuple<int, int>> episodeLookup,
+            bool allowMissingEpisodes)
         {
             var existingEpisodes = (from s in series
                                     let seasonOffset = TvdbSeriesProvider.GetSeriesOffset(s.ProviderIds) ?? ((s.AnimeSeriesIndex ?? 1) - 1)
@@ -316,6 +315,11 @@ namespace MediaBrowser.Providers.TV
                             return true;
                         }
 
+                        if (!allowMissingEpisodes && i.Episode.IsMissingEpisode)
+                        {
+                            return true;
+                        }
+
                         return false;
                     }
 

Some files were not shown because too many files changed in this diff