Some code style clean up

This commit is contained in:
cvium 2019-01-07 20:10:26 +01:00 committed by Bond-009
parent 256e6dc195
commit 0e422a33d6

View file

@ -452,18 +452,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public ChannelInfo GetChannelByNumber(string number) public ChannelInfo GetChannelByNumber(string number)
{ {
ChannelInfo result = null; ChannelsByNumber.TryGetValue(number, out var result);
ChannelsByNumber.TryGetValue(number, out result);
return result; return result;
} }
public ChannelInfo GetChannelByName(string name) public ChannelInfo GetChannelByName(string name)
{ {
ChannelInfo result = null; ChannelsByName.TryGetValue(name, out var result);
ChannelsByName.TryGetValue(name, out result);
return result; return result;
} }
@ -2396,10 +2392,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
} }
_timerProvider.Add(timer); _timerProvider.Add(timer);
if (TimerCreated != null) TimerCreated?.Invoke(this, new GenericEventArgs<TimerInfo>(timer));
{
TimerCreated(this, new GenericEventArgs<TimerInfo>(timer));
}
} }
else else
{ {
@ -2508,9 +2501,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (string.IsNullOrWhiteSpace(channelId) && !parent.ChannelId.Equals(Guid.Empty)) if (string.IsNullOrWhiteSpace(channelId) && !parent.ChannelId.Equals(Guid.Empty))
{ {
LiveTvChannel channel; if (!tempChannelCache.TryGetValue(parent.ChannelId, out var channel))
if (!tempChannelCache.TryGetValue(parent.ChannelId, out channel))
{ {
channel = _libraryManager.GetItemList(new InternalItemsQuery channel = _libraryManager.GetItemList(new InternalItemsQuery
{ {
@ -2569,9 +2560,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (!programInfo.ChannelId.Equals(Guid.Empty)) if (!programInfo.ChannelId.Equals(Guid.Empty))
{ {
LiveTvChannel channel; if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out var channel))
if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out channel))
{ {
channel = _libraryManager.GetItemList(new InternalItemsQuery channel = _libraryManager.GetItemList(new InternalItemsQuery
{ {
@ -2769,15 +2758,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
var configuredDevice = configuredDevices.FirstOrDefault(i => string.Equals(i.DeviceId, device.DeviceId, StringComparison.OrdinalIgnoreCase)); var configuredDevice = configuredDevices.FirstOrDefault(i => string.Equals(i.DeviceId, device.DeviceId, StringComparison.OrdinalIgnoreCase));
if (configuredDevice != null) if (configuredDevice != null && !string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))
{ {
if (!string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase)) _logger.LogInformation("Tuner url has changed from {0} to {1}", configuredDevice.Url, device.Url);
{
_logger.LogInformation("Tuner url has changed from {0} to {1}", configuredDevice.Url, device.Url);
configuredDevice.Url = device.Url; configuredDevice.Url = device.Url;
await _liveTvManager.SaveTunerHost(configuredDevice).ConfigureAwait(false); await _liveTvManager.SaveTunerHost(configuredDevice).ConfigureAwait(false);
}
} }
} }
} }