aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ServerApplication')
-rw-r--r--MediaBrowser.ServerApplication/App.xaml.cs18
-rw-r--r--MediaBrowser.ServerApplication/Implementations/BdInfoExaminer.cs170
-rw-r--r--MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj5
3 files changed, 20 insertions, 173 deletions
diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs
index 492fef242..4aa3cdbb4 100644
--- a/MediaBrowser.ServerApplication/App.xaml.cs
+++ b/MediaBrowser.ServerApplication/App.xaml.cs
@@ -1,6 +1,8 @@
-using MediaBrowser.ClickOnce;
+using BDInfo;
+using MediaBrowser.ClickOnce;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Kernel;
+using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.IsoMounter;
using MediaBrowser.Logging.Nlog;
@@ -8,6 +10,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Updates;
+using MediaBrowser.Networking.Management;
using MediaBrowser.Server.Uninstall;
using MediaBrowser.ServerApplication.Implementations;
using Microsoft.Win32;
@@ -513,9 +516,10 @@ namespace MediaBrowser.ServerApplication
IsoManager = new PismoIsoManager(Logger);
- Register<IIsoManager>(IsoManager);
+ Register(IsoManager);
Register<IBlurayExaminer>(new BdInfoExaminer());
Register<IZipClient>(new DotNetZipClient());
+ Register(typeof (INetworkManager), typeof (NetworkManager));
}
/// <summary>
@@ -573,5 +577,15 @@ namespace MediaBrowser.ServerApplication
}
return (T)result.GetInstance();
}
+
+ /// <summary>
+ /// Registers the specified service type.
+ /// </summary>
+ /// <param name="serviceType">Type of the service.</param>
+ /// <param name="implementation">Type of the concrete.</param>
+ public void Register(Type serviceType, Type implementation)
+ {
+ _container.Register(serviceType, implementation);
+ }
}
}
diff --git a/MediaBrowser.ServerApplication/Implementations/BdInfoExaminer.cs b/MediaBrowser.ServerApplication/Implementations/BdInfoExaminer.cs
deleted file mode 100644
index dbde630be..000000000
--- a/MediaBrowser.ServerApplication/Implementations/BdInfoExaminer.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-using BDInfo;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.MediaInfo;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace MediaBrowser.ServerApplication.Implementations
-{
- /// <summary>
- /// Class BdInfoExaminer
- /// </summary>
- public class BdInfoExaminer : IBlurayExaminer
- {
- /// <summary>
- /// Gets the disc info.
- /// </summary>
- /// <param name="path">The path.</param>
- /// <returns>BlurayDiscInfo.</returns>
- public BlurayDiscInfo GetDiscInfo(string path)
- {
- var bdrom = new BDROM(path);
-
- bdrom.Scan();
-
- // Get the longest playlist
- var playlist = bdrom.PlaylistFiles.Values.OrderByDescending(p => p.TotalLength).FirstOrDefault(p => p.IsValid);
-
- var outputStream = new BlurayDiscInfo
- {
- MediaStreams = new List<MediaStream>()
- };
-
- if (playlist == null)
- {
- return outputStream;
- }
-
- outputStream.Chapters = playlist.Chapters;
-
- outputStream.RunTimeTicks = TimeSpan.FromSeconds(playlist.TotalLength).Ticks;
-
- var mediaStreams = new List<MediaStream> { };
-
- foreach (var stream in playlist.SortedStreams)
- {
- var videoStream = stream as TSVideoStream;
-
- if (videoStream != null)
- {
- AddVideoStream(mediaStreams, videoStream);
- continue;
- }
-
- var audioStream = stream as TSAudioStream;
-
- if (audioStream != null)
- {
- AddAudioStream(mediaStreams, audioStream);
- continue;
- }
-
- var textStream = stream as TSTextStream;
-
- if (textStream != null)
- {
- AddSubtitleStream(mediaStreams, textStream);
- continue;
- }
-
- var graphicsStream = stream as TSGraphicsStream;
-
- if (graphicsStream != null)
- {
- AddSubtitleStream(mediaStreams, graphicsStream);
- }
- }
-
- outputStream.MediaStreams = mediaStreams;
-
- if (playlist.StreamClips != null && playlist.StreamClips.Any())
- {
- // Get the files in the playlist
- outputStream.Files = playlist.StreamClips.Select(i => i.StreamFile.Name).ToList();
- }
-
- return outputStream;
- }
-
- /// <summary>
- /// Adds the video stream.
- /// </summary>
- /// <param name="streams">The streams.</param>
- /// <param name="videoStream">The video stream.</param>
- private void AddVideoStream(List<MediaStream> streams, TSVideoStream videoStream)
- {
- var mediaStream = new MediaStream
- {
- BitRate = Convert.ToInt32(videoStream.BitRate),
- Width = videoStream.Width,
- Height = videoStream.Height,
- Codec = videoStream.CodecShortName,
- ScanType = videoStream.IsInterlaced ? "interlaced" : "progressive",
- Type = MediaStreamType.Video,
- Index = streams.Count
- };
-
- if (videoStream.FrameRateDenominator > 0)
- {
- float frameRateEnumerator = videoStream.FrameRateEnumerator;
- float frameRateDenominator = videoStream.FrameRateDenominator;
-
- mediaStream.AverageFrameRate = mediaStream.RealFrameRate = frameRateEnumerator / frameRateDenominator;
- }
-
- streams.Add(mediaStream);
- }
-
- /// <summary>
- /// Adds the audio stream.
- /// </summary>
- /// <param name="streams">The streams.</param>
- /// <param name="audioStream">The audio stream.</param>
- private void AddAudioStream(List<MediaStream> streams, TSAudioStream audioStream)
- {
- streams.Add(new MediaStream
- {
- BitRate = Convert.ToInt32(audioStream.BitRate),
- Codec = audioStream.CodecShortName,
- Language = audioStream.LanguageCode,
- Channels = audioStream.ChannelCount,
- SampleRate = audioStream.SampleRate,
- Type = MediaStreamType.Audio,
- Index = streams.Count
- });
- }
-
- /// <summary>
- /// Adds the subtitle stream.
- /// </summary>
- /// <param name="streams">The streams.</param>
- /// <param name="textStream">The text stream.</param>
- private void AddSubtitleStream(List<MediaStream> streams, TSTextStream textStream)
- {
- streams.Add(new MediaStream
- {
- Language = textStream.LanguageCode,
- Codec = textStream.CodecShortName,
- Type = MediaStreamType.Subtitle,
- Index = streams.Count
- });
- }
-
- /// <summary>
- /// Adds the subtitle stream.
- /// </summary>
- /// <param name="streams">The streams.</param>
- /// <param name="textStream">The text stream.</param>
- private void AddSubtitleStream(List<MediaStream> streams, TSGraphicsStream textStream)
- {
- streams.Add(new MediaStream
- {
- Language = textStream.LanguageCode,
- Codec = textStream.CodecShortName,
- Type = MediaStreamType.Subtitle,
- Index = streams.Count
- });
- }
- }
-}
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index 9f9b87b05..9b27351a1 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -196,7 +196,6 @@
<Compile Include="Controls\MultiItemUpdateNotification.xaml.cs">
<DependentUpon>MultiItemUpdateNotification.xaml</DependentUpon>
</Compile>
- <Compile Include="Implementations\BdInfoExaminer.cs" />
<Compile Include="Implementations\DotNetZipClient.cs" />
<Compile Include="LibraryExplorer.xaml.cs">
<DependentUpon>LibraryExplorer.xaml</DependentUpon>
@@ -270,6 +269,10 @@
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
</ProjectReference>
+ <ProjectReference Include="..\MediaBrowser.Networking\MediaBrowser.Networking.csproj">
+ <Project>{7c11010e-179a-49b7-bfb2-f1656f5e71ad}</Project>
+ <Name>MediaBrowser.Networking</Name>
+ </ProjectReference>
<ProjectReference Include="..\MediaBrowser.Server.Uninstall\MediaBrowser.Server.Uninstall.csproj">
<Project>{5443422f-9548-417a-90dd-2fc91f2b5999}</Project>
<Name>MediaBrowser.Server.Uninstall</Name>