From 067479f2d1dcf40127ada01fbd452040a14ae877 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 2 Sep 2015 11:33:20 -0400 Subject: [PATCH] update ffmpeg info --- MediaBrowser.Api/Library/LibraryService.cs | 45 +++++++++++++++++++ .../Session/SessionWebSocketListener.cs | 27 ++++++----- .../FFMpeg/FFMpegDownloadInfo.cs | 4 +- 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index ed3f2c6333..96b3070648 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -231,6 +231,17 @@ namespace MediaBrowser.Api.Library public string TvdbId { get; set; } } + [Route("/Library/Movies/Added", "POST", Summary = "Reports that new movies have been added by an external source")] + [Route("/Library/Movies/Updated", "POST", Summary = "Reports that new movies have been added by an external source")] + [Authenticated] + public class PostUpdatedMovies : IReturnVoid + { + [ApiMember(Name = "TmdbId", Description = "Tmdb Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")] + public string TmdbId { get; set; } + [ApiMember(Name = "ImdbId", Description = "Imdb Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")] + public string ImdbId { get; set; } + } + [Route("/Items/{Id}/Download", "GET", Summary = "Downloads item media")] [Authenticated(Roles = "download")] public class GetDownload @@ -444,6 +455,40 @@ namespace MediaBrowser.Api.Library } } + public void Post(PostUpdatedMovies request) + { + var movies = _libraryManager.GetItems(new InternalItemsQuery + { + IncludeItemTypes = new[] { typeof(Movie).Name } + + }).Items; + + if (!string.IsNullOrWhiteSpace(request.ImdbId)) + { + movies = movies.Where(i => string.Equals(request.ImdbId, i.GetProviderId(MetadataProviders.Imdb), StringComparison.OrdinalIgnoreCase)).ToArray(); + } + else if (!string.IsNullOrWhiteSpace(request.TmdbId)) + { + movies = movies.Where(i => string.Equals(request.TmdbId, i.GetProviderId(MetadataProviders.Tmdb), StringComparison.OrdinalIgnoreCase)).ToArray(); + } + else + { + movies = new BaseItem[] { }; + } + + if (movies.Length > 0) + { + foreach (var item in movies) + { + _libraryMonitor.ReportFileSystemChanged(item.Path); + } + } + else + { + Task.Run(() => _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None)); + } + } + public object Get(GetDownload request) { var item = _libraryManager.GetItemById(request.Id); diff --git a/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs b/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs index b473444ac8..602bc4876b 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs @@ -85,16 +85,23 @@ namespace MediaBrowser.Server.Implementations.Session async void _httpServer_WebSocketConnecting(object sender, WebSocketConnectingEventArgs e) { - var token = e.QueryString["api_key"]; - if (!string.IsNullOrWhiteSpace(token)) - { - var session = await GetSession(e.QueryString, e.Endpoint).ConfigureAwait(false); - - if (session == null) - { - //e.AllowConnection = false; - } - } + //var token = e.QueryString["api_key"]; + //if (!string.IsNullOrWhiteSpace(token)) + //{ + // try + // { + // var session = await GetSession(e.QueryString, e.Endpoint).ConfigureAwait(false); + + // if (session == null) + // { + // e.AllowConnection = false; + // } + // } + // catch (Exception ex) + // { + // _logger.ErrorException("Error getting session info", ex); + // } + //} } private Task GetSession(NameValueCollection queryString, string remoteEndpoint) diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs index 2d4ed94f7d..2910479ef8 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs @@ -84,13 +84,13 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg return new[] { "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20150717-git-8250943-win64-static.7z", - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150717-git-8250943-win64-static.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150901-git-b54e03c-win64-static.7z" }; case Architecture.X86: return new[] { "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20150717-git-8250943-win32-static.7z", - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150717-git-8250943-win32-static.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150901-git-b54e03c-win32-static.7z" }; } break;