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 ServiceDescription { get; internal set; }
public string BannerURL { get; internal set; }
public string LinkedApplication { get; set; }
public override bool Equals(object? obj)
{
return obj is DvbIService service &&

View File

@ -139,6 +139,12 @@ namespace skyscraper8.DvbI
case "urn:dvb:metadata:cs:HowRelatedCS:2021:1001.2":
child.LogoURL = value;
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:
throw new NotImplementedException(key);
}

View File

@ -130,6 +130,7 @@ namespace skyscraper8.DvbNip
string serviceListId = serviceListUrls[fluteListener.FileAssociation.ContentLocation];
Stream serviceListStream = fluteListener.ToStream();
byte[] serviceListByteArray = new byte[serviceListStream.Length];
serviceListStream.Read(serviceListByteArray, 0, (int)serviceListStream.Length);
ServiceListType serviceList = DvbIUtils.UnpackServiceList(serviceListByteArray);
EventHandler.OnServiceList(CurrentCarrierInformation, serviceListId, serviceList);
}
@ -158,9 +159,13 @@ namespace skyscraper8.DvbNip
{
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":
MulticastGatewayConfigurationType multicastGatewayConfiguration = DvbNipUtilities.UnpackMulticastGatewayConfiguration(fluteListener.ToStream());
EventHandler?.OnMulticastGatewayConfiguration(CurrentCarrierInformation, multicastGatewayConfiguration);
MulticastGatewayConfigurationType multicastGatewayConfiguration2021 = DvbNipUtilities.UnpackMulticastGatewayConfiguration(fluteListener.ToStream());
EventHandler?.OnMulticastGatewayConfiguration(CurrentCarrierInformation, multicastGatewayConfiguration2021);
return true;
case "urn:dvb:metadata:nativeip:PrivateDataSignalling":
PrivateDataSignallingManifestType privateDataSignallingManifest = DvbNipUtilities.UnpackPrivateDataSignallingManifest(fluteListener.ToStream());
@ -196,6 +201,10 @@ namespace skyscraper8.DvbNip
ServiceInformationFileType serviceInformationFile = DvbNipUtilities.UnpackServiceInformationFile(fluteListener.ToStream());
EventHandler?.OnServiceInformationFile(CurrentCarrierInformation, serviceInformationFile);
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:
throw new NotImplementedException(fluteListener.FileAssociation.ContentLocation);
}

View File

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

View File

@ -2460,10 +2460,41 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnMulticastGatewayConfiguration(NipActualCarrierInformation carrier, MulticastGatewayConfigurationType multicastGatewayConfiguration)
{
if (multicastGatewayConfiguration.MulticastSession == null)
return;
if (multicastGatewayConfiguration.MulticastSession != null)
{
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)
@ -2549,7 +2580,25 @@ namespace skyscraper5.Skyscraper.Scraper
public void OnServiceList(NipActualCarrierInformation currentCarrierInformation, string serviceListId,
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)

View File

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

View File

@ -1479,6 +1479,28 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
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)
{
throw new NotImplementedException();

View File

@ -190,5 +190,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage
void DvbNipInsertNetwork(BroadcastNetworkType network);
bool DvbNipTestForService(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.NetworkInformation;
using skyscraper8.Ietf.FLUTE;
using skyscraper8.Skyscraper.Scraper.Storage.Utilities;
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
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)
{
InMemoryPatEntry inMemoryPatEntry = new InMemoryPatEntry(currentNetworkId, currentTransportStreamId, pmtPid, programId);
InMemoryPatEntry inMemoryPatEntry =
new InMemoryPatEntry(currentNetworkId, currentTransportStreamId, pmtPid, programId);
return patEntries.Add(inMemoryPatEntry);
}
@ -206,7 +208,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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;
}
@ -222,13 +225,15 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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
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
}
@ -352,7 +357,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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)
timeOffsets[currentNetworkId] = new Tuple<DateTime, LocalTimeOffsetDescriptor>[ushort.MaxValue];
@ -363,7 +369,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
if ((newTime - oldTime).TotalSeconds < 10)
return false;
}
timeOffsets[currentNetworkId][currentTransportStreamId] = new Tuple<DateTime, LocalTimeOffsetDescriptor>(newTime, ltod);
timeOffsets[currentNetworkId][currentTransportStreamId] =
new Tuple<DateTime, LocalTimeOffsetDescriptor>(newTime, ltod);
return true;
}
@ -390,7 +398,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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);
}
@ -406,7 +415,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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);
if (outFileInfo.Exists)
return false;
@ -417,7 +427,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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;
}
@ -432,15 +444,19 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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);
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);
if (fi.Exists)
return;
@ -450,7 +466,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
fileStream.Close();
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;
}
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)
rdsProgrammeService = new string[ushort.MaxValue][][];
@ -493,19 +511,23 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
if (rdsProgrammeService[currentNetworkId][currentTransportStreamId] == null)
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;
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);
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)
ptyCodes[currentNetworkId] = new PTY.ProgrammeTypeCodes[ushort.MaxValue][];
@ -522,7 +544,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return false;
}
public bool MarkAsRdsTrafficInformationProgramme(int currentNetworkId, int currentTransportStreamId, int programNumber)
public bool MarkAsRdsTrafficInformationProgramme(int currentNetworkId, int currentTransportStreamId,
int programNumber)
{
if (rdsTrafficInformationPreset == null)
rdsTrafficInformationPreset = new bool[ushort.MaxValue][][];
@ -538,18 +561,23 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
rdsTrafficInformationPreset[currentNetworkId][currentTransportStreamId][programNumber] = true;
return true;
}
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);
}
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);
}
@ -575,41 +603,52 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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);
}
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;
}
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();
File.WriteAllBytes(fi.FullName, imageData);
}
private HashSet<DocsisUpstreamChannelCoordinate> _docsisUpstreamChannelCoordinates;
public bool TestForDocsisUpstreamChannel(PhysicalAddress mmmSource, uint mmmFrequency, int locationId)
{
if (_docsisUpstreamChannelCoordinates == null)
@ -627,30 +666,37 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
if (_docsisUpstreamChannelCoordinates == null)
_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);
}
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)
return false;
DocsisUpstreamChannelCoordinate coord = new DocsisUpstreamChannelCoordinate(physicalAddress, downstreamActiveChannel.Frequency.Value);
DocsisUpstreamChannelCoordinate coord =
new DocsisUpstreamChannelCoordinate(physicalAddress, downstreamActiveChannel.Frequency.Value);
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)
_docsisDownstreamChannelCoordinates = new HashSet<DocsisUpstreamChannelCoordinate>();
DocsisUpstreamChannelCoordinate coord = new DocsisUpstreamChannelCoordinate(physicalAddress, downstreamActiveChannel.Frequency.Value);
DocsisUpstreamChannelCoordinate coord =
new DocsisUpstreamChannelCoordinate(physicalAddress, downstreamActiveChannel.Frequency.Value);
_docsisDownstreamChannelCoordinates.Add(coord);
}
private Dictionary<PhysicalAddress, IPAddress> cmtsIpAddresses;
public bool SetCmtsIp(PhysicalAddress arpHeaderSenderHardwareAddress, IPAddress arpHeaderSenderProtocolAddress)
{
if (cmtsIpAddresses == null)
@ -670,7 +716,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
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)
{
if (dsmCcBlacklist == null)
@ -679,7 +727,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
dsmCcBlacklist = new DsmCcModuleBlacklist(fi);
}
return dsmCcBlacklist.IsBlacklisted(currentNetworkId, currentTransportStreamId, elementaryPid, moduleId, moduleVersion);
return dsmCcBlacklist.IsBlacklisted(currentNetworkId, currentTransportStreamId, elementaryPid, moduleId,
moduleVersion);
}
public int? GetCurrentLocationId()
@ -694,6 +743,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private Dictionary<PhysicalAddress, int> docsisParticipants;
public void StoreDocsisParticipant(PhysicalAddress pa, int currentLocation)
{
if (docsisParticipants == null)
@ -730,6 +780,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
knownTss = new KnownTsMemory("known_ts_filenames.json");
return knownTss.ImportFileKnown(fi);
}
#endregion
public DateTime T2MiGetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid)
@ -771,6 +822,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private List<SatellitePosition> satellitePositions;
public List<SatellitePosition> UiSatellitesListAll()
{
if (satellitePositions == null)
@ -791,6 +843,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private List<TunerMetadata> uiTuners;
public bool UiTunerTestFor(TunerMetadata tuner)
{
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.
}
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();
}
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();
}
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();
}
private List<LnbType> _lnbTypes;
public List<LnbType> UiLnbTypesListAll()
{
if (_lnbTypes == null)
@ -894,6 +951,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private List<DishType> _dishTypes;
public List<DishType> UiDishTypesListAll()
{
if (_dishTypes == null)
@ -991,13 +1049,15 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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)
{
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();
}
@ -1013,12 +1073,14 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
throw new NotImplementedException();
}
public List<SatelliteBeamFootprint> BeamsSelectFootprints(int satelliteBeamId, DateTime satelliteBeamProcessTimestamp)
public List<SatelliteBeamFootprint> BeamsSelectFootprints(int satelliteBeamId,
DateTime satelliteBeamProcessTimestamp)
{
throw new NotImplementedException();
}
private HashSet<DbBlindscanJobContainer> jobs;
public void InsertBlindscanJob(DbBlindscanJob jobInDb)
{
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)
{
DbBlindscanJobContainer dbBlindscanJobContainer = jobs.First(x => x.JobGuid.Equals(jobInDb.JobGuid));
@ -1057,7 +1120,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
if (jobContainer == null)
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)
throw new Exception("Failed to find the search result.");
searchResultContainer.AddService(humanReadableService);
@ -1108,7 +1172,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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();
}
@ -1218,7 +1283,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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();
}
@ -1252,6 +1318,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private HashSet<DnsRecord> dnsRecords;
public void RememberDnsRecord(DnsRecord record)
{
if (dnsRecords == null)
@ -1261,6 +1328,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private SgtList[] sgtLists;
public bool TestForSgtList(SgtList list)
{
if (sgtLists == null)
@ -1278,6 +1346,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private HashSet<SgtService> sgtServices;
public bool TestForSgtService(SgtService child)
{
if (sgtServices == null)
@ -1334,7 +1403,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
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)
_nipPrivateDataSpecifiers = new Dictionary<NipActualCarrierInformation, NipPds>();
@ -1373,6 +1444,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private BroadcastNetworkType[] nipBroadcastNetworkTypes;
public bool DvbNipTestForNetwork(BroadcastNetworkType network)
{
if (nipBroadcastNetworkTypes == null)
@ -1409,7 +1481,8 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
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)
@ -1427,6 +1500,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private Dictionary<NipServiceCoordinate, BroadcastMediaStreamType> _dvbNipServices;
public bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType)
{
if (_dvbNipServices == null)
@ -1445,6 +1519,52 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
_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)
{
if (_dvbiServiceListEntryPointsCoordinates == null)
@ -1494,6 +1614,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return HashCode.Combine(Hash);
}
}
private HashSet<DvbiServiceListEntryPointsCoordinate> _dvbiServiceListEntryPointsCoordinates;
@ -1521,10 +1642,12 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return true;
}
}
return false;
}
private Dictionary<string, DateTime> _dvbiServiceListLastChecked;
public void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime)
{
if (_dvbiServiceListLastChecked == null)
@ -1542,6 +1665,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return coord.LastUpdate;
}
}
return DateTime.MinValue;
}
@ -1551,6 +1675,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private Dictionary<long, List<string>> _dvbiServiceListEntryPointToServiceListMapping;
public void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash)
{
if (_dvbiServiceListEntryPointToServiceListMapping == null)
@ -1564,6 +1689,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
}
private Dictionary<string, List<string>> _dvbiServiceToServiceListMapping;
public void AddDvbiServiceToServiceList(string id, string serviceListId)
{
if (_dvbiServiceToServiceListMapping == null)
@ -1585,10 +1711,12 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
return service.Version;
}
}
return -1;
}
private HashSet<DvbIService> _dvbiServices;
public bool TestForDvbiService(string id)
{
if (_dvbiServices == null)
@ -1609,6 +1737,5 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
{
throw new NotImplementedException();
}
}
}

View File

@ -30,5 +30,9 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
void DvbNipInsertNetwork(BroadcastNetworkType network);
bool DvbNipTestForService(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);
}
[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]
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);
}
}
}