updated nuget
This commit is contained in:
parent
37c27a26e9
commit
063675bb07
|
@ -269,10 +269,18 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
|
||||
var segmentFilename = Path.GetFileName(segmentPath);
|
||||
|
||||
// If it appears in the playlist, it's done
|
||||
if (File.ReadAllText(playlistPath).IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
using (var fileStream = FileSystem.GetFileStream(playlistPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, true))
|
||||
{
|
||||
return ResultFactory.GetStaticFileResult(Request, segmentPath, FileShare.ReadWrite);
|
||||
using (var reader = new StreamReader(fileStream))
|
||||
{
|
||||
var text = await reader.ReadToEndAsync().ConfigureAwait(false);
|
||||
|
||||
// If it appears in the playlist, it's done
|
||||
if (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
return ResultFactory.GetStaticFileResult(Request, segmentPath, FileShare.ReadWrite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if a different file is encoding, it's done
|
||||
|
|
|
@ -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>
|
||||
/// Class RestartApplication
|
||||
/// </summary>
|
||||
|
@ -125,6 +131,20 @@ namespace MediaBrowser.Api
|
|||
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>
|
||||
/// Posts the specified request.
|
||||
/// </summary>
|
||||
|
|
|
@ -40,5 +40,11 @@ namespace MediaBrowser.Controller
|
|||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
|
||||
bool HasUpdateAvailable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the server identifier.
|
||||
/// </summary>
|
||||
/// <value>The server identifier.</value>
|
||||
string ServerId { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,6 +201,14 @@ namespace MediaBrowser.Dlna.Channels
|
|||
private readonly ILogger _logger;
|
||||
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)
|
||||
{
|
||||
_servers = servers;
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
MediaSources = sources,
|
||||
Profile = _profile,
|
||||
DeviceId = deviceId,
|
||||
MaxBitrate = _profile.MaxBitrate
|
||||
MaxBitrate = _profile.MaxStreamingBitrate
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -537,7 +537,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
MediaSources = mediaSources,
|
||||
Profile = profile,
|
||||
DeviceId = deviceId,
|
||||
MaxBitrate = profile.MaxBitrate,
|
||||
MaxBitrate = profile.MaxStreamingBitrate,
|
||||
MediaSourceId = mediaSourceId,
|
||||
AudioStreamIndex = audioStreamIndex,
|
||||
SubtitleStreamIndex = subtitleStreamIndex
|
||||
|
@ -557,7 +557,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
MediaSources = mediaSources,
|
||||
Profile = profile,
|
||||
DeviceId = deviceId,
|
||||
MaxBitrate = profile.MaxBitrate,
|
||||
MaxBitrate = profile.MaxStreamingBitrate,
|
||||
MediaSourceId = mediaSourceId
|
||||
}),
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ namespace MediaBrowser.Dlna.Profiles
|
|||
MaxAlbumArtHeight = 512;
|
||||
MaxAlbumArtWidth = 512;
|
||||
|
||||
MaxBitrate = 8000000;
|
||||
MaxStreamingBitrate = 8000000;
|
||||
MaxStaticBitrate = 8000000;
|
||||
|
||||
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
|
@ -23,7 +23,8 @@
|
|||
<MaxAlbumArtHeight>512</MaxAlbumArtHeight>
|
||||
<MaxIconWidth xsi:nil="true" />
|
||||
<MaxIconHeight xsi:nil="true" />
|
||||
<MaxBitrate>8000000</MaxBitrate>
|
||||
<MaxStreamingBitrate>8000000</MaxStreamingBitrate>
|
||||
<MaxStaticBitrate>8000000</MaxStaticBitrate>
|
||||
<XDlnaDoc>DMS-1.50</XDlnaDoc>
|
||||
<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>
|
||||
|
|
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
|
@ -98,6 +98,9 @@
|
|||
<Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs">
|
||||
<Link>ApiClient\IServerEvents.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\ApiClient\ServerDiscoveryInfo.cs">
|
||||
<Link>ApiClient\ServerDiscoveryInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\ApiClient\SessionUpdatesEventArgs.cs">
|
||||
<Link>ApiClient\SessionUpdatesEventArgs.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -61,6 +61,9 @@
|
|||
<Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs">
|
||||
<Link>ApiClient\IServerEvents.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\ApiClient\ServerDiscoveryInfo.cs">
|
||||
<Link>ApiClient\ServerDiscoveryInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\ApiClient\SessionUpdatesEventArgs.cs">
|
||||
<Link>ApiClient\SessionUpdatesEventArgs.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -226,7 +226,7 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// <param name="userId">The user identifier.</param>
|
||||
/// <returns>Task{BaseItemDto[]}.</returns>
|
||||
Task<ItemsResult> GetAdditionalParts(string itemId, string userId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the users async.
|
||||
/// </summary>
|
||||
|
@ -253,7 +253,7 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// </summary>
|
||||
/// <returns>Task{SessionInfoDto}.</returns>
|
||||
Task<SessionInfoDto> GetCurrentSessionAsync(CancellationToken cancellationToken);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the item counts async.
|
||||
/// </summary>
|
||||
|
@ -368,7 +368,7 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// <param name="query">The query.</param>
|
||||
/// <returns>Task{ItemsResult}.</returns>
|
||||
Task<ItemsResult> GetAlbumArtistsAsync(ArtistsQuery query);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets a studio
|
||||
/// </summary>
|
||||
|
@ -467,6 +467,13 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// <returns>Task{SystemInfo}.</returns>
|
||||
Task<SystemInfo> GetSystemInfoAsync(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the public system information asynchronous.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task<PublicSystemInfo>.</returns>
|
||||
Task<PublicSystemInfo> GetPublicSystemInfoAsync(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a person
|
||||
/// </summary>
|
||||
|
@ -672,7 +679,7 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// <param name="index">The index.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SetSubtitleStreamIndex(string sessionId, int? index);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Instructs the client to display a message to the user
|
||||
/// </summary>
|
||||
|
@ -772,23 +779,16 @@ namespace MediaBrowser.Model.ApiClient
|
|||
IJsonSerializer JsonSerializer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the server host name (myserver or 192.168.x.x)
|
||||
/// Gets or sets the server address
|
||||
/// </summary>
|
||||
/// <value>The name of the server host.</value>
|
||||
string ServerHostName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the port number used by the API
|
||||
/// </summary>
|
||||
/// <value>The server API port.</value>
|
||||
int ServerApiPort { get; }
|
||||
/// <value>The server address.</value>
|
||||
string ServerAddress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Changes the server location.
|
||||
/// </summary>
|
||||
/// <param name="hostName">Name of the host.</param>
|
||||
/// <param name="apiPort">The API port.</param>
|
||||
void ChangeServerLocation(string hostName, int apiPort);
|
||||
/// <param name="address">The address.</param>
|
||||
void ChangeServerLocation(string address);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the client.
|
||||
|
@ -812,7 +812,31 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// Gets or sets the current user id.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
/// Gets the image URL.
|
||||
|
@ -853,7 +877,7 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// <param name="options">The options.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetSubtitleUrl(SubtitleDownloadOptions options);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets an image url that can be used to download an image from the api
|
||||
/// </summary>
|
||||
|
|
22
MediaBrowser.Model/ApiClient/ServerDiscoveryInfo.cs
Normal file
22
MediaBrowser.Model/ApiClient/ServerDiscoveryInfo.cs
Normal 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; }
|
||||
}
|
||||
}
|
|
@ -304,7 +304,6 @@ namespace MediaBrowser.Model.Configuration
|
|||
};
|
||||
|
||||
SubtitleOptions = new SubtitleOptions();
|
||||
LiveTvOptions = new LiveTvOptions();
|
||||
TvFileOrganizationOptions = new TvFileOrganizationOptions();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,5 +35,29 @@ namespace MediaBrowser.Model.Dlna
|
|||
/// </summary>
|
||||
/// <value>The context.</value>
|
||||
public EncodingContext Context { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum bitrate.
|
||||
/// </summary>
|
||||
/// <returns>System.Nullable<System.Int32>.</returns>
|
||||
public int? GetMaxBitrate()
|
||||
{
|
||||
if (MaxBitrate.HasValue)
|
||||
{
|
||||
return MaxBitrate;
|
||||
}
|
||||
|
||||
if (Profile != null)
|
||||
{
|
||||
if (Context == EncodingContext.Static)
|
||||
{
|
||||
return Profile.MaxStaticBitrate;
|
||||
}
|
||||
|
||||
return Profile.MaxStreamingBitrate;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,8 +49,9 @@ namespace MediaBrowser.Model.Dlna
|
|||
public int? MaxIconWidth { get; set; }
|
||||
public int? MaxIconHeight { get; set; }
|
||||
|
||||
public int? MaxBitrate { get; set; }
|
||||
|
||||
public int? MaxStreamingBitrate { get; set; }
|
||||
public int? MaxStaticBitrate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace.
|
||||
/// </summary>
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
RunTimeTicks = item.RunTimeTicks
|
||||
};
|
||||
|
||||
int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
|
||||
int? maxBitrateSetting = options.GetMaxBitrate();
|
||||
|
||||
MediaStream audioStream = item.DefaultAudioStream;
|
||||
|
||||
|
@ -243,7 +243,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
|
||||
MediaStream videoStream = item.VideoStream;
|
||||
|
||||
int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
|
||||
int? maxBitrateSetting = options.GetMaxBitrate();
|
||||
|
||||
if (IsEligibleForDirectPlay(item, maxBitrateSetting, subtitleStream, options))
|
||||
{
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
<Compile Include="ApiClient\ApiClientExtensions.cs" />
|
||||
<Compile Include="ApiClient\IServerEvents.cs" />
|
||||
<Compile Include="ApiClient\GeneralCommandEventArgs.cs" />
|
||||
<Compile Include="ApiClient\ServerDiscoveryInfo.cs" />
|
||||
<Compile Include="ApiClient\SessionUpdatesEventArgs.cs" />
|
||||
<Compile Include="Branding\BrandingOptions.cs" />
|
||||
<Compile Include="Channels\ChannelFeatures.cs" />
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace MediaBrowser.Model.Sync
|
|||
Queued = 0,
|
||||
Transcoding = 1,
|
||||
TranscodingFailed = 2,
|
||||
Transfering = 3,
|
||||
Transferring = 3,
|
||||
Completed = 4,
|
||||
Cancelled = 5
|
||||
}
|
||||
|
|
|
@ -6,14 +6,8 @@ namespace MediaBrowser.Model.System
|
|||
/// <summary>
|
||||
/// Class SystemInfo
|
||||
/// </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>
|
||||
/// Gets or sets the operating sytem.
|
||||
/// </summary>
|
||||
|
@ -86,12 +80,6 @@ namespace MediaBrowser.Model.System
|
|||
/// <value>The failed assembly loads.</value>
|
||||
public List<string> FailedPluginAssemblies { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the program data path.
|
||||
/// </summary>
|
||||
|
@ -152,12 +140,6 @@ namespace MediaBrowser.Model.System
|
|||
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
||||
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>
|
||||
/// Initializes a new instance of the <see cref="SystemInfo" /> class.
|
||||
/// </summary>
|
||||
|
@ -170,4 +152,25 @@ namespace MediaBrowser.Model.System
|
|||
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; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,5 +22,11 @@ namespace MediaBrowser.Model.Users
|
|||
/// </summary>
|
||||
/// <value>The authentication token.</value>
|
||||
public string AccessToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the server identifier.
|
||||
/// </summary>
|
||||
/// <value>The server identifier.</value>
|
||||
public string ServerId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -540,18 +540,10 @@ namespace MediaBrowser.Providers.Manager
|
|||
Type = MetadataPluginType.LocalImageProvider
|
||||
}));
|
||||
|
||||
if (ConfigurationManager.Configuration.EnableInternetProviders)
|
||||
{
|
||||
// Fetchers
|
||||
list.AddRange(imageProviders.Where(i => i is IRemoteImageProvider).Select(i => new MetadataPlugin
|
||||
{
|
||||
Name = i.Name,
|
||||
Type = MetadataPluginType.ImageFetcher
|
||||
}));
|
||||
}
|
||||
var enableInternet = ConfigurationManager.Configuration.EnableInternetProviders;
|
||||
|
||||
// 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,
|
||||
Type = MetadataPluginType.ImageFetcher
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Linq;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Implementations.Configuration;
|
||||
using MediaBrowser.Controller;
|
||||
|
@ -14,6 +13,7 @@ using MediaBrowser.Model.Logging;
|
|||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Configuration
|
||||
{
|
||||
|
|
|
@ -66,22 +66,35 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
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;
|
||||
|
||||
if (byName != null)
|
||||
if (byName != null && !(item is LiveTvChannel))
|
||||
{
|
||||
var libraryItems = user != null ?
|
||||
user.RootFolder.GetRecursiveChildren(user) :
|
||||
_libraryManager.RootFolder.RecursiveChildren;
|
||||
IEnumerable<BaseItem> libraryItems;
|
||||
|
||||
var dto = GetBaseItemDtoInternal(item, fields, user);
|
||||
var artist = item as MusicArtist;
|
||||
|
||||
if (artist == null || artist.IsAccessedByName)
|
||||
{
|
||||
libraryItems = user != null ?
|
||||
user.RootFolder.GetRecursiveChildren(user) :
|
||||
_libraryManager.RootFolder.RecursiveChildren;
|
||||
}
|
||||
else
|
||||
{
|
||||
libraryItems = user != null ?
|
||||
artist.GetRecursiveChildren(user) :
|
||||
artist.RecursiveChildren;
|
||||
}
|
||||
|
||||
SetItemByNameInfo(item, dto, byName.GetTaggedItems(libraryItems).ToList(), user);
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
return GetBaseItemDtoInternal(item, fields, user, owner);
|
||||
return dto;
|
||||
}
|
||||
|
||||
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
|
@ -35,6 +36,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
/// The _HTTP server
|
||||
/// </summary>
|
||||
private readonly IHttpServer _httpServer;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
|
||||
public const int PortNumber = 7359;
|
||||
|
||||
|
@ -45,12 +47,13 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
/// <param name="networkManager">The network manager.</param>
|
||||
/// <param name="serverConfigurationManager">The server configuration manager.</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;
|
||||
_networkManager = networkManager;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
_httpServer = httpServer;
|
||||
_appHost = appHost;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -58,7 +61,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
/// </summary>
|
||||
public void Run()
|
||||
{
|
||||
var udpServer = new UdpServer(_logger, _networkManager, _serverConfigurationManager, _httpServer);
|
||||
var udpServer = new UdpServer(_logger, _networkManager, _serverConfigurationManager, _httpServer, _appHost);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
|
@ -11,6 +12,7 @@ using MediaBrowser.Controller.Localization;
|
|||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
|
@ -83,6 +85,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
public ILiveTvService ActiveService { get; private set; }
|
||||
|
||||
private LiveTvOptions GetConfiguration()
|
||||
{
|
||||
return _config.GetConfiguration<LiveTvOptions>("livetv");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the parts.
|
||||
/// </summary>
|
||||
|
@ -91,7 +98,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
{
|
||||
_services.AddRange(services);
|
||||
|
||||
SetActiveService(_config.Configuration.LiveTvOptions.ActiveService);
|
||||
SetActiveService(GetConfiguration().ActiveService);
|
||||
}
|
||||
|
||||
private void SetActiveService(string name)
|
||||
|
@ -303,22 +310,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
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;
|
||||
LiveStreamInfo info;
|
||||
|
||||
|
@ -1010,9 +1001,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
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;
|
||||
|
|
|
@ -699,6 +699,10 @@
|
|||
"HeaderProfileServerSettingsHelp": "These values control how Media Browser will present itself to the device.",
|
||||
"LabelMaxBitrate": "Max bitrate:",
|
||||
"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",
|
||||
"OptionIgnoreTranscodeByteRangeRequestsHelp": "If enabled, these requests will be honored but will ignore the byte range header.",
|
||||
"LabelFriendlyName": "Friendly name",
|
||||
|
@ -905,5 +909,11 @@
|
|||
"HeaderChapters": "Chapters",
|
||||
"HeaderResumeSettings": "Resume Settings",
|
||||
"TabSync": "Sync",
|
||||
"TitleUsers": "Users"
|
||||
"TitleUsers": "Users",
|
||||
"LabelProtocol": "Protocol:",
|
||||
"OptionProtocolHttp": "Http",
|
||||
"OptionProtocolHls": "Http Live Streaming",
|
||||
"LabelContext": "Context:",
|
||||
"OptionContextStreaming": "Streaming",
|
||||
"OptionContextStatic": "Sync"
|
||||
}
|
||||
|
|
|
@ -198,6 +198,7 @@
|
|||
<Compile Include="Library\Validators\YearsPostScanTask.cs" />
|
||||
<Compile Include="LiveTv\ChannelImageProvider.cs" />
|
||||
<Compile Include="LiveTv\CleanDatabaseScheduledTask.cs" />
|
||||
<Compile Include="LiveTv\LiveTvConfigurationFactory.cs" />
|
||||
<Compile Include="LiveTv\LiveTvDtoService.cs" />
|
||||
<Compile Include="LiveTv\LiveTvManager.cs" />
|
||||
<Compile Include="LiveTv\ProgramImageProvider.cs" />
|
||||
|
|
|
@ -17,6 +17,10 @@ namespace MediaBrowser.Server.Implementations.Security
|
|||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -30,7 +34,27 @@ namespace MediaBrowser.Server.Implementations.Security
|
|||
{
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1236,7 +1236,8 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
{
|
||||
User = _dtoService.GetUserDto(user),
|
||||
SessionInfo = GetSessionInfoDto(session),
|
||||
AccessToken = token
|
||||
AccessToken = token,
|
||||
ServerId = _appHost.ServerId
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,8 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
LimitType = request.LimitType,
|
||||
RequestedItemIds = request.ItemIds,
|
||||
DateCreated = DateTime.UtcNow,
|
||||
DateLastModified = DateTime.UtcNow
|
||||
DateLastModified = DateTime.UtcNow,
|
||||
ItemCount = 1
|
||||
};
|
||||
|
||||
await _repo.Create(job).ConfigureAwait(false);
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Model.ApiClient;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
@ -37,6 +41,11 @@ namespace MediaBrowser.Server.Implementations.Udp
|
|||
|
||||
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>
|
||||
/// Initializes a new instance of the <see cref="UdpServer" /> class.
|
||||
/// </summary>
|
||||
|
@ -44,12 +53,24 @@ namespace MediaBrowser.Server.Implementations.Udp
|
|||
/// <param name="networkManager">The network manager.</param>
|
||||
/// <param name="serverConfigurationManager">The server configuration manager.</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;
|
||||
_networkManager = networkManager;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
_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>
|
||||
|
@ -58,28 +79,51 @@ namespace MediaBrowser.Server.Implementations.Udp
|
|||
/// <param name="e">The <see cref="UdpMessageReceivedEventArgs"/> instance containing the event data.</param>
|
||||
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);
|
||||
var expectedMessageBytes = Encoding.UTF8.GetBytes(expectedMessage);
|
||||
|
||||
if (expectedMessageBytes.SequenceEqual(e.Bytes))
|
||||
if (responder != null)
|
||||
{
|
||||
_logger.Info("Received UDP server request from " + e.RemoteEndPoint);
|
||||
responder.Item2(e.RemoteEndPoint);
|
||||
}
|
||||
}
|
||||
|
||||
var localAddress = GetLocalIpAddress();
|
||||
private async void RespondToV1Message(string endpoint)
|
||||
{
|
||||
var localAddress = GetLocalIpAddress();
|
||||
|
||||
if (!string.IsNullOrEmpty(localAddress))
|
||||
if (!string.IsNullOrEmpty(localAddress))
|
||||
{
|
||||
// Send a response back with our ip address and port
|
||||
var response = String.Format("MediaBrowserServer|{0}:{1}", localAddress, _serverConfigurationManager.Configuration.HttpServerPortNumber);
|
||||
|
||||
await SendAsync(Encoding.UTF8.GetBytes(response), endpoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
_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
|
||||
{
|
||||
// Send a response back with our ip address and port
|
||||
var response = String.Format("MediaBrowser{0}|{1}:{2}", context, GetLocalIpAddress(), _serverConfigurationManager.Configuration.HttpServerPortNumber);
|
||||
Address = serverAddress,
|
||||
Id = _appHost.ServerId,
|
||||
Name = _appHost.Name
|
||||
};
|
||||
|
||||
await SendAsync(Encoding.UTF8.GetBytes(response), e.RemoteEndPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Warn("Unable to respond to udp request because the local ip address could not be determined.");
|
||||
}
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -326,6 +326,13 @@ namespace MediaBrowser.ServerApplication
|
|||
saveConfig = true;
|
||||
}
|
||||
|
||||
if (ServerConfigurationManager.Configuration.LiveTvOptions != null)
|
||||
{
|
||||
ServerConfigurationManager.SaveConfiguration("livetv", ServerConfigurationManager.Configuration.LiveTvOptions);
|
||||
ServerConfigurationManager.Configuration.LiveTvOptions = null;
|
||||
saveConfig = true;
|
||||
}
|
||||
|
||||
if (saveConfig)
|
||||
{
|
||||
ServerConfigurationManager.SaveConfiguration();
|
||||
|
@ -1001,6 +1008,11 @@ namespace MediaBrowser.ServerApplication
|
|||
|
||||
private readonly string _systemId = Environment.MachineName.GetMD5().ToString();
|
||||
|
||||
public string ServerId
|
||||
{
|
||||
get { return _systemId; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the system status.
|
||||
/// </summary>
|
||||
|
@ -1017,7 +1029,7 @@ namespace MediaBrowser.ServerApplication
|
|||
FailedPluginAssemblies = FailedAssemblies.ToList(),
|
||||
InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToList(),
|
||||
CompletedInstallations = InstallationManager.CompletedInstallations.ToList(),
|
||||
Id = _systemId,
|
||||
Id = ServerId,
|
||||
ProgramDataPath = ApplicationPaths.ProgramDataPath,
|
||||
LogPath = ApplicationPaths.LogDirectoryPath,
|
||||
ItemsByNamePath = ApplicationPaths.ItemsByNamePath,
|
||||
|
|
|
@ -185,9 +185,6 @@
|
|||
<Content Include="dashboard-ui\css\images\items\folders\settings.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\menu.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\icons\audiocd.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.418</version>
|
||||
<version>3.0.421</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<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>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.418" />
|
||||
<dependency id="NLog" version="2.1.0" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.421" />
|
||||
<dependency id="NLog" version="3.1.0.0" />
|
||||
<dependency id="SimpleInjector" version="2.5.2" />
|
||||
<dependency id="sharpcompress" version="0.10.2" />
|
||||
</dependencies>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.418</version>
|
||||
<version>3.0.421</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Model.Signed</id>
|
||||
<version>3.0.418</version>
|
||||
<version>3.0.421</version>
|
||||
<title>MediaBrowser.Model - Signed Edition</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.418</version>
|
||||
<version>3.0.421</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.418" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.421" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user