Browse Source

3.0.5324.37963

Luke Pulverenti 11 years ago
parent
commit
a37a11c486

+ 2 - 1
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -1917,7 +1917,8 @@ namespace MediaBrowser.Api.Playback
                     state.TargetPacketLength,
                     state.TranscodeSeekInfo,
                     state.IsTargetAnamorphic
-                    );
+
+                    ).FirstOrDefault() ?? string.Empty;
             }
 
             foreach (var item in responseHeaders)

+ 15 - 15
MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs

@@ -55,21 +55,6 @@ namespace MediaBrowser.Api.Playback.Hls
 
         public object Get(GetMasterHlsVideoStream request)
         {
-            if (string.Equals(request.AudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
-            {
-                throw new ArgumentException("Audio codec copy is not allowed here.");
-            }
-
-            if (string.Equals(request.VideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
-            {
-                throw new ArgumentException("Video codec copy is not allowed here.");
-            }
-
-            if (string.IsNullOrEmpty(request.MediaSourceId))
-            {
-                throw new ArgumentException("MediaSourceId is required");
-            }
-
             var result = GetAsync(request).Result;
 
             return result;
@@ -332,6 +317,21 @@ namespace MediaBrowser.Api.Playback.Hls
         {
             var state = await GetState(request, CancellationToken.None).ConfigureAwait(false);
 
+            if (string.Equals(request.AudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            {
+                throw new ArgumentException("Audio codec copy is not allowed here.");
+            }
+
+            if (string.Equals(request.VideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+            {
+                throw new ArgumentException("Video codec copy is not allowed here.");
+            }
+
+            if (string.IsNullOrEmpty(request.MediaSourceId))
+            {
+                throw new ArgumentException("MediaSourceId is required");
+            }
+
             var audioBitrate = state.OutputAudioBitrate ?? 0;
             var videoBitrate = state.OutputVideoBitrate ?? 0;
 

+ 14 - 8
MediaBrowser.Controller/Library/TVUtils.cs

@@ -223,10 +223,11 @@ namespace MediaBrowser.Controller.Library
                     continue;
                 }
 
-                if ((attributes & FileAttributes.System) == FileAttributes.System)
-                {
-                    continue;
-                }
+                // Can't enforce this because files saved by Bitcasa are always marked System
+                //if ((attributes & FileAttributes.System) == FileAttributes.System)
+                //{
+                //    continue;
+                //}
 
                 if ((attributes & FileAttributes.Directory) == FileAttributes.Directory)
                 {
@@ -268,13 +269,16 @@ namespace MediaBrowser.Controller.Library
 
                 if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                 {
+                    logger.Debug("Igoring series file or folder marked hidden: {0}", child.FullName);
                     continue;
                 }
 
-                if ((attributes & FileAttributes.System) == FileAttributes.System)
-                {
-                    continue;
-                }
+                // Can't enforce this because files saved by Bitcasa are always marked System
+                //if ((attributes & FileAttributes.System) == FileAttributes.System)
+                //{
+                //    logger.Debug("Igoring series subfolder marked system: {0}", child.FullName);
+                //    continue;
+                //}
 
                 if ((attributes & FileAttributes.Directory) == FileAttributes.Directory)
                 {
@@ -299,6 +303,8 @@ namespace MediaBrowser.Controller.Library
                 }
                 else
                 {
+                    logger.Debug("Evaluating series file: {0}", child.FullName);
+                    
                     var fullName = child.FullName;
 
                     if (EntityResolutionHelper.IsVideoFile(fullName) || EntityResolutionHelper.IsVideoPlaceHolder(fullName))

+ 33 - 22
MediaBrowser.Dlna/Didl/DidlBuilder.cs

@@ -97,8 +97,6 @@ namespace MediaBrowser.Dlna.Didl
 
         private void AddVideoResource(XmlElement container, Video video, string deviceId, Filter filter, StreamInfo streamInfo = null)
         {
-            var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
-
             if (streamInfo == null)
             {
                 var sources = _user == null ? video.GetMediaSources(true).ToList() : video.GetMediaSources(true, _user).ToList();
@@ -113,6 +111,38 @@ namespace MediaBrowser.Dlna.Didl
                });
             }
 
+            var targetWidth = streamInfo.TargetWidth;
+            var targetHeight = streamInfo.TargetHeight;
+
+            var contentFeatureList = new ContentFeatureBuilder(_profile).BuildVideoHeader(streamInfo.Container,
+                streamInfo.VideoCodec,
+                streamInfo.AudioCodec,
+                targetWidth,
+                targetHeight,
+                streamInfo.TargetVideoBitDepth,
+                streamInfo.TargetVideoBitrate,
+                streamInfo.TargetAudioChannels,
+                streamInfo.TargetAudioBitrate,
+                streamInfo.TargetTimestamp,
+                streamInfo.IsDirectStream,
+                streamInfo.RunTimeTicks,
+                streamInfo.TargetVideoProfile,
+                streamInfo.TargetVideoLevel,
+                streamInfo.TargetFramerate,
+                streamInfo.TargetPacketLength,
+                streamInfo.TranscodeSeekInfo,
+                streamInfo.IsTargetAnamorphic);
+
+            foreach (var contentFeature in contentFeatureList)
+            {
+                AddVideoResource(container, video, deviceId, filter, contentFeature, streamInfo);
+            }
+        }
+
+        private void AddVideoResource(XmlElement container, Video video, string deviceId, Filter filter, string contentFeatures, StreamInfo streamInfo)
+        {
+            var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
+
             var url = streamInfo.ToDlnaUrl(_serverAddress);
 
             res.InnerText = url;
@@ -189,25 +219,6 @@ namespace MediaBrowser.Dlna.Didl
                ? MimeTypes.GetMimeType(filename)
                : mediaProfile.MimeType;
 
-            var contentFeatures = new ContentFeatureBuilder(_profile).BuildVideoHeader(streamInfo.Container,
-                streamInfo.VideoCodec,
-                streamInfo.AudioCodec,
-                targetWidth,
-                targetHeight,
-                streamInfo.TargetVideoBitDepth,
-                streamInfo.TargetVideoBitrate,
-                streamInfo.TargetAudioChannels,
-                streamInfo.TargetAudioBitrate,
-                streamInfo.TargetTimestamp,
-                streamInfo.IsDirectStream,
-                streamInfo.RunTimeTicks,
-                streamInfo.TargetVideoProfile,
-                streamInfo.TargetVideoLevel,
-                streamInfo.TargetFramerate,
-                streamInfo.TargetPacketLength,
-                streamInfo.TranscodeSeekInfo,
-                streamInfo.IsTargetAnamorphic);
-
             res.SetAttribute("protocolInfo", String.Format(
                 "http-get:*:{0}:{1}",
                 mimeType,
@@ -216,7 +227,7 @@ namespace MediaBrowser.Dlna.Didl
 
             container.AppendChild(res);
         }
-
+        
         private void AddAudioResource(XmlElement container, Audio audio, string deviceId, Filter filter, StreamInfo streamInfo = null)
         {
             var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);

+ 4 - 4
MediaBrowser.Dlna/PlayTo/PlayToController.cs

@@ -501,7 +501,7 @@ namespace MediaBrowser.Dlna.PlayTo
 
             if (streamInfo.MediaType == DlnaProfileType.Video)
             {
-                return new ContentFeatureBuilder(profile)
+                var list = new ContentFeatureBuilder(profile)
                     .BuildVideoHeader(streamInfo.Container,
                     streamInfo.VideoCodec,
                     streamInfo.AudioCodec,
@@ -520,6 +520,8 @@ namespace MediaBrowser.Dlna.PlayTo
                     streamInfo.TargetPacketLength,
                     streamInfo.TranscodeSeekInfo,
                     streamInfo.IsTargetAnamorphic);
+
+                return list.FirstOrDefault();
             }
 
             return null;
@@ -600,9 +602,7 @@ namespace MediaBrowser.Dlna.PlayTo
             _currentPlaylistIndex = index;
             var currentitem = Playlist[index];
 
-            var dlnaheaders = GetDlnaHeaders(currentitem);
-
-            await _device.SetAvTransport(currentitem.StreamUrl, dlnaheaders, currentitem.Didl);
+            await _device.SetAvTransport(currentitem.StreamUrl, GetDlnaHeaders(currentitem), currentitem.Didl);
 
             var streamInfo = currentitem.StreamInfo;
             if (streamInfo.StartPositionTicks > 0 && streamInfo.IsDirectStream)

+ 9 - 6
MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj

@@ -152,9 +152,6 @@
     <Compile Include="..\MediaBrowser.Model\Configuration\ImageSavingConvention.cs">
       <Link>Configuration\ImageSavingConvention.cs</Link>
     </Compile>
-    <Compile Include="..\MediaBrowser.Model\Configuration\LiveTvOptions.cs">
-      <Link>Configuration\LiveTvOptions.cs</Link>
-    </Compile>
     <Compile Include="..\MediaBrowser.Model\Configuration\MetadataOptions.cs">
       <Link>Configuration\MetadataOptions.cs</Link>
     </Compile>
@@ -179,9 +176,6 @@
     <Compile Include="..\MediaBrowser.Model\Configuration\SubtitlePlaybackMode.cs">
       <Link>Configuration\SubtitlePlaybackMode.cs</Link>
     </Compile>
-    <Compile Include="..\MediaBrowser.Model\Configuration\TvFileOrganizationOptions.cs">
-      <Link>Configuration\TvFileOrganizationOptions.cs</Link>
-    </Compile>
     <Compile Include="..\MediaBrowser.Model\Configuration\UnratedItem.cs">
       <Link>Configuration\UnratedItem.cs</Link>
     </Compile>
@@ -473,6 +467,9 @@
     <Compile Include="..\MediaBrowser.Model\Extensions\StringHelper.cs">
       <Link>Extensions\StringHelper.cs</Link>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\FileOrganization\AutoOrganizeOptions.cs">
+      <Link>FileOrganization\AutoOrganizeOptions.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\FileOrganization\EpisodeFileOrganizationRequest.cs">
       <Link>FileOrganization\EpisodeFileOrganizationRequest.cs</Link>
     </Compile>
@@ -488,6 +485,9 @@
     <Compile Include="..\MediaBrowser.Model\FileOrganization\FileSortingStatus.cs">
       <Link>FileOrganization\FileSortingStatus.cs</Link>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\FileOrganization\TvFileOrganizationOptions.cs">
+      <Link>FileOrganization\TvFileOrganizationOptions.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\Games\GameSystem.cs">
       <Link>Games\GameSystem.cs</Link>
     </Compile>
@@ -542,6 +542,9 @@
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvInfo.cs">
       <Link>LiveTv\LiveTvInfo.cs</Link>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvOptions.cs">
+      <Link>LiveTv\LiveTvOptions.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
     </Compile>

+ 9 - 6
MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj

@@ -115,9 +115,6 @@
     <Compile Include="..\MediaBrowser.Model\Configuration\ImageSavingConvention.cs">
       <Link>Configuration\ImageSavingConvention.cs</Link>
     </Compile>
-    <Compile Include="..\MediaBrowser.Model\Configuration\LiveTvOptions.cs">
-      <Link>Configuration\LiveTvOptions.cs</Link>
-    </Compile>
     <Compile Include="..\MediaBrowser.Model\Configuration\MetadataOptions.cs">
       <Link>Configuration\MetadataOptions.cs</Link>
     </Compile>
@@ -142,9 +139,6 @@
     <Compile Include="..\MediaBrowser.Model\Configuration\SubtitlePlaybackMode.cs">
       <Link>Configuration\SubtitlePlaybackMode.cs</Link>
     </Compile>
-    <Compile Include="..\MediaBrowser.Model\Configuration\TvFileOrganizationOptions.cs">
-      <Link>Configuration\TvFileOrganizationOptions.cs</Link>
-    </Compile>
     <Compile Include="..\MediaBrowser.Model\Configuration\UnratedItem.cs">
       <Link>Configuration\UnratedItem.cs</Link>
     </Compile>
@@ -436,6 +430,9 @@
     <Compile Include="..\MediaBrowser.Model\Extensions\StringHelper.cs">
       <Link>Extensions\StringHelper.cs</Link>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\FileOrganization\AutoOrganizeOptions.cs">
+      <Link>FileOrganization\AutoOrganizeOptions.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\FileOrganization\EpisodeFileOrganizationRequest.cs">
       <Link>FileOrganization\EpisodeFileOrganizationRequest.cs</Link>
     </Compile>
@@ -451,6 +448,9 @@
     <Compile Include="..\MediaBrowser.Model\FileOrganization\FileSortingStatus.cs">
       <Link>FileOrganization\FileSortingStatus.cs</Link>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\FileOrganization\TvFileOrganizationOptions.cs">
+      <Link>FileOrganization\TvFileOrganizationOptions.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\Games\GameSystem.cs">
       <Link>Games\GameSystem.cs</Link>
     </Compile>
@@ -499,6 +499,9 @@
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvInfo.cs">
       <Link>LiveTv\LiveTvInfo.cs</Link>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvOptions.cs">
+      <Link>LiveTv\LiveTvOptions.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
     </Compile>

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

@@ -1,7 +1,7 @@
 using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.FileOrganization;
+using MediaBrowser.Model.LiveTv;
 using MediaBrowser.Model.Notifications;
-using MediaBrowser.Model.Weather;
-using System;
 
 namespace MediaBrowser.Model.Configuration
 {
@@ -10,18 +10,6 @@ namespace MediaBrowser.Model.Configuration
     /// </summary>
     public class ServerConfiguration : BaseApplicationConfiguration
     {
-        /// <summary>
-        /// Gets or sets the zip code to use when displaying weather
-        /// </summary>
-        /// <value>The weather location.</value>
-        public string WeatherLocation { get; set; }
-
-        /// <summary>
-        /// Gets or sets the weather unit to use when displaying weather
-        /// </summary>
-        /// <value>The weather unit.</value>
-        public WeatherUnits WeatherUnit { get; set; }
-
         /// <summary>
         /// Gets or sets a value indicating whether [enable u pn p].
         /// </summary>
@@ -191,9 +179,6 @@ namespace MediaBrowser.Model.Configuration
 
         public SubtitleOptions SubtitleOptions { get; set; }
 
-        [Obsolete]
-        public string[] ManualLoginClients { get; set; }
-
         public ChannelOptions ChannelOptions { get; set; }
         public ChapterOptions ChapterOptions { get; set; }
 
@@ -237,8 +222,6 @@ namespace MediaBrowser.Model.Configuration
             SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
             SortRemoveWords = new[] { "the", "a", "an" };
 
-            ManualLoginClients = new string[] { };
-
             SeasonZeroDisplayName = "Specials";
 
             EnableRealtimeMonitor = true;
@@ -304,7 +287,6 @@ namespace MediaBrowser.Model.Configuration
             };
 
             SubtitleOptions = new SubtitleOptions();
-            TvFileOrganizationOptions = new TvFileOrganizationOptions();
         }
     }
 }

+ 25 - 13
MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs

@@ -92,7 +92,7 @@ namespace MediaBrowser.Model.Dlna
             return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
         }
 
-        public string BuildVideoHeader(string container,
+        public List<string> BuildVideoHeader(string container,
             string videoCodec,
             string audioCodec,
             int? width,
@@ -149,30 +149,42 @@ namespace MediaBrowser.Model.Dlna
                 timestamp,
                 isAnamorphic);
 
-            string orgPn = mediaProfile == null ? null : mediaProfile.OrgPn;
+            List<string> orgPnValues = new List<string>();
 
-            if (string.IsNullOrEmpty(orgPn))
+            if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn))
+            {
+                orgPnValues.Add(mediaProfile.OrgPn);
+            }
+            else
             {
                 foreach (string s in GetVideoOrgPnValue(container, videoCodec, audioCodec, width, height, timestamp))
                 {
-                    orgPn = s;
+                    orgPnValues.Add(s);
                     break;
                 }
             }
 
-            if (string.IsNullOrEmpty(orgPn))
+            List<string> contentFeatureList = new List<string>();
+
+            foreach (string orgPn in orgPnValues)
             {
-                // TODO: Support multiple values and return multiple headers?
-                foreach (string s in (orgPn ?? string.Empty).Split(','))
-                {
-                    orgPn = s;
-                    break;
-                }
+                string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn;
+
+                var value = (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
+
+                contentFeatureList.Add(value);
             }
 
-            string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn;
+            if (orgPnValues.Count == 0)
+            {
+                string contentFeatures = string.Empty;
 
-            return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
+                var value = (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
+
+                contentFeatureList.Add(value);
+            }
+
+            return contentFeatureList;
         }
 
         private string GetImageOrgPnValue(string container, int? width, int? height)

+ 17 - 0
MediaBrowser.Model/FileOrganization/AutoOrganizeOptions.cs

@@ -0,0 +1,17 @@
+
+namespace MediaBrowser.Model.FileOrganization
+{
+    public class AutoOrganizeOptions
+    {
+        /// <summary>
+        /// Gets or sets the tv options.
+        /// </summary>
+        /// <value>The tv options.</value>
+        public TvFileOrganizationOptions TvOptions { get; set; }
+
+        public AutoOrganizeOptions()
+        {
+            TvOptions = new TvFileOrganizationOptions();
+        }
+    }
+}

+ 1 - 1
MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs → MediaBrowser.Model/FileOrganization/TvFileOrganizationOptions.cs

@@ -1,5 +1,5 @@
 
-namespace MediaBrowser.Model.Configuration
+namespace MediaBrowser.Model.FileOrganization
 {
     public class TvFileOrganizationOptions
     {

+ 1 - 1
MediaBrowser.Model/Configuration/LiveTvOptions.cs → MediaBrowser.Model/LiveTv/LiveTvOptions.cs

@@ -1,4 +1,4 @@
-namespace MediaBrowser.Model.Configuration
+namespace MediaBrowser.Model.LiveTv
 {
     public class LiveTvOptions
     {

+ 3 - 2
MediaBrowser.Model/MediaBrowser.Model.csproj

@@ -79,13 +79,14 @@
     <Compile Include="Configuration\ChapterOptions.cs" />
     <Compile Include="Configuration\XbmcMetadataOptions.cs" />
     <Compile Include="Configuration\SubtitlePlaybackMode.cs" />
-    <Compile Include="Configuration\TvFileOrganizationOptions.cs" />
+    <Compile Include="FileOrganization\AutoOrganizeOptions.cs" />
+    <Compile Include="FileOrganization\TvFileOrganizationOptions.cs" />
     <Compile Include="Configuration\BaseApplicationConfiguration.cs" />
     <Compile Include="Configuration\DlnaOptions.cs" />
     <Compile Include="Configuration\EncodingQuality.cs" />
     <Compile Include="Configuration\ImageOption.cs" />
     <Compile Include="Configuration\ImageSavingConvention.cs" />
-    <Compile Include="Configuration\LiveTvOptions.cs" />
+    <Compile Include="LiveTv\LiveTvOptions.cs" />
     <Compile Include="Configuration\MetadataPlugin.cs" />
     <Compile Include="Configuration\MetadataOptions.cs" />
     <Compile Include="Configuration\MetadataPluginSummary.cs" />

+ 1 - 1
MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs

@@ -126,7 +126,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
 
             var series = (Series)_libraryManager.GetItemById(new Guid(request.SeriesId));
 
-            await OrganizeEpisode(result.OriginalPath, series, request.SeasonNumber, request.EpisodeNumber, request.EndingEpisodeNumber, _config.Configuration.TvFileOrganizationOptions, true, result, cancellationToken).ConfigureAwait(false);
+            await OrganizeEpisode(result.OriginalPath, series, request.SeasonNumber, request.EpisodeNumber, request.EndingEpisodeNumber, options, true, result, cancellationToken).ConfigureAwait(false);
 
             await _organizationService.SaveResult(result, CancellationToken.None).ConfigureAwait(false);
 

+ 29 - 0
MediaBrowser.Server.Implementations/FileOrganization/Extensions.cs

@@ -0,0 +1,29 @@
+using MediaBrowser.Common.Configuration;
+using MediaBrowser.Model.FileOrganization;
+using System.Collections.Generic;
+
+namespace MediaBrowser.Server.Implementations.FileOrganization
+{
+    public static class ConfigurationExtension
+    {
+        public static AutoOrganizeOptions GetAutoOrganizeOptions(this IConfigurationManager manager)
+        {
+            return manager.GetConfiguration<AutoOrganizeOptions>("autoorganize");
+        }
+    }
+
+    public class AutoOrganizeOptionsFactory : IConfigurationFactory
+    {
+        public IEnumerable<ConfigurationStore> GetConfigurations()
+        {
+            return new List<ConfigurationStore>
+            {
+                new ConfigurationStore
+                {
+                    Key = "autoorganize",
+                    ConfigurationType = typeof (AutoOrganizeOptions)
+                }
+            };
+        }
+    }
+}

+ 7 - 2
MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs

@@ -95,6 +95,11 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
             return _repo.Delete(resultId);
         }
 
+        private TvFileOrganizationOptions GetTvOptions()
+        {
+            return _config.GetAutoOrganizeOptions().TvOptions;
+        }
+
         public async Task PerformOrganization(string resultId)
         {
             var result = _repo.GetResult(resultId);
@@ -107,7 +112,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
             var organizer = new EpisodeFileOrganizer(this, _config, _fileSystem, _logger, _libraryManager,
                 _libraryMonitor, _providerManager);
 
-            await organizer.OrganizeEpisodeFile(result.OriginalPath, _config.Configuration.TvFileOrganizationOptions, true, CancellationToken.None)
+            await organizer.OrganizeEpisodeFile(result.OriginalPath, GetTvOptions(), true, CancellationToken.None)
                     .ConfigureAwait(false);
         }
 
@@ -121,7 +126,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
             var organizer = new EpisodeFileOrganizer(this, _config, _fileSystem, _logger, _libraryManager,
                 _libraryMonitor, _providerManager);
 
-            await organizer.OrganizeWithCorrection(request, _config.Configuration.TvFileOrganizationOptions, CancellationToken.None).ConfigureAwait(false);
+            await organizer.OrganizeWithCorrection(request, GetTvOptions(), CancellationToken.None).ConfigureAwait(false);
         }
     }
 }

+ 9 - 3
MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs

@@ -4,6 +4,7 @@ using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.FileOrganization;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.FileOrganization;
 using MediaBrowser.Model.Logging;
 using System;
 using System.Collections.Generic;
@@ -48,10 +49,15 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
             get { return "Library"; }
         }
 
+        private TvFileOrganizationOptions GetTvOptions()
+        {
+            return _config.GetAutoOrganizeOptions().TvOptions;
+        }
+
         public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
         {
             return new TvFolderOrganizer(_libraryManager, _logger, _fileSystem, _libraryMonitor, _organizationService, _config, _providerManager)
-                .Organize(_config.Configuration.TvFileOrganizationOptions, cancellationToken, progress);
+                .Organize(GetTvOptions(), cancellationToken, progress);
         }
 
         public IEnumerable<ITaskTrigger> GetDefaultTriggers()
@@ -64,12 +70,12 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
 
         public bool IsHidden
         {
-            get { return !_config.Configuration.TvFileOrganizationOptions.IsEnabled; }
+            get { return !GetTvOptions().IsEnabled; }
         }
 
         public bool IsEnabled
         {
-            get { return _config.Configuration.TvFileOrganizationOptions.IsEnabled; }
+            get { return !GetTvOptions().IsEnabled; }
         }
     }
 }

+ 5 - 2
MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs

@@ -60,15 +60,18 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
 
                 var collectionType = args.GetCollectionType();
 
+                var isTvShowsFolder = string.Equals(collectionType, CollectionType.TvShows,
+                    StringComparison.OrdinalIgnoreCase);
+
                 // If there's a collection type and it's not tv, it can't be a series
                 if (!string.IsNullOrEmpty(collectionType) &&
-                    !string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) &&
+                    !isTvShowsFolder &&
                     !string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
                 {
                     return null;
                 }
 
-                if (TVUtils.IsSeriesFolder(args.Path, string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase), args.FileSystemChildren, args.DirectoryService, _fileSystem, _logger))
+                if (TVUtils.IsSeriesFolder(args.Path, isTvShowsFolder, args.FileSystemChildren, args.DirectoryService, _fileSystem, _logger))
                 {
                     return new Series();
                 }

+ 1 - 1
MediaBrowser.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs

@@ -1,5 +1,5 @@
 using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.LiveTv;
 using System.Collections.Generic;
 
 namespace MediaBrowser.Server.Implementations.LiveTv

+ 1 - 0
MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj

@@ -127,6 +127,7 @@
     <Compile Include="EntryPoints\RefreshUsersMetadata.cs" />
     <Compile Include="EntryPoints\UsageEntryPoint.cs" />
     <Compile Include="FileOrganization\EpisodeFileOrganizer.cs" />
+    <Compile Include="FileOrganization\Extensions.cs" />
     <Compile Include="FileOrganization\FileOrganizationService.cs" />
     <Compile Include="FileOrganization\NameUtils.cs" />
     <Compile Include="FileOrganization\TvFolderOrganizer.cs" />

+ 8 - 0
MediaBrowser.ServerApplication/ApplicationHost.cs

@@ -43,6 +43,7 @@ using MediaBrowser.LocalMetadata.Providers;
 using MediaBrowser.MediaEncoding.BdInfo;
 using MediaBrowser.MediaEncoding.Encoder;
 using MediaBrowser.MediaEncoding.Subtitles;
+using MediaBrowser.Model.FileOrganization;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.MediaInfo;
 using MediaBrowser.Model.System;
@@ -333,6 +334,13 @@ namespace MediaBrowser.ServerApplication
                 saveConfig = true;
             }
 
+            if (ServerConfigurationManager.Configuration.TvFileOrganizationOptions != null)
+            {
+                ServerConfigurationManager.SaveConfiguration("autoorganize", new AutoOrganizeOptions { TvOptions = ServerConfigurationManager.Configuration.TvFileOrganizationOptions });
+                ServerConfigurationManager.Configuration.TvFileOrganizationOptions = null;
+                saveConfig = true;
+            }
+
             if (saveConfig)
             {
                 ServerConfigurationManager.SaveConfiguration();