aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs3
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs4
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs5
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs8
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs4
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvManager.cs11
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs16
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs4
8 files changed, 26 insertions, 29 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 30fa68d95..1f72ebd54 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -2872,7 +2872,8 @@ namespace Emby.Server.Implementations.Data
}
if (string.Equals(name, ItemSortBy.IsFavoriteOrLiked, StringComparison.OrdinalIgnoreCase))
{
- return new Tuple<string, bool>("IsFavorite", true);
+ // (Select Case When Abs(COALESCE(ProductionYear, 0) - @ItemProductionYear) < 10 Then 2 Else 0 End )
+ return new Tuple<string, bool>("(Select Case When IsFavorite is null Then 0 Else IsFavorite End )", true);
}
if (string.Equals(name, ItemSortBy.IsFolder, StringComparison.OrdinalIgnoreCase))
{
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 5b0bd8bbc..824812494 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -492,7 +492,7 @@ namespace Emby.Server.Implementations.Dto
}
}
- //if (!(item is LiveTvProgram))
+ if (!(item is LiveTvProgram))
{
dto.PlayAccess = item.GetPlayAccess(user);
}
@@ -1420,7 +1420,7 @@ namespace Emby.Server.Implementations.Dto
{
dto.AirDays = series.AirDays;
dto.AirTime = series.AirTime;
- dto.SeriesStatus = series.Status;
+ dto.Status = series.Status.HasValue ? series.Status.Value.ToString() : null;
}
// Add SeasonInfo
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 7aae0d68a..1fc3dcd72 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -986,6 +986,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
foreach (var program in programs)
{
program.ChannelId = channelId;
+
+ if (provider.Item2.EnableNewProgramIds)
+ {
+ program.Id += "_" + channelId;
+ }
}
if (programs.Count > 0)
diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index 0d7a26553..f76735030 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -81,12 +81,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return programsInfo;
}
- if (string.IsNullOrWhiteSpace(info.ListingsId))
- {
- _logger.Warn("ListingsId is null, returning empty program list");
- return programsInfo;
- }
-
var dates = GetScheduleRequestDates(startDateUtc, endDateUtc);
string stationID = channelId;
@@ -156,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
programDetails.Where(p => p.hasImageArtwork).Select(p => p.programID)
.ToList();
- var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken);
+ var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
var schedules = dailySchedules.SelectMany(d => d.programs);
foreach (ScheduleDirect.Program schedule in schedules)
diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
index a89acf647..c22bb1171 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
@@ -168,7 +168,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
EpisodeNumber = p.Episode == null ? null : p.Episode.Episode,
EpisodeTitle = episodeTitle,
Genres = p.Categories,
- Id = String.Format("{0}_{1:O}", p.ChannelId, p.StartDate), // Construct an id from the channel and start date,
StartDate = GetDate(p.StartDate),
Name = p.Title,
Overview = p.Description,
@@ -208,6 +207,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
programInfo.ShowId = uniqueString.GetMD5().ToString("N");
}
+ // Construct an id from the channel and start date
+ programInfo.Id = String.Format("{0}_{1:O}", p.ChannelId, p.StartDate);
+
if (programInfo.IsMovie)
{
programInfo.IsSeries = false;
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index d5ea0d493..887784213 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -598,10 +598,6 @@ namespace Emby.Server.Implementations.LiveTv
item.ParentId = channel.Id;
//item.ChannelType = channelType;
- if (!string.Equals(item.ServiceName, serviceName, StringComparison.Ordinal))
- {
- forceUpdate = true;
- }
item.ServiceName = serviceName;
item.Audio = info.Audio;
@@ -1311,7 +1307,7 @@ namespace Emby.Server.Implementations.LiveTv
var isKids = false;
var iSSeries = false;
- var channelPrograms = await service.GetProgramsAsync(GetItemExternalId(currentChannel), start, end, cancellationToken).ConfigureAwait(false);
+ var channelPrograms = (await service.GetProgramsAsync(GetItemExternalId(currentChannel), start, end, cancellationToken).ConfigureAwait(false)).ToList();
var existingPrograms = _libraryManager.GetItemList(new InternalItemsQuery
{
@@ -1409,7 +1405,7 @@ namespace Emby.Server.Implementations.LiveTv
double percent = numComplete;
percent /= allChannelsList.Count;
- progress.Report(80 * percent + 10);
+ progress.Report(85 * percent + 15);
}
progress.Report(100);
@@ -1884,7 +1880,7 @@ namespace Emby.Server.Implementations.LiveTv
: _tvDtoService.GetInternalTimerId(service.Name, info.TimerId).ToString("N");
dto.StartDate = info.StartDate;
- dto.RecordingStatus = info.Status;
+ dto.Status = info.Status.ToString();
dto.IsRepeat = info.IsRepeat;
dto.EpisodeTitle = info.EpisodeTitle;
dto.IsMovie = info.IsMovie;
@@ -2865,6 +2861,7 @@ namespace Emby.Server.Implementations.LiveTv
{
info.Id = Guid.NewGuid().ToString("N");
config.ListingProviders.Add(info);
+ info.EnableNewProgramIds = true;
}
else
{
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index 1c7c0828c..bc9d01254 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -9,17 +9,14 @@ using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Net;
@@ -66,7 +63,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return id;
}
- private async Task<IEnumerable<Channels>> GetLineup(TunerHostInfo info, CancellationToken cancellationToken)
+ private async Task<List<Channels>> GetLineup(TunerHostInfo info, CancellationToken cancellationToken)
{
var options = new HttpRequestOptions
{
@@ -74,7 +71,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
CancellationToken = cancellationToken,
BufferContent = false
};
- using (var stream = await _httpClient.Get(options))
+ using (var stream = await _httpClient.Get(options).ConfigureAwait(false))
{
var lineup = JsonSerializer.DeserializeFromStream<List<Channels>>(stream) ?? new List<Channels>();
@@ -127,7 +124,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
CacheMode = CacheMode.Unconditional,
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds),
BufferContent = false
- }))
+
+ }).ConfigureAwait(false))
{
var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);
@@ -169,7 +167,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
CancellationToken = cancellationToken,
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds),
BufferContent = false
- }))
+
+ }).ConfigureAwait(false))
{
var tuners = new List<LiveTvTunerInfo>();
using (var sr = new StreamReader(stream, System.Text.Encoding.UTF8))
@@ -536,7 +535,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
Url = string.Format("{0}/discover.json", GetApiUrl(info, false)),
CancellationToken = CancellationToken.None,
BufferContent = false
- }))
+
+ }).ConfigureAwait(false))
{
var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
index a7e1b3cf3..df83d4341 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
@@ -74,10 +74,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
OnFinished = OnFinished
};
- var initial = _sharedBuffer.ToList();
var list = new List<byte>();
-
- foreach (var bytes in initial)
+ foreach (var bytes in _sharedBuffer)
{
list.AddRange(bytes);
}