From e0c387446b2562ac6b153d36d357a71e70fa736b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 9 Aug 2013 21:16:31 -0400 Subject: [PATCH] reworked iso manager --- .../Playback/BaseStreamingService.cs | 1 + .../Playback/Hls/AudioHlsService.cs | 1 + .../Playback/Hls/BaseHlsService.cs | 1 + .../Playback/Hls/VideoHlsService.cs | 1 + .../Playback/Progressive/AudioService.cs | 1 + .../BaseProgressiveStreamingService.cs | 1 + .../Playback/Progressive/VideoService.cs | 1 + MediaBrowser.Api/Playback/StreamState.cs | 1 + .../MediaBrowser.Common.csproj | 2 -- .../MediaInfo/MediaEncoderHelpers.cs | 1 + MediaBrowser.Model/ApiClient/IApiClient.cs | 28 +++++++++++++++ MediaBrowser.Model/IO/IIsoManager.cs | 34 +++++++++++++++++++ .../IO/IIsoMount.cs | 2 +- .../IO/IIsoMounter.cs | 14 ++++---- MediaBrowser.Model/MediaBrowser.Model.csproj | 3 ++ .../Querying/SimilarItemsQuery.cs | 27 +++++++++++++++ .../MediaInfo/BaseFFMpegProvider.cs | 1 + .../MediaInfo/BaseFFProbeProvider.cs | 1 + .../MediaInfo/FFProbeVideoInfoProvider.cs | 1 + .../Library/LibraryManager.cs | 2 +- .../Persistence/SqliteExtensions.cs | 9 ++--- .../ScheduledTasks/VideoImagesTask.cs | 1 + .../ApplicationHost.cs | 2 +- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +-- 26 files changed, 122 insertions(+), 24 deletions(-) create mode 100644 MediaBrowser.Model/IO/IIsoManager.cs rename {MediaBrowser.Common => MediaBrowser.Model}/IO/IIsoMount.cs (93%) rename MediaBrowser.Common/IO/IIsoManager.cs => MediaBrowser.Model/IO/IIsoMounter.cs (64%) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 10570d911f..b4ba31d723 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -18,6 +18,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.IO; namespace MediaBrowser.Api.Playback { diff --git a/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs b/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs index a666d46280..df80d1f421 100644 --- a/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs @@ -3,6 +3,7 @@ using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Dto; +using MediaBrowser.Model.IO; using ServiceStack.ServiceHost; using System; using System.IO; diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 749b090e0c..e616ca2d2e 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using MediaBrowser.Model.IO; namespace MediaBrowser.Api.Playback.Hls { diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 46093e0fcd..44d3194656 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -2,6 +2,7 @@ using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller; using MediaBrowser.Controller.Library; +using MediaBrowser.Model.IO; using ServiceStack.ServiceHost; using System; using System.IO; diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index 1c4c3d70e8..202318cfef 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -3,6 +3,7 @@ using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; +using MediaBrowser.Model.IO; using ServiceStack.ServiceHost; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index c4f258d8aa..0d5c07cbe4 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -16,6 +16,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using MediaBrowser.Model.IO; namespace MediaBrowser.Api.Playback.Progressive { diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 742fba1c34..b091065b6c 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -4,6 +4,7 @@ using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; +using MediaBrowser.Model.IO; using ServiceStack.ServiceHost; using System; using System.IO; diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index 653c4d57bf..3c2ea5a13a 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -2,6 +2,7 @@ using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.IO; namespace MediaBrowser.Api.Playback { diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index cbacda1f9b..91391d1750 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -65,8 +65,6 @@ - - diff --git a/MediaBrowser.Controller/MediaInfo/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaInfo/MediaEncoderHelpers.cs index e20a425aa8..4485c40726 100644 --- a/MediaBrowser.Controller/MediaInfo/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaInfo/MediaEncoderHelpers.cs @@ -2,6 +2,7 @@ using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.IO; namespace MediaBrowser.Controller.MediaInfo { diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index c2b0289eab..7180ed5bcd 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -176,6 +176,34 @@ namespace MediaBrowser.Model.ApiClient /// query Task GetItemsAsync(ItemQuery query); + /// + /// Gets the instant mix from song async. + /// + /// The query. + /// Task{ItemsResult}. + Task GetInstantMixFromSongAsync(SimilarItemsQuery query); + + /// + /// Gets the instant mix from album async. + /// + /// The query. + /// Task{ItemsResult}. + Task GetInstantMixFromAlbumAsync(SimilarItemsQuery query); + + /// + /// Gets the instant mix from artist async. + /// + /// The query. + /// Task{ItemsResult}. + Task GetInstantMixFromArtistAsync(SimilarItemsByNameQuery query); + + /// + /// Gets the instant mix from music genre async. + /// + /// The query. + /// Task{ItemsResult}. + Task GetInstantMixFromMusicGenreAsync(SimilarItemsByNameQuery query); + /// /// Gets the similar movies async. /// diff --git a/MediaBrowser.Model/IO/IIsoManager.cs b/MediaBrowser.Model/IO/IIsoManager.cs new file mode 100644 index 0000000000..92c4d5aee8 --- /dev/null +++ b/MediaBrowser.Model/IO/IIsoManager.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Model.IO +{ + public interface IIsoManager : IDisposable + { + /// + /// Mounts the specified iso path. + /// + /// The iso path. + /// The cancellation token. + /// IsoMount. + /// isoPath + /// Unable to create mount. + Task Mount(string isoPath, CancellationToken cancellationToken); + + /// + /// Determines whether this instance can mount the specified path. + /// + /// The path. + /// true if this instance can mount the specified path; otherwise, false. + bool CanMount(string path); + + /// + /// Adds the parts. + /// + /// The mounters. + void AddParts(IEnumerable mounters); + } +} \ No newline at end of file diff --git a/MediaBrowser.Common/IO/IIsoMount.cs b/MediaBrowser.Model/IO/IIsoMount.cs similarity index 93% rename from MediaBrowser.Common/IO/IIsoMount.cs rename to MediaBrowser.Model/IO/IIsoMount.cs index c6dabc3b9d..4f8f8b5d25 100644 --- a/MediaBrowser.Common/IO/IIsoMount.cs +++ b/MediaBrowser.Model/IO/IIsoMount.cs @@ -1,6 +1,6 @@ using System; -namespace MediaBrowser.Common.IO +namespace MediaBrowser.Model.IO { /// /// Interface IIsoMount diff --git a/MediaBrowser.Common/IO/IIsoManager.cs b/MediaBrowser.Model/IO/IIsoMounter.cs similarity index 64% rename from MediaBrowser.Common/IO/IIsoManager.cs rename to MediaBrowser.Model/IO/IIsoMounter.cs index 8e94189c4a..91a0453681 100644 --- a/MediaBrowser.Common/IO/IIsoManager.cs +++ b/MediaBrowser.Model/IO/IIsoMounter.cs @@ -1,21 +1,21 @@ using System; +using System.IO; using System.Threading; using System.Threading.Tasks; -namespace MediaBrowser.Common.IO +namespace MediaBrowser.Model.IO { - public interface IIsoManager : IDisposable + public interface IIsoMounter : IDisposable { /// /// Mounts the specified iso path. /// /// The iso path. /// The cancellation token. - /// if set to true [visible to all processes]. /// IsoMount. - /// isoPath - /// Unable to create mount. - Task Mount(string isoPath, CancellationToken cancellationToken, bool visibleToAllProcesses = true); + /// isoPath + /// Unable to create mount. + Task Mount(string isoPath, CancellationToken cancellationToken); /// /// Determines whether this instance can mount the specified path. @@ -24,4 +24,4 @@ namespace MediaBrowser.Common.IO /// true if this instance can mount the specified path; otherwise, false. bool CanMount(string path); } -} \ No newline at end of file +} diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 9a1caceeaf..1c4f798f49 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -56,6 +56,9 @@ + + + diff --git a/MediaBrowser.Model/Querying/SimilarItemsQuery.cs b/MediaBrowser.Model/Querying/SimilarItemsQuery.cs index 0dd4915508..d792aa76dc 100644 --- a/MediaBrowser.Model/Querying/SimilarItemsQuery.cs +++ b/MediaBrowser.Model/Querying/SimilarItemsQuery.cs @@ -26,4 +26,31 @@ /// The fields. public ItemFields[] Fields { get; set; } } + + public class SimilarItemsByNameQuery + { + /// + /// The user to localize search results for + /// + /// The user id. + public string UserId { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// The maximum number of items to return + /// + /// The limit. + public int? Limit { get; set; } + + /// + /// Fields to return within the items, in addition to basic information + /// + /// The fields. + public ItemFields[] Fields { get; set; } + } } diff --git a/MediaBrowser.Providers/MediaInfo/BaseFFMpegProvider.cs b/MediaBrowser.Providers/MediaInfo/BaseFFMpegProvider.cs index 98baa44e38..c692f1238e 100644 --- a/MediaBrowser.Providers/MediaInfo/BaseFFMpegProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/BaseFFMpegProvider.cs @@ -4,6 +4,7 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using System; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/MediaInfo/BaseFFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/BaseFFProbeProvider.cs index 643bcf2cdc..b995863670 100644 --- a/MediaBrowser.Providers/MediaInfo/BaseFFProbeProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/BaseFFProbeProvider.cs @@ -5,6 +5,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.MediaInfo; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using System; diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs index 1b18120336..39beda9cee 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs @@ -8,6 +8,7 @@ using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 58c89141f5..0e0597ed69 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -586,7 +586,7 @@ namespace MediaBrowser.Server.Implementations.Library if (folder.Id == Guid.Empty) { - folder.Id = (folder.Path ?? folder.Name ?? folder.GetType().Name).GetMBId(folder.GetType()); + folder.Id = (folder.Path ?? folder.GetType().Name).GetMBId(folder.GetType()); } rootFolder.AddVirtualChild(folder); diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs index 7795f27b16..fa5e016c16 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs @@ -1,9 +1,9 @@ -using System; +using MediaBrowser.Model.Logging; +using System; using System.Data; using System.Data.SQLite; using System.IO; using System.Threading.Tasks; -using MediaBrowser.Model.Logging; namespace MediaBrowser.Server.Implementations.Persistence { @@ -41,11 +41,6 @@ namespace MediaBrowser.Server.Implementations.Persistence /// public static SQLiteParameter AddParam(this SQLiteCommand cmd, string param, object data) { - if (string.IsNullOrEmpty(param)) - { - throw new ArgumentNullException(); - } - var sqliteParam = AddParam(cmd, param); sqliteParam.Value = data; return sqliteParam; diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/VideoImagesTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/VideoImagesTask.cs index 09eb663613..39b610925a 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/VideoImagesTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/VideoImagesTask.cs @@ -8,6 +8,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaInfo; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MoreLinq; using System; diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 52c01d4a9d..1ef3adb13b 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -238,7 +238,7 @@ namespace MediaBrowser.ServerApplication RegisterSingleInstance(() => new AlchemyServer(Logger)); - RegisterSingleInstance(() => new PismoIsoManager(Logger)); + //RegisterSingleInstance(() => new PismoIsoManager(Logger)); RegisterSingleInstance(() => new BdInfoExaminer()); ZipClient = new DotNetZipClient(); diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index eb9fbc88e3..e9beca2ba4 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.175 + 3.0.176 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 fbad490cf6..79d4ab40d8 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.175 + 3.0.176 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 8c9563bc9b..2e7fa8bf5c 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.175 + 3.0.176 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 - +