updated nuget

This commit is contained in:
Luke Pulverenti 2014-07-27 18:01:29 -04:00
parent 37c27a26e9
commit 063675bb07
58 changed files with 404 additions and 142 deletions

View File

@ -269,11 +269,19 @@ namespace MediaBrowser.Api.Playback.Hls
var segmentFilename = Path.GetFileName(segmentPath); var segmentFilename = Path.GetFileName(segmentPath);
using (var fileStream = FileSystem.GetFileStream(playlistPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, true))
{
using (var reader = new StreamReader(fileStream))
{
var text = await reader.ReadToEndAsync().ConfigureAwait(false);
// If it appears in the playlist, it's done // If it appears in the playlist, it's done
if (File.ReadAllText(playlistPath).IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1) if (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1)
{ {
return ResultFactory.GetStaticFileResult(Request, segmentPath, FileShare.ReadWrite); return ResultFactory.GetStaticFileResult(Request, segmentPath, FileShare.ReadWrite);
} }
}
}
// if a different file is encoding, it's done // if a different file is encoding, it's done
//var currentTranscodingIndex = GetCurrentTranscodingIndex(playlistPath); //var currentTranscodingIndex = GetCurrentTranscodingIndex(playlistPath);

View File

@ -21,6 +21,12 @@ namespace MediaBrowser.Api
} }
[Route("/System/Info/Public", "GET", Summary = "Gets public information about the server")]
public class GetPublicSystemInfo : IReturn<PublicSystemInfo>
{
}
/// <summary> /// <summary>
/// Class RestartApplication /// Class RestartApplication
/// </summary> /// </summary>
@ -125,6 +131,20 @@ namespace MediaBrowser.Api
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
public object Get(GetPublicSystemInfo request)
{
var result = _appHost.GetSystemInfo();
var publicInfo = new PublicSystemInfo
{
Id = result.Id,
ServerName = result.ServerName,
Version = result.Version
};
return ToOptimizedResult(publicInfo);
}
/// <summary> /// <summary>
/// Posts the specified request. /// Posts the specified request.
/// </summary> /// </summary>

View File

@ -40,5 +40,11 @@ namespace MediaBrowser.Controller
/// </summary> /// </summary>
/// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
bool HasUpdateAvailable { get; } bool HasUpdateAvailable { get; }
/// <summary>
/// Gets or sets the server identifier.
/// </summary>
/// <value>The server identifier.</value>
string ServerId { get; }
} }
} }

View File

@ -201,6 +201,14 @@ namespace MediaBrowser.Dlna.Channels
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly string _controlUrl; private readonly string _controlUrl;
/// <summary>
/// Prevents core from throwing an exception
/// </summary>
public ServerChannel()
{
}
public ServerChannel(List<Device> servers, IHttpClient httpClient, ILogger logger, string controlUrl) public ServerChannel(List<Device> servers, IHttpClient httpClient, ILogger logger, string controlUrl)
{ {
_servers = servers; _servers = servers;

View File

@ -108,7 +108,7 @@ namespace MediaBrowser.Dlna.Didl
MediaSources = sources, MediaSources = sources,
Profile = _profile, Profile = _profile,
DeviceId = deviceId, DeviceId = deviceId,
MaxBitrate = _profile.MaxBitrate MaxBitrate = _profile.MaxStreamingBitrate
}); });
} }

View File

@ -537,7 +537,7 @@ namespace MediaBrowser.Dlna.PlayTo
MediaSources = mediaSources, MediaSources = mediaSources,
Profile = profile, Profile = profile,
DeviceId = deviceId, DeviceId = deviceId,
MaxBitrate = profile.MaxBitrate, MaxBitrate = profile.MaxStreamingBitrate,
MediaSourceId = mediaSourceId, MediaSourceId = mediaSourceId,
AudioStreamIndex = audioStreamIndex, AudioStreamIndex = audioStreamIndex,
SubtitleStreamIndex = subtitleStreamIndex SubtitleStreamIndex = subtitleStreamIndex
@ -557,7 +557,7 @@ namespace MediaBrowser.Dlna.PlayTo
MediaSources = mediaSources, MediaSources = mediaSources,
Profile = profile, Profile = profile,
DeviceId = deviceId, DeviceId = deviceId,
MaxBitrate = profile.MaxBitrate, MaxBitrate = profile.MaxStreamingBitrate,
MediaSourceId = mediaSourceId MediaSourceId = mediaSourceId
}), }),

View File

@ -27,7 +27,8 @@ namespace MediaBrowser.Dlna.Profiles
MaxAlbumArtHeight = 512; MaxAlbumArtHeight = 512;
MaxAlbumArtWidth = 512; MaxAlbumArtWidth = 512;
MaxBitrate = 8000000; MaxStreamingBitrate = 8000000;
MaxStaticBitrate = 8000000;
TranscodingProfiles = new[] TranscodingProfiles = new[]
{ {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,8 @@
<MaxAlbumArtHeight>512</MaxAlbumArtHeight> <MaxAlbumArtHeight>512</MaxAlbumArtHeight>
<MaxIconWidth xsi:nil="true" /> <MaxIconWidth xsi:nil="true" />
<MaxIconHeight xsi:nil="true" /> <MaxIconHeight xsi:nil="true" />
<MaxBitrate>8000000</MaxBitrate> <MaxStreamingBitrate>8000000</MaxStreamingBitrate>
<MaxStaticBitrate>8000000</MaxStaticBitrate>
<XDlnaDoc>DMS-1.50</XDlnaDoc> <XDlnaDoc>DMS-1.50</XDlnaDoc>
<SonyAggregationFlags>10</SonyAggregationFlags> <SonyAggregationFlags>10</SonyAggregationFlags>
<ProtocolInfo>http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=81500000000000000000000000000000,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_OP=00;DLNA.ORG_FLAGS=00D00000000000000000000000000000,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_PAL;DLNA.ORG_OP=11;DLNA.ORG_FLAGS=81500000000000000000000000000000</ProtocolInfo> <ProtocolInfo>http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=81500000000000000000000000000000,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_OP=00;DLNA.ORG_FLAGS=00D00000000000000000000000000000,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_PAL;DLNA.ORG_OP=11;DLNA.ORG_FLAGS=81500000000000000000000000000000</ProtocolInfo>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -98,6 +98,9 @@
<Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs"> <Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs">
<Link>ApiClient\IServerEvents.cs</Link> <Link>ApiClient\IServerEvents.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\ApiClient\ServerDiscoveryInfo.cs">
<Link>ApiClient\ServerDiscoveryInfo.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\ApiClient\SessionUpdatesEventArgs.cs"> <Compile Include="..\MediaBrowser.Model\ApiClient\SessionUpdatesEventArgs.cs">
<Link>ApiClient\SessionUpdatesEventArgs.cs</Link> <Link>ApiClient\SessionUpdatesEventArgs.cs</Link>
</Compile> </Compile>

View File

@ -61,6 +61,9 @@
<Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs"> <Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs">
<Link>ApiClient\IServerEvents.cs</Link> <Link>ApiClient\IServerEvents.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\ApiClient\ServerDiscoveryInfo.cs">
<Link>ApiClient\ServerDiscoveryInfo.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\ApiClient\SessionUpdatesEventArgs.cs"> <Compile Include="..\MediaBrowser.Model\ApiClient\SessionUpdatesEventArgs.cs">
<Link>ApiClient\SessionUpdatesEventArgs.cs</Link> <Link>ApiClient\SessionUpdatesEventArgs.cs</Link>
</Compile> </Compile>

View File

@ -467,6 +467,13 @@ namespace MediaBrowser.Model.ApiClient
/// <returns>Task{SystemInfo}.</returns> /// <returns>Task{SystemInfo}.</returns>
Task<SystemInfo> GetSystemInfoAsync(CancellationToken cancellationToken); Task<SystemInfo> GetSystemInfoAsync(CancellationToken cancellationToken);
/// <summary>
/// Gets the public system information asynchronous.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;PublicSystemInfo&gt;.</returns>
Task<PublicSystemInfo> GetPublicSystemInfoAsync(CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets a person /// Gets a person
/// </summary> /// </summary>
@ -772,23 +779,16 @@ namespace MediaBrowser.Model.ApiClient
IJsonSerializer JsonSerializer { get; set; } IJsonSerializer JsonSerializer { get; set; }
/// <summary> /// <summary>
/// Gets or sets the server host name (myserver or 192.168.x.x) /// Gets or sets the server address
/// </summary> /// </summary>
/// <value>The name of the server host.</value> /// <value>The server address.</value>
string ServerHostName { get; } string ServerAddress { get; }
/// <summary>
/// Gets or sets the port number used by the API
/// </summary>
/// <value>The server API port.</value>
int ServerApiPort { get; }
/// <summary> /// <summary>
/// Changes the server location. /// Changes the server location.
/// </summary> /// </summary>
/// <param name="hostName">Name of the host.</param> /// <param name="address">The address.</param>
/// <param name="apiPort">The API port.</param> void ChangeServerLocation(string address);
void ChangeServerLocation(string hostName, int apiPort);
/// <summary> /// <summary>
/// Gets or sets the type of the client. /// Gets or sets the type of the client.
@ -812,7 +812,31 @@ namespace MediaBrowser.Model.ApiClient
/// Gets or sets the current user id. /// Gets or sets the current user id.
/// </summary> /// </summary>
/// <value>The current user id.</value> /// <value>The current user id.</value>
string CurrentUserId { get; set; } string CurrentUserId { get; }
/// <summary>
/// Gets the access token.
/// </summary>
/// <value>The access token.</value>
string AccessToken { get; }
/// <summary>
/// Sets the authentication information.
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <param name="userId">The user identifier.</param>
void SetAuthenticationInfo(string accessToken, string userId);
/// <summary>
/// Sets the authentication information.
/// </summary>
/// <param name="accessToken">The access token.</param>
void SetAuthenticationInfo(string accessToken);
/// <summary>
/// Clears the authentication information.
/// </summary>
void ClearAuthenticationInfo();
/// <summary> /// <summary>
/// Gets the image URL. /// Gets the image URL.

View File

@ -0,0 +1,22 @@

namespace MediaBrowser.Model.ApiClient
{
public class ServerDiscoveryInfo
{
/// <summary>
/// Gets or sets the address.
/// </summary>
/// <value>The address.</value>
public string Address { get; set; }
/// <summary>
/// Gets or sets the server identifier.
/// </summary>
/// <value>The server identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
}
}

View File

@ -304,7 +304,6 @@ namespace MediaBrowser.Model.Configuration
}; };
SubtitleOptions = new SubtitleOptions(); SubtitleOptions = new SubtitleOptions();
LiveTvOptions = new LiveTvOptions();
TvFileOrganizationOptions = new TvFileOrganizationOptions(); TvFileOrganizationOptions = new TvFileOrganizationOptions();
} }
} }

View File

@ -35,5 +35,29 @@ namespace MediaBrowser.Model.Dlna
/// </summary> /// </summary>
/// <value>The context.</value> /// <value>The context.</value>
public EncodingContext Context { get; set; } public EncodingContext Context { get; set; }
/// <summary>
/// Gets the maximum bitrate.
/// </summary>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
public int? GetMaxBitrate()
{
if (MaxBitrate.HasValue)
{
return MaxBitrate;
}
if (Profile != null)
{
if (Context == EncodingContext.Static)
{
return Profile.MaxStaticBitrate;
}
return Profile.MaxStreamingBitrate;
}
return null;
}
} }
} }

View File

@ -49,7 +49,8 @@ namespace MediaBrowser.Model.Dlna
public int? MaxIconWidth { get; set; } public int? MaxIconWidth { get; set; }
public int? MaxIconHeight { get; set; } public int? MaxIconHeight { get; set; }
public int? MaxBitrate { get; set; } public int? MaxStreamingBitrate { get; set; }
public int? MaxStaticBitrate { get; set; }
/// <summary> /// <summary>
/// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace. /// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace.

View File

@ -105,7 +105,7 @@ namespace MediaBrowser.Model.Dlna
RunTimeTicks = item.RunTimeTicks RunTimeTicks = item.RunTimeTicks
}; };
int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate; int? maxBitrateSetting = options.GetMaxBitrate();
MediaStream audioStream = item.DefaultAudioStream; MediaStream audioStream = item.DefaultAudioStream;
@ -243,7 +243,7 @@ namespace MediaBrowser.Model.Dlna
MediaStream videoStream = item.VideoStream; MediaStream videoStream = item.VideoStream;
int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate; int? maxBitrateSetting = options.GetMaxBitrate();
if (IsEligibleForDirectPlay(item, maxBitrateSetting, subtitleStream, options)) if (IsEligibleForDirectPlay(item, maxBitrateSetting, subtitleStream, options))
{ {

View File

@ -64,6 +64,7 @@
<Compile Include="ApiClient\ApiClientExtensions.cs" /> <Compile Include="ApiClient\ApiClientExtensions.cs" />
<Compile Include="ApiClient\IServerEvents.cs" /> <Compile Include="ApiClient\IServerEvents.cs" />
<Compile Include="ApiClient\GeneralCommandEventArgs.cs" /> <Compile Include="ApiClient\GeneralCommandEventArgs.cs" />
<Compile Include="ApiClient\ServerDiscoveryInfo.cs" />
<Compile Include="ApiClient\SessionUpdatesEventArgs.cs" /> <Compile Include="ApiClient\SessionUpdatesEventArgs.cs" />
<Compile Include="Branding\BrandingOptions.cs" /> <Compile Include="Branding\BrandingOptions.cs" />
<Compile Include="Channels\ChannelFeatures.cs" /> <Compile Include="Channels\ChannelFeatures.cs" />

View File

@ -6,7 +6,7 @@ namespace MediaBrowser.Model.Sync
Queued = 0, Queued = 0,
Transcoding = 1, Transcoding = 1,
TranscodingFailed = 2, TranscodingFailed = 2,
Transfering = 3, Transferring = 3,
Completed = 4, Completed = 4,
Cancelled = 5 Cancelled = 5
} }

View File

@ -6,14 +6,8 @@ namespace MediaBrowser.Model.System
/// <summary> /// <summary>
/// Class SystemInfo /// Class SystemInfo
/// </summary> /// </summary>
public class SystemInfo public class SystemInfo : PublicSystemInfo
{ {
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public string Version { get; set; }
/// <summary> /// <summary>
/// Gets or sets the operating sytem. /// Gets or sets the operating sytem.
/// </summary> /// </summary>
@ -86,12 +80,6 @@ namespace MediaBrowser.Model.System
/// <value>The failed assembly loads.</value> /// <value>The failed assembly loads.</value>
public List<string> FailedPluginAssemblies { get; set; } public List<string> FailedPluginAssemblies { get; set; }
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public string Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the program data path. /// Gets or sets the program data path.
/// </summary> /// </summary>
@ -152,12 +140,6 @@ namespace MediaBrowser.Model.System
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value> /// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
public bool SupportsAutoRunAtStartup { get; set; } public bool SupportsAutoRunAtStartup { get; set; }
/// <summary>
/// Gets or sets the name of the server.
/// </summary>
/// <value>The name of the server.</value>
public string ServerName { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SystemInfo" /> class. /// Initializes a new instance of the <see cref="SystemInfo" /> class.
/// </summary> /// </summary>
@ -170,4 +152,25 @@ namespace MediaBrowser.Model.System
FailedPluginAssemblies = new List<string>(); FailedPluginAssemblies = new List<string>();
} }
} }
public class PublicSystemInfo
{
/// <summary>
/// Gets or sets the name of the server.
/// </summary>
/// <value>The name of the server.</value>
public string ServerName { get; set; }
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public string Version { get; set; }
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public string Id { get; set; }
}
} }

View File

@ -22,5 +22,11 @@ namespace MediaBrowser.Model.Users
/// </summary> /// </summary>
/// <value>The authentication token.</value> /// <value>The authentication token.</value>
public string AccessToken { get; set; } public string AccessToken { get; set; }
/// <summary>
/// Gets or sets the server identifier.
/// </summary>
/// <value>The server identifier.</value>
public string ServerId { get; set; }
} }
} }

View File

@ -540,18 +540,10 @@ namespace MediaBrowser.Providers.Manager
Type = MetadataPluginType.LocalImageProvider Type = MetadataPluginType.LocalImageProvider
})); }));
if (ConfigurationManager.Configuration.EnableInternetProviders) var enableInternet = ConfigurationManager.Configuration.EnableInternetProviders;
{
// Fetchers
list.AddRange(imageProviders.Where(i => i is IRemoteImageProvider).Select(i => new MetadataPlugin
{
Name = i.Name,
Type = MetadataPluginType.ImageFetcher
}));
}
// Fetchers // Fetchers
list.AddRange(imageProviders.Where(i => i is IDynamicImageProvider).Select(i => new MetadataPlugin list.AddRange(imageProviders.Where(i => i is IDynamicImageProvider || (enableInternet && i is IRemoteImageProvider)).Select(i => new MetadataPlugin
{ {
Name = i.Name, Name = i.Name,
Type = MetadataPluginType.ImageFetcher Type = MetadataPluginType.ImageFetcher

View File

@ -1,5 +1,4 @@
using System.Linq; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events; using MediaBrowser.Common.Events;
using MediaBrowser.Common.Implementations.Configuration; using MediaBrowser.Common.Implementations.Configuration;
using MediaBrowser.Controller; using MediaBrowser.Controller;
@ -14,6 +13,7 @@ using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;
using System.IO; using System.IO;
using System.Linq;
namespace MediaBrowser.Server.Implementations.Configuration namespace MediaBrowser.Server.Implementations.Configuration
{ {

View File

@ -66,22 +66,35 @@ namespace MediaBrowser.Server.Implementations.Dto
/// <exception cref="System.ArgumentNullException">item</exception> /// <exception cref="System.ArgumentNullException">item</exception>
public BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null) public BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)
{ {
var dto = GetBaseItemDtoInternal(item, fields, user, owner);
var byName = item as IItemByName; var byName = item as IItemByName;
if (byName != null) if (byName != null && !(item is LiveTvChannel))
{ {
var libraryItems = user != null ? IEnumerable<BaseItem> libraryItems;
var artist = item as MusicArtist;
if (artist == null || artist.IsAccessedByName)
{
libraryItems = user != null ?
user.RootFolder.GetRecursiveChildren(user) : user.RootFolder.GetRecursiveChildren(user) :
_libraryManager.RootFolder.RecursiveChildren; _libraryManager.RootFolder.RecursiveChildren;
}
var dto = GetBaseItemDtoInternal(item, fields, user); else
{
libraryItems = user != null ?
artist.GetRecursiveChildren(user) :
artist.RecursiveChildren;
}
SetItemByNameInfo(item, dto, byName.GetTaggedItems(libraryItems).ToList(), user); SetItemByNameInfo(item, dto, byName.GetTaggedItems(libraryItems).ToList(), user);
return dto; return dto;
} }
return GetBaseItemDtoInternal(item, fields, user, owner); return dto;
} }
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null) private BaseItemDto GetBaseItemDtoInternal(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)

View File

@ -1,4 +1,5 @@
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Plugins;
@ -35,6 +36,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// The _HTTP server /// The _HTTP server
/// </summary> /// </summary>
private readonly IHttpServer _httpServer; private readonly IHttpServer _httpServer;
private readonly IServerApplicationHost _appHost;
public const int PortNumber = 7359; public const int PortNumber = 7359;
@ -45,12 +47,13 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// <param name="networkManager">The network manager.</param> /// <param name="networkManager">The network manager.</param>
/// <param name="serverConfigurationManager">The server configuration manager.</param> /// <param name="serverConfigurationManager">The server configuration manager.</param>
/// <param name="httpServer">The HTTP server.</param> /// <param name="httpServer">The HTTP server.</param>
public UdpServerEntryPoint(ILogger logger, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager, IHttpServer httpServer) public UdpServerEntryPoint(ILogger logger, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager, IHttpServer httpServer, IServerApplicationHost appHost)
{ {
_logger = logger; _logger = logger;
_networkManager = networkManager; _networkManager = networkManager;
_serverConfigurationManager = serverConfigurationManager; _serverConfigurationManager = serverConfigurationManager;
_httpServer = httpServer; _httpServer = httpServer;
_appHost = appHost;
} }
/// <summary> /// <summary>
@ -58,7 +61,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// </summary> /// </summary>
public void Run() public void Run()
{ {
var udpServer = new UdpServer(_logger, _networkManager, _serverConfigurationManager, _httpServer); var udpServer = new UdpServer(_logger, _networkManager, _serverConfigurationManager, _httpServer, _appHost);
try try
{ {

View File

@ -0,0 +1,21 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
using System.Collections.Generic;
namespace MediaBrowser.Server.Implementations.LiveTv
{
public class LiveTvConfigurationFactory : IConfigurationFactory
{
public IEnumerable<ConfigurationStore> GetConfigurations()
{
return new List<ConfigurationStore>
{
new ConfigurationStore
{
ConfigurationType = typeof(LiveTvOptions),
Key = "livetv"
}
};
}
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
@ -11,6 +12,7 @@ using MediaBrowser.Controller.Localization;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Sorting; using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.LiveTv;
@ -83,6 +85,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
public ILiveTvService ActiveService { get; private set; } public ILiveTvService ActiveService { get; private set; }
private LiveTvOptions GetConfiguration()
{
return _config.GetConfiguration<LiveTvOptions>("livetv");
}
/// <summary> /// <summary>
/// Adds the parts. /// Adds the parts.
/// </summary> /// </summary>
@ -91,7 +98,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
_services.AddRange(services); _services.AddRange(services);
SetActiveService(_config.Configuration.LiveTvOptions.ActiveService); SetActiveService(GetConfiguration().ActiveService);
} }
private void SetActiveService(string name) private void SetActiveService(string name)
@ -303,22 +310,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
try try
{ {
// Avoid implicitly captured closure
var itemId = id;
var stream = _openStreams
.Where(i => string.Equals(i.Value.ItemId, itemId) && isChannel == i.Value.IsChannel)
.Take(1)
.Select(i => i.Value)
.FirstOrDefault();
if (stream != null)
{
stream.ConsumerCount++;
_logger.Debug("Returning existing live tv stream");
return stream.Info;
}
var service = ActiveService; var service = ActiveService;
LiveStreamInfo info; LiveStreamInfo info;
@ -1010,9 +1001,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private double GetGuideDays(int channelCount) private double GetGuideDays(int channelCount)
{ {
if (_config.Configuration.LiveTvOptions.GuideDays.HasValue) var config = GetConfiguration();
if (config.GuideDays.HasValue)
{ {
return _config.Configuration.LiveTvOptions.GuideDays.Value; return config.GuideDays.Value;
} }
var programsPerDay = channelCount * 48; var programsPerDay = channelCount * 48;

View File

@ -699,6 +699,10 @@
"HeaderProfileServerSettingsHelp": "These values control how Media Browser will present itself to the device.", "HeaderProfileServerSettingsHelp": "These values control how Media Browser will present itself to the device.",
"LabelMaxBitrate": "Max bitrate:", "LabelMaxBitrate": "Max bitrate:",
"LabelMaxBitrateHelp": "Specify a max bitrate in bandwidth constrained environments, or if the device imposes it's own limit.", "LabelMaxBitrateHelp": "Specify a max bitrate in bandwidth constrained environments, or if the device imposes it's own limit.",
"LabelMaxStreamingBitrate": "Max streaming bitrate:",
"LabelMaxStreamingBitrateHelp": "Specify a max bitrate when streaming.",
"LabelMaxStaticBitrate": "Max sync bitrate:",
"LabelMaxStaticBitrateHelp": "Specify a max bitrate when syncing content at high quality.",
"OptionIgnoreTranscodeByteRangeRequests": "Ignore transcode byte range requests", "OptionIgnoreTranscodeByteRangeRequests": "Ignore transcode byte range requests",
"OptionIgnoreTranscodeByteRangeRequestsHelp": "If enabled, these requests will be honored but will ignore the byte range header.", "OptionIgnoreTranscodeByteRangeRequestsHelp": "If enabled, these requests will be honored but will ignore the byte range header.",
"LabelFriendlyName": "Friendly name", "LabelFriendlyName": "Friendly name",
@ -905,5 +909,11 @@
"HeaderChapters": "Chapters", "HeaderChapters": "Chapters",
"HeaderResumeSettings": "Resume Settings", "HeaderResumeSettings": "Resume Settings",
"TabSync": "Sync", "TabSync": "Sync",
"TitleUsers": "Users" "TitleUsers": "Users",
"LabelProtocol": "Protocol:",
"OptionProtocolHttp": "Http",
"OptionProtocolHls": "Http Live Streaming",
"LabelContext": "Context:",
"OptionContextStreaming": "Streaming",
"OptionContextStatic": "Sync"
} }

View File

@ -198,6 +198,7 @@
<Compile Include="Library\Validators\YearsPostScanTask.cs" /> <Compile Include="Library\Validators\YearsPostScanTask.cs" />
<Compile Include="LiveTv\ChannelImageProvider.cs" /> <Compile Include="LiveTv\ChannelImageProvider.cs" />
<Compile Include="LiveTv\CleanDatabaseScheduledTask.cs" /> <Compile Include="LiveTv\CleanDatabaseScheduledTask.cs" />
<Compile Include="LiveTv\LiveTvConfigurationFactory.cs" />
<Compile Include="LiveTv\LiveTvDtoService.cs" /> <Compile Include="LiveTv\LiveTvDtoService.cs" />
<Compile Include="LiveTv\LiveTvManager.cs" /> <Compile Include="LiveTv\LiveTvManager.cs" />
<Compile Include="LiveTv\ProgramImageProvider.cs" /> <Compile Include="LiveTv\ProgramImageProvider.cs" />

View File

@ -17,6 +17,10 @@ namespace MediaBrowser.Server.Implementations.Security
{ {
if (value == null) throw new ArgumentNullException("value"); if (value == null) throw new ArgumentNullException("value");
#if __MonoCS__
return EncryptStringUniversal(value);
#endif
return Encoding.Default.GetString(ProtectedData.Protect(Encoding.Default.GetBytes(value), null, DataProtectionScope.LocalMachine)); return Encoding.Default.GetString(ProtectedData.Protect(Encoding.Default.GetBytes(value), null, DataProtectionScope.LocalMachine));
} }
@ -30,7 +34,27 @@ namespace MediaBrowser.Server.Implementations.Security
{ {
if (value == null) throw new ArgumentNullException("value"); if (value == null) throw new ArgumentNullException("value");
#if __MonoCS__
return DecryptStringUniversal(value);
#endif
return Encoding.Default.GetString(ProtectedData.Unprotect(Encoding.Default.GetBytes(value), null, DataProtectionScope.LocalMachine)); return Encoding.Default.GetString(ProtectedData.Unprotect(Encoding.Default.GetBytes(value), null, DataProtectionScope.LocalMachine));
} }
private string EncryptStringUniversal(string value)
{
// Yes, this isn't good, but ProtectedData in mono is throwing exceptions, so use this for now
var bytes = Encoding.UTF8.GetBytes(value);
return Convert.ToBase64String(bytes);
}
private string DecryptStringUniversal(string value)
{
// Yes, this isn't good, but ProtectedData in mono is throwing exceptions, so use this for now
var bytes = Convert.FromBase64String(value);
return Encoding.UTF8.GetString(bytes);
}
} }
} }

View File

@ -1236,7 +1236,8 @@ namespace MediaBrowser.Server.Implementations.Session
{ {
User = _dtoService.GetUserDto(user), User = _dtoService.GetUserDto(user),
SessionInfo = GetSessionInfoDto(session), SessionInfo = GetSessionInfoDto(session),
AccessToken = token AccessToken = token,
ServerId = _appHost.ServerId
}; };
} }

View File

@ -68,7 +68,8 @@ namespace MediaBrowser.Server.Implementations.Sync
LimitType = request.LimitType, LimitType = request.LimitType,
RequestedItemIds = request.ItemIds, RequestedItemIds = request.ItemIds,
DateCreated = DateTime.UtcNow, DateCreated = DateTime.UtcNow,
DateLastModified = DateTime.UtcNow DateLastModified = DateTime.UtcNow,
ItemCount = 1
}; };
await _repo.Create(job).ConfigureAwait(false); await _repo.Create(job).ConfigureAwait(false);

View File

@ -1,8 +1,12 @@
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.ApiClient;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
@ -37,6 +41,11 @@ namespace MediaBrowser.Server.Implementations.Udp
private bool _isDisposed; private bool _isDisposed;
private readonly List<Tuple<byte[], Action<string>>> _responders = new List<Tuple<byte[], Action<string>>>();
private readonly IServerApplicationHost _appHost;
private readonly IJsonSerializer _json;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UdpServer" /> class. /// Initializes a new instance of the <see cref="UdpServer" /> class.
/// </summary> /// </summary>
@ -44,12 +53,24 @@ namespace MediaBrowser.Server.Implementations.Udp
/// <param name="networkManager">The network manager.</param> /// <param name="networkManager">The network manager.</param>
/// <param name="serverConfigurationManager">The server configuration manager.</param> /// <param name="serverConfigurationManager">The server configuration manager.</param>
/// <param name="httpServer">The HTTP server.</param> /// <param name="httpServer">The HTTP server.</param>
public UdpServer(ILogger logger, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager, IHttpServer httpServer) /// <param name="appHost">The application host.</param>
public UdpServer(ILogger logger, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager, IHttpServer httpServer, IServerApplicationHost appHost)
{ {
_logger = logger; _logger = logger;
_networkManager = networkManager; _networkManager = networkManager;
_serverConfigurationManager = serverConfigurationManager; _serverConfigurationManager = serverConfigurationManager;
_httpServer = httpServer; _httpServer = httpServer;
_appHost = appHost;
AddMessageResponder("who is MediaBrowserServer?", RespondToV1Message);
AddMessageResponder("who is MediaBrowserServer_v2?", RespondToV2Message);
}
private void AddMessageResponder(string message, Action<string> responder)
{
var expectedMessageBytes = Encoding.UTF8.GetBytes(message);
_responders.Add(new Tuple<byte[], Action<string>>(expectedMessageBytes, responder));
} }
/// <summary> /// <summary>
@ -58,29 +79,52 @@ namespace MediaBrowser.Server.Implementations.Udp
/// <param name="e">The <see cref="UdpMessageReceivedEventArgs"/> instance containing the event data.</param> /// <param name="e">The <see cref="UdpMessageReceivedEventArgs"/> instance containing the event data.</param>
private async void OnMessageReceived(UdpMessageReceivedEventArgs e) private async void OnMessageReceived(UdpMessageReceivedEventArgs e)
{ {
const string context = "Server"; var responder = _responders.FirstOrDefault(i => i.Item1.SequenceEqual(e.Bytes));
var expectedMessage = String.Format("who is MediaBrowser{0}?", context); if (responder != null)
var expectedMessageBytes = Encoding.UTF8.GetBytes(expectedMessage);
if (expectedMessageBytes.SequenceEqual(e.Bytes))
{ {
_logger.Info("Received UDP server request from " + e.RemoteEndPoint); responder.Item2(e.RemoteEndPoint);
}
}
private async void RespondToV1Message(string endpoint)
{
var localAddress = GetLocalIpAddress(); var localAddress = GetLocalIpAddress();
if (!string.IsNullOrEmpty(localAddress)) if (!string.IsNullOrEmpty(localAddress))
{ {
// Send a response back with our ip address and port // Send a response back with our ip address and port
var response = String.Format("MediaBrowser{0}|{1}:{2}", context, GetLocalIpAddress(), _serverConfigurationManager.Configuration.HttpServerPortNumber); var response = String.Format("MediaBrowserServer|{0}:{1}", localAddress, _serverConfigurationManager.Configuration.HttpServerPortNumber);
await SendAsync(Encoding.UTF8.GetBytes(response), e.RemoteEndPoint); await SendAsync(Encoding.UTF8.GetBytes(response), endpoint);
} }
else else
{ {
_logger.Warn("Unable to respond to udp request because the local ip address could not be determined."); _logger.Warn("Unable to respond to udp request because the local ip address could not be determined.");
} }
} }
private async void RespondToV2Message(string endpoint)
{
var localAddress = GetLocalIpAddress();
if (!string.IsNullOrEmpty(localAddress))
{
var serverAddress = string.Format("http://{0}:{1}", localAddress, _serverConfigurationManager.Configuration.HttpServerPortNumber);
var response = new ServerDiscoveryInfo
{
Address = serverAddress,
Id = _appHost.ServerId,
Name = _appHost.Name
};
await SendAsync(Encoding.UTF8.GetBytes(_json.SerializeToString(response)), endpoint);
}
else
{
_logger.Warn("Unable to respond to udp request because the local ip address could not be determined.");
}
} }
/// <summary> /// <summary>

View File

@ -326,6 +326,13 @@ namespace MediaBrowser.ServerApplication
saveConfig = true; saveConfig = true;
} }
if (ServerConfigurationManager.Configuration.LiveTvOptions != null)
{
ServerConfigurationManager.SaveConfiguration("livetv", ServerConfigurationManager.Configuration.LiveTvOptions);
ServerConfigurationManager.Configuration.LiveTvOptions = null;
saveConfig = true;
}
if (saveConfig) if (saveConfig)
{ {
ServerConfigurationManager.SaveConfiguration(); ServerConfigurationManager.SaveConfiguration();
@ -1001,6 +1008,11 @@ namespace MediaBrowser.ServerApplication
private readonly string _systemId = Environment.MachineName.GetMD5().ToString(); private readonly string _systemId = Environment.MachineName.GetMD5().ToString();
public string ServerId
{
get { return _systemId; }
}
/// <summary> /// <summary>
/// Gets the system status. /// Gets the system status.
/// </summary> /// </summary>
@ -1017,7 +1029,7 @@ namespace MediaBrowser.ServerApplication
FailedPluginAssemblies = FailedAssemblies.ToList(), FailedPluginAssemblies = FailedAssemblies.ToList(),
InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToList(), InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToList(),
CompletedInstallations = InstallationManager.CompletedInstallations.ToList(), CompletedInstallations = InstallationManager.CompletedInstallations.ToList(),
Id = _systemId, Id = ServerId,
ProgramDataPath = ApplicationPaths.ProgramDataPath, ProgramDataPath = ApplicationPaths.ProgramDataPath,
LogPath = ApplicationPaths.LogDirectoryPath, LogPath = ApplicationPaths.LogDirectoryPath,
ItemsByNamePath = ApplicationPaths.ItemsByNamePath, ItemsByNamePath = ApplicationPaths.ItemsByNamePath,

View File

@ -185,9 +185,6 @@
<Content Include="dashboard-ui\css\images\items\folders\settings.png"> <Content Include="dashboard-ui\css\images\items\folders\settings.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\css\images\menu.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\icons\audiocd.png"> <Content Include="dashboard-ui\css\images\icons\audiocd.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.418</version> <version>3.0.421</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,8 +12,8 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.418" /> <dependency id="MediaBrowser.Common" version="3.0.421" />
<dependency id="NLog" version="2.1.0" /> <dependency id="NLog" version="3.1.0.0" />
<dependency id="SimpleInjector" version="2.5.2" /> <dependency id="SimpleInjector" version="2.5.2" />
<dependency id="sharpcompress" version="0.10.2" /> <dependency id="sharpcompress" version="0.10.2" />
</dependencies> </dependencies>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.418</version> <version>3.0.421</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Model.Signed</id> <id>MediaBrowser.Model.Signed</id>
<version>3.0.418</version> <version>3.0.421</version>
<title>MediaBrowser.Model - Signed Edition</title> <title>MediaBrowser.Model - Signed Edition</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.418</version> <version>3.0.421</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.418" /> <dependency id="MediaBrowser.Common" version="3.0.421" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>