mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-01 20:02:52 +01:00
ReSharper format: conform inline 'out' parameters.
This commit is contained in:
@@ -395,8 +395,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
private async Task<EpgChannelData> GetEpgChannels(IListingsProvider provider, ListingsProviderInfo info, bool enableCache, CancellationToken cancellationToken)
|
||||
{
|
||||
EpgChannelData result;
|
||||
if (!enableCache || !_epgChannels.TryGetValue(info.Id, out result))
|
||||
if (!enableCache || !_epgChannels.TryGetValue(info.Id, out var result))
|
||||
{
|
||||
var channels = await provider.GetChannels(info, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -652,9 +651,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
TimerCancelled(this, new GenericEventArgs<string>(timerId));
|
||||
}
|
||||
}
|
||||
ActiveRecordingInfo activeRecordingInfo;
|
||||
|
||||
if (_activeRecordings.TryGetValue(timerId, out activeRecordingInfo))
|
||||
if (_activeRecordings.TryGetValue(timerId, out var activeRecordingInfo))
|
||||
{
|
||||
activeRecordingInfo.Timer = timer;
|
||||
activeRecordingInfo.CancellationTokenSource.Cancel();
|
||||
@@ -821,8 +819,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
}
|
||||
|
||||
// Only update if not currently active
|
||||
ActiveRecordingInfo activeRecordingInfo;
|
||||
if (!_activeRecordings.TryGetValue(updatedTimer.Id, out activeRecordingInfo))
|
||||
if (!_activeRecordings.TryGetValue(updatedTimer.Id, out var activeRecordingInfo))
|
||||
{
|
||||
existingTimer.PrePaddingSeconds = updatedTimer.PrePaddingSeconds;
|
||||
existingTimer.PostPaddingSeconds = updatedTimer.PostPaddingSeconds;
|
||||
@@ -864,9 +861,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
public string GetActiveRecordingPath(string id)
|
||||
{
|
||||
ActiveRecordingInfo info;
|
||||
|
||||
if (_activeRecordings.TryGetValue(id, out info))
|
||||
if (_activeRecordings.TryGetValue(id, out var info))
|
||||
{
|
||||
return info.Path;
|
||||
}
|
||||
@@ -1440,8 +1435,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
TriggerRefresh(recordPath);
|
||||
_libraryMonitor.ReportFileSystemChangeComplete(recordPath, false);
|
||||
|
||||
ActiveRecordingInfo removed;
|
||||
_activeRecordings.TryRemove(timer.Id, out removed);
|
||||
_activeRecordings.TryRemove(timer.Id, out var removed);
|
||||
|
||||
if (recordingStatus != RecordingStatus.Completed && DateTime.UtcNow < timer.EndDate && timer.RetryCount < 10)
|
||||
{
|
||||
@@ -2007,8 +2001,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
writer.WriteStartDocument(true);
|
||||
writer.WriteStartElement("tvshow");
|
||||
|
||||
string id;
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out var id))
|
||||
{
|
||||
writer.WriteElementString("id", id);
|
||||
}
|
||||
@@ -2417,8 +2410,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
// Only update if not currently active - test both new timer and existing in case Id's are different
|
||||
// Id's could be different if the timer was created manually prior to series timer creation
|
||||
ActiveRecordingInfo activeRecordingInfo;
|
||||
if (!_activeRecordings.TryGetValue(timer.Id, out activeRecordingInfo) && !_activeRecordings.TryGetValue(existingTimer.Id, out activeRecordingInfo))
|
||||
if (!_activeRecordings.TryGetValue(timer.Id, out var activeRecordingInfo) && !_activeRecordings.TryGetValue(existingTimer.Id, out activeRecordingInfo))
|
||||
{
|
||||
UpdateExistingTimerWithNewMetadata(existingTimer, timer);
|
||||
|
||||
@@ -2521,9 +2513,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
if (string.IsNullOrWhiteSpace(channelId) && !parent.ChannelId.Equals(Guid.Empty))
|
||||
{
|
||||
LiveTvChannel channel;
|
||||
|
||||
if (!tempChannelCache.TryGetValue(parent.ChannelId, out channel))
|
||||
if (!tempChannelCache.TryGetValue(parent.ChannelId, out var channel))
|
||||
{
|
||||
channel = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
@@ -2582,9 +2572,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
if (!programInfo.ChannelId.Equals(Guid.Empty))
|
||||
{
|
||||
LiveTvChannel channel;
|
||||
|
||||
if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out channel))
|
||||
if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out var channel))
|
||||
{
|
||||
channel = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
|
||||
@@ -140,8 +140,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
private void StopTimer(TimerInfo item)
|
||||
{
|
||||
ITimer timer;
|
||||
if (_timers.TryRemove(item.Id, out timer))
|
||||
if (_timers.TryRemove(item.Id, out var timer))
|
||||
{
|
||||
timer.Dispose();
|
||||
}
|
||||
|
||||
@@ -528,8 +528,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
var isNew = false;
|
||||
var forceUpdate = false;
|
||||
|
||||
LiveTvProgram item;
|
||||
if (!allExistingPrograms.TryGetValue(id, out item))
|
||||
if (!allExistingPrograms.TryGetValue(id, out var item))
|
||||
{
|
||||
isNew = true;
|
||||
item = new LiveTvProgram
|
||||
@@ -1940,8 +1939,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
foreach (var programDto in currentProgramDtos)
|
||||
{
|
||||
BaseItemDto channelDto;
|
||||
if (currentChannelsDict.TryGetValue(programDto.ChannelId, out channelDto))
|
||||
if (currentChannelsDict.TryGetValue(programDto.ChannelId, out var channelDto))
|
||||
{
|
||||
channelDto.CurrentProgram = programDto;
|
||||
}
|
||||
|
||||
@@ -118,8 +118,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
{
|
||||
if (!string.IsNullOrEmpty(cacheKey))
|
||||
{
|
||||
DiscoverResponse response;
|
||||
if (_modelCache.TryGetValue(cacheKey, out response))
|
||||
if (_modelCache.TryGetValue(cacheKey, out var response))
|
||||
{
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -132,8 +132,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
var receiveBuffer = new byte[8192];
|
||||
var response = await socket.ReceiveAsync(receiveBuffer, 0, receiveBuffer.Length, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
string returnVal;
|
||||
ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal);
|
||||
ParseReturnMessage(response.Buffer, response.ReceivedBytes, out var returnVal);
|
||||
|
||||
return string.Equals(returnVal, "none", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
@@ -167,9 +166,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
var lockkeyMsg = CreateSetMessage(i, "lockkey", lockKeyString, null);
|
||||
await tcpClient.SendToAsync(lockkeyMsg, 0, lockkeyMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false);
|
||||
var response = await tcpClient.ReceiveAsync(receiveBuffer, 0, receiveBuffer.Length, cancellationToken).ConfigureAwait(false);
|
||||
string returnVal;
|
||||
// parse response to make sure it worked
|
||||
if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal))
|
||||
if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out var returnVal))
|
||||
continue;
|
||||
|
||||
var commandList = commands.GetCommands();
|
||||
@@ -222,8 +220,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false);
|
||||
var response = await tcpClient.ReceiveAsync(receiveBuffer, 0, receiveBuffer.Length, cancellationToken).ConfigureAwait(false);
|
||||
// parse response to make sure it worked
|
||||
string returnVal;
|
||||
if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal))
|
||||
if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out var returnVal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,9 +135,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
var protocol = _mediaSourceManager.GetPathProtocol(path);
|
||||
|
||||
Uri uri;
|
||||
var isRemote = true;
|
||||
if (Uri.TryCreate(path, UriKind.Absolute, out uri))
|
||||
if (Uri.TryCreate(path, UriKind.Absolute, out var uri))
|
||||
{
|
||||
isRemote = !_networkManager.IsInLocalNetwork(uri.Host);
|
||||
}
|
||||
|
||||
@@ -117,12 +117,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
extInf = extInf.Trim();
|
||||
|
||||
string remaining;
|
||||
var attributes = ParseExtInf(extInf, out remaining);
|
||||
var attributes = ParseExtInf(extInf, out var remaining);
|
||||
extInf = remaining;
|
||||
|
||||
string value;
|
||||
if (attributes.TryGetValue("tvg-logo", out value))
|
||||
if (attributes.TryGetValue("tvg-logo", out var value))
|
||||
{
|
||||
channel.ImageUrl = value;
|
||||
}
|
||||
@@ -130,11 +128,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
channel.Name = GetChannelName(extInf, attributes);
|
||||
channel.Number = GetChannelNumber(extInf, attributes, mediaUrl);
|
||||
|
||||
string tvgId;
|
||||
attributes.TryGetValue("tvg-id", out tvgId);
|
||||
attributes.TryGetValue("tvg-id", out var tvgId);
|
||||
|
||||
string channelId;
|
||||
attributes.TryGetValue("channel-id", out channelId);
|
||||
attributes.TryGetValue("channel-id", out var channelId);
|
||||
|
||||
channel.TunerChannelId = string.IsNullOrWhiteSpace(tvgId) ? channelId : tvgId;
|
||||
|
||||
@@ -172,8 +168,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
{
|
||||
var numberPart = nameInExtInf.Substring(0, numberIndex).Trim(new[] { ' ', '.' });
|
||||
|
||||
double number;
|
||||
if (double.TryParse(numberPart, NumberStyles.Any, CultureInfo.InvariantCulture, out number))
|
||||
if (double.TryParse(numberPart, NumberStyles.Any, CultureInfo.InvariantCulture, out var number))
|
||||
{
|
||||
numberString = numberPart;
|
||||
}
|
||||
@@ -187,11 +182,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
if (!IsValidChannelNumber(numberString))
|
||||
{
|
||||
string value;
|
||||
if (attributes.TryGetValue("tvg-id", out value))
|
||||
if (attributes.TryGetValue("tvg-id", out var value))
|
||||
{
|
||||
double doubleValue;
|
||||
if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out doubleValue))
|
||||
if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var doubleValue))
|
||||
{
|
||||
numberString = value;
|
||||
}
|
||||
@@ -205,8 +198,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
if (!IsValidChannelNumber(numberString))
|
||||
{
|
||||
string value;
|
||||
if (attributes.TryGetValue("channel-id", out value))
|
||||
if (attributes.TryGetValue("channel-id", out var value))
|
||||
{
|
||||
numberString = value;
|
||||
}
|
||||
@@ -259,8 +251,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
return false;
|
||||
}
|
||||
|
||||
double value;
|
||||
if (!double.TryParse(numberString, NumberStyles.Any, CultureInfo.InvariantCulture, out value))
|
||||
if (!double.TryParse(numberString, NumberStyles.Any, CultureInfo.InvariantCulture, out var value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -283,8 +274,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
{
|
||||
var numberPart = nameInExtInf.Substring(0, numberIndex).Trim(new[] { ' ', '.' });
|
||||
|
||||
double number;
|
||||
if (double.TryParse(numberPart, NumberStyles.Any, CultureInfo.InvariantCulture, out number))
|
||||
if (double.TryParse(numberPart, NumberStyles.Any, CultureInfo.InvariantCulture, out var number))
|
||||
{
|
||||
//channel.Number = number.ToString();
|
||||
nameInExtInf = nameInExtInf.Substring(numberIndex + 1).Trim(new[] { ' ', '-' });
|
||||
@@ -292,8 +282,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
}
|
||||
}
|
||||
|
||||
string name;
|
||||
attributes.TryGetValue("tvg-name", out name);
|
||||
attributes.TryGetValue("tvg-name", out var name);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user