NIP Metadata Storage Proof-of-Concept.
This commit is contained in:
parent
7590c7c5bc
commit
17b1350185
@ -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 &&
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -63,6 +63,7 @@ namespace skyscraper5
|
||||
SkyscraperContext skyscraperContext = new SkyscraperContext(new TsContext());
|
||||
skyscraperContext.InitalizeFilterChain();
|
||||
skyscraperContext.IngestFromStream(m3U8Stream);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].Equals("aactest"))
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -78,6 +78,8 @@
|
||||
FluteFileProgress,
|
||||
NipPrivateDataSpecifier,
|
||||
DvbNipNetwork,
|
||||
DvbNipService
|
||||
DvbNipService,
|
||||
DvbNipMulticastSession,
|
||||
DvbNipMulticastGatewayConfigurationTransportSession
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user