diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index df85ca3cbc..1963ad10a5 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/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)
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index ccaa918ec7..c00e0c18b5 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/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;
diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs
index 6ef1fb6f72..5e43eb6441 100644
--- a/MediaBrowser.Controller/Library/TVUtils.cs
+++ b/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))
diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs
index 649ba2c8ff..f1377727bb 100644
--- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs
+++ b/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);
diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs
index d81e460492..9e8d8213fd 100644
--- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs
+++ b/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)
diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
index e55d3eec9b..f374ed5297 100644
--- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
+++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
@@ -152,9 +152,6 @@
Configuration\ImageSavingConvention.cs
-
- Configuration\LiveTvOptions.cs
-
Configuration\MetadataOptions.cs
@@ -179,9 +176,6 @@
Configuration\SubtitlePlaybackMode.cs
-
- Configuration\TvFileOrganizationOptions.cs
-
Configuration\UnratedItem.cs
@@ -473,6 +467,9 @@
Extensions\StringHelper.cs
+
+ FileOrganization\AutoOrganizeOptions.cs
+
FileOrganization\EpisodeFileOrganizationRequest.cs
@@ -488,6 +485,9 @@
FileOrganization\FileSortingStatus.cs
+
+ FileOrganization\TvFileOrganizationOptions.cs
+
Games\GameSystem.cs
@@ -542,6 +542,9 @@
LiveTv\LiveTvInfo.cs
+
+ LiveTv\LiveTvOptions.cs
+
LiveTv\LiveTvServiceInfo.cs
diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
index 603eecbaed..5385ee036c 100644
--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
@@ -115,9 +115,6 @@
Configuration\ImageSavingConvention.cs
-
- Configuration\LiveTvOptions.cs
-
Configuration\MetadataOptions.cs
@@ -142,9 +139,6 @@
Configuration\SubtitlePlaybackMode.cs
-
- Configuration\TvFileOrganizationOptions.cs
-
Configuration\UnratedItem.cs
@@ -436,6 +430,9 @@
Extensions\StringHelper.cs
+
+ FileOrganization\AutoOrganizeOptions.cs
+
FileOrganization\EpisodeFileOrganizationRequest.cs
@@ -451,6 +448,9 @@
FileOrganization\FileSortingStatus.cs
+
+ FileOrganization\TvFileOrganizationOptions.cs
+
Games\GameSystem.cs
@@ -499,6 +499,9 @@
LiveTv\LiveTvInfo.cs
+
+ LiveTv\LiveTvOptions.cs
+
LiveTv\LiveTvServiceInfo.cs
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 00f7add14c..4734e2af7d 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/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
///
public class ServerConfiguration : BaseApplicationConfiguration
{
- ///
- /// Gets or sets the zip code to use when displaying weather
- ///
- /// The weather location.
- public string WeatherLocation { get; set; }
-
- ///
- /// Gets or sets the weather unit to use when displaying weather
- ///
- /// The weather unit.
- public WeatherUnits WeatherUnit { get; set; }
-
///
/// Gets or sets a value indicating whether [enable u pn p].
///
@@ -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();
}
}
}
diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
index b6d9d9f77d..5417c5b82c 100644
--- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
+++ b/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 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 orgPnValues = new List();
- 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 contentFeatureList = new List();
+
+ 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)
diff --git a/MediaBrowser.Model/FileOrganization/AutoOrganizeOptions.cs b/MediaBrowser.Model/FileOrganization/AutoOrganizeOptions.cs
new file mode 100644
index 0000000000..ae701ea68d
--- /dev/null
+++ b/MediaBrowser.Model/FileOrganization/AutoOrganizeOptions.cs
@@ -0,0 +1,17 @@
+
+namespace MediaBrowser.Model.FileOrganization
+{
+ public class AutoOrganizeOptions
+ {
+ ///
+ /// Gets or sets the tv options.
+ ///
+ /// The tv options.
+ public TvFileOrganizationOptions TvOptions { get; set; }
+
+ public AutoOrganizeOptions()
+ {
+ TvOptions = new TvFileOrganizationOptions();
+ }
+ }
+}
diff --git a/MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs b/MediaBrowser.Model/FileOrganization/TvFileOrganizationOptions.cs
similarity index 96%
rename from MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs
rename to MediaBrowser.Model/FileOrganization/TvFileOrganizationOptions.cs
index fe32d4a80a..973ecf6e71 100644
--- a/MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs
+++ b/MediaBrowser.Model/FileOrganization/TvFileOrganizationOptions.cs
@@ -1,5 +1,5 @@
-namespace MediaBrowser.Model.Configuration
+namespace MediaBrowser.Model.FileOrganization
{
public class TvFileOrganizationOptions
{
diff --git a/MediaBrowser.Model/Configuration/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs
similarity index 74%
rename from MediaBrowser.Model/Configuration/LiveTvOptions.cs
rename to MediaBrowser.Model/LiveTv/LiveTvOptions.cs
index 575f0b8637..05fdc00b12 100644
--- a/MediaBrowser.Model/Configuration/LiveTvOptions.cs
+++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs
@@ -1,4 +1,4 @@
-namespace MediaBrowser.Model.Configuration
+namespace MediaBrowser.Model.LiveTv
{
public class LiveTvOptions
{
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index f57c3b95db..efd8c2a0a2 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -79,13 +79,14 @@
-
+
+
-
+
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
index 594ba9d235..cf9571824c 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
+++ b/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);
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/Extensions.cs b/MediaBrowser.Server.Implementations/FileOrganization/Extensions.cs
new file mode 100644
index 0000000000..e43ab3665e
--- /dev/null
+++ b/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("autoorganize");
+ }
+ }
+
+ public class AutoOrganizeOptionsFactory : IConfigurationFactory
+ {
+ public IEnumerable GetConfigurations()
+ {
+ return new List
+ {
+ new ConfigurationStore
+ {
+ Key = "autoorganize",
+ ConfigurationType = typeof (AutoOrganizeOptions)
+ }
+ };
+ }
+ }
+}
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs
index 7cf38b0a0e..7c52696787 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs
+++ b/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);
}
}
}
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs b/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs
index fbb743f943..4e182ea88f 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs
+++ b/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 progress)
{
return new TvFolderOrganizer(_libraryManager, _logger, _fileSystem, _libraryMonitor, _organizationService, _config, _providerManager)
- .Organize(_config.Configuration.TvFileOrganizationOptions, cancellationToken, progress);
+ .Organize(GetTvOptions(), cancellationToken, progress);
}
public IEnumerable 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; }
}
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
index a17c33845f..d3aad582a3 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
+++ b/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();
}
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs
index fefe6401db..57d1d79e16 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs
+++ b/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
diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
index 79d15039b2..5cc22ac64c 100644
--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
@@ -127,6 +127,7 @@
+
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index e584a950cd..7dc70627bd 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/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();