Added rudimentary support for DVB-I Service List Entry Points.
This commit is contained in:
parent
a4f8ee5f34
commit
1909331d2d
@ -54,6 +54,9 @@ namespace skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs
|
||||
|
||||
public bool FileExists(string filename)
|
||||
{
|
||||
if (filename.StartsWith("/"))
|
||||
filename = filename.Replace('/', '\\');
|
||||
|
||||
foreach (VfsFile file in vfsFiles)
|
||||
{
|
||||
if (file.ToString().Equals(filename))
|
||||
@ -64,6 +67,9 @@ namespace skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs
|
||||
|
||||
public byte[] GetFile(string filename)
|
||||
{
|
||||
if (filename.StartsWith("/"))
|
||||
filename = filename.Replace('/', '\\');
|
||||
|
||||
foreach (VfsFile file in vfsFiles)
|
||||
{
|
||||
if (file.ToString().Equals(filename))
|
||||
|
||||
@ -8,8 +8,19 @@ namespace skyscraper8.DvbI
|
||||
{
|
||||
public interface DvbIDataStorage
|
||||
{
|
||||
DateTime GetLastServiceListEntryPointUpdateDate(long sourceHash);
|
||||
void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash);
|
||||
void AddDvbiServiceToServiceList(string id, string serviceListId);
|
||||
DateTime GetDvbiServiceListLastUpdateDate(string id);
|
||||
int GetDvbiServiceVersion(string id);
|
||||
DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash);
|
||||
void InsertDvbiServiceList(DvbiServiceList serviceList);
|
||||
void InsertDvbiService(DvbIService service);
|
||||
void InsertDvbiServiceListEntryPoint(long sourceHash);
|
||||
bool TestForServiceListEntryPoints(long sourceHash);
|
||||
bool TestForDvbiService(string id);
|
||||
bool TestForDvbiServiceListEntryPoints(long sourceHash);
|
||||
void UpdateDvbiService(DvbIService service);
|
||||
void UpdateDvbiServiceListEntryPointUpdateDate(long v, DateTime currentTime);
|
||||
void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime);
|
||||
bool TestForDvbiServiceList(string id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,15 +47,16 @@ namespace skyscraper8.DvbI
|
||||
|
||||
DvbIDataStorage dataStorage = (DvbIDataStorage)context.DataStorage;
|
||||
long sourceHash = context.GetSourceHash();
|
||||
if (dataStorage.TestForServiceListEntryPoints(sourceHash))
|
||||
if (dataStorage.TestForDvbiServiceListEntryPoints(sourceHash))
|
||||
{
|
||||
DateTime lastChecked = dataStorage.GetLastServiceListEntryPointUpdateDate(sourceHash);
|
||||
DateTime lastChecked = dataStorage.GetLastDvbiServiceListEntryPointUpdateDate(sourceHash);
|
||||
TimeSpan sinceLastChecked = context.CurrentTime - lastChecked;
|
||||
if (sinceLastChecked.TotalDays < 1.0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.InfoFormat("New DVB-I Service List Entry Point: {0}", context.ToHumanReadableSourceString());
|
||||
dataStorage.InsertDvbiServiceListEntryPoint(sourceHash);
|
||||
}
|
||||
|
||||
@ -64,10 +65,55 @@ namespace skyscraper8.DvbI
|
||||
IEnumerable<DvbiServiceList> enumerable = DvbIUtils.FlattenServiceListEntryPoints(serviceListEntryPoints);
|
||||
foreach(DvbiServiceList serviceList in enumerable)
|
||||
{
|
||||
logger.DebugFormat("Found DVB-I Service List: {0}", serviceList.ToString());
|
||||
DateTime serviceListLastChecked;
|
||||
if (dataStorage.TestForDvbiServiceList(serviceList.Id))
|
||||
{
|
||||
serviceListLastChecked = dataStorage.GetDvbiServiceListLastUpdateDate(serviceList.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.InfoFormat("New DVB-I Service List: {0}", serviceList.Name);
|
||||
dataStorage.InsertDvbiServiceList(serviceList);
|
||||
dataStorage.AddDvbiServiceListToServiceListEntryPoint(serviceList, sourceHash);
|
||||
serviceListLastChecked = new DateTime(1970, 1, 1);
|
||||
}
|
||||
|
||||
TimeSpan sinceLastServiceListCheck = context.CurrentTime - serviceListLastChecked;
|
||||
if (sinceLastServiceListCheck.TotalDays < 1.0)
|
||||
continue;
|
||||
|
||||
if (vfs.FileExists(serviceList.URI))
|
||||
{
|
||||
byte[] serviceListBytes = vfs.GetFile(serviceList.URI);
|
||||
ServiceListType serviceListData = DvbIUtils.UnpackServiceList(serviceListBytes);
|
||||
HandleServiceList(serviceListData, dataStorage, serviceList.Id);
|
||||
dataStorage.UpdateDvbiServiceListLastCheckedDate(serviceList.Id, context.CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
dataStorage.UpdateDvbiServiceListEntryPointUpdateDate(sourceHash, context.CurrentTime);
|
||||
}
|
||||
|
||||
private void HandleServiceList(ServiceListType serviceListData, DvbIDataStorage dataStorage, string serviceListId)
|
||||
{
|
||||
IEnumerable<DvbIService> services = DvbIUtils.FlattenServiceList(serviceListData);
|
||||
foreach(DvbIService service in services)
|
||||
{
|
||||
if (dataStorage.TestForDvbiService(service.Id))
|
||||
{
|
||||
int versionInDb = dataStorage.GetDvbiServiceVersion(service.Id);
|
||||
if (service.Version > versionInDb)
|
||||
{
|
||||
dataStorage.UpdateDvbiService(service);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.InfoFormat("New DVB-I Service: {0}", service.ServiceName);
|
||||
dataStorage.InsertDvbiService(service);
|
||||
dataStorage.AddDvbiServiceToServiceList(service.Id, serviceListId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
48
skyscraper8/DvbI/DvbIService.cs
Normal file
48
skyscraper8/DvbI/DvbIService.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using moe.yo3explorer.skyscraper8.DVBI.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace skyscraper8.DvbI
|
||||
{
|
||||
public class DvbIService
|
||||
{
|
||||
public string ProviderName { get; internal set; }
|
||||
public string LogoURL { get; internal set; }
|
||||
public ushort OriginalNetworkId { get; internal set; }
|
||||
public ushort ServiceId { get; internal set; }
|
||||
public ushort TransportStreamId { get; internal set; }
|
||||
public DVBSDeliveryParametersTypeFEC FEC { get; internal set; }
|
||||
public string Frequency { get; internal set; }
|
||||
public DVBSDeliveryParametersTypeModcodMode Modcod { get; internal set; }
|
||||
public DVBSDeliveryParametersTypeModulationSystem ModulationSystem { get; internal set; }
|
||||
public DVBSDeliveryParametersTypeModulationType ModulationType { get; internal set; }
|
||||
public double OrbitalPosition { get; internal set; }
|
||||
public DVBSDeliveryParametersTypePolarization Polarization { get; internal set; }
|
||||
public DVBSDeliveryParametersTypeRollOff RollOff { get; internal set; }
|
||||
public string SymbolRate { get; internal set; }
|
||||
public string SatIpQueryParameters { get; internal set; }
|
||||
public string ServiceName { get; internal set; }
|
||||
public string ServiceType { get; internal set; }
|
||||
public string Id { get; internal set; }
|
||||
public int Version { get; internal set; }
|
||||
public string? RelatedItem { get; internal set; }
|
||||
public string Country { get; internal set; }
|
||||
public int Ranking { get; internal set; }
|
||||
public string Region { get; internal set; }
|
||||
public string ServiceDescription { get; internal set; }
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is DvbIService service &&
|
||||
Id == service.Id;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25,6 +25,18 @@ namespace skyscraper8.DvbI
|
||||
return serviceListEntryPoint;
|
||||
}
|
||||
|
||||
private static XmlSerializer serviceListSerializer;
|
||||
public static ServiceListType UnpackServiceList(byte[] buffer)
|
||||
{
|
||||
if (serviceListSerializer == null)
|
||||
serviceListSerializer = new XmlSerializer(typeof(ServiceListType));
|
||||
|
||||
MemoryStream slStream = new MemoryStream(buffer, false);
|
||||
object slWrapped = serviceListSerializer.Deserialize(slStream);
|
||||
ServiceListType slt = (ServiceListType)slWrapped;
|
||||
return slt;
|
||||
}
|
||||
|
||||
public static IEnumerable<DvbiServiceList> FlattenServiceListEntryPoints(ServiceListEntryPoints input)
|
||||
{
|
||||
foreach(ServiceListEntryPointsProviderOffering offering in input.ProviderOffering)
|
||||
@ -61,5 +73,158 @@ namespace skyscraper8.DvbI
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
public static IEnumerable<DvbIService> FlattenServiceList(ServiceListType serviceList)
|
||||
{
|
||||
foreach (ServiceType service in serviceList.Items)
|
||||
{
|
||||
DvbIService child = new DvbIService();
|
||||
|
||||
if (service.AdditionalServiceParameters != null)
|
||||
throw new NotImplementedException(nameof(service.AdditionalServiceParameters));
|
||||
|
||||
if (service.ContentGuideServiceRef != null)
|
||||
throw new NotImplementedException(nameof(service.ContentGuideServiceRef));
|
||||
|
||||
if (service.Item != null)
|
||||
child.RelatedItem = service.Item.ToString();
|
||||
|
||||
if (service.NVOD != null)
|
||||
throw new NotImplementedException(nameof(service.NVOD));
|
||||
|
||||
if (service.ParentalRating != null)
|
||||
throw new NotImplementedException(nameof(service.ParentalRating));
|
||||
|
||||
if (service.ProminenceList != null)
|
||||
{
|
||||
child.Country = service.ProminenceList[0].country;
|
||||
child.Ranking = int.Parse(service.ProminenceList[0].ranking);
|
||||
child.Region = service.ProminenceList[0].region;
|
||||
}
|
||||
|
||||
if (service.ProviderName != null)
|
||||
child.ProviderName = service.ProviderName[0].Value;
|
||||
|
||||
if (service.RecordingInfo != null)
|
||||
throw new NotImplementedException(nameof(service.RecordingInfo));
|
||||
|
||||
if (service.RelatedMaterial != null)
|
||||
{
|
||||
foreach(RelatedMaterialType rmt in service.RelatedMaterial)
|
||||
{
|
||||
if (rmt.HowRelated == null)
|
||||
continue;
|
||||
|
||||
if (rmt.Items == null)
|
||||
continue;
|
||||
|
||||
if (rmt.Items.Length == 0)
|
||||
continue;
|
||||
|
||||
string key = rmt.HowRelated.href;
|
||||
string value = ExtractUrlFromRelatedMaterial(rmt);
|
||||
|
||||
if (string.IsNullOrEmpty(value))
|
||||
continue;
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case "urn:dvb:metadata:cs:HowRelatedCS:2021:1001.2":
|
||||
child.LogoURL = value;
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (service.ServiceDescription != null)
|
||||
child.ServiceDescription = service.ServiceDescription[0].Value;
|
||||
|
||||
if (service.ServiceGenre != null)
|
||||
{
|
||||
GenreType genre = service.ServiceGenre[0];
|
||||
if (genre.Definition != null)
|
||||
throw new NotImplementedException(nameof(genre.Definition));
|
||||
|
||||
if (genre.Name != null)
|
||||
throw new NotImplementedException(nameof(genre.Name));
|
||||
|
||||
if (genre.metadataOriginIDRef != null)
|
||||
throw new NotImplementedException(nameof(genre.metadataOriginIDRef));
|
||||
|
||||
}
|
||||
|
||||
if (service.ServiceInstance != null)
|
||||
{
|
||||
foreach(object si in service.ServiceInstance[0].Items)
|
||||
{
|
||||
Type serviceInstanceType = si.GetType();
|
||||
if (serviceInstanceType == typeof(DVBSDeliveryParametersType))
|
||||
{
|
||||
DVBSDeliveryParametersType s = (DVBSDeliveryParametersType)si;
|
||||
if (s.DVBTriplet != null)
|
||||
{
|
||||
child.OriginalNetworkId = s.DVBTriplet.origNetId;
|
||||
child.ServiceId = s.DVBTriplet.serviceId;
|
||||
child.TransportStreamId = s.DVBTriplet.tsId;
|
||||
}
|
||||
child.FEC = s.FEC;
|
||||
child.Frequency = s.Frequency;
|
||||
child.Modcod = s.ModcodMode;
|
||||
child.ModulationSystem = s.ModulationSystem;
|
||||
child.ModulationType = s.ModulationType;
|
||||
child.OrbitalPosition = s.OrbitalPosition;
|
||||
child.Polarization = s.Polarization;
|
||||
child.RollOff = s.RollOff;
|
||||
child.SymbolRate = s.SymbolRate;
|
||||
}
|
||||
else if (serviceInstanceType == typeof(SATIPDeliveryParametersType))
|
||||
{
|
||||
SATIPDeliveryParametersType satip = (SATIPDeliveryParametersType)si;
|
||||
child.SatIpQueryParameters = satip.QueryParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (service.ServiceName != null)
|
||||
child.ServiceName = service.ServiceName[0].Value;
|
||||
|
||||
if (service.ServiceType1 != null)
|
||||
child.ServiceType = service.ServiceType1.href;
|
||||
|
||||
if (service.TargetRegion != null)
|
||||
throw new NotImplementedException();
|
||||
|
||||
child.Id = service.UniqueIdentifier;
|
||||
child.Version = int.Parse(service.version);
|
||||
yield return child;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
private static string ExtractUrlFromRelatedMaterial(RelatedMaterialType rmt)
|
||||
{
|
||||
foreach(object o in rmt.Items)
|
||||
{
|
||||
if (o.GetType() == typeof(TVAMediaLocatorType))
|
||||
{
|
||||
TVAMediaLocatorType tVAMediaLocator = (TVAMediaLocatorType)o;
|
||||
foreach (object p in tVAMediaLocator.Items)
|
||||
{
|
||||
if (p.GetType() == typeof(ExtendedURIType))
|
||||
{
|
||||
ExtendedURIType extendedURI = (ExtendedURIType)p;
|
||||
return extendedURI.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException(o.GetType().FullName);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace skyscraper8.DvbI
|
||||
{
|
||||
internal class DvbiServiceList
|
||||
public class DvbiServiceList
|
||||
{
|
||||
public string Id { get; internal set; }
|
||||
public string Name { get; internal set; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,7 @@ using skyscraper5.src.Skyscraper.FrequencyListGenerator;
|
||||
using skyscraper5.src.Skyscraper.Scraper.Dns;
|
||||
using skyscraper5.src.Skyscraper.Scraper.Storage.InMemory;
|
||||
using skyscraper5.Teletext;
|
||||
using skyscraper8.DvbI;
|
||||
using skyscraper8.Ses;
|
||||
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
|
||||
|
||||
@ -1428,7 +1429,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public DateTime GetLastServiceListEntryPointUpdateDate(long sourceHash)
|
||||
public DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -1442,5 +1443,65 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public DateTime GetDvbiServiceListLastUpdateDate(string id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void InsertDvbiServiceList(DvbiServiceList serviceList)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TestForDvbiService(string id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TestForDvbiServiceListEntryPoints(long sourceHash)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void AddDvbiServiceToServiceList(string id, string serviceListId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetDvbiServiceVersion(string id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void InsertDvbiService(DvbIService service)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void UpdateDvbiService(DvbIService service)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void UpdateDvbiServiceListEntryPointUpdateDate(long v, DateTime currentTime)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TestForDvbiServiceList(string id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,9 @@ using skyscraper5.src.Skyscraper.FrequencyListGenerator;
|
||||
using skyscraper5.src.Skyscraper.Scraper.Dns;
|
||||
using skyscraper5.src.Skyscraper.Scraper.Storage.InMemory;
|
||||
using skyscraper5.Teletext;
|
||||
using skyscraper8.DvbI;
|
||||
using skyscraper8.Ses;
|
||||
using skyscraper8.Ses.Descriptors;
|
||||
using skyscraper8.Skyscraper.Scraper.Storage.InMemory.Model;
|
||||
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
|
||||
|
||||
@ -1290,33 +1292,170 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
|
||||
sgtServices.Add(child);
|
||||
}
|
||||
|
||||
public DateTime GetLastServiceListEntryPointUpdateDate(long sourceHash)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void InsertDvbiServiceListEntryPoint(long sourceHash)
|
||||
{
|
||||
if (_serviceListEntryPointCoordinates == null)
|
||||
_serviceListEntryPointCoordinates = new HashSet<ServiceListEntryPointCoordinate>();
|
||||
if (_dvbiServiceListEntryPointsCoordinates == null)
|
||||
_dvbiServiceListEntryPointsCoordinates = new HashSet<DvbiServiceListEntryPointsCoordinate>();
|
||||
|
||||
ServiceListEntryPointCoordinate newCoordinate = new ServiceListEntryPointCoordinate();
|
||||
newCoordinate.hash = sourceHash;
|
||||
_serviceListEntryPointCoordinates.Add(newCoordinate);
|
||||
DvbiServiceListEntryPointsCoordinate coordinate = new DvbiServiceListEntryPointsCoordinate();
|
||||
coordinate.Hash = sourceHash;
|
||||
_dvbiServiceListEntryPointsCoordinates.Add(coordinate);
|
||||
}
|
||||
|
||||
public bool TestForServiceListEntryPoints(long sourceHash)
|
||||
{
|
||||
if (_serviceListEntryPointCoordinates == null)
|
||||
return false;
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private HashSet<ServiceListEntryPointCoordinate> _serviceListEntryPointCoordinates;
|
||||
class ServiceListEntryPointCoordinate
|
||||
{
|
||||
public long hash;
|
||||
}
|
||||
public void InsertDvbiServiceList(DvbiServiceList serviceList)
|
||||
{
|
||||
if (_dvbiServiceLists == null)
|
||||
_dvbiServiceLists = new Dictionary<string, DvbiServiceList>();
|
||||
|
||||
_dvbiServiceLists.Add(serviceList.Id, serviceList);
|
||||
}
|
||||
|
||||
public bool TestForDvbiServiceList(string id)
|
||||
{
|
||||
if (_dvbiServiceLists == null)
|
||||
return false;
|
||||
|
||||
return _dvbiServiceLists.ContainsKey(id);
|
||||
}
|
||||
|
||||
private Dictionary<string, DvbiServiceList> _dvbiServiceLists;
|
||||
|
||||
private class DvbiServiceListEntryPointsCoordinate
|
||||
{
|
||||
public long Hash { get; internal set; }
|
||||
public DateTime LastUpdate { get; internal set; }
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is DvbiServiceListEntryPointsCoordinate coordinate &&
|
||||
Hash == coordinate.Hash;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(Hash);
|
||||
}
|
||||
}
|
||||
private HashSet<DvbiServiceListEntryPointsCoordinate> _dvbiServiceListEntryPointsCoordinates;
|
||||
|
||||
|
||||
public void UpdateDvbiServiceListEntryPointUpdateDate(long v, DateTime currentTime)
|
||||
{
|
||||
foreach(DvbiServiceListEntryPointsCoordinate coord in _dvbiServiceListEntryPointsCoordinates)
|
||||
{
|
||||
if (coord.Hash == v)
|
||||
{
|
||||
coord.LastUpdate = currentTime;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool TestForDvbiServiceListEntryPoints(long sourceHash)
|
||||
{
|
||||
if (_dvbiServiceListEntryPointsCoordinates == null)
|
||||
return false;
|
||||
|
||||
foreach (DvbiServiceListEntryPointsCoordinate coord in _dvbiServiceListEntryPointsCoordinates)
|
||||
{
|
||||
if (coord.Hash == sourceHash)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Dictionary<string, DateTime> _dvbiServiceListLastChecked;
|
||||
public void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime)
|
||||
{
|
||||
if (_dvbiServiceListLastChecked == null)
|
||||
_dvbiServiceListLastChecked = new Dictionary<string, DateTime>();
|
||||
|
||||
_dvbiServiceListLastChecked[id] = currentTime;
|
||||
}
|
||||
|
||||
public DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash)
|
||||
{
|
||||
foreach (DvbiServiceListEntryPointsCoordinate coord in _dvbiServiceListEntryPointsCoordinates)
|
||||
{
|
||||
if (coord.Hash == sourceHash)
|
||||
{
|
||||
return coord.LastUpdate;
|
||||
}
|
||||
}
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
|
||||
public DateTime GetDvbiServiceListLastUpdateDate(string id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Dictionary<long, List<string>> _dvbiServiceListEntryPointToServiceListMapping;
|
||||
public void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash)
|
||||
{
|
||||
if (_dvbiServiceListEntryPointToServiceListMapping == null)
|
||||
_dvbiServiceListEntryPointToServiceListMapping = new Dictionary<long, List<string>>();
|
||||
|
||||
if (!_dvbiServiceListEntryPointToServiceListMapping.ContainsKey(sourceHash))
|
||||
_dvbiServiceListEntryPointToServiceListMapping.Add(sourceHash, new List<string>());
|
||||
|
||||
if (!_dvbiServiceListEntryPointToServiceListMapping[sourceHash].Contains(serviceList.Id))
|
||||
_dvbiServiceListEntryPointToServiceListMapping[sourceHash].Add(serviceList.Id);
|
||||
}
|
||||
|
||||
private Dictionary<string, List<string>> _dvbiServiceToServiceListMapping;
|
||||
public void AddDvbiServiceToServiceList(string id, string serviceListId)
|
||||
{
|
||||
if (_dvbiServiceToServiceListMapping == null)
|
||||
_dvbiServiceToServiceListMapping = new Dictionary<string, List<string>>();
|
||||
|
||||
if (!_dvbiServiceToServiceListMapping.ContainsKey(serviceListId))
|
||||
_dvbiServiceToServiceListMapping.Add(serviceListId, new List<string>());
|
||||
|
||||
if (!_dvbiServiceToServiceListMapping[serviceListId].Contains(id))
|
||||
_dvbiServiceToServiceListMapping [serviceListId].Add(id);
|
||||
}
|
||||
|
||||
public int GetDvbiServiceVersion(string id)
|
||||
{
|
||||
foreach(DvbIService service in _dvbiServices)
|
||||
{
|
||||
if (service.Id.Equals(id))
|
||||
{
|
||||
return service.Version;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private HashSet<DvbIService> _dvbiServices;
|
||||
public bool TestForDvbiService(string id)
|
||||
{
|
||||
if (_dvbiServices == null)
|
||||
return false;
|
||||
|
||||
return _dvbiServices.Any(x => x.Id.Equals(id));
|
||||
}
|
||||
|
||||
public void InsertDvbiService(DvbIService service)
|
||||
{
|
||||
if (_dvbiServices == null)
|
||||
_dvbiServices = new HashSet<DvbIService>();
|
||||
|
||||
_dvbiServices.Add(service);
|
||||
}
|
||||
|
||||
public void UpdateDvbiService(DvbIService service)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ using skyscraper5.src.InteractionChannel.Model.Descriptors;
|
||||
using skyscraper5.src.Skyscraper.FrequencyListGenerator;
|
||||
using skyscraper5.src.Skyscraper.Scraper.Dns;
|
||||
using skyscraper5.Teletext;
|
||||
using skyscraper8.DvbI;
|
||||
using skyscraper8.Ses;
|
||||
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
|
||||
|
||||
@ -165,5 +166,19 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
|
||||
void InsertSgtList(SgtList list);
|
||||
bool TestForSgtService(SgtService child);
|
||||
void InsertSgtService(SgtService child);
|
||||
void InsertDvbiServiceListEntryPoint(long sourceHash);
|
||||
bool TestForServiceListEntryPoints(long sourceHash);
|
||||
void InsertDvbiServiceList(DvbiServiceList serviceList);
|
||||
bool TestForDvbiService(string id);
|
||||
bool TestForDvbiServiceListEntryPoints(long sourceHash);
|
||||
void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime);
|
||||
DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash);
|
||||
DateTime GetDvbiServiceListLastUpdateDate(string id);
|
||||
void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash);
|
||||
void AddDvbiServiceToServiceList(string id, string serviceListId);
|
||||
int GetDvbiServiceVersion(string id);
|
||||
void UpdateDvbiService(DvbIService service);
|
||||
void UpdateDvbiServiceListEntryPointUpdateDate(long hash, DateTime currentTime);
|
||||
void InsertDvbiService(DvbIService service);
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ using skyscraper5.src.InteractionChannel.Model.Descriptors;
|
||||
using skyscraper5.src.Skyscraper.FrequencyListGenerator;
|
||||
using skyscraper5.src.Skyscraper.Scraper.Dns;
|
||||
using skyscraper5.Teletext;
|
||||
using skyscraper8.DvbI;
|
||||
using skyscraper8.Ses;
|
||||
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
|
||||
|
||||
@ -869,7 +870,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
|
||||
{
|
||||
return dataStorage.TestForSgtList(list);
|
||||
}
|
||||
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public void InsertSgtList(SgtList list)
|
||||
{
|
||||
@ -888,17 +889,90 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
|
||||
dataStorage.InsertSgtService(child);
|
||||
}
|
||||
|
||||
public DateTime GetLastServiceListEntryPointUpdateDate(long sourceHash)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public void InsertDvbiServiceListEntryPoint(long sourceHash)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
dataStorage.InsertDvbiServiceListEntryPoint(sourceHash);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public bool TestForServiceListEntryPoints(long sourceHash)
|
||||
{
|
||||
return dataStorage.TestForServiceListEntryPoints(sourceHash);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public void InsertDvbiServiceList(DvbiServiceList serviceList)
|
||||
{
|
||||
dataStorage.InsertDvbiServiceList(serviceList);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public bool TestForDvbiService(string id)
|
||||
{
|
||||
return dataStorage.TestForDvbiService(id);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public bool TestForDvbiServiceListEntryPoints(long sourceHash)
|
||||
{
|
||||
return dataStorage.TestForDvbiServiceListEntryPoints(sourceHash);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime)
|
||||
{
|
||||
dataStorage.UpdateDvbiServiceListLastCheckedDate(id, currentTime);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash)
|
||||
{
|
||||
return dataStorage.GetLastDvbiServiceListEntryPointUpdateDate(sourceHash);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public DateTime GetDvbiServiceListLastUpdateDate(string id)
|
||||
{
|
||||
return dataStorage.GetDvbiServiceListLastUpdateDate(id);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash)
|
||||
{
|
||||
dataStorage.AddDvbiServiceListToServiceListEntryPoint(serviceList, sourceHash);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public void AddDvbiServiceToServiceList(string id, string serviceListId)
|
||||
{
|
||||
dataStorage.AddDvbiServiceToServiceList(id, serviceListId);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public int GetDvbiServiceVersion(string id)
|
||||
{
|
||||
return dataStorage.GetDvbiServiceVersion(id);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public void UpdateDvbiService(DvbIService service)
|
||||
{
|
||||
dataStorage.UpdateDvbiService(service);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public void UpdateDvbiServiceListEntryPointUpdateDate(long hash, DateTime currentTime)
|
||||
{
|
||||
dataStorage.UpdateDvbiServiceListEntryPointUpdateDate(hash, currentTime);
|
||||
}
|
||||
|
||||
public void InsertDvbiService(DvbIService service)
|
||||
{
|
||||
dataStorage.InsertDvbiService(service);
|
||||
}
|
||||
|
||||
public bool TestForDvbiServiceList(string id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@ -34,5 +34,16 @@ namespace skyscraper8.yo3explorer
|
||||
throw new NotImplementedException(Source.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
internal string ToHumanReadableSourceString()
|
||||
{
|
||||
switch (Source)
|
||||
{
|
||||
case ServiceListEntryPointSource.TransportStream:
|
||||
return String.Format("ONID: {0}, TSID: {1}, PID: {2}", OriginalNetworkId.Value, TransportStreamId.Value, PID);
|
||||
default:
|
||||
throw new NotImplementedException(Source.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user