more remote control

This commit is contained in:
Luke Pulverenti 2013-05-30 23:38:46 -04:00
parent 300c3b7fd6
commit 11941a4db2
3 changed files with 53 additions and 2 deletions

View File

@ -115,6 +115,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WeatherService.cs" /> <Compile Include="WeatherService.cs" />
<Compile Include="WebSocket\LogFileWebSocketListener.cs" /> <Compile Include="WebSocket\LogFileWebSocketListener.cs" />
<Compile Include="WebSocket\SessionInfoWebSocketListener.cs" />
<Compile Include="WebSocket\SystemInfoWebSocketListener.cs" /> <Compile Include="WebSocket\SystemInfoWebSocketListener.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,52 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Session;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MediaBrowser.Api.WebSocket
{
/// <summary>
/// Class SessionInfoWebSocketListener
/// </summary>
class SessionInfoWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<SessionInfoDto>, object>
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
protected override string Name
{
get { return "Sessions"; }
}
/// <summary>
/// The _kernel
/// </summary>
private readonly ISessionManager _sessionManager;
/// <summary>
/// Initializes a new instance of the <see cref="SessionInfoWebSocketListener"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="sessionManager">The session manager.</param>
public SessionInfoWebSocketListener(ILogger logger, ISessionManager sessionManager)
: base(logger)
{
_sessionManager = sessionManager;
}
/// <summary>
/// Gets the data to send.
/// </summary>
/// <param name="state">The state.</param>
/// <returns>Task{SystemInfo}.</returns>
protected override Task<IEnumerable<SessionInfoDto>> GetDataToSend(object state)
{
return Task.FromResult(_sessionManager.Sessions.Select(SessionInfoDtoBuilder.GetSessionInfoDto));
}
}
}

View File

@ -277,8 +277,6 @@ namespace MediaBrowser.Controller.Providers.Movies
// backdrops - only download if earlier providers didn't find any (fanart) // backdrops - only download if earlier providers didn't find any (fanart)
if (images.backdrops != null && images.backdrops.Count > 0 && ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0) if (images.backdrops != null && images.backdrops.Count > 0 && ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0)
{ {
item.BackdropImagePaths = new List<string>();
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
var tmdbImageUrl = tmdbSettings.images.base_url + ConfigurationManager.Configuration.TmdbFetchedBackdropSize; var tmdbImageUrl = tmdbSettings.images.base_url + ConfigurationManager.Configuration.TmdbFetchedBackdropSize;