split files into separate classes

This commit is contained in:
Luke Pulverenti 2014-05-08 17:23:24 -04:00
parent e653b41000
commit dce9093ba1
46 changed files with 293 additions and 156 deletions

View File

@ -95,11 +95,12 @@
<Compile Include="ScheduledTasks\Tasks\DeleteCacheFileTask.cs" />
<Compile Include="ScheduledTasks\Tasks\DeleteLogFileTask.cs" />
<Compile Include="ScheduledTasks\Tasks\PluginUpdateTask.cs" />
<Compile Include="ScheduledTasks\Tasks\ReloadLoggerTask.cs" />
<Compile Include="ScheduledTasks\Tasks\ReloadLoggerFileTask.cs" />
<Compile Include="ScheduledTasks\Tasks\SystemUpdateTask.cs" />
<Compile Include="Security\MBLicenseFile.cs" />
<Compile Include="Security\MBRegistration.cs" />
<Compile Include="Security\PluginSecurityManager.cs" />
<Compile Include="Security\RegRecord.cs" />
<Compile Include="Serialization\JsonSerializer.cs" />
<Compile Include="Serialization\XmlSerializer.cs" />
<Compile Include="Updates\InstallationManager.cs" />

View File

@ -94,11 +94,4 @@ namespace MediaBrowser.Common.Implementations.Security
return new MBRegistrationRecord { IsRegistered = reg.registered, ExpirationDate = reg.expDate, RegChecked = true };
}
}
class RegRecord
{
public string featId { get; set; }
public bool registered { get; set; }
public DateTime expDate { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using System;
namespace MediaBrowser.Common.Implementations.Security
{
class RegRecord
{
public string featId { get; set; }
public bool registered { get; set; }
public DateTime expDate { get; set; }
}
}

View File

@ -152,15 +152,4 @@ namespace MediaBrowser.Common
/// <returns>System.Object.</returns>
object CreateInstance(Type type);
}
public interface IDependencyContainer
{
void RegisterSingleInstance<T>(T obj, bool manageLifetime = true)
where T : class;
void RegisterSingleInstance<T>(Func<T> func)
where T : class;
void Register(Type typeInterface, Type typeImplementation);
}
}

View File

@ -0,0 +1,15 @@
using System;
namespace MediaBrowser.Common
{
public interface IDependencyContainer
{
void RegisterSingleInstance<T>(T obj, bool manageLifetime = true)
where T : class;
void RegisterSingleInstance<T>(Func<T> func)
where T : class;
void Register(Type typeInterface, Type typeImplementation);
}
}

View File

@ -60,6 +60,7 @@
<Compile Include="Events\EventHelper.cs" />
<Compile Include="Extensions\BaseExtensions.cs" />
<Compile Include="Extensions\ResourceNotFoundException.cs" />
<Compile Include="IDependencyContainer.cs" />
<Compile Include="IO\FileSystemRepository.cs" />
<Compile Include="IO\IFileSystem.cs" />
<Compile Include="IO\ProgressStream.cs" />
@ -78,9 +79,12 @@
<Compile Include="Net\IWebSocketServer.cs" />
<Compile Include="Net\MimeTypes.cs" />
<Compile Include="Net\WebSocketConnectEventArgs.cs" />
<Compile Include="Net\WebSocketMessageInfo.cs" />
<Compile Include="Plugins\IDependencyModule.cs" />
<Compile Include="Plugins\IPlugin.cs" />
<Compile Include="Progress\ActionableProgress.cs" />
<Compile Include="ScheduledTasks\IConfigurableScheduledTask.cs" />
<Compile Include="ScheduledTasks\IHasKey.cs" />
<Compile Include="ScheduledTasks\IScheduledTask.cs" />
<Compile Include="ScheduledTasks\IScheduledTaskWorker.cs" />
<Compile Include="ScheduledTasks\ITaskManager.cs" />
@ -98,6 +102,7 @@
<Compile Include="Security\ISecurityManager.cs" />
<Compile Include="Updates\IInstallationManager.cs" />
<Compile Include="Updates\InstallationEventArgs.cs" />
<Compile Include="Updates\InstallationFailedEventArgs.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />

View File

@ -65,16 +65,4 @@ namespace MediaBrowser.Common.Net
/// <exception cref="System.ArgumentNullException">buffer</exception>
Task SendAsync(byte[] buffer, WebSocketMessageType type, CancellationToken cancellationToken);
}
/// <summary>
/// Class WebSocketMessageInfo
/// </summary>
public class WebSocketMessageInfo : WebSocketMessage<string>
{
/// <summary>
/// Gets or sets the connection.
/// </summary>
/// <value>The connection.</value>
public IWebSocketConnection Connection { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using MediaBrowser.Model.Net;
namespace MediaBrowser.Common.Net
{
/// <summary>
/// Class WebSocketMessageInfo
/// </summary>
public class WebSocketMessageInfo : WebSocketMessage<string>
{
/// <summary>
/// Gets or sets the connection.
/// </summary>
/// <value>The connection.</value>
public IWebSocketConnection Connection { get; set; }
}
}

View File

@ -0,0 +1,16 @@
namespace MediaBrowser.Common.ScheduledTasks
{
public interface IConfigurableScheduledTask
{
/// <summary>
/// Gets a value indicating whether this instance is hidden.
/// </summary>
/// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
bool IsHidden { get; }
/// <summary>
/// Gets a value indicating whether this instance is enabled.
/// </summary>
/// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value>
bool IsEnabled { get; }
}
}

View File

@ -0,0 +1,7 @@
namespace MediaBrowser.Common.ScheduledTasks
{
public interface IHasKey
{
string Key { get; }
}
}

View File

@ -42,23 +42,4 @@ namespace MediaBrowser.Common.ScheduledTasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
IEnumerable<ITaskTrigger> GetDefaultTriggers();
}
public interface IConfigurableScheduledTask
{
/// <summary>
/// Gets a value indicating whether this instance is hidden.
/// </summary>
/// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
bool IsHidden { get; }
/// <summary>
/// Gets a value indicating whether this instance is enabled.
/// </summary>
/// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value>
bool IsEnabled { get; }
}
public interface IHasKey
{
string Key { get; }
}
}

View File

@ -1,5 +1,4 @@
using MediaBrowser.Model.Updates;
using System;
namespace MediaBrowser.Common.Updates
{
@ -9,9 +8,4 @@ namespace MediaBrowser.Common.Updates
public PackageVersionInfo PackageVersionInfo { get; set; }
}
public class InstallationFailedEventArgs : InstallationEventArgs
{
public Exception Exception { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace MediaBrowser.Common.Updates
{
public class InstallationFailedEventArgs : InstallationEventArgs
{
public Exception Exception { get; set; }
}
}

View File

@ -59,18 +59,22 @@
<Compile Include="PlayTo\Device.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="PlayTo\DeviceEventArgs.cs" />
<Compile Include="PlayTo\PlaybackStartEventArgs.cs" />
<Compile Include="PlayTo\DeviceInfo.cs" />
<Compile Include="Common\DeviceService.cs" />
<Compile Include="Didl\DidlBuilder.cs" />
<Compile Include="PlayTo\DlnaController.cs" />
<Compile Include="PlayTo\PlayToController.cs" />
<Compile Include="PlayTo\Extensions.cs" />
<Compile Include="PlayTo\PlaybackProgressEventArgs.cs" />
<Compile Include="PlayTo\PlaybackStoppedEventArgs.cs" />
<Compile Include="PlayTo\PlaylistItem.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="PlayTo\PlaylistItemFactory.cs" />
<Compile Include="PlayTo\PlayToManager.cs" />
<Compile Include="Common\ServiceAction.cs" />
<Compile Include="PlayTo\TRANSPORTSTATE.cs" />
<Compile Include="PlayTo\uParserObject.cs" />
<Compile Include="Profiles\Foobar2000Profile.cs" />
<Compile Include="Profiles\Windows81Profile.cs" />
<Compile Include="Profiles\WindowsMediaCenterProfile.cs" />

View File

@ -1,28 +0,0 @@
using System;
namespace MediaBrowser.Dlna.PlayTo
{
public class PlaybackStartEventArgs : EventArgs
{
public uBaseObject MediaInfo { get; set; }
}
public class PlaybackProgressEventArgs : EventArgs
{
public uBaseObject MediaInfo { get; set; }
}
public class PlaybackStoppedEventArgs : EventArgs
{
public uBaseObject MediaInfo { get; set; }
}
public enum TRANSPORTSTATE
{
STOPPED,
PLAYING,
TRANSITIONING,
PAUSED_PLAYBACK,
PAUSED
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace MediaBrowser.Dlna.PlayTo
{
public class PlaybackProgressEventArgs : EventArgs
{
public uBaseObject MediaInfo { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace MediaBrowser.Dlna.PlayTo
{
public class PlaybackStartEventArgs : EventArgs
{
public uBaseObject MediaInfo { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace MediaBrowser.Dlna.PlayTo
{
public class PlaybackStoppedEventArgs : EventArgs
{
public uBaseObject MediaInfo { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace MediaBrowser.Dlna.PlayTo
{
public enum TRANSPORTSTATE
{
STOPPED,
PLAYING,
TRANSITIONING,
PAUSED_PLAYBACK,
PAUSED
}
}

View File

@ -44,9 +44,4 @@ namespace MediaBrowser.Dlna.PlayTo
return UpnpContainer.Create(uItem.Element);
}
}
public class uParserObject
{
public XElement Element { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using System.Xml.Linq;
namespace MediaBrowser.Dlna.PlayTo
{
public class uParserObject
{
public XElement Element { get; set; }
}
}

View File

@ -19,8 +19,8 @@ namespace MediaBrowser.Dlna.Profiles
ModelDescription = "Media Browser";
ModelName = "Media Browser";
ModelNumber = "Media Browser";
ModelUrl = "http://mediabrowser3.com/";
ManufacturerUrl = "http://mediabrowser3.com/";
ModelUrl = "http://mediabrowser.tv/";
ManufacturerUrl = "http://mediabrowser.tv/";
AlbumArtPn = "JPEG_SM";

View File

@ -3,11 +3,11 @@
<Name>Generic Device</Name>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -8,11 +8,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -9,11 +9,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -7,11 +7,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -10,11 +10,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -9,11 +9,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>true</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -9,11 +9,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Microsoft Corporation</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Windows Media Player Sharing</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>3.0</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -11,11 +11,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Microsoft Corporation</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Windows Media Player Sharing</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>3.0</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -10,11 +10,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -10,11 +10,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>true</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -8,11 +8,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio,Photo,Video</SupportedMediaTypes>

View File

@ -9,11 +9,11 @@
</Identification>
<FriendlyName>Media Browser</FriendlyName>
<Manufacturer>Media Browser</Manufacturer>
<ManufacturerUrl>http://mediabrowser3.com/</ManufacturerUrl>
<ManufacturerUrl>http://mediabrowser.tv/</ManufacturerUrl>
<ModelName>Media Browser</ModelName>
<ModelDescription>Media Browser</ModelDescription>
<ModelNumber>Media Browser</ModelNumber>
<ModelUrl>http://mediabrowser3.com/</ModelUrl>
<ModelUrl>http://mediabrowser.tv/</ModelUrl>
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<EnableAlbumArtInDidl>false</EnableAlbumArtInDidl>
<SupportedMediaTypes>Audio</SupportedMediaTypes>

View File

@ -22,7 +22,12 @@ namespace MediaBrowser.Model.Dlna
public List<string> GetCodecs()
{
return (Codec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (Codec ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
public bool ContainsCodec(string codec)

View File

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
@ -20,7 +19,12 @@ namespace MediaBrowser.Model.Dlna
public List<string> GetContainers()
{
return (Container ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (Container ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
}
}

View File

@ -105,7 +105,12 @@ namespace MediaBrowser.Model.Dlna
public List<string> GetSupportedMediaTypes()
{
return (SupportedMediaTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (SupportedMediaTypes ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec)

View File

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
@ -20,17 +19,32 @@ namespace MediaBrowser.Model.Dlna
public List<string> GetContainers()
{
return (Container ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (Container ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
public List<string> GetAudioCodecs()
{
return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (AudioCodec ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
public List<string> GetVideoCodecs()
{
return (VideoCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (VideoCodec ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
}
}

View File

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
@ -33,17 +32,32 @@ namespace MediaBrowser.Model.Dlna
public List<string> GetContainers()
{
return (Container ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (Container ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
public List<string> GetAudioCodecs()
{
return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (AudioCodec ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
public List<string> GetVideoCodecs()
{
return (VideoCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (VideoCodec ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
}
}

View File

@ -24,12 +24,17 @@ namespace MediaBrowser.Model.Dlna
// Avoid implicitly captured closure
string mediaSourceId = options.MediaSourceId;
mediaSources = mediaSources
.Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
.ToList();
mediaSources = new List<MediaSourceInfo>();
foreach (MediaSourceInfo i in mediaSources)
{
if (string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
mediaSources.Add(i);
}
}
List<StreamInfo> streams = mediaSources.Select(i => BuildAudioItem(i, options)).ToList();
List<StreamInfo> streams = new List<StreamInfo>();
foreach (MediaSourceInfo i in mediaSources)
streams.Add(BuildAudioItem(i, options));
foreach (StreamInfo stream in streams)
{
@ -52,12 +57,17 @@ namespace MediaBrowser.Model.Dlna
// Avoid implicitly captured closure
string mediaSourceId = options.MediaSourceId;
mediaSources = mediaSources
.Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
.ToList();
mediaSources = new List<MediaSourceInfo>();
foreach (MediaSourceInfo i in mediaSources)
{
if (string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
mediaSources.Add(i);
}
}
List<StreamInfo> streams = mediaSources.Select(i => BuildVideoItem(i, options)).ToList();
List<StreamInfo> streams = new List<StreamInfo>();
foreach (MediaSourceInfo i in mediaSources)
streams.Add(BuildVideoItem(i, options));
foreach (StreamInfo stream in streams)
{
@ -72,8 +82,19 @@ namespace MediaBrowser.Model.Dlna
{
// Grab the first one that can be direct streamed
// If that doesn't produce anything, just take the first
return streams.FirstOrDefault(i => i.IsDirectStream) ??
streams.FirstOrDefault();
foreach (StreamInfo i in streams)
{
if (i.IsDirectStream)
{
return i;
}
}
foreach (StreamInfo stream in streams)
{
return stream;
}
return null;
}
private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options)
@ -191,8 +212,15 @@ namespace MediaBrowser.Model.Dlna
}
// Can't direct play, find the transcoding profile
TranscodingProfile transcodingProfile = options.Profile.TranscodingProfiles
.FirstOrDefault(i => i.Type == playlistItem.MediaType);
TranscodingProfile transcodingProfile = null;
foreach (TranscodingProfile i in options.Profile.TranscodingProfiles)
{
if (i.Type == playlistItem.MediaType)
{
transcodingProfile = i;
break;
}
}
if (transcodingProfile != null)
{
@ -200,7 +228,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.Container = transcodingProfile.Container;
playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength;
playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
playlistItem.AudioCodec = transcodingProfile.AudioCodec.Split(',').FirstOrDefault();
playlistItem.AudioCodec = transcodingProfile.AudioCodec.Split(',')[0];
playlistItem.VideoCodec = transcodingProfile.VideoCodec;
playlistItem.Protocol = transcodingProfile.Protocol;
playlistItem.AudioStreamIndex = options.AudioStreamIndex;
@ -261,8 +289,15 @@ namespace MediaBrowser.Model.Dlna
MediaStream audioStream)
{
// See if it can be direct played
DirectPlayProfile directPlay = profile.DirectPlayProfiles
.FirstOrDefault(i => i.Type == DlnaProfileType.Video && IsVideoDirectPlaySupported(i, mediaSource, videoStream, audioStream));
DirectPlayProfile directPlay = null;
foreach (DirectPlayProfile i in profile.DirectPlayProfiles)
{
if (i.Type == DlnaProfileType.Video && IsVideoDirectPlaySupported(i, mediaSource, videoStream, audioStream))
{
directPlay = i;
break;
}
}
if (directPlay == null)
{

View File

@ -1,11 +1,10 @@
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{
@ -134,14 +133,23 @@ namespace MediaBrowser.Model.Dlna
{
if (MediaSource != null)
{
IEnumerable<MediaStream> audioStreams = MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio);
if (AudioStreamIndex.HasValue)
{
return audioStreams.FirstOrDefault(i => i.Index == AudioStreamIndex.Value);
foreach (MediaStream i in MediaSource.MediaStreams)
{
if (i.Index == AudioStreamIndex.Value && i.Type == MediaStreamType.Audio)
return i;
}
return null;
}
return audioStreams.FirstOrDefault();
foreach (MediaStream stream in MediaSource.MediaStreams)
{
if (stream.Type == MediaStreamType.Audio)
return stream;
}
return null;
}
return null;
@ -157,8 +165,12 @@ namespace MediaBrowser.Model.Dlna
{
if (MediaSource != null)
{
return MediaSource.MediaStreams
.FirstOrDefault(i => i.Type == MediaStreamType.Video && (i.Codec ?? string.Empty).IndexOf("jpeg", StringComparison.OrdinalIgnoreCase) == -1);
foreach (MediaStream i in MediaSource.MediaStreams)
{
if (i.Type == MediaStreamType.Video && (i.Codec ?? string.Empty).IndexOf("jpeg", StringComparison.OrdinalIgnoreCase) == -1)
return i;
}
return null;
}
return null;

View File

@ -35,7 +35,12 @@ namespace MediaBrowser.Model.Dlna
public List<string> GetAudioCodecs()
{
return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
List<string> list = new List<string>();
foreach (string i in (AudioCodec ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
}
}
}

View File

@ -138,7 +138,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
var notification = new NotificationRequest
{
Description = "Please see mediabrowser3.com for details.",
Description = "Please see mediabrowser.tv for details.",
NotificationType = type
};

View File

@ -45,7 +45,7 @@ namespace MediaBrowser.ServerApplication.Native
/// <param name="logger">The logger.</param>
public static void OpenCommunity(ILogger logger)
{
OpenUrl("http://mediabrowser3.com/community", logger);
OpenUrl("http://mediabrowser.tv/community", logger);
}
/// <summary>