From 998026cfa8e5f041e2fd0b0c61bd719027c227ab Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 6 Mar 2015 22:53:31 -0500 Subject: [PATCH] removed folder sync --- MediaBrowser.Api/LiveTv/LiveTvService.cs | 6 +- MediaBrowser.Model/LiveTv/ProgramQuery.cs | 4 +- .../MediaInfo/LiveMediaInfoResult.cs | 9 +- .../LiveTv/LiveTvManager.cs | 6 + .../Localization/JavaScript/javascript.json | 8 +- ...MediaBrowser.Server.Implementations.csproj | 2 - .../Photos/DynamicImageProvider.cs | 6 +- .../Sync/FolderSync/FolderSyncDataProvider.cs | 31 ---- .../Sync/FolderSync/FolderSyncProvider.cs | 143 ------------------ MediaBrowser.ServerApplication/MainStartup.cs | 3 +- .../MediaBrowser.ServerApplication.csproj | 4 +- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Model.Signed.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 15 files changed, 40 insertions(+), 194 deletions(-) delete mode 100644 MediaBrowser.Server.Implementations/Sync/FolderSync/FolderSyncDataProvider.cs delete mode 100644 MediaBrowser.Server.Implementations/Sync/FolderSync/FolderSyncProvider.cs diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index f3dcf57e03..fe21b9ada1 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -171,6 +171,9 @@ namespace MediaBrowser.Api.LiveTv [ApiMember(Name = "MinStartDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")] public string MinStartDate { get; set; } + [ApiMember(Name = "HasAired", Description = "Optional. Filter by programs that have completed airing, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] + public bool? HasAired { get; set; } + [ApiMember(Name = "MaxStartDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")] public string MaxStartDate { get; set; } @@ -369,7 +372,8 @@ namespace MediaBrowser.Api.LiveTv var query = new ProgramQuery { ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray(), - UserId = request.UserId + UserId = request.UserId, + HasAired = request.HasAired }; if (!string.IsNullOrEmpty(request.MinStartDate)) diff --git a/MediaBrowser.Model/LiveTv/ProgramQuery.cs b/MediaBrowser.Model/LiveTv/ProgramQuery.cs index 36c06d4c08..2d15a4c4bd 100644 --- a/MediaBrowser.Model/LiveTv/ProgramQuery.cs +++ b/MediaBrowser.Model/LiveTv/ProgramQuery.cs @@ -26,7 +26,9 @@ namespace MediaBrowser.Model.LiveTv public DateTime? MinEndDate { get; set; } public DateTime? MaxEndDate { get; set; } - + + public bool? HasAired { get; set; } + public ProgramQuery() { ChannelIdList = new string[] { }; diff --git a/MediaBrowser.Model/MediaInfo/LiveMediaInfoResult.cs b/MediaBrowser.Model/MediaInfo/LiveMediaInfoResult.cs index afd5c890f4..4a206ea202 100644 --- a/MediaBrowser.Model/MediaInfo/LiveMediaInfoResult.cs +++ b/MediaBrowser.Model/MediaInfo/LiveMediaInfoResult.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Dto; using System.Collections.Generic; namespace MediaBrowser.Model.MediaInfo @@ -17,6 +18,12 @@ namespace MediaBrowser.Model.MediaInfo /// The live stream identifier. public string LiveStreamId { get; set; } + /// + /// Gets or sets the error code. + /// + /// The error code. + public PlaybackErrorCode? ErrorCode { get; set; } + public LiveMediaInfoResult() { MediaSources = new List(); diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index be3926f4c1..337bba6a21 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -659,6 +659,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv programs = programs.Where(i => i.StartDate <= val); } + if (query.HasAired.HasValue) + { + var val = query.HasAired.Value; + programs = programs.Where(i => i.HasAired == val); + } + if (query.ChannelIdList.Length > 0) { var guids = query.ChannelIdList.Select(i => new Guid(i)).ToList(); diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index 035cdf21c0..484578e31b 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -36,8 +36,8 @@ "MessageKeyUpdated": "Thank you. Your supporter key has been updated.", "MessageKeyRemoved": "Thank you. Your supporter key has been removed.", "ErrorLaunchingChromecast": "There was an error launching chromecast. Please ensure your device is connected to your wireless network.", - "ValueTimeLimitSingleHour": "Time limit: 1 hour", - "ValueTimeLimitMultiHour": "Time limit: {0} hours", + "ValueTimeLimitSingleHour": "Time limit: 1 hour", + "ValueTimeLimitMultiHour": "Time limit: {0} hours", "HeaderSearch": "Search", "ValueDateCreated": "Date created: {0}", "LabelArtist": "Artist", @@ -97,6 +97,10 @@ "LabelVersionInstalled": "{0} installed", "LabelNumberReviews": "{0} Reviews", "LabelFree": "Free", + "HeaderPlaybackError": "Playback Error", + "MessagePlaybackErrorNotAllowed": "You're currently not authorized to play this content. Please contact your system administrator for details.", + "MessagePlaybackErrorNoCompatibleStream": "No compatible streams are currently available. Please try again later.", + "MessagePlaybackErrorRateLimitExceeded": "Your playback rate limit has been exceeded. Please contact your system administrator for details.", "HeaderSelectAudio": "Select Audio", "HeaderSelectSubtitles": "Select Subtitles", "ButtonMarkForRemoval": "Remove from device", diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index fe8185447f..4e2d66894a 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -304,8 +304,6 @@ - - diff --git a/MediaBrowser.Server.Implementations/Photos/DynamicImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/DynamicImageProvider.cs index f93153c9c8..4e1330144e 100644 --- a/MediaBrowser.Server.Implementations/Photos/DynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/DynamicImageProvider.cs @@ -13,13 +13,15 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Photos { - public class MusicDynamicImageProvider : BaseDynamicImageProvider, ICustomMetadataProvider + public class DynamicImageProvider : BaseDynamicImageProvider, ICustomMetadataProvider { private readonly IUserManager _userManager; private readonly ILibraryManager _libraryManager; - public MusicDynamicImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths) : base(fileSystem, providerManager, applicationPaths) + public DynamicImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IUserManager userManager, ILibraryManager libraryManager) : base(fileSystem, providerManager, applicationPaths) { + _userManager = userManager; + _libraryManager = libraryManager; } protected override async Task> GetItemsWithImages(IHasImages item) diff --git a/MediaBrowser.Server.Implementations/Sync/FolderSync/FolderSyncDataProvider.cs b/MediaBrowser.Server.Implementations/Sync/FolderSync/FolderSyncDataProvider.cs deleted file mode 100644 index b9008d87e5..0000000000 --- a/MediaBrowser.Server.Implementations/Sync/FolderSync/FolderSyncDataProvider.cs +++ /dev/null @@ -1,31 +0,0 @@ -using MediaBrowser.Controller.Sync; -using MediaBrowser.Model.Sync; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace MediaBrowser.Server.Implementations.Sync.FolderSync -{ - public class FolderSyncDataProvider : ISyncDataProvider - { - public Task> GetServerItemIds(SyncTarget target, string serverId) - { - throw new NotImplementedException(); - } - - public Task AddOrUpdate(SyncTarget target, LocalItem item) - { - throw new NotImplementedException(); - } - - public Task Delete(SyncTarget target, string id) - { - throw new NotImplementedException(); - } - - public Task Get(SyncTarget target, string id) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.Server.Implementations/Sync/FolderSync/FolderSyncProvider.cs b/MediaBrowser.Server.Implementations/Sync/FolderSync/FolderSyncProvider.cs deleted file mode 100644 index 3183816c8a..0000000000 --- a/MediaBrowser.Server.Implementations/Sync/FolderSync/FolderSyncProvider.cs +++ /dev/null @@ -1,143 +0,0 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Sync; -using MediaBrowser.Model.Sync; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Server.Implementations.Sync.FolderSync -{ - public class FolderSyncProvider : IServerSyncProvider - { - private readonly IApplicationPaths _appPaths; - private readonly IUserManager _userManager; - - public FolderSyncProvider(IApplicationPaths appPaths, IUserManager userManager) - { - _appPaths = appPaths; - _userManager = userManager; - } - - public Task SendFile(string inputFile, string path, SyncTarget target, IProgress progress, CancellationToken cancellationToken) - { - return Task.Run(() => File.Copy(inputFile, path, true), cancellationToken); - } - - public Task DeleteFile(string path, SyncTarget target, CancellationToken cancellationToken) - { - return Task.Run(() => File.Delete(path), cancellationToken); - } - - public Task GetFile(string path, SyncTarget target, IProgress progress, CancellationToken cancellationToken) - { - return Task.FromResult((Stream)File.OpenRead(path)); - } - - public string GetFullPath(IEnumerable paths, SyncTarget target) - { - var account = GetSyncAccounts() - .FirstOrDefault(i => string.Equals(i.Id, target.Id, StringComparison.OrdinalIgnoreCase)); - - if (account == null) - { - throw new ArgumentException("Invalid SyncTarget supplied."); - } - - var list = paths.ToList(); - list.Insert(0, account.Path); - - return Path.Combine(list.ToArray()); - } - - public string GetParentDirectoryPath(string path, SyncTarget target) - { - return Path.GetDirectoryName(path); - } - - public Task> GetFileSystemEntries(string path, SyncTarget target) - { - List files; - - try - { - files = new DirectoryInfo(path).EnumerateFiles("*", SearchOption.TopDirectoryOnly).ToList(); - } - catch (DirectoryNotFoundException) - { - files = new List(); - } - - return Task.FromResult(files.Select(i => new DeviceFileInfo - { - Name = i.Name, - Path = i.FullName - - }).ToList()); - } - - public ISyncDataProvider GetDataProvider() - { - // If single instances are needed, manage them here - return new FolderSyncDataProvider(); - } - - public string Name - { - get { return "Folder Sync"; } - } - - public IEnumerable GetSyncTargets(string userId) - { - return GetSyncAccounts() - .Where(i => i.UserIds.Contains(userId, StringComparer.OrdinalIgnoreCase)) - .Select(GetSyncTarget); - } - - public IEnumerable GetAllSyncTargets() - { - return GetSyncAccounts().Select(GetSyncTarget); - } - - private SyncTarget GetSyncTarget(SyncAccount account) - { - return new SyncTarget - { - Id = account.Id, - Name = account.Name - }; - } - - private IEnumerable GetSyncAccounts() - { - return new List(); - // Dummy this up - return _userManager - .Users - .Select(i => new SyncAccount - { - Id = i.Id.ToString("N"), - UserIds = new List { i.Id.ToString("N") }, - Path = Path.Combine(_appPaths.DataPath, "foldersync", i.Id.ToString("N")), - Name = i.Name + "'s Folder Sync" - }); - } - - // An internal class to manage all configured Folder Sync accounts for differnet users - class SyncAccount - { - public string Id { get; set; } - public string Name { get; set; } - public string Path { get; set; } - public List UserIds { get; set; } - - public SyncAccount() - { - UserIds = new List(); - } - } - } -} diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 598ec1fd79..e77af1c6bb 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -1,5 +1,4 @@ -using ImageMagickSharp; -using MediaBrowser.Common.Implementations.Logging; +using MediaBrowser.Common.Implementations.Logging; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Implementations; using MediaBrowser.Server.Startup.Common; diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index fb889e4f2f..53e34ceae3 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -455,9 +455,7 @@ MediaBrowser.XbmcMetadata - - - + diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index f83ddcbf12..94d843174e 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.580 + 3.0.581 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 675b9aafc8..578cda06a2 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.580 + 3.0.581 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec index 892b64be98..ae5e261f90 100644 --- a/Nuget/MediaBrowser.Model.Signed.nuspec +++ b/Nuget/MediaBrowser.Model.Signed.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Model.Signed - 3.0.580 + 3.0.581 MediaBrowser.Model - Signed Edition Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 537313ec88..d3de0bb79c 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.580 + 3.0.581 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +