aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs')
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs28
1 files changed, 11 insertions, 17 deletions
diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
index 4d7c7fef4..e7a3d748d 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
@@ -36,15 +36,9 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
_zipClient = zipClient;
}
- public string Name
- {
- get { return "XmlTV"; }
- }
+ public string Name => "XmlTV";
- public string Type
- {
- get { return "xmltv"; }
- }
+ public string Type => "xmltv";
private string GetLanguage(ListingsProviderInfo info)
{
@@ -78,7 +72,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
{
CancellationToken = cancellationToken,
Url = path,
- Progress = new SimpleProgress<Double>(),
+ Progress = new SimpleProgress<double>(),
DecompressionMethod = CompressionMethod.Gzip,
// It's going to come back gzipped regardless of this value
@@ -164,7 +158,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
{
if (string.IsNullOrWhiteSpace(channelId))
{
- throw new ArgumentNullException("channelId");
+ throw new ArgumentNullException(nameof(channelId));
}
/*
@@ -187,7 +181,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
.Select(p => GetProgramInfo(p, info));
}
- private ProgramInfo GetProgramInfo(XmlTvProgram program, ListingsProviderInfo info)
+ private static ProgramInfo GetProgramInfo(XmlTvProgram program, ListingsProviderInfo info)
{
string episodeTitle = program.Episode?.Title;
@@ -210,9 +204,9 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
IsMovie = program.Categories.Any(c => info.MovieCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
IsNews = program.Categories.Any(c => info.NewsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
IsSports = program.Categories.Any(c => info.SportsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
- ImageUrl = program.Icon != null && !String.IsNullOrEmpty(program.Icon.Source) ? program.Icon.Source : null,
- HasImage = program.Icon != null && !String.IsNullOrEmpty(program.Icon.Source),
- OfficialRating = program.Rating != null && !String.IsNullOrEmpty(program.Rating.Value) ? program.Rating.Value : null,
+ ImageUrl = program.Icon != null && !string.IsNullOrEmpty(program.Icon.Source) ? program.Icon.Source : null,
+ HasImage = program.Icon != null && !string.IsNullOrEmpty(program.Icon.Source),
+ OfficialRating = program.Rating != null && !string.IsNullOrEmpty(program.Rating.Value) ? program.Rating.Value : null,
CommunityRating = program.StarRating,
SeriesId = program.Episode == null ? null : program.Title.GetMD5().ToString("N")
};
@@ -246,7 +240,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
}
// Construct an id from the channel and start date
- programInfo.Id = String.Format("{0}_{1:O}", program.ChannelId, program.StartDate);
+ programInfo.Id = string.Format("{0}_{1:O}", program.ChannelId, program.StartDate);
if (programInfo.IsMovie)
{
@@ -287,14 +281,14 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
string path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
_logger.LogDebug("Opening XmlTvReader for {path}", path);
var reader = new XmlTvReader(path, GetLanguage(info));
- IEnumerable<XmlTvChannel> results = reader.GetChannels();
+ var results = reader.GetChannels();
// Should this method be async?
return results.Select(c => new ChannelInfo
{
Id = c.Id,
Name = c.DisplayName,
- ImageUrl = c.Icon != null && !String.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null,
+ ImageUrl = c.Icon != null && !string.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null,
Number = string.IsNullOrWhiteSpace(c.Number) ? c.Id : c.Number
}).ToList();