NIP Metadata Storage Proof-of-Concept.

This commit is contained in:
feyris-tan 2025-06-22 14:29:44 +02:00
parent 7590c7c5bc
commit 17b1350185
12 changed files with 1240 additions and 928 deletions

View File

@ -34,6 +34,9 @@ namespace skyscraper8.DvbI
public string Region { get; internal set; } public string Region { get; internal set; }
public string ServiceDescription { get; internal set; } public string ServiceDescription { get; internal set; }
public string BannerURL { get; internal set; }
public string LinkedApplication { get; set; }
public override bool Equals(object? obj) public override bool Equals(object? obj)
{ {
return obj is DvbIService service && return obj is DvbIService service &&

View File

@ -139,6 +139,12 @@ namespace skyscraper8.DvbI
case "urn:dvb:metadata:cs:HowRelatedCS:2021:1001.2": case "urn:dvb:metadata:cs:HowRelatedCS:2021:1001.2":
child.LogoURL = value; child.LogoURL = value;
break; break;
case "urn:dvb:metadata:cs:HowRelatedCS:2021:1001.3":
child.BannerURL = value;
break;
case "urn:dvb:metadata:cs:LinkedApplicationCS:2019:1.1":
child.LinkedApplication = value;
break;
default: default:
throw new NotImplementedException(key); throw new NotImplementedException(key);
} }

View File

@ -130,6 +130,7 @@ namespace skyscraper8.DvbNip
string serviceListId = serviceListUrls[fluteListener.FileAssociation.ContentLocation]; string serviceListId = serviceListUrls[fluteListener.FileAssociation.ContentLocation];
Stream serviceListStream = fluteListener.ToStream(); Stream serviceListStream = fluteListener.ToStream();
byte[] serviceListByteArray = new byte[serviceListStream.Length]; byte[] serviceListByteArray = new byte[serviceListStream.Length];
serviceListStream.Read(serviceListByteArray, 0, (int)serviceListStream.Length);
ServiceListType serviceList = DvbIUtils.UnpackServiceList(serviceListByteArray); ServiceListType serviceList = DvbIUtils.UnpackServiceList(serviceListByteArray);
EventHandler.OnServiceList(CurrentCarrierInformation, serviceListId, serviceList); EventHandler.OnServiceList(CurrentCarrierInformation, serviceListId, serviceList);
} }
@ -158,9 +159,13 @@ namespace skyscraper8.DvbNip
{ {
switch (fluteListener.FileAssociation.ContentLocation) switch (fluteListener.FileAssociation.ContentLocation)
{ {
case "urn:dvb:metadata:cs:NativeIPMulticastTransportObjectTypeCS:2023:bootstrap":
MulticastGatewayConfigurationType multicastGatewayConfiguration2023 = DvbNipUtilities.UnpackMulticastGatewayConfiguration(fluteListener.ToStream());
EventHandler?.OnMulticastGatewayConfiguration(CurrentCarrierInformation, multicastGatewayConfiguration2023);
return true;
case "urn:dvb:metadata:cs:MulticastTransportObjectTypeCS:2021:gateway-configuration": case "urn:dvb:metadata:cs:MulticastTransportObjectTypeCS:2021:gateway-configuration":
MulticastGatewayConfigurationType multicastGatewayConfiguration = DvbNipUtilities.UnpackMulticastGatewayConfiguration(fluteListener.ToStream()); MulticastGatewayConfigurationType multicastGatewayConfiguration2021 = DvbNipUtilities.UnpackMulticastGatewayConfiguration(fluteListener.ToStream());
EventHandler?.OnMulticastGatewayConfiguration(CurrentCarrierInformation, multicastGatewayConfiguration); EventHandler?.OnMulticastGatewayConfiguration(CurrentCarrierInformation, multicastGatewayConfiguration2021);
return true; return true;
case "urn:dvb:metadata:nativeip:PrivateDataSignalling": case "urn:dvb:metadata:nativeip:PrivateDataSignalling":
PrivateDataSignallingManifestType privateDataSignallingManifest = DvbNipUtilities.UnpackPrivateDataSignallingManifest(fluteListener.ToStream()); PrivateDataSignallingManifestType privateDataSignallingManifest = DvbNipUtilities.UnpackPrivateDataSignallingManifest(fluteListener.ToStream());
@ -196,6 +201,10 @@ namespace skyscraper8.DvbNip
ServiceInformationFileType serviceInformationFile = DvbNipUtilities.UnpackServiceInformationFile(fluteListener.ToStream()); ServiceInformationFileType serviceInformationFile = DvbNipUtilities.UnpackServiceInformationFile(fluteListener.ToStream());
EventHandler?.OnServiceInformationFile(CurrentCarrierInformation, serviceInformationFile); EventHandler?.OnServiceInformationFile(CurrentCarrierInformation, serviceInformationFile);
return true; return true;
case "urn:dvb:metadata:nativeip:ServiceGuide":
//Unfortunately, the NIPServiceGuideManifest does not contain any useful information at all, which is why we ignore it.
//There doesn't seem to be a way to get the actual EIT XML from it.
return true;
default: default:
throw new NotImplementedException(fluteListener.FileAssociation.ContentLocation); throw new NotImplementedException(fluteListener.FileAssociation.ContentLocation);
} }

View File

@ -63,6 +63,7 @@ namespace skyscraper5
SkyscraperContext skyscraperContext = new SkyscraperContext(new TsContext()); SkyscraperContext skyscraperContext = new SkyscraperContext(new TsContext());
skyscraperContext.InitalizeFilterChain(); skyscraperContext.InitalizeFilterChain();
skyscraperContext.IngestFromStream(m3U8Stream); skyscraperContext.IngestFromStream(m3U8Stream);
return;
} }
if (args[0].Equals("aactest")) if (args[0].Equals("aactest"))

View File

@ -2460,10 +2460,41 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnMulticastGatewayConfiguration(NipActualCarrierInformation carrier, MulticastGatewayConfigurationType multicastGatewayConfiguration) public void OnMulticastGatewayConfiguration(NipActualCarrierInformation carrier, MulticastGatewayConfigurationType multicastGatewayConfiguration)
{ {
if (multicastGatewayConfiguration.MulticastSession == null) if (multicastGatewayConfiguration.MulticastSession != null)
return; {
foreach (MulticastSessionType multicastSession in multicastGatewayConfiguration.MulticastSession)
{
if (!ScraperStorage.DvbNipTestForMulticastSession(multicastSession))
{
LogEvent(SkyscraperContextEvent.DvbNipMulticastSession, multicastSession.serviceIdentifier);
ScraperStorage.DvbNipInsertMulticastSession(multicastSession);
}
}
}
throw new NotImplementedException(); if (multicastGatewayConfiguration.MulticastGatewayConfigurationTransportSession != null)
{
foreach (MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession in multicastGatewayConfiguration.MulticastGatewayConfigurationTransportSession)
{
if (multicastGatewayConfigurationTransportSession.EndpointAddress == null)
continue;
MulticastEndpointAddressType endpointAddress = multicastGatewayConfigurationTransportSession.EndpointAddress[0];
if (!ScraperStorage.DvbNipTestForMulticastGatewayConfigurationTransportSession(carrier, endpointAddress))
{
string name = String.Format("{0} -> {1}:{2}, TSI = {3}", endpointAddress.NetworkSourceAddress,
endpointAddress.NetworkDestinationGroupAddress, endpointAddress.TransportDestinationPort,
endpointAddress.MediaTransportSessionIdentifier);
LogEvent(SkyscraperContextEvent.DvbNipMulticastGatewayConfigurationTransportSession, name);
ScraperStorage.DvbNipInsertMulticastGatewayConfigurationTransportSession(carrier, multicastGatewayConfigurationTransportSession);
}
}
}
if (multicastGatewayConfiguration.MulticastGatewaySessionReporting != null)
{
throw new NotImplementedException(nameof(multicastGatewayConfiguration.MulticastGatewaySessionReporting));
}
} }
public void OnNipCarrierDetected(NipActualCarrierInformation currentCarrierInformation) public void OnNipCarrierDetected(NipActualCarrierInformation currentCarrierInformation)
@ -2549,7 +2580,25 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnServiceList(NipActualCarrierInformation currentCarrierInformation, string serviceListId, public void OnServiceList(NipActualCarrierInformation currentCarrierInformation, string serviceListId,
ServiceListType serviceList) ServiceListType serviceList)
{ {
throw new NotImplementedException(); List<DvbIService> services = DvbIUtils.FlattenServiceList(serviceList).ToList();
DvbIDataStorage dataStorage = ScraperStorage;
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);
}
}
} }
public void OnTimeOffsetFile(NipActualCarrierInformation currentCarrierInformation, TimeOffsetFileType timeOffsetFile) public void OnTimeOffsetFile(NipActualCarrierInformation currentCarrierInformation, TimeOffsetFileType timeOffsetFile)

View File

@ -78,6 +78,8 @@
FluteFileProgress, FluteFileProgress,
NipPrivateDataSpecifier, NipPrivateDataSpecifier,
DvbNipNetwork, DvbNipNetwork,
DvbNipService DvbNipService,
DvbNipMulticastSession,
DvbNipMulticastGatewayConfigurationTransportSession
} }
} }

View File

@ -1479,6 +1479,28 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession)
{
throw new NotImplementedException();
}
public void DvbNipInsertMulticastSession(MulticastSessionType multicastSession)
{
throw new NotImplementedException();
}
public bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
MulticastEndpointAddressType multicastEndpointAddressType)
{
throw new NotImplementedException();
}
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession)
{
throw new NotImplementedException();
}
public DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash) public DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -190,5 +190,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage
void DvbNipInsertNetwork(BroadcastNetworkType network); void DvbNipInsertNetwork(BroadcastNetworkType network);
bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType); bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType);
void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType); void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType);
bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession);
void DvbNipInsertMulticastSession(MulticastSessionType multicastSession);
bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastEndpointAddressType);
void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession);
} }
} }

View File

@ -37,6 +37,7 @@ using System.Linq;
using System.Net; using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using skyscraper8.Ietf.FLUTE; using skyscraper8.Ietf.FLUTE;
using skyscraper8.Skyscraper.Scraper.Storage.Utilities;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
@ -178,7 +179,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
public bool StorePatEntry(int currentNetworkId, int currentTransportStreamId, int pmtPid, ushort programId) public bool StorePatEntry(int currentNetworkId, int currentTransportStreamId, int pmtPid, ushort programId)
{ {
InMemoryPatEntry inMemoryPatEntry = new InMemoryPatEntry(currentNetworkId, currentTransportStreamId, pmtPid, programId); InMemoryPatEntry inMemoryPatEntry =
new InMemoryPatEntry(currentNetworkId, currentTransportStreamId, pmtPid, programId);
return patEntries.Add(inMemoryPatEntry); return patEntries.Add(inMemoryPatEntry);
} }
@ -206,7 +208,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return result; return result;
} }
public bool StoreTeletextPage(int networkId, int transportStreamId, ushort programNumber, TeletextMagazine magazine, DateTime timestamp) public bool StoreTeletextPage(int networkId, int transportStreamId, ushort programNumber,
TeletextMagazine magazine, DateTime timestamp)
{ {
return false; return false;
} }
@ -222,13 +225,15 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return sdtServices[transportStreamId][originalNetworkId][sdtService.ServiceId] != null; return sdtServices[transportStreamId][originalNetworkId][sdtService.ServiceId] != null;
} }
public bool TestForTeletextPage(int networkId, int transportStreamId, ushort programNumber, TeletextMagazine magazine, DateTime timestamp) public bool TestForTeletextPage(int networkId, int transportStreamId, ushort programNumber,
TeletextMagazine magazine, DateTime timestamp)
{ {
//No need to keep teletext pages in memory //No need to keep teletext pages in memory
return true; return true;
} }
public void MarkTeletextPageAsKnown(int networkId, int transportStreamId, ushort programNumber, TeletextMagazine magazine, DateTime timestamp) public void MarkTeletextPageAsKnown(int networkId, int transportStreamId, ushort programNumber,
TeletextMagazine magazine, DateTime timestamp)
{ {
//No need to keep teletext pages in memory //No need to keep teletext pages in memory
} }
@ -352,7 +357,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
batTransportStreams[batBouquetBouquetId][child.TransportStreamId] = child; batTransportStreams[batBouquetBouquetId][child.TransportStreamId] = child;
} }
public bool UpdateTimeOffsetTable(int currentNetworkId, int currentTransportStreamId, DateTime newTime, LocalTimeOffsetDescriptor ltod) public bool UpdateTimeOffsetTable(int currentNetworkId, int currentTransportStreamId, DateTime newTime,
LocalTimeOffsetDescriptor ltod)
{ {
if (timeOffsets[currentNetworkId] == null) if (timeOffsets[currentNetworkId] == null)
timeOffsets[currentNetworkId] = new Tuple<DateTime, LocalTimeOffsetDescriptor>[ushort.MaxValue]; timeOffsets[currentNetworkId] = new Tuple<DateTime, LocalTimeOffsetDescriptor>[ushort.MaxValue];
@ -363,7 +369,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
if ((newTime - oldTime).TotalSeconds < 10) if ((newTime - oldTime).TotalSeconds < 10)
return false; return false;
} }
timeOffsets[currentNetworkId][currentTransportStreamId] = new Tuple<DateTime, LocalTimeOffsetDescriptor>(newTime, ltod);
timeOffsets[currentNetworkId][currentTransportStreamId] =
new Tuple<DateTime, LocalTimeOffsetDescriptor>(newTime, ltod);
return true; return true;
} }
@ -390,7 +398,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
public bool TestForAitApplication(ApplicationIdentifier aitApplicationApplicationIdentifier) public bool TestForAitApplication(ApplicationIdentifier aitApplicationApplicationIdentifier)
{ {
AitApplicationCoordinate aitCoordinate = new AitApplicationCoordinate(aitApplicationApplicationIdentifier.OrganisationId, aitApplicationApplicationIdentifier.ApplicationId); AitApplicationCoordinate aitCoordinate = new AitApplicationCoordinate(
aitApplicationApplicationIdentifier.OrganisationId, aitApplicationApplicationIdentifier.ApplicationId);
return aitApplicationCoordinates.Contains(aitCoordinate); return aitApplicationCoordinates.Contains(aitCoordinate);
} }
@ -406,7 +415,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
public bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId) public bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId)
{ {
string outPath = String.Format("{0}{1}{2}{1}{3}{4}", networkId, Path.DirectorySeparatorChar, transportStreamId, vfsFile.SourcePid, vfsFile.ToString()); string outPath = String.Format("{0}{1}{2}{1}{3}{4}", networkId, Path.DirectorySeparatorChar,
transportStreamId, vfsFile.SourcePid, vfsFile.ToString());
FileInfo outFileInfo = new FileInfo(outPath); FileInfo outFileInfo = new FileInfo(outPath);
if (outFileInfo.Exists) if (outFileInfo.Exists)
return false; return false;
@ -417,13 +427,15 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
public bool TestForCaSystem(int currentNetworkId, int currentTransportStreamId, int caDescriptorCaPid) public bool TestForCaSystem(int currentNetworkId, int currentTransportStreamId, int caDescriptorCaPid)
{ {
InMemoryCaSystem find = caSystems.Find(x => x.CurrentNetworkId == currentNetworkId && x.CurrentTransportStreamId == currentTransportStreamId && x.CaPid == caDescriptorCaPid); InMemoryCaSystem find = caSystems.Find(x =>
x.CurrentNetworkId == currentNetworkId && x.CurrentTransportStreamId == currentTransportStreamId &&
x.CaPid == caDescriptorCaPid);
return find != null; return find != null;
} }
public void StoreCaSystem(int currentNetworkId, int currentTransportStreamId, CaDescriptor caDescriptor) public void StoreCaSystem(int currentNetworkId, int currentTransportStreamId, CaDescriptor caDescriptor)
{ {
InMemoryCaSystem caSystem = new InMemoryCaSystem(currentNetworkId, currentTransportStreamId,caDescriptor); InMemoryCaSystem caSystem = new InMemoryCaSystem(currentNetworkId, currentTransportStreamId, caDescriptor);
caSystems.Add(caSystem); caSystems.Add(caSystem);
} }
@ -432,15 +444,19 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return updateHashes.Contains(hashCode); return updateHashes.Contains(hashCode);
} }
public void StoreUpdateNotification(int hashCode, UpdateNotificationGroup common, Compatibility compatibility, Platform platform) public void StoreUpdateNotification(int hashCode, UpdateNotificationGroup common, Compatibility compatibility,
Platform platform)
{ {
updateHashes.Add(hashCode); updateHashes.Add(hashCode);
updates.Add(new Tuple<int, Compatibility, Platform>(hashCode, compatibility, platform)); updates.Add(new Tuple<int, Compatibility, Platform>(hashCode, compatibility, platform));
} }
public void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleModuleId, byte moduleModuleVersion, Stream result) public void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid,
ushort moduleModuleId, byte moduleModuleVersion, Stream result)
{ {
string outPath = String.Format("{0}{1}{2}{1}{3}{1}{4}_{5}.bin", currentNetworkId, Path.DirectorySeparatorChar, currentTransportStreamId, elementaryPid, moduleModuleId, moduleModuleVersion); string outPath = String.Format("{0}{1}{2}{1}{3}{1}{4}_{5}.bin", currentNetworkId,
Path.DirectorySeparatorChar, currentTransportStreamId, elementaryPid, moduleModuleId,
moduleModuleVersion);
FileInfo fi = new FileInfo(outPath); FileInfo fi = new FileInfo(outPath);
if (fi.Exists) if (fi.Exists)
return; return;
@ -450,7 +466,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
fileStream.Close(); fileStream.Close();
fileStream.Dispose(); fileStream.Dispose();
DsmCcModuleXmlMemory.GetInstance().MarkComplete(currentNetworkId, currentTransportStreamId, elementaryPid, moduleModuleId, moduleModuleVersion); DsmCcModuleXmlMemory.GetInstance().MarkComplete(currentNetworkId, currentTransportStreamId, elementaryPid,
moduleModuleId, moduleModuleVersion);
} }
@ -482,7 +499,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
rdsDataPresent[currentNetworkId][currentTransportStreamId][programNumber] = true; rdsDataPresent[currentNetworkId][currentTransportStreamId][programNumber] = true;
} }
public bool UpdateRdsProgrammeServiceName(int currentNetworkId, int currentTransportStreamId, int programNumber, string programmeService2) public bool UpdateRdsProgrammeServiceName(int currentNetworkId, int currentTransportStreamId, int programNumber,
string programmeService2)
{ {
if (rdsProgrammeService == null) if (rdsProgrammeService == null)
rdsProgrammeService = new string[ushort.MaxValue][][]; rdsProgrammeService = new string[ushort.MaxValue][][];
@ -493,19 +511,23 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
if (rdsProgrammeService[currentNetworkId][currentTransportStreamId] == null) if (rdsProgrammeService[currentNetworkId][currentTransportStreamId] == null)
rdsProgrammeService[currentNetworkId][currentTransportStreamId] = new string[ushort.MaxValue]; rdsProgrammeService[currentNetworkId][currentTransportStreamId] = new string[ushort.MaxValue];
bool result = !string.Equals(programmeService2, rdsProgrammeService[currentNetworkId][currentTransportStreamId][programNumber]); bool result = !string.Equals(programmeService2,
rdsProgrammeService[currentNetworkId][currentTransportStreamId][programNumber]);
rdsProgrammeService[currentNetworkId][currentTransportStreamId][programNumber] = programmeService2; rdsProgrammeService[currentNetworkId][currentTransportStreamId][programNumber] = programmeService2;
return result; return result;
} }
public bool UpdateRdsRadioText(int currentNetworkId, int currentTransportStreamId, int programNumber, string text) public bool UpdateRdsRadioText(int currentNetworkId, int currentTransportStreamId, int programNumber,
string text)
{ {
InMemoryRdsText child = new InMemoryRdsText(currentNetworkId, currentTransportStreamId, programNumber, text); InMemoryRdsText child =
new InMemoryRdsText(currentNetworkId, currentTransportStreamId, programNumber, text);
bool add = rdsTexts.Add(child); bool add = rdsTexts.Add(child);
return add; return add;
} }
public bool UpdateRdsPty(int currentNetworkId, int currentTransportStreamId, int programNumber, PTY.ProgrammeTypeCodes pty) public bool UpdateRdsPty(int currentNetworkId, int currentTransportStreamId, int programNumber,
PTY.ProgrammeTypeCodes pty)
{ {
if (ptyCodes[currentNetworkId] == null) if (ptyCodes[currentNetworkId] == null)
ptyCodes[currentNetworkId] = new PTY.ProgrammeTypeCodes[ushort.MaxValue][]; ptyCodes[currentNetworkId] = new PTY.ProgrammeTypeCodes[ushort.MaxValue][];
@ -522,7 +544,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return false; return false;
} }
public bool MarkAsRdsTrafficInformationProgramme(int currentNetworkId, int currentTransportStreamId, int programNumber) public bool MarkAsRdsTrafficInformationProgramme(int currentNetworkId, int currentTransportStreamId,
int programNumber)
{ {
if (rdsTrafficInformationPreset == null) if (rdsTrafficInformationPreset == null)
rdsTrafficInformationPreset = new bool[ushort.MaxValue][][]; rdsTrafficInformationPreset = new bool[ushort.MaxValue][][];
@ -538,18 +561,23 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
rdsTrafficInformationPreset[currentNetworkId][currentTransportStreamId][programNumber] = true; rdsTrafficInformationPreset[currentNetworkId][currentTransportStreamId][programNumber] = true;
return true; return true;
} }
return false; return false;
} }
public bool TestForScte35SpliceInsert(int currentNetworkId, int currentTransportStreamId, ushort programNumber, SpliceInsert spliceInsert) public bool TestForScte35SpliceInsert(int currentNetworkId, int currentTransportStreamId, ushort programNumber,
SpliceInsert spliceInsert)
{ {
Scte35SpliceCoordinate scte35sc = new Scte35SpliceCoordinate(currentNetworkId, currentTransportStreamId, programNumber, spliceInsert.SpliceEventId); Scte35SpliceCoordinate scte35sc = new Scte35SpliceCoordinate(currentNetworkId, currentTransportStreamId,
programNumber, spliceInsert.SpliceEventId);
return scte35SpliceCoordinates.Contains(scte35sc); return scte35SpliceCoordinates.Contains(scte35sc);
} }
public void StoreScte35SpliceInsert(int currentNetworkId, int currentTransportStreamId, ushort programNumber, SpliceInsert spliceInsert) public void StoreScte35SpliceInsert(int currentNetworkId, int currentTransportStreamId, ushort programNumber,
SpliceInsert spliceInsert)
{ {
Scte35SpliceCoordinate scte35sc = new Scte35SpliceCoordinate(currentNetworkId, currentTransportStreamId, programNumber, spliceInsert.SpliceEventId); Scte35SpliceCoordinate scte35sc = new Scte35SpliceCoordinate(currentNetworkId, currentTransportStreamId,
programNumber, spliceInsert.SpliceEventId);
scte35SpliceCoordinates.Add(scte35sc); scte35SpliceCoordinates.Add(scte35sc);
} }
@ -575,41 +603,52 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return result; return result;
} }
public bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, byte moduleVersion) public bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid,
ushort moduleId, byte moduleVersion)
{ {
return DsmCcModuleXmlMemory.GetInstance().IsWanted(currentNetworkId, currentTransportStreamId,elementaryPid, moduleId, moduleVersion); return DsmCcModuleXmlMemory.GetInstance().IsWanted(currentNetworkId, currentTransportStreamId,
elementaryPid, moduleId, moduleVersion);
} }
public void StoreDsmCcDoItNowEvent(DateTime timestamp, int currentNetworkId, int currentTransportStreamId, int programNumber, StreamEventDescriptor descriptorListStreamEventDescriptor, int pid) public void StoreDsmCcDoItNowEvent(DateTime timestamp, int currentNetworkId, int currentTransportStreamId,
int programNumber, StreamEventDescriptor descriptorListStreamEventDescriptor, int pid)
{ {
} }
public bool StoreRunningStatus(uint transportStreamId, uint originalNetworkId, uint serviceId, uint eventId, RunningStatus runningStatus, DateTime currentTime) public bool StoreRunningStatus(uint transportStreamId, uint originalNetworkId, uint serviceId, uint eventId,
RunningStatus runningStatus, DateTime currentTime)
{ {
RstCoordinates rstCoordinates = new RstCoordinates(originalNetworkId, transportStreamId, serviceId, eventId, runningStatus, currentTime); RstCoordinates rstCoordinates = new RstCoordinates(originalNetworkId, transportStreamId, serviceId, eventId,
runningStatus, currentTime);
return this.rstCoordinates.Add(rstCoordinates); return this.rstCoordinates.Add(rstCoordinates);
} }
public void SetScte35TimeSignal(int currentNetworkId, int currentTransportStreamId, DateTime currentTime, ushort programNumber, TimeSignal timeSignal) public void SetScte35TimeSignal(int currentNetworkId, int currentTransportStreamId, DateTime currentTime,
ushort programNumber, TimeSignal timeSignal)
{ {
} }
public bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, int mappingStreamElementaryPid) public bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber,
int mappingStreamElementaryPid)
{ {
FileInfo fi = new FileInfo(Path.Combine("screenshots", currentNetworkId.ToString(), transportStreamId.ToString(), String.Format("{0}.jpg", mappingProgramNumber))); FileInfo fi = new FileInfo(Path.Combine("screenshots", currentNetworkId.ToString(),
transportStreamId.ToString(), String.Format("{0}.jpg", mappingProgramNumber)));
return fi.Exists; return fi.Exists;
} }
public void StoreFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, ushort pid, byte[] imageData) public void StoreFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, ushort pid,
byte[] imageData)
{ {
FileInfo fi = new FileInfo(Path.Combine("screenshots", currentNetworkId.ToString(), transportStreamId.ToString(), String.Format("{0}.jpg", mappingProgramNumber))); FileInfo fi = new FileInfo(Path.Combine("screenshots", currentNetworkId.ToString(),
transportStreamId.ToString(), String.Format("{0}.jpg", mappingProgramNumber)));
fi.Directory.EnsureExists(); fi.Directory.EnsureExists();
File.WriteAllBytes(fi.FullName, imageData); File.WriteAllBytes(fi.FullName, imageData);
} }
private HashSet<DocsisUpstreamChannelCoordinate> _docsisUpstreamChannelCoordinates; private HashSet<DocsisUpstreamChannelCoordinate> _docsisUpstreamChannelCoordinates;
public bool TestForDocsisUpstreamChannel(PhysicalAddress mmmSource, uint mmmFrequency, int locationId) public bool TestForDocsisUpstreamChannel(PhysicalAddress mmmSource, uint mmmFrequency, int locationId)
{ {
if (_docsisUpstreamChannelCoordinates == null) if (_docsisUpstreamChannelCoordinates == null)
@ -627,30 +666,37 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
if (_docsisUpstreamChannelCoordinates == null) if (_docsisUpstreamChannelCoordinates == null)
_docsisUpstreamChannelCoordinates = new HashSet<DocsisUpstreamChannelCoordinate>(); _docsisUpstreamChannelCoordinates = new HashSet<DocsisUpstreamChannelCoordinate>();
DocsisUpstreamChannelCoordinate coord = new DocsisUpstreamChannelCoordinate(mmm.Source, mmm.Frequency.Value); DocsisUpstreamChannelCoordinate
coord = new DocsisUpstreamChannelCoordinate(mmm.Source, mmm.Frequency.Value);
_docsisUpstreamChannelCoordinates.Add(coord); _docsisUpstreamChannelCoordinates.Add(coord);
} }
private HashSet<DocsisUpstreamChannelCoordinate> _docsisDownstreamChannelCoordinates; private HashSet<DocsisUpstreamChannelCoordinate> _docsisDownstreamChannelCoordinates;
public bool TestForDocsisDownstreamChannel(PhysicalAddress physicalAddress, MacDomainDescriptor.DownstreamActiveChannel downstreamActiveChannel, int locationId)
public bool TestForDocsisDownstreamChannel(PhysicalAddress physicalAddress,
MacDomainDescriptor.DownstreamActiveChannel downstreamActiveChannel, int locationId)
{ {
if (_docsisDownstreamChannelCoordinates == null) if (_docsisDownstreamChannelCoordinates == null)
return false; return false;
DocsisUpstreamChannelCoordinate coord = new DocsisUpstreamChannelCoordinate(physicalAddress, downstreamActiveChannel.Frequency.Value); DocsisUpstreamChannelCoordinate coord =
new DocsisUpstreamChannelCoordinate(physicalAddress, downstreamActiveChannel.Frequency.Value);
return _docsisDownstreamChannelCoordinates.Contains(coord); return _docsisDownstreamChannelCoordinates.Contains(coord);
} }
public void StoreDocsisDownstreamChannel(PhysicalAddress physicalAddress, MacDomainDescriptor.DownstreamActiveChannel downstreamActiveChannel, int locationId) public void StoreDocsisDownstreamChannel(PhysicalAddress physicalAddress,
MacDomainDescriptor.DownstreamActiveChannel downstreamActiveChannel, int locationId)
{ {
if (_docsisDownstreamChannelCoordinates == null) if (_docsisDownstreamChannelCoordinates == null)
_docsisDownstreamChannelCoordinates = new HashSet<DocsisUpstreamChannelCoordinate>(); _docsisDownstreamChannelCoordinates = new HashSet<DocsisUpstreamChannelCoordinate>();
DocsisUpstreamChannelCoordinate coord = new DocsisUpstreamChannelCoordinate(physicalAddress, downstreamActiveChannel.Frequency.Value); DocsisUpstreamChannelCoordinate coord =
new DocsisUpstreamChannelCoordinate(physicalAddress, downstreamActiveChannel.Frequency.Value);
_docsisDownstreamChannelCoordinates.Add(coord); _docsisDownstreamChannelCoordinates.Add(coord);
} }
private Dictionary<PhysicalAddress, IPAddress> cmtsIpAddresses; private Dictionary<PhysicalAddress, IPAddress> cmtsIpAddresses;
public bool SetCmtsIp(PhysicalAddress arpHeaderSenderHardwareAddress, IPAddress arpHeaderSenderProtocolAddress) public bool SetCmtsIp(PhysicalAddress arpHeaderSenderHardwareAddress, IPAddress arpHeaderSenderProtocolAddress)
{ {
if (cmtsIpAddresses == null) if (cmtsIpAddresses == null)
@ -670,7 +716,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private DsmCcModuleBlacklist dsmCcBlacklist; private DsmCcModuleBlacklist dsmCcBlacklist;
public bool IsDsmCcModuleBlacklisted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId,
public bool IsDsmCcModuleBlacklisted(int currentNetworkId, int currentTransportStreamId, int elementaryPid,
ushort moduleId,
byte moduleVersion) byte moduleVersion)
{ {
if (dsmCcBlacklist == null) if (dsmCcBlacklist == null)
@ -679,7 +727,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
dsmCcBlacklist = new DsmCcModuleBlacklist(fi); dsmCcBlacklist = new DsmCcModuleBlacklist(fi);
} }
return dsmCcBlacklist.IsBlacklisted(currentNetworkId, currentTransportStreamId, elementaryPid, moduleId, moduleVersion); return dsmCcBlacklist.IsBlacklisted(currentNetworkId, currentTransportStreamId, elementaryPid, moduleId,
moduleVersion);
} }
public int? GetCurrentLocationId() public int? GetCurrentLocationId()
@ -694,6 +743,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private Dictionary<PhysicalAddress, int> docsisParticipants; private Dictionary<PhysicalAddress, int> docsisParticipants;
public void StoreDocsisParticipant(PhysicalAddress pa, int currentLocation) public void StoreDocsisParticipant(PhysicalAddress pa, int currentLocation)
{ {
if (docsisParticipants == null) if (docsisParticipants == null)
@ -730,6 +780,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
knownTss = new KnownTsMemory("known_ts_filenames.json"); knownTss = new KnownTsMemory("known_ts_filenames.json");
return knownTss.ImportFileKnown(fi); return knownTss.ImportFileKnown(fi);
} }
#endregion #endregion
public DateTime T2MiGetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid) public DateTime T2MiGetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid)
@ -771,6 +822,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private List<SatellitePosition> satellitePositions; private List<SatellitePosition> satellitePositions;
public List<SatellitePosition> UiSatellitesListAll() public List<SatellitePosition> UiSatellitesListAll()
{ {
if (satellitePositions == null) if (satellitePositions == null)
@ -791,6 +843,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private List<TunerMetadata> uiTuners; private List<TunerMetadata> uiTuners;
public bool UiTunerTestFor(TunerMetadata tuner) public bool UiTunerTestFor(TunerMetadata tuner)
{ {
if (uiTuners == null) if (uiTuners == null)
@ -862,22 +915,26 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
//Since we're working solely in memory, we won't need to remember this. //Since we're working solely in memory, we won't need to remember this.
} }
public bool T2MiTestForTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier) public bool T2MiTestForTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid,
ushort txIdentifier)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void T2MiRememberTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier) public void T2MiRememberTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid,
ushort txIdentifier)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void T2MiSetTransmitterTimeOffset(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier, ushort timeOffset) public void T2MiSetTransmitterTimeOffset(int? currentNetworkId, int? currentTransportStreamId, int relatedPid,
ushort txIdentifier, ushort timeOffset)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
private List<LnbType> _lnbTypes; private List<LnbType> _lnbTypes;
public List<LnbType> UiLnbTypesListAll() public List<LnbType> UiLnbTypesListAll()
{ {
if (_lnbTypes == null) if (_lnbTypes == null)
@ -894,6 +951,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private List<DishType> _dishTypes; private List<DishType> _dishTypes;
public List<DishType> UiDishTypesListAll() public List<DishType> UiDishTypesListAll()
{ {
if (_dishTypes == null) if (_dishTypes == null)
@ -991,13 +1049,15 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void BeamFootprintStore(int databasePointerId, DateTime databasePointerBeamsProcessTimestamp, string name, public void BeamFootprintStore(int databasePointerId, DateTime databasePointerBeamsProcessTimestamp,
string name,
string getPolygonString, string id) string getPolygonString, string id)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool TestForBeamFootprint(int databasePointerId, DateTime databasePointerBeamsProcessTimestamp, string name,string id) public bool TestForBeamFootprint(int databasePointerId, DateTime databasePointerBeamsProcessTimestamp,
string name, string id)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -1013,12 +1073,14 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
throw new NotImplementedException(); throw new NotImplementedException();
} }
public List<SatelliteBeamFootprint> BeamsSelectFootprints(int satelliteBeamId, DateTime satelliteBeamProcessTimestamp) public List<SatelliteBeamFootprint> BeamsSelectFootprints(int satelliteBeamId,
DateTime satelliteBeamProcessTimestamp)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
private HashSet<DbBlindscanJobContainer> jobs; private HashSet<DbBlindscanJobContainer> jobs;
public void InsertBlindscanJob(DbBlindscanJob jobInDb) public void InsertBlindscanJob(DbBlindscanJob jobInDb)
{ {
if (jobs == null) if (jobs == null)
@ -1034,7 +1096,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
public void InsertSearchResult(DbBlindscanJob jobInDb, bool satellite, SearchResult searchResult, int polarityIndex, public void InsertSearchResult(DbBlindscanJob jobInDb, bool satellite, SearchResult searchResult,
int polarityIndex,
SearchResult2 searchResult2) SearchResult2 searchResult2)
{ {
DbBlindscanJobContainer dbBlindscanJobContainer = jobs.First(x => x.JobGuid.Equals(jobInDb.JobGuid)); DbBlindscanJobContainer dbBlindscanJobContainer = jobs.First(x => x.JobGuid.Equals(jobInDb.JobGuid));
@ -1057,7 +1120,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
if (jobContainer == null) if (jobContainer == null)
throw new Exception("Failed to find the job."); throw new Exception("Failed to find the job.");
DbBlindscanJobContainer.SearchResultContainer searchResultContainer = jobContainer.GetSearchResult(resultSatellite, resultSr1, resultSr2); DbBlindscanJobContainer.SearchResultContainer searchResultContainer =
jobContainer.GetSearchResult(resultSatellite, resultSr1, resultSr2);
if (searchResultContainer == null) if (searchResultContainer == null)
throw new Exception("Failed to find the search result."); throw new Exception("Failed to find the search result.");
searchResultContainer.AddService(humanReadableService); searchResultContainer.AddService(humanReadableService);
@ -1108,7 +1172,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void StoreTerminalBurstTimePlan(ushort interactiveNetworkId, uint gtoupId, uint superframeCount, uint frameNumber, Tbtp.TbtpFrame.BtpEntity btp) public void StoreTerminalBurstTimePlan(ushort interactiveNetworkId, uint gtoupId, uint superframeCount,
uint frameNumber, Tbtp.TbtpFrame.BtpEntity btp)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -1218,7 +1283,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool NetworkLayerInfoTim(PhysicalAddress mac, _0xa0_NetworkLayerInfoDescriptor nlid, DateTime timestamped) public bool NetworkLayerInfoTim(PhysicalAddress mac, _0xa0_NetworkLayerInfoDescriptor nlid,
DateTime timestamped)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -1252,6 +1318,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private HashSet<DnsRecord> dnsRecords; private HashSet<DnsRecord> dnsRecords;
public void RememberDnsRecord(DnsRecord record) public void RememberDnsRecord(DnsRecord record)
{ {
if (dnsRecords == null) if (dnsRecords == null)
@ -1261,6 +1328,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private SgtList[] sgtLists; private SgtList[] sgtLists;
public bool TestForSgtList(SgtList list) public bool TestForSgtList(SgtList list)
{ {
if (sgtLists == null) if (sgtLists == null)
@ -1278,6 +1346,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private HashSet<SgtService> sgtServices; private HashSet<SgtService> sgtServices;
public bool TestForSgtService(SgtService child) public bool TestForSgtService(SgtService child)
{ {
if (sgtServices == null) if (sgtServices == null)
@ -1334,7 +1403,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private Dictionary<NipActualCarrierInformation, NipPds> _nipPrivateDataSpecifiers; private Dictionary<NipActualCarrierInformation, NipPds> _nipPrivateDataSpecifiers;
public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, uint privateDataSpecifier, List<string> privateDataSessions)
public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation,
DateTime versionUpdate, uint privateDataSpecifier, List<string> privateDataSessions)
{ {
if (_nipPrivateDataSpecifiers == null) if (_nipPrivateDataSpecifiers == null)
_nipPrivateDataSpecifiers = new Dictionary<NipActualCarrierInformation, NipPds>(); _nipPrivateDataSpecifiers = new Dictionary<NipActualCarrierInformation, NipPds>();
@ -1373,6 +1444,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private BroadcastNetworkType[] nipBroadcastNetworkTypes; private BroadcastNetworkType[] nipBroadcastNetworkTypes;
public bool DvbNipTestForNetwork(BroadcastNetworkType network) public bool DvbNipTestForNetwork(BroadcastNetworkType network)
{ {
if (nipBroadcastNetworkTypes == null) if (nipBroadcastNetworkTypes == null)
@ -1409,7 +1481,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
protected bool Equals(NipServiceCoordinate other) protected bool Equals(NipServiceCoordinate other)
{ {
return ServiceId == other.ServiceId && LinkId == other.LinkId && CarrierId == other.CarrierId && NetworkId == other.NetworkId; return ServiceId == other.ServiceId && LinkId == other.LinkId && CarrierId == other.CarrierId &&
NetworkId == other.NetworkId;
} }
public override bool Equals(object? obj) public override bool Equals(object? obj)
@ -1427,6 +1500,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private Dictionary<NipServiceCoordinate, BroadcastMediaStreamType> _dvbNipServices; private Dictionary<NipServiceCoordinate, BroadcastMediaStreamType> _dvbNipServices;
public bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType) public bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType)
{ {
if (_dvbNipServices == null) if (_dvbNipServices == null)
@ -1445,6 +1519,52 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
_dvbNipServices.Add(coords, broadcastMediaStreamType); _dvbNipServices.Add(coords, broadcastMediaStreamType);
} }
private Dictionary<string, MulticastSessionType> _dvbNipMulticastSessions;
public bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession)
{
if (_dvbNipMulticastSessions == null)
return false;
return _dvbNipMulticastSessions.ContainsKey(multicastSession.serviceIdentifier);
}
public void DvbNipInsertMulticastSession(MulticastSessionType multicastSession)
{
if (_dvbNipMulticastSessions == null)
_dvbNipMulticastSessions = new Dictionary<string, MulticastSessionType>();
_dvbNipMulticastSessions[multicastSession.serviceIdentifier] = multicastSession;
}
private Dictionary<DatabaseKeyNipMulticastGatewayConfigurationTransportSession,
MulticastGatewayConfigurationTransportSessionType> _nipMulticastGatewayConfigurationTransportSessions;
public bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
MulticastEndpointAddressType multicastEndpointAddressType)
{
if (_nipMulticastGatewayConfigurationTransportSessions == null)
return false;
DatabaseKeyNipMulticastGatewayConfigurationTransportSession key =
new DatabaseKeyNipMulticastGatewayConfigurationTransportSession(carrier, multicastEndpointAddressType);
return _nipMulticastGatewayConfigurationTransportSessions.ContainsKey(key);
}
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession)
{
if (_nipMulticastGatewayConfigurationTransportSessions == null)
_nipMulticastGatewayConfigurationTransportSessions =
new Dictionary<DatabaseKeyNipMulticastGatewayConfigurationTransportSession,
MulticastGatewayConfigurationTransportSessionType>();
DatabaseKeyNipMulticastGatewayConfigurationTransportSession key =
new DatabaseKeyNipMulticastGatewayConfigurationTransportSession(carrier,
multicastGatewayConfigurationTransportSession.EndpointAddress[0]);
_nipMulticastGatewayConfigurationTransportSessions.Add(key, multicastGatewayConfigurationTransportSession);
}
public void InsertDvbiServiceListEntryPoint(long sourceHash) public void InsertDvbiServiceListEntryPoint(long sourceHash)
{ {
if (_dvbiServiceListEntryPointsCoordinates == null) if (_dvbiServiceListEntryPointsCoordinates == null)
@ -1494,12 +1614,13 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return HashCode.Combine(Hash); return HashCode.Combine(Hash);
} }
} }
private HashSet<DvbiServiceListEntryPointsCoordinate> _dvbiServiceListEntryPointsCoordinates; private HashSet<DvbiServiceListEntryPointsCoordinate> _dvbiServiceListEntryPointsCoordinates;
public void UpdateDvbiServiceListEntryPointUpdateDate(long v, DateTime currentTime) public void UpdateDvbiServiceListEntryPointUpdateDate(long v, DateTime currentTime)
{ {
foreach(DvbiServiceListEntryPointsCoordinate coord in _dvbiServiceListEntryPointsCoordinates) foreach (DvbiServiceListEntryPointsCoordinate coord in _dvbiServiceListEntryPointsCoordinates)
{ {
if (coord.Hash == v) if (coord.Hash == v)
{ {
@ -1521,10 +1642,12 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return true; return true;
} }
} }
return false; return false;
} }
private Dictionary<string, DateTime> _dvbiServiceListLastChecked; private Dictionary<string, DateTime> _dvbiServiceListLastChecked;
public void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime) public void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime)
{ {
if (_dvbiServiceListLastChecked == null) if (_dvbiServiceListLastChecked == null)
@ -1542,6 +1665,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return coord.LastUpdate; return coord.LastUpdate;
} }
} }
return DateTime.MinValue; return DateTime.MinValue;
} }
@ -1551,6 +1675,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private Dictionary<long, List<string>> _dvbiServiceListEntryPointToServiceListMapping; private Dictionary<long, List<string>> _dvbiServiceListEntryPointToServiceListMapping;
public void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash) public void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash)
{ {
if (_dvbiServiceListEntryPointToServiceListMapping == null) if (_dvbiServiceListEntryPointToServiceListMapping == null)
@ -1564,6 +1689,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
private Dictionary<string, List<string>> _dvbiServiceToServiceListMapping; private Dictionary<string, List<string>> _dvbiServiceToServiceListMapping;
public void AddDvbiServiceToServiceList(string id, string serviceListId) public void AddDvbiServiceToServiceList(string id, string serviceListId)
{ {
if (_dvbiServiceToServiceListMapping == null) if (_dvbiServiceToServiceListMapping == null)
@ -1573,22 +1699,24 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
_dvbiServiceToServiceListMapping.Add(serviceListId, new List<string>()); _dvbiServiceToServiceListMapping.Add(serviceListId, new List<string>());
if (!_dvbiServiceToServiceListMapping[serviceListId].Contains(id)) if (!_dvbiServiceToServiceListMapping[serviceListId].Contains(id))
_dvbiServiceToServiceListMapping [serviceListId].Add(id); _dvbiServiceToServiceListMapping[serviceListId].Add(id);
} }
public int GetDvbiServiceVersion(string id) public int GetDvbiServiceVersion(string id)
{ {
foreach(DvbIService service in _dvbiServices) foreach (DvbIService service in _dvbiServices)
{ {
if (service.Id.Equals(id)) if (service.Id.Equals(id))
{ {
return service.Version; return service.Version;
} }
} }
return -1; return -1;
} }
private HashSet<DvbIService> _dvbiServices; private HashSet<DvbIService> _dvbiServices;
public bool TestForDvbiService(string id) public bool TestForDvbiService(string id)
{ {
if (_dvbiServices == null) if (_dvbiServices == null)
@ -1609,6 +1737,5 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
} }

View File

@ -30,5 +30,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
void DvbNipInsertNetwork(BroadcastNetworkType network); void DvbNipInsertNetwork(BroadcastNetworkType network);
bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType); bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType);
void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType); void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType);
bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession);
void DvbNipInsertMulticastSession(MulticastSessionType multicastSession);
bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastEndpointAddressType);
void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession);
} }
} }

View File

@ -933,6 +933,31 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
objectStorage.DvbNipInsertService(broadcastMediaStreamType); objectStorage.DvbNipInsertService(broadcastMediaStreamType);
} }
[DebuggerStepThrough]
public bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession)
{
return objectStorage.DvbNipTestForMulticastSession(multicastSession);
}
[DebuggerStepThrough]
public void DvbNipInsertMulticastSession(MulticastSessionType multicastSession)
{
objectStorage.DvbNipInsertMulticastSession(multicastSession);
}
[DebuggerStepThrough]
public bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
MulticastEndpointAddressType multicastEndpointAddressType)
{
return objectStorage.DvbNipTestForMulticastGatewayConfigurationTransportSession(carrier, multicastEndpointAddressType);
}
[DebuggerStepThrough]
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession)
{
objectStorage.DvbNipInsertMulticastGatewayConfigurationTransportSession(carrier, multicastGatewayConfigurationTransportSession);
}
[DebuggerStepThrough] [DebuggerStepThrough]
public void InsertDvbiServiceListEntryPoint(long sourceHash) public void InsertDvbiServiceListEntryPoint(long sourceHash)
{ {

View File

@ -0,0 +1,60 @@
using skyscraper8.DvbNip;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.Skyscraper.Scraper.Storage.Utilities
{
public class DatabaseKeyNipMulticastGatewayConfigurationTransportSession
{
public DatabaseKeyNipMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType address)
{
this.CarrierId = carrier.NipCarrierId;
this.LinkId = carrier.NipLinkId;
this.NetworkId = carrier.NipNetworkId;
this.ServiceId = carrier.NipServiceId;
this.SourceAddress = IPAddress.Parse(address.NetworkSourceAddress);
this.DestinationAddress = IPAddress.Parse(address.NetworkDestinationGroupAddress);
this.DestinationPort = ushort.Parse(address.TransportDestinationPort);
this.TSI = long.Parse(address.MediaTransportSessionIdentifier);
}
public long TSI { get; set; }
public ushort DestinationPort { get; set; }
public IPAddress DestinationAddress { get; set; }
public IPAddress SourceAddress { get; set; }
public ushort ServiceId { get; set; }
public ushort NetworkId { get; set; }
public ushort LinkId { get; set; }
public ushort CarrierId { get; set; }
protected bool Equals(DatabaseKeyNipMulticastGatewayConfigurationTransportSession other)
{
return TSI == other.TSI && DestinationPort == other.DestinationPort && DestinationAddress.Equals(other.DestinationAddress) && SourceAddress.Equals(other.SourceAddress) && ServiceId == other.ServiceId && NetworkId == other.NetworkId && LinkId == other.LinkId && CarrierId == other.CarrierId;
}
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((DatabaseKeyNipMulticastGatewayConfigurationTransportSession)obj);
}
public override int GetHashCode()
{
return HashCode.Combine(TSI, DestinationPort, DestinationAddress, SourceAddress, ServiceId, NetworkId, LinkId, CarrierId);
}
}
}