add tuner infos to tv service status

This commit is contained in:
Luke Pulverenti 2014-01-22 12:22:04 -05:00
parent 529a397b69
commit 9b370d904f
3 changed files with 96 additions and 1 deletions

View file

@ -1,4 +1,5 @@
using MediaBrowser.Model.LiveTv;
using System.Collections.Generic;
namespace MediaBrowser.Controller.LiveTv
{
@ -27,5 +28,66 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
public bool HasUpdateAvailable { get; set; }
/// <summary>
/// Gets or sets the tuners.
/// </summary>
/// <value>The tuners.</value>
public List<LiveTvTunerInfo> Tuners { get; set; }
public LiveTvServiceStatusInfo()
{
Tuners = new List<LiveTvTunerInfo>();
}
}
public class LiveTvTunerInfo
{
/// <summary>
/// Gets or sets the type of the source.
/// </summary>
/// <value>The type of the source.</value>
public string SourceType { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>The status.</value>
public LiveTvTunerStatus Status { get; set; }
/// <summary>
/// Gets or sets the channel identifier.
/// </summary>
/// <value>The channel identifier.</value>
public string ChannelId { get; set; }
/// <summary>
/// Gets or sets the timer identifier.
/// </summary>
/// <value>The timer identifier.</value>
public string TimerId { get; set; }
/// <summary>
/// Gets or sets the clients.
/// </summary>
/// <value>The clients.</value>
public List<string> Clients { get; set; }
public LiveTvTunerInfo()
{
Clients = new List<string>();
}
}
}

View file

@ -103,4 +103,12 @@ namespace MediaBrowser.Model.LiveTv
Ok = 0,
Unavailable = 1
}
public enum LiveTvTunerStatus
{
Available = 0,
Disabled = 1,
RecordingTv = 2,
LiveTv = 3
}
}

View file

@ -86,7 +86,10 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
if (options.DeleteEmptyFolders)
{
DeleteEmptyFolders(path);
foreach (var subfolder in GetDirectories(path).ToList())
{
DeleteEmptyFolders(subfolder);
}
}
}
@ -99,6 +102,27 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
progress.Report(100);
}
/// <summary>
/// Gets the directories.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>IEnumerable{System.String}.</returns>
private IEnumerable<string> GetDirectories(string path)
{
try
{
return Directory
.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)
.ToList();
}
catch (IOException ex)
{
_logger.ErrorException("Error getting files from {0}", ex, path);
return new List<string>();
}
}
/// <summary>
/// Gets the files to organize.
/// </summary>
@ -164,6 +188,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
{
try
{
_logger.Debug("Deleting empty directory {0}", path);
Directory.Delete(path);
}
catch (UnauthorizedAccessException) { }