add media streams back to library explorer

This commit is contained in:
Luke Pulverenti 2013-12-16 17:46:40 -05:00
parent cb9b570a2a
commit db945fda9b
4 changed files with 29 additions and 7 deletions

View File

@ -116,7 +116,8 @@ namespace MediaBrowser.ServerApplication
var win = new MainWindow(host.LogManager, host,
host.ServerConfigurationManager, host.UserManager,
host.LibraryManager, host.JsonSerializer,
host.DisplayPreferencesRepository);
host.DisplayPreferencesRepository,
host.ItemRepository);
win.Show();

View File

@ -162,7 +162,7 @@ namespace MediaBrowser.ServerApplication
private IUserDataManager UserDataManager { get; set; }
private IUserRepository UserRepository { get; set; }
internal IDisplayPreferencesRepository DisplayPreferencesRepository { get; set; }
private IItemRepository ItemRepository { get; set; }
internal IItemRepository ItemRepository { get; set; }
private INotificationsRepository NotificationsRepository { get; set; }
/// <summary>

View File

@ -35,6 +35,8 @@ namespace MediaBrowser.ServerApplication
private readonly ILibraryManager _libraryManager;
private readonly IDisplayPreferencesRepository _displayPreferencesManager;
private readonly IItemRepository _itemRepository;
/// <summary>
/// The current user
/// </summary>
@ -48,7 +50,7 @@ namespace MediaBrowser.ServerApplication
/// <param name="userManager">The user manager.</param>
/// <param name="libraryManager">The library manager.</param>
/// <param name="displayPreferencesManager">The display preferences manager.</param>
public LibraryExplorer(IJsonSerializer jsonSerializer, ILogger logger, IApplicationHost appHost, IUserManager userManager, ILibraryManager libraryManager, IDisplayPreferencesRepository displayPreferencesManager)
public LibraryExplorer(IJsonSerializer jsonSerializer, ILogger logger, IApplicationHost appHost, IUserManager userManager, ILibraryManager libraryManager, IDisplayPreferencesRepository displayPreferencesManager, IItemRepository itemRepo)
{
_logger = logger;
_jsonSerializer = jsonSerializer;
@ -62,7 +64,7 @@ namespace MediaBrowser.ServerApplication
ddlProfile.Items.Insert(0, new User { Name = "Physical" });
ddlProfile.SelectedIndex = 0;
ddlIndexBy.Visibility = ddlSortBy.Visibility = lblIndexBy.Visibility = lblSortBy.Visibility = Visibility.Hidden;
_itemRepository = itemRepo;
}
/// <summary>
@ -212,7 +214,24 @@ namespace MediaBrowser.ServerApplication
lblIndexBy.Visibility = ddlIndexBy.Visibility = ddlSortBy.Visibility = lblSortBy.Visibility = Visibility.Hidden;
}
txtData.Text = FormatJson(_jsonSerializer.SerializeToString(item));
var json = FormatJson(_jsonSerializer.SerializeToString(item));
if (item is IHasMediaStreams)
{
var mediaStreams = _itemRepository.GetMediaStreams(new MediaStreamQuery
{
ItemId = item.Id
}).ToList();
if (mediaStreams.Count > 0)
{
json += "\n\nMedia Streams:\n\n"+FormatJson(_jsonSerializer.SerializeToString(mediaStreams));
}
}
txtData.Text = json;
var previews = new List<PreviewItem>();
await Task.Run(() =>

View File

@ -45,6 +45,7 @@ namespace MediaBrowser.ServerApplication
private readonly ILibraryManager _libraryManager;
private readonly IJsonSerializer _jsonSerializer;
private readonly IDisplayPreferencesRepository _displayPreferencesManager;
private readonly IItemRepository _itemRepository;
/// <summary>
/// Initializes a new instance of the <see cref="MainWindow" /> class.
@ -57,7 +58,7 @@ namespace MediaBrowser.ServerApplication
/// <param name="jsonSerializer">The json serializer.</param>
/// <param name="displayPreferencesManager">The display preferences manager.</param>
/// <exception cref="System.ArgumentNullException">logger</exception>
public MainWindow(ILogManager logManager, IServerApplicationHost appHost, IServerConfigurationManager configurationManager, IUserManager userManager, ILibraryManager libraryManager, IJsonSerializer jsonSerializer, IDisplayPreferencesRepository displayPreferencesManager)
public MainWindow(ILogManager logManager, IServerApplicationHost appHost, IServerConfigurationManager configurationManager, IUserManager userManager, ILibraryManager libraryManager, IJsonSerializer jsonSerializer, IDisplayPreferencesRepository displayPreferencesManager, IItemRepository itemRepo)
{
if (logManager == null)
{
@ -73,6 +74,7 @@ namespace MediaBrowser.ServerApplication
}
_logger = logManager.GetLogger("MainWindow");
_itemRepository = itemRepo;
_appHost = appHost;
_logManager = logManager;
_configurationManager = configurationManager;
@ -234,7 +236,7 @@ namespace MediaBrowser.ServerApplication
/// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
private void cmOpenExplorer_click(object sender, RoutedEventArgs e)
{
new LibraryExplorer(_jsonSerializer, _logger, _appHost, _userManager, _libraryManager, _displayPreferencesManager).Show();
new LibraryExplorer(_jsonSerializer, _logger, _appHost, _userManager, _libraryManager, _displayPreferencesManager, _itemRepository).Show();
}
/// <summary>