From 73b76a4f189eb4f5fe6677d322cfa5a2ff6bf3e5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 2 May 2013 10:30:38 -0400 Subject: [PATCH] added image by name api methods --- MediaBrowser.Api/BaseApiService.cs | 10 +++++++ MediaBrowser.Api/MediaBrowser.Api.csproj | 1 + .../Playback/BaseStreamingService.cs | 4 ++- MediaBrowser.Api/TvShowsService.cs | 3 ++- .../IServerApplicationPaths.cs | 6 +++++ .../Providers/Music/FanArtArtistProvider.cs | 3 ++- .../Providers/Music/LastfmArtistProvider.cs | 2 +- .../ServerApplicationPaths.cs | 26 +++++++++++++++++++ 8 files changed, 51 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index e644f1f31..0c95f6112 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -76,6 +76,16 @@ namespace MediaBrowser.Api { return ResultFactory.GetCachedResult(RequestContext, cacheKey, lastDateModified, cacheDuration, factoryFn, contentType); } + + /// + /// To the static file result. + /// + /// The path. + /// System.Object. + protected object ToStaticFileResult(string path) + { + return ResultFactory.GetStaticFileResult(RequestContext, path); + } } /// diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index 579a8d241..1d0777bd5 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -64,6 +64,7 @@ + diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 3e5da5b53..04b6a656d 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -635,7 +635,7 @@ namespace MediaBrowser.Api.Playback /// /// The process. /// The state. - protected void OnFfMpegProcessExited(Process process, StreamState state) + protected async void OnFfMpegProcessExited(Process process, StreamState state) { if (state.IsoMount != null) { @@ -667,6 +667,8 @@ namespace MediaBrowser.Api.Playback { Logger.Info("Deleting partial stream file(s) {0}", outputFilePath); + await Task.Delay(1000).ConfigureAwait(false); + try { DeletePartialStreamFiles(outputFilePath); diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs index 840b88af5..84b9a66b6 100644 --- a/MediaBrowser.Api/TvShowsService.cs +++ b/MediaBrowser.Api/TvShowsService.cs @@ -171,7 +171,8 @@ namespace MediaBrowser.Api { var allEpisodes = series.GetRecursiveChildren(user) .OfType() - .OrderByDescending(i => i.PremiereDate) + .OrderByDescending(i => i.PremiereDate ?? DateTime.MinValue) + .ThenByDescending(i => i.IndexNumber ?? 0) .ToList(); Episode lastWatched = null; diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs index 09f2f5e8e..9325d2054 100644 --- a/MediaBrowser.Controller/IServerApplicationPaths.cs +++ b/MediaBrowser.Controller/IServerApplicationPaths.cs @@ -70,6 +70,12 @@ namespace MediaBrowser.Controller /// The ratings path. string RatingsPath { get; } + /// + /// Gets the media info images path. + /// + /// The media info images path. + string MediaInfoImagesPath { get; } + /// /// Gets the path to the user configuration directory /// diff --git a/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs index ba07da2c1..86c7a22f4 100644 --- a/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Net; @@ -49,7 +50,7 @@ namespace MediaBrowser.Controller.Providers.Music /// true if XXXX, false otherwise public override bool Supports(BaseItem item) { - return false; + return item is MusicArtist; } protected virtual bool SaveLocalMeta diff --git a/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs index 8fabf2368..c846fcd97 100644 --- a/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs @@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Providers.Music public override bool Supports(BaseItem item) { - return false; + return item is MusicArtist; } } } diff --git a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs index 6d345a99c..c30c1b9db 100644 --- a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs +++ b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs @@ -132,6 +132,7 @@ namespace MediaBrowser.Server.Implementations _musicArtistsPath = null; _generalPath = null; _ratingsPath = null; + _mediaInfoImagesPath = null; } } @@ -285,6 +286,31 @@ namespace MediaBrowser.Server.Implementations } } + /// + /// The _media info images path + /// + private string _mediaInfoImagesPath; + /// + /// Gets the media info images path. + /// + /// The media info images path. + public string MediaInfoImagesPath + { + get + { + if (_mediaInfoImagesPath == null) + { + _mediaInfoImagesPath = Path.Combine(ItemsByNamePath, "MediaInfo"); + if (!Directory.Exists(_mediaInfoImagesPath)) + { + Directory.CreateDirectory(_mediaInfoImagesPath); + } + } + + return _mediaInfoImagesPath; + } + } + /// /// The _user configuration directory path ///