Merge pull request #2870 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-09-08 12:14:23 -04:00 committed by GitHub
commit 2a78066658
12 changed files with 274 additions and 224 deletions

View File

@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.Data
{
get
{
return false;
return true;
}
}
@ -252,6 +252,7 @@ namespace Emby.Server.Implementations.Data
AddColumn(db, "TypedBaseItems", "AlbumArtists", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExternalId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeriesPresentationUniqueKey", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ShowId", "Text", existingColumnNames);
existingColumnNames = GetColumnNames(db, "ItemValues");
AddColumn(db, "ItemValues", "CleanValue", "Text", existingColumnNames);
@ -457,7 +458,8 @@ namespace Emby.Server.Implementations.Data
"Artists",
"AlbumArtists",
"ExternalId",
"SeriesPresentationUniqueKey"
"SeriesPresentationUniqueKey",
"ShowId"
};
private readonly string[] _mediaStreamSaveColumns =
@ -577,7 +579,8 @@ namespace Emby.Server.Implementations.Data
"Artists",
"AlbumArtists",
"ExternalId",
"SeriesPresentationUniqueKey"
"SeriesPresentationUniqueKey",
"ShowId"
};
var saveItemCommandCommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
@ -1044,6 +1047,16 @@ namespace Emby.Server.Implementations.Data
saveItemStatement.TryBind("@AlbumArtists", albumArtists);
saveItemStatement.TryBind("@ExternalId", item.ExternalId);
var program = item as LiveTvProgram;
if (program != null)
{
saveItemStatement.TryBind("@ShowId", program.ShowId);
}
else
{
saveItemStatement.TryBindNull("@ShowId");
}
saveItemStatement.MoveNext();
}
@ -1935,6 +1948,23 @@ namespace Emby.Server.Implementations.Data
index++;
}
if (enableProgramAttributes)
{
var program = item as LiveTvProgram;
if (program != null)
{
if (!reader.IsDBNull(index))
{
program.ShowId = reader.GetString(index);
}
index++;
}
else
{
index ++;
}
}
return item;
}
@ -2441,6 +2471,7 @@ namespace Emby.Server.Implementations.Data
list.Remove("IsPremiere");
list.Remove("EpisodeTitle");
list.Remove("IsRepeat");
list.Remove("ShowId");
}
if (!HasEpisodeAttributes(query))

View File

@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.Data
{
get
{
return false;
return true;
}
}

View File

@ -305,26 +305,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var seriesTimers = await GetSeriesTimersAsync(cancellationToken).ConfigureAwait(false);
List<ChannelInfo> channels = null;
foreach (var timer in seriesTimers)
{
List<ProgramInfo> epgData;
if (timer.RecordAnyChannel)
{
if (channels == null)
{
channels = (await GetChannelsAsync(true, CancellationToken.None).ConfigureAwait(false)).ToList();
}
var channelIds = channels.Select(i => i.Id).ToList();
epgData = GetEpgDataForChannels(channelIds);
}
else
{
epgData = GetEpgDataForChannel(timer.ChannelId);
}
await UpdateTimersForSeriesTimer(epgData, timer, false, true).ConfigureAwait(false);
await UpdateTimersForSeriesTimer(timer, false, true).ConfigureAwait(false);
}
}
@ -332,6 +315,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var timers = await GetTimersAsync(cancellationToken).ConfigureAwait(false);
var tempChannelCache = new Dictionary<string, LiveTvChannel>();
foreach (var timer in timers)
{
if (DateTime.UtcNow > timer.EndDate && !_activeRecordings.ContainsKey(timer.Id))
@ -345,15 +330,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
continue;
}
var epg = GetEpgDataForChannel(timer.ChannelId);
var program = epg.FirstOrDefault(i => string.Equals(i.Id, timer.ProgramId, StringComparison.OrdinalIgnoreCase));
var program = GetProgramInfoFromCache(timer);
if (program == null)
{
OnTimerOutOfDate(timer);
continue;
}
RecordingHelper.CopyProgramInfoToTimerInfo(program, timer);
CopyProgramInfoToTimerInfo(program, timer, tempChannelCache);
_timerProvider.Update(timer);
}
}
@ -672,11 +656,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
timer.Id = Guid.NewGuid().ToString("N");
ProgramInfo programInfo = null;
LiveTvProgram programInfo = null;
if (!string.IsNullOrWhiteSpace(timer.ProgramId))
{
programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.ProgramId);
programInfo = GetProgramInfoFromCache(timer);
}
if (programInfo == null)
{
@ -686,7 +670,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (programInfo != null)
{
RecordingHelper.CopyProgramInfoToTimerInfo(programInfo, timer);
CopyProgramInfoToTimerInfo(programInfo, timer);
}
timer.IsManual = true;
@ -698,24 +682,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
info.Id = Guid.NewGuid().ToString("N");
List<ProgramInfo> epgData;
if (info.RecordAnyChannel)
{
var channels = await GetChannelsAsync(true, CancellationToken.None).ConfigureAwait(false);
var channelIds = channels.Select(i => i.Id).ToList();
epgData = GetEpgDataForChannels(channelIds);
}
else
{
epgData = GetEpgDataForChannel(info.ChannelId);
}
// populate info.seriesID
var program = epgData.FirstOrDefault(i => string.Equals(i.Id, info.ProgramId, StringComparison.OrdinalIgnoreCase));
var program = GetProgramInfoFromCache(info.ProgramId);
if (program != null)
{
info.SeriesId = program.SeriesId;
info.SeriesId = program.ExternalSeriesId;
}
else
{
@ -750,7 +722,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_timerProvider.AddOrUpdate(timer, false);
}
await UpdateTimersForSeriesTimer(epgData, info, true, false).ConfigureAwait(false);
await UpdateTimersForSeriesTimer(info, true, false).ConfigureAwait(false);
return info.Id;
}
@ -779,19 +751,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_seriesTimerProvider.Update(instance);
List<ProgramInfo> epgData;
if (instance.RecordAnyChannel)
{
var channels = await GetChannelsAsync(true, CancellationToken.None).ConfigureAwait(false);
var channelIds = channels.Select(i => i.Id).ToList();
epgData = GetEpgDataForChannels(channelIds);
}
else
{
epgData = GetEpgDataForChannel(instance.ChannelId);
}
await UpdateTimersForSeriesTimer(epgData, instance, true, true).ConfigureAwait(false);
await UpdateTimersForSeriesTimer(instance, true, true).ConfigureAwait(false);
}
}
@ -962,23 +922,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return Task.FromResult((IEnumerable<SeriesTimerInfo>)_seriesTimerProvider.GetAll());
}
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
{
try
{
return await GetProgramsAsyncInternal(channelId, startDateUtc, endDateUtc, cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
throw;
}
catch (Exception ex)
{
_logger.ErrorException("Error getting programs", ex);
return GetEpgDataForChannel(channelId).Where(i => i.StartDate <= endDateUtc && i.EndDate >= startDateUtc);
}
}
private bool IsListingProviderEnabledForTuner(ListingsProviderInfo info, string tunerHostId)
{
if (info.EnableAllTuners)
@ -994,7 +937,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return info.EnabledTuners.Contains(tunerHostId, StringComparer.OrdinalIgnoreCase);
}
private async Task<IEnumerable<ProgramInfo>> GetProgramsAsyncInternal(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
{
var channels = await GetChannelsAsync(true, cancellationToken).ConfigureAwait(false);
var channel = channels.First(i => string.Equals(i.Id, channelId, StringComparison.OrdinalIgnoreCase));
@ -1037,8 +980,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (programs.Count > 0)
{
SaveEpgDataForChannel(channelId, programs);
return programs;
}
}
@ -1464,11 +1405,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
throw new ArgumentNullException("timer");
}
ProgramInfo programInfo = null;
LiveTvProgram programInfo = null;
if (!string.IsNullOrWhiteSpace(timer.ProgramId))
{
programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.ProgramId);
programInfo = GetProgramInfoFromCache(timer);
}
if (programInfo == null)
{
@ -1478,8 +1419,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (programInfo != null)
{
RecordingHelper.CopyProgramInfoToTimerInfo(programInfo, timer);
activeRecordingInfo.Program = programInfo;
CopyProgramInfoToTimerInfo(programInfo, timer);
//activeRecordingInfo.Program = programInfo;
}
string seriesPath = null;
@ -2336,18 +2277,49 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
private ProgramInfo GetProgramInfoFromCache(string channelId, string programId)
private LiveTvProgram GetProgramInfoFromCache(string programId)
{
var epgData = GetEpgDataForChannel(channelId);
return epgData.FirstOrDefault(p => string.Equals(p.Id, programId, StringComparison.OrdinalIgnoreCase));
var query = new InternalItemsQuery
{
ItemIds = new[] { _liveTvManager.GetInternalProgramId(Name, programId).ToString("N") },
Limit = 1,
DtoOptions = new DtoOptions()
};
return _libraryManager.GetItemList(query).Cast<LiveTvProgram>().FirstOrDefault();
}
private ProgramInfo GetProgramInfoFromCache(string channelId, DateTime startDateUtc)
private LiveTvProgram GetProgramInfoFromCache(TimerInfo timer)
{
var epgData = GetEpgDataForChannel(channelId);
var startDateTicks = startDateUtc.Ticks;
// Find the first program that starts within 3 minutes
return epgData.FirstOrDefault(p => Math.Abs(startDateTicks - p.StartDate.Ticks) <= TimeSpan.FromMinutes(3).Ticks);
return GetProgramInfoFromCache(timer.ProgramId, timer.ChannelId);
}
private LiveTvProgram GetProgramInfoFromCache(string programId, string channelId)
{
return GetProgramInfoFromCache(programId);
}
private LiveTvProgram GetProgramInfoFromCache(string channelId, DateTime startDateUtc)
{
var query = new InternalItemsQuery
{
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
Limit = 1,
DtoOptions = new DtoOptions(true)
{
EnableImages = false
},
MinStartDate = startDateUtc.AddMinutes(-3),
MaxStartDate = startDateUtc.AddMinutes(3),
OrderBy = new[] { new Tuple<string, SortOrder>(ItemSortBy.StartDate, SortOrder.Ascending) }
};
if (!string.IsNullOrWhiteSpace(channelId))
{
query.ChannelIds = new[] { _liveTvManager.GetInternalChannelId(Name, channelId).ToString("N") };
}
return _libraryManager.GetItemList(query).Cast<LiveTvProgram>().FirstOrDefault();
}
private LiveTvOptions GetConfiguration()
@ -2421,9 +2393,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
private async Task UpdateTimersForSeriesTimer(List<ProgramInfo> epgData, SeriesTimerInfo seriesTimer, bool updateTimerSettings, bool deleteInvalidTimers)
private async Task UpdateTimersForSeriesTimer(SeriesTimerInfo seriesTimer, bool updateTimerSettings, bool deleteInvalidTimers)
{
var allTimers = GetTimersForSeries(seriesTimer, epgData)
var allTimers = GetTimersForSeries(seriesTimer)
.ToList();
var registration = await _liveTvManager.GetRegistrationInfo("seriesrecordings").ConfigureAwait(false);
@ -2520,23 +2492,160 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
private IEnumerable<TimerInfo> GetTimersForSeries(SeriesTimerInfo seriesTimer, IEnumerable<ProgramInfo> allPrograms)
private IEnumerable<TimerInfo> GetTimersForSeries(SeriesTimerInfo seriesTimer)
{
if (seriesTimer == null)
{
throw new ArgumentNullException("seriesTimer");
}
if (allPrograms == null)
if (string.IsNullOrWhiteSpace(seriesTimer.SeriesId))
{
throw new ArgumentNullException("allPrograms");
return new List<TimerInfo>();
}
// Exclude programs that have already ended
allPrograms = allPrograms.Where(i => i.EndDate > DateTime.UtcNow);
var query = new InternalItemsQuery
{
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
ExternalSeriesId = seriesTimer.SeriesId,
DtoOptions = new DtoOptions(true)
{
EnableImages = false
},
MinEndDate = DateTime.UtcNow
};
allPrograms = GetProgramsForSeries(seriesTimer, allPrograms);
if (!seriesTimer.RecordAnyChannel)
{
query.ChannelIds = new[] { _liveTvManager.GetInternalChannelId(Name, seriesTimer.ChannelId).ToString("N") };
}
return allPrograms.Select(i => RecordingHelper.CreateTimer(i, seriesTimer));
var tempChannelCache = new Dictionary<string, LiveTvChannel>();
return _libraryManager.GetItemList(query).Cast<LiveTvProgram>().Select(i => CreateTimer(i, seriesTimer, tempChannelCache));
}
private TimerInfo CreateTimer(LiveTvProgram parent, SeriesTimerInfo seriesTimer, Dictionary<string, LiveTvChannel> tempChannelCache)
{
string channelId = seriesTimer.RecordAnyChannel ? null : seriesTimer.ChannelId;
if (string.IsNullOrWhiteSpace(channelId) && !string.IsNullOrWhiteSpace(parent.ChannelId))
{
LiveTvChannel channel;
if (!tempChannelCache.TryGetValue(parent.ChannelId, out channel))
{
channel = _libraryManager.GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new string[] { typeof(LiveTvChannel).Name },
ItemIds = new[] { parent.ChannelId },
DtoOptions = new DtoOptions()
}).Cast<LiveTvChannel>().FirstOrDefault();
if (channel != null && !string.IsNullOrWhiteSpace(channel.ExternalId))
{
tempChannelCache[parent.ChannelId] = channel;
}
}
if (channel != null || tempChannelCache.TryGetValue(parent.ChannelId, out channel))
{
channelId = channel.ExternalId;
}
}
var timer = new TimerInfo
{
ChannelId = channelId,
Id = (seriesTimer.Id + parent.ExternalId).GetMD5().ToString("N"),
StartDate = parent.StartDate,
EndDate = parent.EndDate.Value,
ProgramId = parent.ExternalId,
PrePaddingSeconds = seriesTimer.PrePaddingSeconds,
PostPaddingSeconds = seriesTimer.PostPaddingSeconds,
IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired,
IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired,
KeepUntil = seriesTimer.KeepUntil,
Priority = seriesTimer.Priority,
Name = parent.Name,
Overview = parent.Overview,
SeriesId = parent.ExternalSeriesId,
SeriesTimerId = seriesTimer.Id,
ShowId = parent.ShowId
};
CopyProgramInfoToTimerInfo(parent, timer, tempChannelCache);
return timer;
}
private void CopyProgramInfoToTimerInfo(LiveTvProgram programInfo, TimerInfo timerInfo)
{
var tempChannelCache = new Dictionary<string, LiveTvChannel>();
CopyProgramInfoToTimerInfo(programInfo, timerInfo, tempChannelCache);
}
private void CopyProgramInfoToTimerInfo(LiveTvProgram programInfo, TimerInfo timerInfo, Dictionary<string, LiveTvChannel> tempChannelCache)
{
string channelId = null;
if (!string.IsNullOrWhiteSpace(programInfo.ChannelId))
{
LiveTvChannel channel;
if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out channel))
{
channel = _libraryManager.GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new string[] { typeof(LiveTvChannel).Name },
ItemIds = new[] { programInfo.ChannelId },
DtoOptions = new DtoOptions()
}).Cast<LiveTvChannel>().FirstOrDefault();
if (channel != null && !string.IsNullOrWhiteSpace(channel.ExternalId))
{
tempChannelCache[programInfo.ChannelId] = channel;
}
}
if (channel != null || tempChannelCache.TryGetValue(programInfo.ChannelId, out channel))
{
channelId = channel.ExternalId;
}
}
timerInfo.Name = programInfo.Name;
timerInfo.StartDate = programInfo.StartDate;
timerInfo.EndDate = programInfo.EndDate.Value;
if (!string.IsNullOrWhiteSpace(channelId))
{
timerInfo.ChannelId = channelId;
}
timerInfo.SeasonNumber = programInfo.ParentIndexNumber;
timerInfo.EpisodeNumber = programInfo.IndexNumber;
timerInfo.IsMovie = programInfo.IsMovie;
timerInfo.IsKids = programInfo.IsKids;
timerInfo.IsNews = programInfo.IsNews;
timerInfo.IsSports = programInfo.IsSports;
timerInfo.ProductionYear = programInfo.ProductionYear;
timerInfo.EpisodeTitle = programInfo.EpisodeTitle;
timerInfo.OriginalAirDate = programInfo.PremiereDate;
timerInfo.IsProgramSeries = programInfo.IsSeries;
timerInfo.IsSeries = programInfo.IsSeries;
timerInfo.IsLive = programInfo.IsLive;
timerInfo.IsPremiere = programInfo.IsPremiere;
timerInfo.HomePageUrl = programInfo.HomePageUrl;
timerInfo.CommunityRating = programInfo.CommunityRating;
timerInfo.Overview = programInfo.Overview;
timerInfo.OfficialRating = programInfo.OfficialRating;
timerInfo.IsRepeat = programInfo.IsRepeat;
timerInfo.SeriesId = programInfo.ExternalSeriesId;
}
private bool IsProgramAlreadyInLibrary(TimerInfo program)
@ -2577,51 +2686,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return false;
}
private IEnumerable<ProgramInfo> GetProgramsForSeries(SeriesTimerInfo seriesTimer, IEnumerable<ProgramInfo> allPrograms)
{
if (string.IsNullOrWhiteSpace(seriesTimer.SeriesId))
{
_logger.Error("seriesTimer.SeriesId is null. Cannot find programs for series");
return new List<ProgramInfo>();
}
return allPrograms.Where(i => string.Equals(i.SeriesId, seriesTimer.SeriesId, StringComparison.OrdinalIgnoreCase));
}
private string GetChannelEpgCachePath(string channelId)
{
return Path.Combine(_config.CommonApplicationPaths.CachePath, "embytvepg", channelId + ".json");
}
private readonly object _epgLock = new object();
private void SaveEpgDataForChannel(string channelId, List<ProgramInfo> epgData)
{
var path = GetChannelEpgCachePath(channelId);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
lock (_epgLock)
{
_jsonSerializer.SerializeToFile(epgData, path);
}
}
private List<ProgramInfo> GetEpgDataForChannel(string channelId)
{
try
{
lock (_epgLock)
{
return _jsonSerializer.DeserializeFromFile<List<ProgramInfo>>(GetChannelEpgCachePath(channelId));
}
}
catch
{
return new List<ProgramInfo>();
}
}
private List<ProgramInfo> GetEpgDataForChannels(List<string> channelIds)
{
return channelIds.SelectMany(GetEpgDataForChannel).ToList();
}
private bool _disposed;
public void Dispose()
{

View File

@ -1,8 +1,6 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.LiveTv;
using System;
using System.Globalization;
using MediaBrowser.Model.LiveTv;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
@ -13,63 +11,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return timer.StartDate.AddSeconds(-timer.PrePaddingSeconds);
}
public static TimerInfo CreateTimer(ProgramInfo parent, SeriesTimerInfo seriesTimer)
{
var timer = new TimerInfo
{
ChannelId = parent.ChannelId,
Id = (seriesTimer.Id + parent.Id).GetMD5().ToString("N"),
StartDate = parent.StartDate,
EndDate = parent.EndDate,
ProgramId = parent.Id,
PrePaddingSeconds = seriesTimer.PrePaddingSeconds,
PostPaddingSeconds = seriesTimer.PostPaddingSeconds,
IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired,
IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired,
KeepUntil = seriesTimer.KeepUntil,
Priority = seriesTimer.Priority,
Name = parent.Name,
Overview = parent.Overview,
SeriesId = parent.SeriesId,
SeriesTimerId = seriesTimer.Id,
ShowId = parent.ShowId
};
CopyProgramInfoToTimerInfo(parent, timer);
return timer;
}
public static void CopyProgramInfoToTimerInfo(ProgramInfo programInfo, TimerInfo timerInfo)
{
timerInfo.Name = programInfo.Name;
timerInfo.StartDate = programInfo.StartDate;
timerInfo.EndDate = programInfo.EndDate;
timerInfo.ChannelId = programInfo.ChannelId;
timerInfo.SeasonNumber = programInfo.SeasonNumber;
timerInfo.EpisodeNumber = programInfo.EpisodeNumber;
timerInfo.IsMovie = programInfo.IsMovie;
timerInfo.IsKids = programInfo.IsKids;
timerInfo.IsNews = programInfo.IsNews;
timerInfo.IsSports = programInfo.IsSports;
timerInfo.ProductionYear = programInfo.ProductionYear;
timerInfo.EpisodeTitle = programInfo.EpisodeTitle;
timerInfo.OriginalAirDate = programInfo.OriginalAirDate;
timerInfo.IsProgramSeries = programInfo.IsSeries;
timerInfo.IsSeries = programInfo.IsSeries;
timerInfo.IsLive = programInfo.IsLive;
timerInfo.IsPremiere = programInfo.IsPremiere;
timerInfo.HomePageUrl = programInfo.HomePageUrl;
timerInfo.CommunityRating = programInfo.CommunityRating;
timerInfo.Overview = programInfo.Overview;
timerInfo.OfficialRating = programInfo.OfficialRating;
timerInfo.IsRepeat = programInfo.IsRepeat;
timerInfo.SeriesId = programInfo.SeriesId;
}
public static string GetRecordingName(TimerInfo info)
{
var name = info.Name;

View File

@ -9,14 +9,12 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Querying;
namespace Emby.Server.Implementations.LiveTv
{
@ -25,15 +23,13 @@ namespace Emby.Server.Implementations.LiveTv
private readonly ILogger _logger;
private readonly IImageProcessor _imageProcessor;
private readonly IUserDataManager _userDataManager;
private readonly IDtoService _dtoService;
private readonly IApplicationHost _appHost;
private readonly ILibraryManager _libraryManager;
public LiveTvDtoService(IDtoService dtoService, IUserDataManager userDataManager, IImageProcessor imageProcessor, ILogger logger, IApplicationHost appHost, ILibraryManager libraryManager)
public LiveTvDtoService(IDtoService dtoService, IImageProcessor imageProcessor, ILogger logger, IApplicationHost appHost, ILibraryManager libraryManager)
{
_dtoService = dtoService;
_userDataManager = userDataManager;
_imageProcessor = imageProcessor;
_logger = logger;
_appHost = appHost;

View File

@ -99,7 +99,7 @@ namespace Emby.Server.Implementations.LiveTv
_dtoService = dtoService;
_userDataManager = userDataManager;
_tvDtoService = new LiveTvDtoService(dtoService, userDataManager, imageProcessor, logger, appHost, _libraryManager);
_tvDtoService = new LiveTvDtoService(dtoService, imageProcessor, logger, appHost, _libraryManager);
}
/// <summary>
@ -600,6 +600,12 @@ namespace Emby.Server.Implementations.LiveTv
};
}
if (!string.Equals(info.ShowId, item.ShowId, StringComparison.OrdinalIgnoreCase))
{
item.ShowId = info.ShowId;
forceUpdate = true;
}
var seriesId = info.SeriesId;
if (!item.ParentId.Equals(channel.Id))
@ -3143,5 +3149,15 @@ namespace Emby.Server.Implementations.LiveTv
var provider = _listingProviders.First(i => string.Equals(i.Type, info.Type, StringComparison.OrdinalIgnoreCase));
return provider.GetChannels(info, cancellationToken);
}
public Guid GetInternalChannelId(string serviceName, string externalId)
{
return _tvDtoService.GetInternalChannelId(serviceName, externalId);
}
public Guid GetInternalProgramId(string serviceName, string externalId)
{
return _tvDtoService.GetInternalProgramId(serviceName, externalId);
}
}
}

View File

@ -42,7 +42,6 @@ namespace MediaBrowser.Controller.LiveTv
public string Id { get; set; }
public string Path { get; set; }
public TimerInfo Timer { get; set; }
public ProgramInfo Program { get; set; }
public CancellationTokenSource CancellationTokenSource { get; set; }
}
}

View File

@ -88,6 +88,9 @@ namespace MediaBrowser.Controller.LiveTv
[IgnoreDataMember]
public string EpisodeTitle { get; set; }
[IgnoreDataMember]
public string ShowId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is movie.
/// </summary>

View File

@ -24,8 +24,5 @@ namespace MediaBrowser.Model.Net
/// Sends a UDP message to a particular end point (uni or multicast).
/// </summary>
Task SendToAsync(byte[] buffer, int offset, int bytes, IpEndPointInfo endPoint, CancellationToken cancellationToken);
IAsyncResult BeginSendTo(byte[] buffer, int offset, int size, IpEndPointInfo endPoint, AsyncCallback callback, object state);
int EndSendTo(IAsyncResult result);
}
}

View File

@ -12,9 +12,8 @@
<AssemblyName>RSSDP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -77,8 +76,18 @@
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
</ProjectReference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="EmitMSBuildWarning" BeforeTargets="Build">
<Warning Text="Packages containing MSBuild targets and props files cannot be fully installed in projects targeting multiple frameworks. The MSBuild targets and props files have been ignored." />
</Target>
</Project>

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.30.9")]
[assembly: AssemblyVersion("3.2.30.10")]