Now deleting IQ Graphics and RF Spectrums when deleting a Blindscan job.

This commit is contained in:
feyris-tan 2025-08-09 21:38:02 +02:00
parent 0049af0476
commit c07efd58d1
12 changed files with 120 additions and 19 deletions

View File

@ -17,6 +17,7 @@ using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using Minio.DataModel.Response; using Minio.DataModel.Response;
using skyscraper5.Dvb.Descriptors;
namespace skyscraper5.Data namespace skyscraper5.Data
{ {
@ -330,5 +331,30 @@ namespace skyscraper5.Data
WriteObject(fullName, ms); WriteObject(fullName, ms);
} }
private bool DeleteFile(string fullname)
{
RemoveObjectArgs removeObject = new RemoveObjectArgs();
removeObject.WithObject(fullname);
removeObject.WithBucket(_minioBucket);
Task task = _minioClient.RemoveObjectAsync(removeObject);
task.Wait();
if (task.Exception != null)
return false;
return true;
}
public void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2)
{
char polarityChar = frequencyItem2.ToString()[0];
string fullName = String.Format("/iq/{0}/{1}_{2}.iq", selectedGuid.ToString("D"), frequencyItem1, polarityChar);
DeleteFile(fullName);
}
public void DeleteRfSpectrum(Guid selectedGuid)
{
string fullName = String.Format("/rf/{0}.rf", selectedGuid.ToString("D"));
DeleteFile(fullName);
}
} }
} }

View File

@ -1,4 +1,9 @@
using skyscraper5.Skyscraper.IO.CrazycatStreamReader; using Npgsql;
using NpgsqlTypes;
using skyscraper5.Dvb.Descriptors;
using skyscraper5.Skyscraper;
using skyscraper5.Skyscraper.Gps;
using skyscraper5.Skyscraper.IO.CrazycatStreamReader;
using skyscraper5.src.Skyscraper.FrequencyListGenerator; using skyscraper5.src.Skyscraper.FrequencyListGenerator;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -8,10 +13,6 @@ using System.Linq;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Npgsql;
using NpgsqlTypes;
using skyscraper5.Skyscraper;
using skyscraper5.Skyscraper.Gps;
namespace skyscraper5.Data.PostgreSql namespace skyscraper5.Data.PostgreSql
{ {
@ -568,5 +569,27 @@ namespace skyscraper5.Data.PostgreSql
connection.Close(); connection.Close();
} }
} }
public IEnumerable<Tuple<int, SatelliteDeliverySystemDescriptor.PolarizationEnum>> GetBlindscanResultFrequencies(Guid selectedGuid)
{
using (NpgsqlConnection connection = new NpgsqlConnection(connectionStringBuilder.ToString()))
{
connection.Open();
NpgsqlCommand command = connection.CreateCommand();
command.CommandText = "SELECT freq, pol FROM skyscraper5_blindscan_search_results WHERE related_job = @job";
command.Parameters.AddWithValue("@job", NpgsqlDbType.Uuid, selectedGuid);
NpgsqlDataReader dataReader = command.ExecuteReader();
while (dataReader.Read())
{
int freq = dataReader.GetInt32(0);
int pol = dataReader.GetInt32(1);
Tuple<int, SatelliteDeliverySystemDescriptor.PolarizationEnum> child = new Tuple<int, SatelliteDeliverySystemDescriptor.PolarizationEnum>(freq, (SatelliteDeliverySystemDescriptor.PolarizationEnum)pol);
yield return child;
}
dataReader.Close();
dataReader.Dispose();
connection.Close();
}
}
} }
} }

View File

@ -7,6 +7,7 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper5.Dvb.Descriptors;
using skyscraper8.DvbNip; using skyscraper8.DvbNip;
using skyscraper8.Skyscraper.Scraper.Storage; using skyscraper8.Skyscraper.Scraper.Storage;
@ -351,6 +352,8 @@ namespace skyscraper5.Data.PostgreSql
return result; return result;
} }
private Dictionary<string, DateTime> _knownDvbiServiceListUpdateDates; private Dictionary<string, DateTime> _knownDvbiServiceListUpdateDates;
public DateTime GetDvbiServiceListLastUpdateDate(string id) public DateTime GetDvbiServiceListLastUpdateDate(string id)

View File

@ -8,34 +8,45 @@ using System.Linq;
using System.Runtime.Intrinsics.X86; using System.Runtime.Intrinsics.X86;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper5.Dvb.Descriptors;
using skyscraper8.Skyscraper.Scraper.Storage; using skyscraper8.Skyscraper.Scraper.Storage;
namespace SDL2Demo.Forms namespace SDL2Demo.Forms
{ {
class BlindscanJobDeleter : IRenderable class BlindscanJobDeleter : IRenderable
{ {
private readonly DataStorage storage; private readonly DataStorage dataStorage;
private readonly ObjectStorage objectStorage;
private List<DbBlindscanJob> blindscanJobs; private List<DbBlindscanJob> blindscanJobs;
private Guid selectedGuid; private Guid selectedGuid;
private string tableGuid; private string tableGuid;
public bool Closed { get; private set; } public bool Closed { get; private set; }
public BlindscanJobDeleter(DataStorage storage) public BlindscanJobDeleter(DataStorage dataStorage,ObjectStorage objectStorage)
{ {
this.storage = storage; this.dataStorage = dataStorage;
this.objectStorage = objectStorage;
this.LoadPastBlindscans(); this.LoadPastBlindscans();
this.tableGuid = Guid.NewGuid().ToString(); this.tableGuid = Guid.NewGuid().ToString();
} }
private void LoadPastBlindscans() private void LoadPastBlindscans()
{ {
blindscanJobs = storage.GetDbBlindscanJobs().ToList(); blindscanJobs = dataStorage.GetDbBlindscanJobs().ToList();
selectedGuid = Guid.Empty; selectedGuid = Guid.Empty;
} }
private void DeleteSelectedJob() private void DeleteSelectedJob()
{ {
storage.DeleteBlindscanJob(selectedGuid); IEnumerable<Tuple<int,SatelliteDeliverySystemDescriptor.PolarizationEnum>> frequencies = dataStorage.GetBlindscanResultFrequencies(selectedGuid);
foreach (Tuple<int, SatelliteDeliverySystemDescriptor.PolarizationEnum> frequency in frequencies)
{
objectStorage.DeleteIqGraph(selectedGuid, frequency.Item1, frequency.Item2);
}
objectStorage.DeleteRfSpectrum(selectedGuid);
dataStorage.DeleteBlindscanJob(selectedGuid);
LoadPastBlindscans(); LoadPastBlindscans();
} }

View File

@ -818,7 +818,12 @@ namespace SDL2Demo.Jobs
*/ */
IqChartData result = IqChartData.Create(); IqChartData result = IqChartData.Create();
IqWindow iqWindow = new IqWindow(JobContext.ImgUiDevice, result); IqWindow iqWindow = new IqWindow(JobContext.ImgUiDevice, result);
Monitor.Enter(JobContext.Renderables);
JobContext.Renderables.Add(iqWindow); JobContext.Renderables.Add(iqWindow);
Monitor.Exit(JobContext.Renderables);
sbyte[] buffer = new sbyte[400]; sbyte[] buffer = new sbyte[400];
DateTime started = DateTime.Now; DateTime started = DateTime.Now;
while (!result.IsComplete) while (!result.IsComplete)

View File

@ -555,7 +555,7 @@ namespace SkyscraperUI
{ {
if (ImGui.MenuItem("Delete Blindscan Jobs", CanOpenJobDeleter())) if (ImGui.MenuItem("Delete Blindscan Jobs", CanOpenJobDeleter()))
{ {
jobDeleter = new BlindscanJobDeleter(dataStorage); jobDeleter = new BlindscanJobDeleter(dataStorage, objectStorage);
} }
ImGui.EndMenu(); ImGui.EndMenu();
} }
@ -749,13 +749,12 @@ namespace SkyscraperUI
{ {
if (jobContext.Renderables.Count > 0) if (jobContext.Renderables.Count > 0)
{ {
lock (jobContext.Renderables) Monitor.Enter(jobContext.Renderables);
{ foreach (IRenderable jobContextRenderable in jobContext.Renderables)
foreach (IRenderable jobContextRenderable in jobContext.Renderables) {
{ jobContextRenderable.Render();
jobContextRenderable.Render(); }
} Monitor.Exit(jobContext.Renderables);
}
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -190,5 +190,6 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
object[] GetPluginConnector(); object[] GetPluginConnector();
void Ping(); void Ping();
IEnumerable<Tuple<int, SatelliteDeliverySystemDescriptor.PolarizationEnum>> GetBlindscanResultFrequencies(Guid selectedGuid);
} }
} }

View File

@ -1116,6 +1116,11 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
} }
} }
public IEnumerable<Tuple<int, SatelliteDeliverySystemDescriptor.PolarizationEnum>> GetBlindscanResultFrequencies(Guid selectedGuid)
{
throw new NotImplementedException();
}
public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt() public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@ -1465,6 +1470,16 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2)
{
throw new NotImplementedException();
}
public void DeleteRfSpectrum(Guid selectedGuid)
{
throw new NotImplementedException();
}
public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate,
uint privateDataSpecifier, List<string> privateDataSessions) uint privateDataSpecifier, List<string> privateDataSessions)
{ {

View File

@ -924,6 +924,11 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
} }
public IEnumerable<Tuple<int, SatelliteDeliverySystemDescriptor.PolarizationEnum>> GetBlindscanResultFrequencies(Guid selectedGuid)
{
throw new NotImplementedException();
}
public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt() public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt()
{ {
for (int x = 0; x < pmtEntries.Length; x++) for (int x = 0; x < pmtEntries.Length; x++)

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
using skyscraper5.Dvb.Descriptors;
using skyscraper8.DvbNip; using skyscraper8.DvbNip;
using skyscraper8.Ietf.FLUTE; using skyscraper8.Ietf.FLUTE;
using skyscraper8.Skyscraper.Drawing; using skyscraper8.Skyscraper.Drawing;
@ -88,5 +89,15 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2)
{
throw new NotImplementedException();
}
public void DeleteRfSpectrum(Guid selectedGuid)
{
throw new NotImplementedException();
}
} }
} }

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
using skyscraper5.Dvb.Descriptors;
using skyscraper5.Teletext; using skyscraper5.Teletext;
using skyscraper8.DvbNip; using skyscraper8.DvbNip;
using skyscraper8.Ietf.FLUTE; using skyscraper8.Ietf.FLUTE;
@ -28,5 +29,7 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener); void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener);
void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot); void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot);
void StoreRfSpectrum(Guid jobGuid, RfSpectrumData rfSpectrum); void StoreRfSpectrum(Guid jobGuid, RfSpectrumData rfSpectrum);
void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2);
void DeleteRfSpectrum(Guid selectedGuid);
} }
} }