update legacy hd homerun support

This commit is contained in:
Luke Pulverenti
2017-03-07 13:27:56 -05:00
parent 9e74d834a7
commit 9fa6868af3
27 changed files with 206 additions and 13 deletions

View File

@@ -195,13 +195,12 @@ namespace Emby.Server.Implementations.Devices
}
var config = _config.GetUploadOptions();
if (!string.IsNullOrWhiteSpace(config.CameraUploadPath))
var path = config.CameraUploadPath;
if (string.IsNullOrWhiteSpace(path))
{
return config.CameraUploadPath;
path = DefaultCameraUploadsPath;
}
var path = DefaultCameraUploadsPath;
if (config.EnableCameraUploadSubfolders)
{
path = Path.Combine(path, _fileSystem.GetValidFilename(device.Name));

View File

@@ -409,18 +409,41 @@ namespace Emby.Server.Implementations.Library
if (options.DeleteFileLocation && locationType != LocationType.Remote && locationType != LocationType.Virtual)
{
// Assume only the first is required
// Add this flag to GetDeletePaths if required in the future
var isRequiredForDelete = true;
foreach (var fileSystemInfo in item.GetDeletePaths().ToList())
{
if (fileSystemInfo.IsDirectory)
try
{
_logger.Debug("Deleting path {0}", fileSystemInfo.FullName);
_fileSystem.DeleteDirectory(fileSystemInfo.FullName, true);
if (fileSystemInfo.IsDirectory)
{
_logger.Debug("Deleting path {0}", fileSystemInfo.FullName);
_fileSystem.DeleteDirectory(fileSystemInfo.FullName, true);
}
else
{
_logger.Debug("Deleting path {0}", fileSystemInfo.FullName);
_fileSystem.DeleteFile(fileSystemInfo.FullName);
}
}
else
catch (IOException)
{
_logger.Debug("Deleting path {0}", fileSystemInfo.FullName);
_fileSystem.DeleteFile(fileSystemInfo.FullName);
if (isRequiredForDelete)
{
throw;
}
}
catch (UnauthorizedAccessException)
{
if (isRequiredForDelete)
{
throw;
}
}
isRequiredForDelete = false;
}
if (parent != null)

View File

@@ -434,6 +434,11 @@ namespace Emby.Server.Implementations.Library
Policy = user.Policy
};
if (!hasPassword && Users.Count() == 1)
{
dto.EnableAutoLogin = true;
}
var image = user.GetImageInfo(ImageType.Primary, 0);
if (image != null)

View File

@@ -596,6 +596,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
else
{
var mediaSource = GetMediaSource(info, hdhrId, channelInfo, profile);
//var modelInfo = await GetModelInfo(info, false, cancellationToken).ConfigureAwait(false);
return new HdHomerunHttpStream(mediaSource, streamId, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost);
//return new HdHomerunUdpStream(mediaSource, streamId, new HdHomerunChannelCommands(hdhomerunChannel.Number), modelInfo.TunerCount, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _socketFactory, _networkManager);

View File

@@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, _lockkey.Value);
await tcpClient.SendAsync(channelMsg, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false);
await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false);
response = await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false);
// parse response to make sure it worked
if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal))
{
@@ -172,6 +172,29 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
}
public async Task ChangeChannel(IHdHomerunChannelCommands commands, CancellationToken cancellationToken)
{
if (!_lockkey.HasValue)
return;
using (var tcpClient = _socketFactory.CreateTcpSocket(_remoteIp, HdHomeRunPort))
{
var commandList = commands.GetCommands();
foreach (Tuple<string, string> command in commandList)
{
var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey.Value);
await tcpClient.SendAsync(channelMsg, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false);
var response = await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false);
// parse response to make sure it worked
string returnVal;
if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal))
{
return;
}
}
}
}
public async Task StopStreaming()
{
if (!_lockkey.HasValue)