Merge pull request #1690 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-04-28 15:09:56 -04:00
commit 9492b9b7d9
24 changed files with 83 additions and 71 deletions

View File

@ -317,6 +317,11 @@ namespace MediaBrowser.Controller.Entities
{
return false;
}
if (newAsVideo.VideoType != VideoType)
{
return false;
}
}
return base.IsValidFromResolver(newItem);

View File

@ -8,7 +8,7 @@ using CommonIO;
namespace MediaBrowser.LocalMetadata
{
public abstract class BaseXmlProvider<T> : ILocalMetadataProvider<T>, IHasChangeMonitor, IHasOrder
public abstract class BaseXmlProvider<T> : ILocalMetadataProvider<T>, IHasItemChangeMonitor, IHasOrder
where T : IHasMetadata, new()
{
protected IFileSystem FileSystem;
@ -56,7 +56,7 @@ namespace MediaBrowser.LocalMetadata
protected abstract FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService);
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var file = GetXmlFile(new ItemInfo(item), directoryService);
@ -65,7 +65,7 @@ namespace MediaBrowser.LocalMetadata
return false;
}
return file.Exists && FileSystem.GetLastWriteTimeUtc(file) > date;
return file.Exists && FileSystem.GetLastWriteTimeUtc(file) > item.DateLastSaved;
}
public string Name

View File

@ -9,6 +9,7 @@ namespace MediaBrowser.Model.LiveTv
public string RecordingPath { get; set; }
public bool EnableAutoOrganize { get; set; }
public bool EnableRecordingEncoding { get; set; }
public bool EnableOriginalAudioWithEncodedRecordings { get; set; }
public List<TunerHostInfo> TunerHosts { get; set; }
public List<ListingsProviderInfo> ListingProviders { get; set; }

View File

@ -295,7 +295,12 @@ namespace MediaBrowser.Providers.Manager
return true;
}
if (item is BoxSet || item is IItemByName || item is Playlist)
if (!(item is Audio) && !(item is Video))
{
return true;
}
if (item is IItemByName)
{
return true;
}
@ -305,16 +310,6 @@ namespace MediaBrowser.Providers.Manager
return true;
}
if (item is ICollectionFolder)
{
return true;
}
if (!(item is Audio) && !(item is Video))
{
return true;
}
return false;
}
@ -435,18 +430,18 @@ namespace MediaBrowser.Providers.Manager
var providersWithChanges = providers
.Where(i =>
{
var hasChangeMonitor = i as IHasChangeMonitor;
if (hasChangeMonitor != null)
{
return HasChanged(item, hasChangeMonitor, currentItem.DateLastSaved, options.DirectoryService);
}
var hasFileChangeMonitor = i as IHasItemChangeMonitor;
if (hasFileChangeMonitor != null)
{
return HasChanged(item, hasFileChangeMonitor, options.DirectoryService);
}
var hasChangeMonitor = i as IHasChangeMonitor;
if (hasChangeMonitor != null)
{
return HasChanged(item, hasChangeMonitor, currentItem.DateLastSaved, options.DirectoryService);
}
return false;
})
.ToList();

View File

@ -23,7 +23,7 @@ using MediaBrowser.Providers.TV;
namespace MediaBrowser.Providers.Movies
{
public class FanartMovieImageProvider : IRemoteImageProvider, IHasChangeMonitor, IHasOrder
public class FanartMovieImageProvider : IRemoteImageProvider, IHasItemChangeMonitor, IHasOrder
{
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
private readonly IServerConfigurationManager _config;
@ -239,7 +239,7 @@ namespace MediaBrowser.Providers.Movies
});
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var options = FanartSeriesProvider.Current.GetFanartOptions();
if (!options.EnableAutomaticUpdates)
@ -260,7 +260,7 @@ namespace MediaBrowser.Providers.Movies
var fileInfo = _fileSystem.GetFileInfo(path);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
return false;

View File

@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace MediaBrowser.Providers.Movies
{
class MovieDbImageProvider : IRemoteImageProvider, IHasOrder, IHasChangeMonitor
class MovieDbImageProvider : IRemoteImageProvider, IHasOrder, IHasItemChangeMonitor
{
private readonly IJsonSerializer _jsonSerializer;
private readonly IHttpClient _httpClient;
@ -222,9 +222,9 @@ namespace MediaBrowser.Providers.Movies
});
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
return MovieDbProvider.Current.HasChanged(item, date);
return MovieDbProvider.Current.HasChanged(item);
}
}
}

View File

@ -414,7 +414,7 @@ namespace MediaBrowser.Providers.Movies
return _configurationManager.GetConfiguration<TheMovieDbOptions>("themoviedb");
}
public bool HasChanged(IHasMetadata item, DateTime date)
public bool HasChanged(IHasMetadata item)
{
if (!GetTheMovieDbOptions().EnableAutomaticUpdates)
{
@ -430,7 +430,7 @@ namespace MediaBrowser.Providers.Movies
var fileInfo = _fileSystem.GetFileInfo(dataFilePath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
return false;

View File

@ -33,9 +33,9 @@ namespace MediaBrowser.Providers.Movies
get { return MovieDbProvider.Current.Name; }
}
public bool HasChanged(IHasMetadata item, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
return MovieDbProvider.Current.HasChanged(item, date);
return MovieDbProvider.Current.HasChanged(item);
}
public int Order

View File

@ -19,7 +19,7 @@ using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Providers.Music
{
public class FanartAlbumProvider : IRemoteImageProvider, IHasChangeMonitor, IHasOrder
public class FanartAlbumProvider : IRemoteImageProvider, IHasItemChangeMonitor, IHasOrder
{
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
private readonly IServerConfigurationManager _config;
@ -213,7 +213,7 @@ namespace MediaBrowser.Providers.Music
});
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var options = FanartSeriesProvider.Current.GetFanartOptions();
if (!options.EnableAutomaticUpdates)
@ -235,7 +235,7 @@ namespace MediaBrowser.Providers.Music
var fileInfo = _fileSystem.GetFileInfo(artistJsonPath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
}

View File

@ -22,7 +22,7 @@ using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Providers.Music
{
public class FanartArtistProvider : IRemoteImageProvider, IHasChangeMonitor, IHasOrder
public class FanartArtistProvider : IRemoteImageProvider, IHasItemChangeMonitor, IHasOrder
{
internal readonly SemaphoreSlim FanArtResourcePool = new SemaphoreSlim(3, 3);
internal const string ApiKey = "5c6b04c68e904cfed1e6cbc9a9e683d4";
@ -207,7 +207,7 @@ namespace MediaBrowser.Providers.Music
});
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var options = FanartSeriesProvider.Current.GetFanartOptions();
if (!options.EnableAutomaticUpdates)
@ -224,7 +224,7 @@ namespace MediaBrowser.Providers.Music
var fileInfo = _fileSystem.GetFileInfo(artistJsonPath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
return false;

View File

@ -27,9 +27,9 @@ namespace MediaBrowser.Providers.Music
get { return MovieDbProvider.Current.Name; }
}
public bool HasChanged(IHasMetadata item, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
return MovieDbProvider.Current.HasChanged(item, date);
return MovieDbProvider.Current.HasChanged(item);
}
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)

View File

@ -21,7 +21,7 @@ using CommonIO;
namespace MediaBrowser.Providers.TV
{
public class FanArtSeasonProvider : IRemoteImageProvider, IHasOrder, IHasChangeMonitor
public class FanArtSeasonProvider : IRemoteImageProvider, IHasOrder, IHasItemChangeMonitor
{
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
private readonly IServerConfigurationManager _config;
@ -225,7 +225,7 @@ namespace MediaBrowser.Providers.TV
});
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var options = FanartSeriesProvider.Current.GetFanartOptions();
if (!options.EnableAutomaticUpdates)
@ -250,7 +250,7 @@ namespace MediaBrowser.Providers.TV
var fileInfo = _fileSystem.GetFileInfo(imagesFilePath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
return false;

View File

@ -23,7 +23,7 @@ using CommonIO;
namespace MediaBrowser.Providers.TV
{
public class FanartSeriesProvider : IRemoteImageProvider, IHasOrder, IHasChangeMonitor
public class FanartSeriesProvider : IRemoteImageProvider, IHasOrder, IHasItemChangeMonitor
{
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
private readonly IServerConfigurationManager _config;
@ -341,7 +341,7 @@ namespace MediaBrowser.Providers.TV
}
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var options = GetFanartOptions();
if (!options.EnableAutomaticUpdates)
@ -358,7 +358,7 @@ namespace MediaBrowser.Providers.TV
var fileInfo = _fileSystem.GetFileInfo(imagesFilePath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
return false;

View File

@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace MediaBrowser.Providers.TV
{
public class MovieDbSeriesImageProvider : IRemoteImageProvider, IHasOrder, IHasChangeMonitor
public class MovieDbSeriesImageProvider : IRemoteImageProvider, IHasOrder, IHasItemChangeMonitor
{
private readonly IJsonSerializer _jsonSerializer;
private readonly IHttpClient _httpClient;
@ -196,9 +196,9 @@ namespace MediaBrowser.Providers.TV
});
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
return MovieDbSeriesProvider.Current.HasChanged(item, date);
return MovieDbSeriesProvider.Current.HasChanged(item);
}
}
}

View File

@ -414,7 +414,7 @@ namespace MediaBrowser.Providers.TV
return Path.Combine(path, filename);
}
public bool HasChanged(IHasMetadata item, DateTime date)
public bool HasChanged(IHasMetadata item)
{
if (!MovieDbProvider.Current.GetTheMovieDbOptions().EnableAutomaticUpdates)
{
@ -430,7 +430,7 @@ namespace MediaBrowser.Providers.TV
var fileInfo = _fileSystem.GetFileInfo(dataFilePath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
return false;

View File

@ -17,7 +17,7 @@ using CommonIO;
namespace MediaBrowser.Providers.TV
{
public class TvdbEpisodeImageProvider : IRemoteImageProvider, IHasChangeMonitor
public class TvdbEpisodeImageProvider : IRemoteImageProvider, IHasItemChangeMonitor
{
private readonly IServerConfigurationManager _config;
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
@ -174,7 +174,7 @@ namespace MediaBrowser.Providers.TV
});
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var episode = (Episode)item;
@ -196,7 +196,7 @@ namespace MediaBrowser.Providers.TV
// Process images
var seriesXmlPath = TvdbSeriesProvider.Current.GetSeriesXmlPath(series.ProviderIds, series.GetPreferredMetadataLanguage());
return _fileSystem.GetLastWriteTimeUtc(seriesXmlPath) > date;
return _fileSystem.GetLastWriteTimeUtc(seriesXmlPath) > item.DateLastRefreshed;
}
}

View File

@ -24,7 +24,7 @@ namespace MediaBrowser.Providers.TV
/// <summary>
/// Class RemoteEpisodeProvider
/// </summary>
class TvdbEpisodeProvider : IRemoteMetadataProvider<Episode, EpisodeInfo>, IItemIdentityProvider<EpisodeInfo>, IHasChangeMonitor
class TvdbEpisodeProvider : IRemoteMetadataProvider<Episode, EpisodeInfo>, IItemIdentityProvider<EpisodeInfo>, IHasItemChangeMonitor
{
private static readonly string FullIdKey = MetadataProviders.Tvdb + "-Full";
@ -144,7 +144,7 @@ namespace MediaBrowser.Providers.TV
return result;
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
// Only enable for virtual items
if (item.LocationType != LocationType.Virtual)
@ -160,7 +160,7 @@ namespace MediaBrowser.Providers.TV
// Process images
var seriesXmlPath = TvdbSeriesProvider.Current.GetSeriesXmlPath(series.ProviderIds, series.GetPreferredMetadataLanguage());
return _fileSystem.GetLastWriteTimeUtc(seriesXmlPath) > date;
return _fileSystem.GetLastWriteTimeUtc(seriesXmlPath) > item.DateLastRefreshed;
}
return false;

View File

@ -20,7 +20,7 @@ using CommonIO;
namespace MediaBrowser.Providers.TV
{
public class TvdbSeasonImageProvider : IRemoteImageProvider, IHasOrder, IHasChangeMonitor
public class TvdbSeasonImageProvider : IRemoteImageProvider, IHasOrder, IHasItemChangeMonitor
{
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
@ -363,7 +363,7 @@ namespace MediaBrowser.Providers.TV
});
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
if (item.LocationType != LocationType.Virtual)
{
@ -384,7 +384,7 @@ namespace MediaBrowser.Providers.TV
var fileInfo = _fileSystem.GetFileInfo(imagesXmlPath);
return fileInfo.Exists && _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
return fileInfo.Exists && _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
return false;

View File

@ -927,13 +927,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private async Task<IRecorder> GetRecorder()
{
if (GetConfiguration().EnableRecordingEncoding)
var config = GetConfiguration();
if (config.EnableRecordingEncoding)
{
var regInfo = await _security.GetRegistrationStatus("embytvrecordingconversion").ConfigureAwait(false);
if (regInfo.IsValid)
{
return new EncodedRecorder(_logger, _fileSystem, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer);
return new EncodedRecorder(_logger, _fileSystem, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer, config);
}
}

View File

@ -12,6 +12,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
@ -23,6 +24,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private readonly IFileSystem _fileSystem;
private readonly IMediaEncoder _mediaEncoder;
private readonly IApplicationPaths _appPaths;
private readonly LiveTvOptions _liveTvOptions;
private bool _hasExited;
private Stream _logFileStream;
private string _targetPath;
@ -30,13 +32,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private readonly IJsonSerializer _json;
private readonly TaskCompletionSource<bool> _taskCompletionSource = new TaskCompletionSource<bool>();
public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IApplicationPaths appPaths, IJsonSerializer json)
public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IApplicationPaths appPaths, IJsonSerializer json, LiveTvOptions liveTvOptions)
{
_logger = logger;
_fileSystem = fileSystem;
_mediaEncoder = mediaEncoder;
_appPaths = appPaths;
_json = json;
_liveTvOptions = liveTvOptions;
}
public async Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
@ -129,7 +132,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
var copyAudio = new[] { "aac", "mp3" };
var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>();
if (mediaStreams.Any(i => i.Type == MediaStreamType.Audio && copyAudio.Contains(i.Codec, StringComparer.OrdinalIgnoreCase)))
if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings || mediaStreams.Any(i => i.Type == MediaStreamType.Audio && copyAudio.Contains(i.Codec, StringComparer.OrdinalIgnoreCase)))
{
return "-codec:a:0 copy";
}

View File

@ -17,7 +17,7 @@ using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Server.Implementations.Photos
{
public abstract class BaseDynamicImageProvider<T> : IHasChangeMonitor, IForcedProvider, ICustomMetadataProvider<T>, IHasOrder
public abstract class BaseDynamicImageProvider<T> : IHasItemChangeMonitor, IForcedProvider, ICustomMetadataProvider<T>, IHasOrder
where T : IHasMetadata
{
protected IFileSystem FileSystem { get; private set; }
@ -247,7 +247,7 @@ namespace MediaBrowser.Server.Implementations.Photos
get { return 7; }
}
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryServicee)
{
if (!Supports(item))
{

View File

@ -273,11 +273,13 @@ namespace MediaBrowser.ServerApplication
}
private static ServerNotifyIcon _serverNotifyIcon;
private static TaskScheduler _mainTaskScheduler;
private static void ShowTrayIcon()
{
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
_serverNotifyIcon = new ServerNotifyIcon(_appHost.LogManager, _appHost, _appHost.ServerConfigurationManager, _appHost.LocalizationManager);
_mainTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
Application.Run();
}
@ -323,7 +325,14 @@ namespace MediaBrowser.ServerApplication
public static void Invoke(Action action)
{
_serverNotifyIcon.Invoke(action);
if (_isRunningAsService)
{
action();
}
else
{
Task.Factory.StartNew(action, CancellationToken.None, TaskCreationOptions.None, _mainTaskScheduler ?? TaskScheduler.Current);
}
}
/// <summary>

View File

@ -368,9 +368,6 @@
<Content Include="dashboard-ui\scripts\shared.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\sharingmanager.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\sharingwidget.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@ -9,7 +9,7 @@ using CommonIO;
namespace MediaBrowser.XbmcMetadata.Providers
{
public abstract class BaseNfoProvider<T> : ILocalMetadataProvider<T>, IHasChangeMonitor
public abstract class BaseNfoProvider<T> : ILocalMetadataProvider<T>, IHasItemChangeMonitor
where T : IHasMetadata, new()
{
protected IFileSystem FileSystem;
@ -57,7 +57,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
protected abstract FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService);
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var file = GetXmlFile(new ItemInfo(item), directoryService);
@ -66,7 +66,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
return false;
}
return file.Exists && FileSystem.GetLastWriteTimeUtc(file) > date;
return file.Exists && FileSystem.GetLastWriteTimeUtc(file) > item.DateLastSaved;
}
public string Name