Various little fixes. Like adding NDS/OpenTV-SSUs to Minio.

This commit is contained in:
feyris-tan 2025-09-07 22:00:09 +02:00
parent 3595b51fcc
commit d9c2bc6d46
15 changed files with 266 additions and 48 deletions

View File

@ -2,9 +2,12 @@
using Minio;
using Minio.DataModel;
using Minio.DataModel.Args;
using Minio.DataModel.Response;
using Minio.Exceptions;
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
using skyscraper5.Dvb.Descriptors;
using skyscraper8.DvbNip;
using skyscraper8.Experimentals.NdsSsu;
using skyscraper8.Ietf.FLUTE;
using skyscraper8.Skyscraper.Drawing;
using skyscraper8.Skyscraper.Scraper.Storage;
@ -15,10 +18,9 @@ using System.Globalization;
using System.IO;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using Minio.DataModel.Response;
using skyscraper5.Dvb.Descriptors;
namespace skyscraper5.Data
{
@ -368,5 +370,50 @@ namespace skyscraper5.Data
string fullName = String.Format("/rf/{0}.rf", selectedGuid.ToString("D"));
DeleteFile(fullName);
}
public bool OtvSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int sourcePid, ushort tableIdExtension,
uint fileId, uint unknown1, uint length)
{
string cnid = currentNetworkId.HasValue ? currentNetworkId.Value.ToString() : "unknown";
string ctsid = currentTransportStreamId.HasValue ? currentTransportStreamId.Value.ToString() : "unknown";
string fname = tableIdExtension.ToString() + ".bin";
string path = String.Format("/OpenTV-SSU/{0}/{1}/{2}/{3}", cnid, ctsid, sourcePid.ToString(), fname);
return FileExists(path);
}
public void OnOtvSsuComplete(int? currentNetworkId, int? currentTransportStreamId, int sourcePid, Stream getStream,
ushort tableIdExtension, uint fileId, uint unknown1, uint length)
{
string cnid = currentNetworkId.HasValue ? currentNetworkId.Value.ToString() : "unknown";
string ctsid = currentTransportStreamId.HasValue ? currentTransportStreamId.Value.ToString() : "unknown";
string fname = tableIdExtension.ToString() + ".bin";
string path = String.Format("/OpenTV-SSU/{0}/{1}/{2}/{3}", cnid, ctsid, sourcePid.ToString(), fname);
WriteObject(path, getStream);
}
public void OnNdsSsuComplete(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension,
NdsSsuDataMap dataMap)
{
string cnid = currentNetworkId.HasValue ? currentNetworkId.Value.ToString() : "unknown";
string ctsid = currentTransportStreamId.HasValue ? currentTransportStreamId.Value.ToString() : "unknown";
string fname = tableIdExtension.ToString() + ".bin";
string path = String.Format("/NDS-SSU/{0}/{1}/{2}/{3}", cnid, ctsid, pid.ToString(), fname);
long bufferLength = dataMap.CalculateLength();
MemoryStream buffer = new MemoryStream(new byte[bufferLength]);
dataMap.WriteToStream(buffer);
buffer.Position = 0;
WriteObject(path, buffer);
}
public bool NdsSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension)
{
string cnid = currentNetworkId.HasValue ? currentNetworkId.Value.ToString() : "unknown";
string ctsid = currentTransportStreamId.HasValue ? currentTransportStreamId.Value.ToString() : "unknown";
string fname = tableIdExtension.ToString() + ".bin";
string path = String.Format("/NDS-SSU/{0}/{1}/{2}/{3}", cnid, ctsid, pid.ToString(), fname);
return FileExists(path);
}
}
}

View File

@ -9,6 +9,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Dvb.Descriptors;
namespace skyscraper5.Data.MySql
{
@ -118,5 +119,24 @@ namespace skyscraper5.Data.MySql
}
}
public IEnumerable<Tuple<int, SatelliteDeliverySystemDescriptor.PolarizationEnum>> GetBlindscanResultFrequencies(Guid selectedGuid)
{
throw new NotImplementedException();
}
public void InsertUiBlindscanSettingHistory(int settingsWindowBlScanTunerSelection,
bool settingsWindowUseDifferentTunerForSetFilter, int settingsWindowSetFilterTunerSelection,
int settingsWindowDiseqc, bool settingsWindowCollectIqGraphs, bool settingsWindowCollectRfSpectrum,
bool settingsWindowCaptureFile, int settingsWindowSatellite, int settingsWindowLnb, int dish,
bool settingsWindowScanHorizontalLow, bool settingsWindowScanHorizontalHigh, bool settingsWindowScanVerticalLow,
bool settingsWindowScanVerticalHigh)
{
throw new NotImplementedException();
}
public object[] GetLastUiBlindscanSettings()
{
throw new NotImplementedException();
}
}
}

View File

@ -3,6 +3,7 @@ using skyscraper5.Skyscraper.Scraper;
using skyscraper5.Skyscraper.Scraper.Storage;
using skyscraper5.UI.Overrides;
using skyscraper5.UI.StreamAcquisition;
using skyscraper8.Skyscraper.Scraper.Storage;
namespace skyscraper5.UI
{
@ -19,7 +20,7 @@ namespace skyscraper5.UI
AcquiredStream = acquiredStream;
tsContext = new TsContext();
tsContext.OnPacketLoss += TsContext_OnPacketLoss;
skyscraperContext = new SkyscraperContext(tsContext, storage);
skyscraperContext = new SkyscraperContext(tsContext, dataStorage, objectStorage);
skyscraperContext.UiJunction = uiJunction;
}
@ -31,7 +32,10 @@ namespace skyscraper5.UI
public StreamSource AcquiredStream { get; }
private TsContext tsContext;
private SkyscraperContext skyscraperContext;
private IScraperStroage storage;
private DataStorage dataStorage;
private ObjectStorage objectStorage;
private Form1UiJunction uiJunction;
private DateTime windowOpenedTimestamp;
private TimeSpan windowOpenDuration;

View File

@ -17,6 +17,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using skyscraper5.Skyscraper.Equipment;
using skyscraper5.Skyscraper.IO.CrazycatStreamReader;
using skyscraper8.Skyscraper.Drawing;
using skyscraper8.Skyscraper.FrequencyListGenerator;
namespace skyscraper5.UI.Overrides
{
@ -87,6 +91,124 @@ namespace skyscraper5.UI.Overrides
throw new NotImplementedException();
}
public void OnBlindscanOpenFoundFrquenciesWindow(List<BlindscanSearchResult> foundFrequencies, STD_TYPE tunerMetadataType)
{
throw new NotImplementedException();
}
public void OnBlindscanJobDone(bool success)
{
throw new NotImplementedException();
}
public void OnBlindscanErrorMessage(string blindscanningLowHorizontalAreaFailed)
{
throw new NotImplementedException();
}
public void OnBlindscanBandComplete()
{
throw new NotImplementedException();
}
public void OnBlindscanBeforeBLScan(int minimum, int currentProgress, int maximum)
{
throw new NotImplementedException();
}
public void OnBlindscanAfterBLScan()
{
throw new NotImplementedException();
}
public void OnBlindscanSearchResult1Callback(BlindscanSearchResult searchResult, int polarityIndex,
int lnbTypeMinimumFrequency, int lnbTypeMaximumFrequency)
{
throw new NotImplementedException();
}
public void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult, LnbType lnbType)
{
throw new NotImplementedException();
}
public void OnScrapeBandComplete()
{
throw new NotImplementedException();
}
public void OnBlindscanScrapeTransponderComplete(BlindscanSearchResult blindscanResult)
{
throw new NotImplementedException();
}
public void OnBlindscanBeginRfSpectrum()
{
throw new NotImplementedException();
}
public void OnBlindscanRfSpectrumEnqueueSample(SatelliteDeliverySystemDescriptor.PolarizationEnum polarization, int frequency, double rf)
{
throw new NotImplementedException();
}
public void OnBlindscanEndRfSpectrum()
{
throw new NotImplementedException();
}
public void OnBlindscanBeginIqSpectrum(IqChartData result)
{
throw new NotImplementedException();
}
public void OnBlindscanEndIq()
{
throw new NotImplementedException();
}
public void OnBlindscanLockFail(SearchResult satelliteSr, BlindscanResultState resultState)
{
throw new NotImplementedException();
}
public void OnBlindscanFilterSetUp()
{
throw new NotImplementedException();
}
public void OnBlindscanScrapeStopCondition()
{
throw new NotImplementedException();
}
public void OnBlindscanAfterPacketDrain()
{
throw new NotImplementedException();
}
public void OnBlindscanPacketError(int errorCount, int length)
{
throw new NotImplementedException();
}
public void OnBlindscanPacketOk(int numPackets, int packetsQueueCount)
{
throw new NotImplementedException();
}
public bool IsZapNowRequested()
{
throw new NotImplementedException();
}
public bool MayAutoZap()
{
throw new NotImplementedException();
}
public TaskQueue Tasks { get; set; }
public void NotifyAit(AitApplication aitApplication)
{
SkyscraperUiNode applicationNode = form1.EnsureNodeExists("AIT", aitApplication.TryGetName());

View File

@ -1448,7 +1448,6 @@ namespace SDL2Demo.Jobs
public void NotifyScte35(ushort programNumber, TimeSignal spliceInsert)
{
throw new NotImplementedException();
}
public void SetMemorySaverMode(bool saveMemory)
@ -1560,7 +1559,11 @@ namespace SDL2Demo.Jobs
public void OnBlindscanOpenFoundFrquenciesWindow(List<BlindscanSearchResult> foundFrequencies, STD_TYPE tunerMetadataType)
{
foundFrequenciesWindow = new FoundFrequenciesWindow2(foundFrequencies);
Tasks.EnqueueTask(() =>
{
jobContext.Renderables.Add(foundFrequenciesWindow);
});
}
public void OnBlindscanJobDone(bool success)

View File

@ -50,7 +50,7 @@ namespace skyscraper5.Aprs.AprsStorage
private NpgsqlTransaction transaction;
private void WriterThreadFunction()
{
using (NpgsqlConnection connection = new NpgsqlConnection(connectionStringBuilder.ToString()))
using (NpgsqlConnection connection = _postgresql.GetConnection())
{
connection.Open();
transaction = connection.BeginTransaction();
@ -142,7 +142,7 @@ namespace skyscraper5.Aprs.AprsStorage
private void FetchAprsPositionHistory(string packetSender)
{
using (NpgsqlConnection connection = new NpgsqlConnection(connectionStringBuilder.ToString()))
using (NpgsqlConnection connection = _postgresql.GetConnection())
{
connection.Open();
NpgsqlCommand command = connection.CreateCommand();
@ -186,7 +186,7 @@ namespace skyscraper5.Aprs.AprsStorage
private void SelectAprsWeatherReports(string sender)
{
using (NpgsqlConnection connection = new NpgsqlConnection(connectionStringBuilder.ToString()))
using (NpgsqlConnection connection = _postgresql.GetConnection())
{
connection.Open();
NpgsqlCommand command = connection.CreateCommand();
@ -278,7 +278,7 @@ namespace skyscraper5.Aprs.AprsStorage
private bool TestForAprsStationCapabilities(string sender)
{
bool result;
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
using (NpgsqlConnection conn = _postgresql.GetConnection())
{
conn.Open();
NpgsqlCommand command = conn.CreateCommand();
@ -361,7 +361,7 @@ namespace skyscraper5.Aprs.AprsStorage
if (_gpsSentences.Contains(cgs))
return true;
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
using (NpgsqlConnection conn = _postgresql.GetConnection())
{
conn.Open();
NpgsqlCommand command = conn.CreateCommand();

View File

@ -1,13 +1,15 @@
using AprsSharp.Parsers.Aprs;
using GeoCoordinatePortable;
using log4net;
using NmeaParser.Messages;
using skyscraper5.Aprs.AprsSharp;
using skyscraper5.Skyscraper.Plugins;
using skyscraper8.Skyscraper.Plugins;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NmeaParser.Messages;
using skyscraper5.Aprs.AprsSharp;
using skyscraper5.Skyscraper.Plugins;
namespace skyscraper5.Aprs
{
@ -15,12 +17,11 @@ namespace skyscraper5.Aprs
{
private readonly LX9SESStorage _storage;
public DateTime? currentTime;
private PluginLogMessage LogEvent;
private static PluginLogger logger = PluginLogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public LX9SESMessageReceiver(LX9SESStorage storage, PluginLogMessage pluginLogMessage)
public LX9SESMessageReceiver(LX9SESStorage storage)
{
this._storage = storage;
this.LogEvent = pluginLogMessage;
}
public void OnAprsPosition(string packetSender, GeoCoordinate positionCoordinates, string? piComment)
@ -33,7 +34,7 @@ namespace skyscraper5.Aprs
if (_storage.AprsPosition(currentTime.Value, packetSender, positionCoordinates, piComment))
{
LogEvent(String.Format("[{3}] {0} is at {1}, {2}", packetSender, positionCoordinates.Latitude, positionCoordinates.Longitude, "AprsPosition"));
logger.Log(PluginLogLevel.Info,String.Format("[{3}] {0} is at {1}, {2}", packetSender, positionCoordinates.Latitude, positionCoordinates.Longitude, "AprsPosition"));
}
}
@ -49,13 +50,13 @@ namespace skyscraper5.Aprs
{
if (_storage.AprsPosition(currentTime.Value, packetSender, wi.Position.Coordinates, wiComment))
{
LogEvent(String.Format("[{3}] {0} is at {1}, {2}", packetSender, wi.Position.Coordinates.Latitude, wi.Position.Coordinates.Longitude,"AprsPosition"));
logger.Log(PluginLogLevel.Info, (String.Format("[{3}] {0} is at {1}, {2}", packetSender, wi.Position.Coordinates.Latitude, wi.Position.Coordinates.Longitude,"AprsPosition")));
}
}
if (_storage.AprsWeatherReport(currentTime.Value, packetSender, wi))
{
LogEvent(String.Format("[{2}] {0}, {1}", packetSender, currentTime.Value, "AprsWeather"));
logger.Log(PluginLogLevel.Info, (String.Format("[{2}] {0}, {1}", packetSender, currentTime.Value, "AprsWeather")));
}
}
@ -74,7 +75,7 @@ namespace skyscraper5.Aprs
if (_storage.AprsStationCapabilities(packetSender, stationCapabilities))
{
LogEvent(String.Format("[{2}] {0} -> {1}", packetSender, stationCapabilities.Encode(), "AprsStationCapabilities"));
logger.Log(PluginLogLevel.Info, (String.Format("[{2}] {0} -> {1}", packetSender, stationCapabilities.Encode(), "AprsStationCapabilities")));
}
}
@ -93,7 +94,7 @@ namespace skyscraper5.Aprs
bool conB = _storage.AprsGpsSentence(currentTime.Value, packetSender, gprmc.Course, gprmc.MagneticVariation, gprmc.Speed);
if (conA || conB)
{
LogEvent(String.Format("[{2}] {0}: {1}", packetSender, parsed.ToString(), "AprsGpsSentence"));
logger.Log(PluginLogLevel.Info, (String.Format("[{2}] {0}: {1}", packetSender, parsed.ToString(), "AprsGpsSentence")));
}
break;
default:

View File

@ -203,6 +203,16 @@ namespace skyscraper8.Experimentals.NdsSsu
blocks[i] = null;
}
}
public long CalculateLength()
{
long result = 0;
for (int i = 0; i < blocks.Length; i++)
{
result += (blocks[i].Length - 4);
}
return result;
}
}
public bool WasAlreadyPushed(byte[] payload, byte sectionNumber, byte lastSectionNumber)
@ -284,6 +294,16 @@ namespace skyscraper8.Experimentals.NdsSsu
superblocks[x] = null;
}
}
public long CalculateLength()
{
long result = 0;
for (int x = 0; x < superblocks.Length; x++)
{
result += superblocks[x].CalculateLength();
}
return result;
}
}
}

View File

@ -15,6 +15,9 @@ namespace skyscraper8.Experimentals.OtvSsu
[SkyscraperPlugin]
internal class OtvSsuDetector : Contestant, OtvSsuHandler
{
private const int MAXIMUM_FILE_SIZE = 33554432; //32MB.
//Let's use a limit here to avoid detecting too many large files and false positives.
private OtvSsuDetectorParser parser;
public OtvSsuDetector(int pid) : base("OpenTV SSU", pid)
{
@ -76,7 +79,7 @@ namespace skyscraper8.Experimentals.OtvSsu
uint unknown1 = ms.ReadUInt32BE();
uint offset = ms.ReadUInt32BE();
uint length = ms.ReadUInt32BE();
if (length > Int32.MaxValue)
if (length > MAXIMUM_FILE_SIZE)
{
_handler.OnOtvSsuError(_pid, OtvSsuError.FileTooLarge);
return;

View File

@ -169,6 +169,7 @@ namespace skyscraper8.Ietf.FLUTE
case null:
case "null":
case "ll":
case "nunull":
break;
case "gzip":
GZipStream level2 = new GZipStream(level1, CompressionMode.Decompress, false);

View File

@ -53,10 +53,18 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator
foundFrequencies = new List<BlindscanSearchResult>();
config.Ui.OnBlindscanOpenFoundFrquenciesWindow(foundFrequencies, config.TunerMetadata.Type);
if (!config.StreamReader.StartDvbEx(config.TunerMetadata.Index))
{
if (!config.StreamReader.StopDVB())
{
throw new Exception("failed to stop DVB in order to restart it.");
}
if (!config.StreamReader.StartDvbEx(config.TunerMetadata.Index))
{
throw new Exception("Failed to start DVB");
}
}
if (!RunBlindscan())
{
config.StreamReader.StopDVB();

View File

@ -103,7 +103,10 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator
public bool StopDVB()
{
throw new NotImplementedException();
bool result = _proxiedStreamReader.StopDVB();
if (result)
currentlySelectedTuner = -1;
return result;
}
public bool GetTunerType(ref STD_TYPE type)

View File

@ -313,6 +313,12 @@ namespace skyscraper5.Skyscraper.Scraper
if (id == 0x2710)
return "DRE-Crypt";
if (id == 0x188e)
return "Nagravision (?)";
if ((id >= 0x1ec0) && (id <= 0x1ec2))
return "Cryptoguard";
return "???";
}
}

View File

@ -27,7 +27,9 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
public override void DeclareWinner(SkyscraperContext skyscraperContext, int pid, ProgramContext programContext)
{
throw new NotImplementedException();
InteractionChannelPsiGatherer icPsi = new InteractionChannelPsiGatherer();
icPsi.Handler = skyscraperContext;
skyscraperContext.DvbContext.RegisterPacketProcessor(pid, new PsiDecoder(pid, icPsi));
}
public override void Introduce(ProgramContext programContext)

View File

@ -1,22 +0,0 @@
[startup]
dataStorage=3
objectStorage=1
[plugins_disabled]
postgresql=C:\Users\Sascha Schiemann\source\repos\skyscraper8\DataTableStorages\skyscraper5.Data.PostgreSql\bin\Debug\net8.0\skyscraper5.Data.PostgreSql.dll
minio=C:\Users\Sascha Schiemann\source\repos\skyscraper8\BlobStorages\skyscraper5.Data.Minio\bin\Debug\net8.0\skyscraper5.Data.Minio.dll
epgcollector=C:\Users\Sascha Schiemann\source\repos\skyscraper8\PrivateDataSpecifiers\skyscraper8.EPGCollectorPort\bin\Debug\net8.0\skyscraper8.EPGCollectorPort.dll
[objectStorage1]
Bucket=skyscraper5
Secure=0
SecretKey=12345678
AccessKey=feyris-tan
Endpoint=172.20.20.3:9000
[dataStorage3]
Username=ft
Port=5432
Password=welcometotheworld
Host=172.20.20.17
Database=skyscraper5