diff --git a/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorage.cs b/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorage.cs index 3a26093..eb68415 100644 --- a/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorage.cs +++ b/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorage.cs @@ -8,9 +8,9 @@ using Minio.DataModel; using Minio.DataModel.Args; using Minio.Exceptions; using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper8.DvbNip; using skyscraper8.Ietf.FLUTE; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data { @@ -136,7 +136,8 @@ namespace skyscraper5.Data catch (AggregateException e) { MinioException minioException = e.InnerExceptions[0] as MinioException; - if (minioException.Message.Contains("Minio.Exceptions.ObjectNotFoundException")) + ObjectNotFoundException objectNotFoundException = minioException as ObjectNotFoundException; + if (objectNotFoundException != null) { definetlyMissingFiles.Add(combine); return false; diff --git a/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorageFactory.cs b/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorageFactory.cs new file mode 100644 index 0000000..2a6d0b2 --- /dev/null +++ b/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorageFactory.cs @@ -0,0 +1,55 @@ +using Minio; +using Minio.DataModel.Args; +using skyscraper5.Skyscraper.Plugins; +using skyscraper8.Skyscraper.Plugins; +using skyscraper8.Skyscraper.Scraper.Storage; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper5.Data.Minio +{ + [SkyscraperPlugin] + [StorageId(1)] + [StorageName("MinIO")] + public class MinioObjectStorageFactory : ObjectStorageFactory + { + private static PluginLogger logger = PluginLogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + + public string Bucket { get; set; } + + public bool Secure { get; set; } + + public string SecretKey { get; set; } + + public string AccessKey { get; set; } + + public string Endpoint { get; set; } + + public ObjectStorage CreateObjectStorage() + { + IMinioClient mc = new MinioClient() + .WithEndpoint(Endpoint) + .WithCredentials(AccessKey, SecretKey) + .WithSSL(Secure).Build(); + BucketExistsArgs bucketExistsArgs = new BucketExistsArgs().WithBucket(Bucket); + bool bucketExists = mc.BucketExistsAsync(bucketExistsArgs).Result; + if (!bucketExists) + { + logger.Log(PluginLogLevel.Info, "Creating MinIO Bucket: {0}", Bucket); + MakeBucketArgs makeBucketArgs = new MakeBucketArgs().WithBucket(Bucket); + mc.MakeBucketAsync(makeBucketArgs).Wait(); + } + + MinioObjectStorage minioOs = new MinioObjectStorage(mc, Bucket); + return minioOs; + } + + public bool IsEquivalent(DataStorageFactory dataStorageFactory) + { + return false; + } + } +} diff --git a/BlobStorages/skyscraper5.Data.Minio/skyscraper5.Data.Minio.csproj b/BlobStorages/skyscraper5.Data.Minio/skyscraper5.Data.Minio.csproj index e66e7c2..f208679 100644 --- a/BlobStorages/skyscraper5.Data.Minio/skyscraper5.Data.Minio.csproj +++ b/BlobStorages/skyscraper5.Data.Minio/skyscraper5.Data.Minio.csproj @@ -5,7 +5,7 @@ - + diff --git a/DataTableStorages/skyscraper5.Data.MySql/Ait.cs b/DataTableStorages/skyscraper5.Data.MySql/Ait.cs index 5352746..944a628 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Ait.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Ait.cs @@ -1,6 +1,5 @@  using MySqlConnector; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper5.Mhp.Si; using skyscraper5.Mhp.Si.Model; using System.Collections.Generic; @@ -9,6 +8,7 @@ using skyscraper5.Mhp.Descriptors; using skyscraper5.Mhp.Descriptors.InteractionTransportSelectors; using System; using skyscraper5.Teletext; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Bat.cs b/DataTableStorages/skyscraper5.Data.MySql/Bat.cs index 30021cf..f86de11 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Bat.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Bat.cs @@ -1,5 +1,4 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -23,6 +22,7 @@ using skyscraper5.src.InteractionChannel.Model.Descriptors; using System.Net.NetworkInformation; using System.Net; using skyscraper5.src.Skyscraper.Scraper.Dns; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Cat.cs b/DataTableStorages/skyscraper5.Data.MySql/Cat.cs index 6645de1..5145177 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Cat.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Cat.cs @@ -1,6 +1,6 @@ using MySqlConnector; using skyscraper5.Mpeg2.Descriptors; -using skyscraper5.Skyscraper.Scraper.Storage.Split; +using skyscraper8.Skyscraper.Scraper.Storage; using System; using System.Collections.Generic; using System.Linq; diff --git a/DataTableStorages/skyscraper5.Data.MySql/Docsis.cs b/DataTableStorages/skyscraper5.Data.MySql/Docsis.cs index e33ef40..a468441 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Docsis.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Docsis.cs @@ -1,5 +1,5 @@ using MySqlConnector; -using skyscraper5.Skyscraper.Scraper.Storage.Split; +using skyscraper8.Skyscraper.Scraper.Storage; using System; using System.Collections.Generic; using System.Linq; diff --git a/DataTableStorages/skyscraper5.Data.MySql/DsmCc.cs b/DataTableStorages/skyscraper5.Data.MySql/DsmCc.cs index 18b8fb4..264ba53 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/DsmCc.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/DsmCc.cs @@ -1,5 +1,5 @@ using MySqlConnector; -using skyscraper5.Skyscraper.Scraper.Storage.Split; +using skyscraper8.Skyscraper.Scraper.Storage; using System; using System.Collections.Generic; using System.Linq; diff --git a/DataTableStorages/skyscraper5.Data.MySql/DsmCcEvent.cs b/DataTableStorages/skyscraper5.Data.MySql/DsmCcEvent.cs index c6bff1f..a598c47 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/DsmCcEvent.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/DsmCcEvent.cs @@ -1,11 +1,11 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MySqlConnector; using skyscraper5.DsmCc.Descriptors; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Eit.cs b/DataTableStorages/skyscraper5.Data.MySql/Eit.cs index 8a81277..1ff4fde 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Eit.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Eit.cs @@ -1,5 +1,4 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,6 +7,7 @@ using System.Threading.Tasks; using MySqlConnector; using skyscraper5.Dvb.Descriptors; using skyscraper5.Dvb.Psi.Model; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Int.cs b/DataTableStorages/skyscraper5.Data.MySql/Int.cs index 48ebf2d..ba2b0fa 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Int.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Int.cs @@ -1,5 +1,5 @@ using skyscraper5.Dvb.DataBroadcasting.IntModel; -using skyscraper5.Skyscraper.Scraper.Storage.Split; +using skyscraper8.Skyscraper.Scraper.Storage; using System; using System.Collections.Generic; using System.Linq; diff --git a/DataTableStorages/skyscraper5.Data.MySql/MySqlDataStorage.cs b/DataTableStorages/skyscraper5.Data.MySql/MySqlDataStorage.cs index 2666d76..3245388 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/MySqlDataStorage.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/MySqlDataStorage.cs @@ -15,13 +15,13 @@ using skyscraper5.Skyscraper.Equipment; using skyscraper5.Skyscraper.Gps; using skyscraper5.Skyscraper.Headless; using skyscraper5.Skyscraper.IO.CrazycatStreamReader; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper5.Skyscraper.Scraper.Storage.Utilities; using skyscraper5.src.InteractionChannel.Model.Descriptors; using skyscraper5.src.InteractionChannel.Model; using skyscraper5.src.Skyscraper.FrequencyListGenerator; using skyscraper5.src.Skyscraper.Scraper.Dns; using skyscraper5.Teletext; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Nit.cs b/DataTableStorages/skyscraper5.Data.MySql/Nit.cs index 56d3d0c..68418e2 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Nit.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Nit.cs @@ -9,7 +9,7 @@ using MySqlConnector; using skyscraper5.Dvb.Descriptors; using skyscraper5.Dvb.Descriptors.Extension; using skyscraper5.Dvb.Psi.Model; -using skyscraper5.Skyscraper.Scraper.Storage.Split; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Pat.cs b/DataTableStorages/skyscraper5.Data.MySql/Pat.cs index fa9cee3..7eb7fbb 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Pat.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Pat.cs @@ -1,10 +1,10 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MySqlConnector; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Pmt.cs b/DataTableStorages/skyscraper5.Data.MySql/Pmt.cs index 7b233f3..a0500d9 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Pmt.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Pmt.cs @@ -1,5 +1,4 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -11,6 +10,7 @@ using skyscraper5.Mpeg2.Descriptors; using skyscraper5.Mpeg2.Psi.Model; using System.IO; using static skyscraper5.Dvb.Descriptors.ApplicationSignallingDescriptor; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Scte35.cs b/DataTableStorages/skyscraper5.Data.MySql/Scte35.cs index 95b58e6..36a8d26 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Scte35.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Scte35.cs @@ -1,5 +1,4 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,6 +6,7 @@ using System.Threading.Tasks; using MySqlConnector; using skyscraper5.Scte35; using skyscraper5.Scte35.Descriptors; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Sdt.cs b/DataTableStorages/skyscraper5.Data.MySql/Sdt.cs index d68addb..f5dcf43 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Sdt.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Sdt.cs @@ -1,5 +1,4 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Data; using System.Linq; @@ -9,6 +8,7 @@ using MySqlConnector; using skyscraper5.Dvb.Descriptors; using skyscraper5.Dvb.Psi.Model; using static skyscraper5.Dvb.Descriptors.ServiceListDescriptor; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Skyscraper.cs b/DataTableStorages/skyscraper5.Data.MySql/Skyscraper.cs index 4eaa3bf..0e42b73 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Skyscraper.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Skyscraper.cs @@ -1,7 +1,7 @@ using MySqlConnector; using skyscraper5.Skyscraper; using skyscraper5.Skyscraper.Headless; -using skyscraper5.Skyscraper.Scraper.Storage.Split; +using skyscraper8.Skyscraper.Scraper.Storage; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/DataTableStorages/skyscraper5.Data.MySql/Speedhacks.cs b/DataTableStorages/skyscraper5.Data.MySql/Speedhacks.cs index 5da1520..aaa7b21 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Speedhacks.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Speedhacks.cs @@ -1,5 +1,4 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -12,6 +11,7 @@ using skyscraper5.Mpeg2.Descriptors; using skyscraper5.Mpeg2.Psi.Model; using static skyscraper5.Dvb.Descriptors.ContentIdentifierDescriptor; using System.Diagnostics.Metrics; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Tdt.cs b/DataTableStorages/skyscraper5.Data.MySql/Tdt.cs index 7971554..8d7608a 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Tdt.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Tdt.cs @@ -1,10 +1,10 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MySqlConnector; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Teletext.cs b/DataTableStorages/skyscraper5.Data.MySql/Teletext.cs index 812c76c..a442c82 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Teletext.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Teletext.cs @@ -1,6 +1,6 @@ using MySqlConnector; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper5.Teletext; +using skyscraper8.Skyscraper.Scraper.Storage; using System; using System.Collections.Generic; using System.Linq; diff --git a/DataTableStorages/skyscraper5.Data.MySql/Tot.cs b/DataTableStorages/skyscraper5.Data.MySql/Tot.cs index 9d356c9..cdf9ad0 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Tot.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Tot.cs @@ -1,5 +1,4 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Versioning; @@ -7,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using MySqlConnector; using skyscraper5.Dvb.Descriptors; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Tsdt.cs b/DataTableStorages/skyscraper5.Data.MySql/Tsdt.cs index 9af695c..69cbf0b 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Tsdt.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Tsdt.cs @@ -1,5 +1,5 @@ using MySqlConnector; -using skyscraper5.Skyscraper.Scraper.Storage.Split; +using skyscraper8.Skyscraper.Scraper.Storage; using System; using System.Collections.Generic; using System.Linq; diff --git a/DataTableStorages/skyscraper5.Data.MySql/Unt.cs b/DataTableStorages/skyscraper5.Data.MySql/Unt.cs index 77bd70a..62aba1b 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Unt.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Unt.cs @@ -1,11 +1,11 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MySqlConnector; using skyscraper5.Dvb.SystemSoftwareUpdate.Model; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.MySql/Utilities.cs b/DataTableStorages/skyscraper5.Data.MySql/Utilities.cs index 5d12489..3d6d31b 100644 --- a/DataTableStorages/skyscraper5.Data.MySql/Utilities.cs +++ b/DataTableStorages/skyscraper5.Data.MySql/Utilities.cs @@ -1,5 +1,4 @@ -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using System; +using System; using System.Collections.Generic; using System.Data.Common; using System.IO; @@ -7,6 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using MySqlConnector; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.MySql { diff --git a/DataTableStorages/skyscraper5.Data.PostgreSql/Dvbi.cs b/DataTableStorages/skyscraper5.Data.PostgreSql/Dvbi.cs index 0136f42..d07a628 100644 --- a/DataTableStorages/skyscraper5.Data.PostgreSql/Dvbi.cs +++ b/DataTableStorages/skyscraper5.Data.PostgreSql/Dvbi.cs @@ -1,6 +1,5 @@ using Npgsql; using NpgsqlTypes; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper8.DvbI; using System; using System.Collections.Generic; @@ -9,6 +8,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using skyscraper8.DvbNip; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.PostgreSql { diff --git a/DataTableStorages/skyscraper5.Data.PostgreSql/Eit.cs b/DataTableStorages/skyscraper5.Data.PostgreSql/Eit.cs index 44b4dfc..7c7d318 100644 --- a/DataTableStorages/skyscraper5.Data.PostgreSql/Eit.cs +++ b/DataTableStorages/skyscraper5.Data.PostgreSql/Eit.cs @@ -10,7 +10,6 @@ using NpgsqlTypes; using skyscraper5.Dvb.Descriptors; using skyscraper5.Dvb.Psi.Model; using skyscraper5.Mpeg2.Psi.Model; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper5.Skyscraper.Scraper.Storage.Utilities; namespace skyscraper5.Data.PostgreSql diff --git a/DataTableStorages/skyscraper5.Data.PostgreSql/PostgresqlDataStore.cs b/DataTableStorages/skyscraper5.Data.PostgreSql/PostgresqlDataStore.cs index 3318786..5107809 100644 --- a/DataTableStorages/skyscraper5.Data.PostgreSql/PostgresqlDataStore.cs +++ b/DataTableStorages/skyscraper5.Data.PostgreSql/PostgresqlDataStore.cs @@ -6,8 +6,8 @@ using NpgsqlTypes; using skyscraper5.Dvb.Psi.Model; using skyscraper5.Dvb.TvAnytime; using skyscraper5.Skyscraper.Headless; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper8.DvbNip; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Data.PostgreSql { diff --git a/DataTableStorages/skyscraper5.Data.PostgreSql/PostgresqlDataStoreFactory.cs b/DataTableStorages/skyscraper5.Data.PostgreSql/PostgresqlDataStoreFactory.cs new file mode 100644 index 0000000..1d498d6 --- /dev/null +++ b/DataTableStorages/skyscraper5.Data.PostgreSql/PostgresqlDataStoreFactory.cs @@ -0,0 +1,49 @@ +using Npgsql; +using skyscraper5.Skyscraper.Plugins; +using skyscraper8.Skyscraper.Plugins; +using skyscraper8.Skyscraper.Scraper.Storage; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper5.Data.PostgreSql +{ + [SkyscraperPlugin] + [StorageId(3)] + [StorageName("PostgreSQL")] + public class PostgresqlDataStoreFactory : DataStorageFactory + { + private static PluginLogger logger = PluginLogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + + public string Username { get; set; } + + public ushort Port { get; set; } + + public string Password { get; set; } + + public string Host { get; set; } + + public string Database { get; set; } + + public DataStorage CreateDataStorage() + { + logger.Log(PluginLogLevel.Info, "Connecting to PostgreSQL & MinIO"); + NpgsqlConnectionStringBuilder ncsb = new NpgsqlConnectionStringBuilder(); + ncsb.Database = Database; + ncsb.ApplicationName = "skyscraper5"; + ncsb.Host = Host; + ncsb.Password = Password; + ncsb.Pooling = true; + ncsb.Port = Port; + ncsb.Username = Username; + + if (Debugger.IsAttached) + ncsb.Timeout = 1024; + + return new PostgresqlDataStore(ncsb); + } + } +} diff --git a/DataTableStorages/skyscraper5.Data.PostgreSql/Rds.cs b/DataTableStorages/skyscraper5.Data.PostgreSql/Rds.cs index 0d659ab..80887d4 100644 --- a/DataTableStorages/skyscraper5.Data.PostgreSql/Rds.cs +++ b/DataTableStorages/skyscraper5.Data.PostgreSql/Rds.cs @@ -1,5 +1,5 @@ using skyscraper5.Rds.Messages; -using skyscraper5.Skyscraper.Scraper.Storage.Split; +using skyscraper8.Skyscraper.Scraper.Storage; using System; using System.Collections.Generic; using System.Linq; diff --git a/DataTableStorages/skyscraper5.Data.PostgreSql/Sgt.cs b/DataTableStorages/skyscraper5.Data.PostgreSql/Sgt.cs index 0d1fe92..7ec429b 100644 --- a/DataTableStorages/skyscraper5.Data.PostgreSql/Sgt.cs +++ b/DataTableStorages/skyscraper5.Data.PostgreSql/Sgt.cs @@ -1,8 +1,8 @@ using Newtonsoft.Json; using Npgsql; using NpgsqlTypes; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper8.Ses; +using skyscraper8.Skyscraper.Scraper.Storage; using skyscraper8.Skyscraper.Scraper.Storage.Utilities; using System; using System.Collections.Generic; diff --git a/Documentation/TODO.md b/Documentation/TODO.md index a2a8ffe..46daf21 100644 --- a/Documentation/TODO.md +++ b/Documentation/TODO.md @@ -124,7 +124,7 @@ * HLS Stream * benötigt vorher einen PCR delayten Stream * benötigt vorher einen Rate-Limited Stream -* ScraperStorage ablösen, und stattdessen DataStorage und FileStorage einzeln setzen. +* [DONE] ScraperStorage ablösen, und stattdessen DataStorage und FileStorage einzeln setzen. * .tar/.tar.gz File mit FilesystemStorage Inhalt importieren * WGS84 zu Lat/Lon konvertieren - für RCS-Map. * Beispielcode in C# hier: https://stackoverflow.com/a/16660841 diff --git a/Documentation/storage_system_ids.md b/Documentation/storage_system_ids.md new file mode 100644 index 0000000..6103b1e --- /dev/null +++ b/Documentation/storage_system_ids.md @@ -0,0 +1,14 @@ +# Data Storages +These contain tabular data, like EIT Events, Scan results, etc. +|ID|Type | +|--|----------| +| 1|In-Memory | +| 2|Filesystem| +| 3|PostgreSQL| + +# Object Storages +These contain blob-like data, like Screenshots, DSM-CC Carousels, etc. +|ID|Type | +|--|----------| +| 1|MinIO | +| 2|Filesystem| diff --git a/FactoryStorages/skyscraper5.Storage.MariaDbMinio/MariaDbMinioStorageFactory.cs b/FactoryStorages/skyscraper5.Storage.MariaDbMinio/MariaDbMinioStorageFactory.cs deleted file mode 100644 index 6ed5a3f..0000000 --- a/FactoryStorages/skyscraper5.Storage.MariaDbMinio/MariaDbMinioStorageFactory.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Minio; -using Minio.DataModel.Args; -using MySqlConnector; -using skyscraper5.Data; -using skyscraper5.Data.MySql; -using skyscraper5.Skyscraper.Scraper.Storage; -using skyscraper5.Skyscraper.Scraper.Storage.Split; - -namespace skyscraper5.Storage.MariaDbMinio -{ - [ScrapeStorageFactoryId(2,"MariaDB & MinIO",false)] - public class MariaDbMinioStorageFactory : IScraperStorageFactory - { - public IScraperStroage CreateScraperStroage() - { - MySqlConnectionStringBuilder mcsb = new MySqlConnectionStringBuilder(); - mcsb.Database = MariaDbDatabase; - mcsb.Password = MariaDbPassword; - mcsb.Port = MariaDbPort; - mcsb.Server = MariaDbHost; - mcsb.UserID = MariaDbUsername; - mcsb.ApplicationName = "skyscraper5"; - mcsb.Pooling = true; - - IMinioClient mc = new MinioClient() - .WithEndpoint(MinioEndpoint) - .WithCredentials(MinioAccessKey, MinioSecretKey) - .WithSSL(MinioSecure).Build(); - BucketExistsArgs bucketExistsArgs = new BucketExistsArgs().WithBucket(MinioBucket); - bool bucketExists = mc.BucketExistsAsync(bucketExistsArgs).Result; - if (!bucketExists) - { - MakeBucketArgs makeBucketArgs = new MakeBucketArgs().WithBucket(MinioBucket); - mc.MakeBucketAsync(makeBucketArgs).Wait(); - } - - MySqlDataStorage myds = new MySqlDataStorage(mcsb); - - MinioObjectStorage mos = new MinioObjectStorage(mc, MinioBucket); - - return new SplitScraperStorage(myds, mos); - } - - - public string MariaDbHost { get; set; } - public ushort MariaDbPort { get; set; } - public string MariaDbUsername { get; set; } - public string MariaDbPassword { get; set; } - public string MariaDbDatabase { get; set; } - public string MinioEndpoint { get; set; } - public string MinioAccessKey { get; set; } - public string MinioSecretKey { get; set; } - public bool MinioSecure { get; set; } - public string MinioBucket { get; set; } - } -} diff --git a/FactoryStorages/skyscraper5.Storage.MariaDbMinio/skyscraper5.Storage.MariaDbMinio.csproj b/FactoryStorages/skyscraper5.Storage.MariaDbMinio/skyscraper5.Storage.MariaDbMinio.csproj deleted file mode 100644 index 81002cb..0000000 --- a/FactoryStorages/skyscraper5.Storage.MariaDbMinio/skyscraper5.Storage.MariaDbMinio.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net8.0 - - - - - - - - diff --git a/FactoryStorages/skyscraper5.Storage.PostgresqlMinio/PostgresqlMinioStorageFactory.cs b/FactoryStorages/skyscraper5.Storage.PostgresqlMinio/PostgresqlMinioStorageFactory.cs deleted file mode 100644 index 21a30b5..0000000 --- a/FactoryStorages/skyscraper5.Storage.PostgresqlMinio/PostgresqlMinioStorageFactory.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System.Diagnostics; -using Minio; -using Minio.DataModel.Args; -using Npgsql; -using skyscraper5.Data; -using skyscraper5.Data.PostgreSql; -using skyscraper5.Skyscraper.Plugins; -using skyscraper5.Skyscraper.Scraper.Storage; -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using skyscraper8.Skyscraper.Plugins; - -namespace skyscraper5.Storage.PostgresqlMinio -{ - [SkyscraperPlugin] - [ScrapeStorageFactoryId(3,"PostgreSQL & MinIO",false)] - public class PostgresqlMinioStorageFactory : IScraperStorageFactory - { - private static PluginLogger logger = PluginLogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - public IScraperStroage CreateScraperStroage() - { - logger.Log(PluginLogLevel.Info, "Connecting to PostgreSQL & MinIO"); - NpgsqlConnectionStringBuilder ncsb = new NpgsqlConnectionStringBuilder(); - ncsb.Database = PostgreSqlDatabase; - ncsb.ApplicationName = "skyscraper5"; - ncsb.Host = PostgreSqlHost; - ncsb.Password = PostgreSqlPassword; - ncsb.Pooling = true; - ncsb.Port = PostgreSqlPort; - ncsb.Username = PostgreSqlUsername; - - if (Debugger.IsAttached) - ncsb.Timeout = 1024; - - IMinioClient mc = new MinioClient() - .WithEndpoint(MinioEndpoint) - .WithCredentials(MinioAccessKey, MinioSecretKey) - .WithSSL(MinioSecure).Build(); - BucketExistsArgs bucketExistsArgs = new BucketExistsArgs().WithBucket(MinioBucket); - bool bucketExists = mc.BucketExistsAsync(bucketExistsArgs).Result; - if (!bucketExists) - { - logger.Log(PluginLogLevel.Info, "Creating MinIO Bucket: {0}", MinioBucket); - MakeBucketArgs makeBucketArgs = new MakeBucketArgs().WithBucket(MinioBucket); - mc.MakeBucketAsync(makeBucketArgs).Wait(); - } - - PostgresqlDataStore postgresDs = new PostgresqlDataStore(ncsb); - MinioObjectStorage minioOs = new MinioObjectStorage(mc, MinioBucket); - - - return new SplitScraperStorage(postgresDs, minioOs); - } - - public string MinioBucket { get; set; } - - public bool MinioSecure { get; set; } - - public string MinioSecretKey { get; set; } - - public string MinioAccessKey { get; set; } - - public string MinioEndpoint { get; set; } - - public string PostgreSqlUsername { get; set; } - - public ushort PostgreSqlPort { get; set; } - - public string PostgreSqlPassword { get; set; } - - public string PostgreSqlHost { get; set; } - - public string PostgreSqlDatabase { get; set; } - } -} diff --git a/FactoryStorages/skyscraper5.Storage.PostgresqlMinio/skyscraper5.Storage.PostgresqlMinio.csproj b/FactoryStorages/skyscraper5.Storage.PostgresqlMinio/skyscraper5.Storage.PostgresqlMinio.csproj deleted file mode 100644 index 99b349f..0000000 --- a/FactoryStorages/skyscraper5.Storage.PostgresqlMinio/skyscraper5.Storage.PostgresqlMinio.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net8.0 - true - - - - - - - - diff --git a/skyscraper8.sln b/skyscraper8.sln index a08fca2..01fc13c 100644 --- a/skyscraper8.sln +++ b/skyscraper8.sln @@ -47,12 +47,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper5.Data.PostgreSql EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper5.RSR.IQTester", "Gimmicks\skyscraper5.RSR.IQTester\skyscraper5.RSR.IQTester.csproj", "{0E4C7079-228A-B94C-379A-8A14B08BAB34}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StorageFactories", "StorageFactories", "{21CE40E6-0C04-4994-9353-F8A4208B6DA2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper5.Storage.MariaDbMinio", "FactoryStorages\skyscraper5.Storage.MariaDbMinio\skyscraper5.Storage.MariaDbMinio.csproj", "{11572C79-1D7F-5609-C7D6-8E32130E3901}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper5.Storage.PostgresqlMinio", "FactoryStorages\skyscraper5.Storage.PostgresqlMinio\skyscraper5.Storage.PostgresqlMinio.csproj", "{B3930CC1-4877-FC74-8CD3-CFED82DB7474}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper5.DNS", "MpePlugins\skyscraper5.DNS\skyscraper5.DNS.csproj", "{3B52C24E-58E2-F982-F9B7-B9E7465B82A2}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper5.Gimmicks.IptvCollector", "Gimmicks\skyscraper5.Gimmicks.IptvCollector\skyscraper5.Gimmicks.IptvCollector.csproj", "{8F17668C-623C-F9B3-EAD4-2922E5414B75}" @@ -131,14 +125,6 @@ Global {0E4C7079-228A-B94C-379A-8A14B08BAB34}.Debug|Any CPU.Build.0 = Debug|Any CPU {0E4C7079-228A-B94C-379A-8A14B08BAB34}.Release|Any CPU.ActiveCfg = Release|Any CPU {0E4C7079-228A-B94C-379A-8A14B08BAB34}.Release|Any CPU.Build.0 = Release|Any CPU - {11572C79-1D7F-5609-C7D6-8E32130E3901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {11572C79-1D7F-5609-C7D6-8E32130E3901}.Debug|Any CPU.Build.0 = Debug|Any CPU - {11572C79-1D7F-5609-C7D6-8E32130E3901}.Release|Any CPU.ActiveCfg = Release|Any CPU - {11572C79-1D7F-5609-C7D6-8E32130E3901}.Release|Any CPU.Build.0 = Release|Any CPU - {B3930CC1-4877-FC74-8CD3-CFED82DB7474}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B3930CC1-4877-FC74-8CD3-CFED82DB7474}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B3930CC1-4877-FC74-8CD3-CFED82DB7474}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B3930CC1-4877-FC74-8CD3-CFED82DB7474}.Release|Any CPU.Build.0 = Release|Any CPU {3B52C24E-58E2-F982-F9B7-B9E7465B82A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3B52C24E-58E2-F982-F9B7-B9E7465B82A2}.Debug|Any CPU.Build.0 = Debug|Any CPU {3B52C24E-58E2-F982-F9B7-B9E7465B82A2}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -178,8 +164,6 @@ Global {17C2E095-B952-8919-2C68-F2EAA7A601C3} = {CDAECB5B-E4A5-4287-85CA-6D65085A091E} {07214423-32B2-DDE8-8D38-511D55ADC206} = {CDAECB5B-E4A5-4287-85CA-6D65085A091E} {0E4C7079-228A-B94C-379A-8A14B08BAB34} = {E00647B6-4509-4A1C-A7CB-D0C72325D23E} - {11572C79-1D7F-5609-C7D6-8E32130E3901} = {21CE40E6-0C04-4994-9353-F8A4208B6DA2} - {B3930CC1-4877-FC74-8CD3-CFED82DB7474} = {21CE40E6-0C04-4994-9353-F8A4208B6DA2} {3B52C24E-58E2-F982-F9B7-B9E7465B82A2} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} {8F17668C-623C-F9B3-EAD4-2922E5414B75} = {E00647B6-4509-4A1C-A7CB-D0C72325D23E} {46CACA1C-F9B2-2FE0-2068-716F381325E9} = {E23457C5-3A34-48EE-8107-C91E2C174B2D} diff --git a/skyscraper8/DvbNip/DvbNipUtilities.cs b/skyscraper8/DvbNip/DvbNipUtilities.cs index 795cabe..354f84e 100644 --- a/skyscraper8/DvbNip/DvbNipUtilities.cs +++ b/skyscraper8/DvbNip/DvbNipUtilities.cs @@ -37,6 +37,8 @@ namespace skyscraper8.DvbNip if (string.IsNullOrEmpty(Path.GetExtension(newFilename))) newFilename += ".dat"; + newFilename = newFilename.Replace("%3D", "-3D-"); + return newFilename; } diff --git a/skyscraper8/Passing.cs b/skyscraper8/Passing.cs index 28ac37e..bfee833 100644 --- a/skyscraper8/Passing.cs +++ b/skyscraper8/Passing.cs @@ -10,6 +10,7 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; using System.Threading.Tasks; +using log4net; using skyscraper5.Dvb.Psi.Model; using skyscraper5.Mpeg2; using skyscraper5.Skyscraper; @@ -20,17 +21,20 @@ using skyscraper5.Skyscraper.IO.TunerInterface; using skyscraper5.Skyscraper.Plugins; using skyscraper5.Skyscraper.Scraper; using skyscraper5.Skyscraper.Scraper.Storage; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5 { public class Passing { - public IScraperStroage ScraperStorage { get; set; } + public DataStorage DataStorage { get; private set; } + public ObjectStorage ObjectStorage { get; private set; } private IStreamReader streamReader; private List tuners; private List satellitePositions; + private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name); - public Passing() + public Passing() { } @@ -39,47 +43,42 @@ namespace skyscraper5 { Ini ini = PluginManager.GetInstance().Ini; - - int requiredFactoryId = ini.ReadValue("startup", "storage", -1); - if (requiredFactoryId == -1) - { - Console.WriteLine("Could not determine storage factory from ini file. Configure it using the UI!"); - return false; - } - - ScraperStorageFactoryConnectionManager connectionManager = ScraperStorageFactoryConnectionManager.GetInstance(); - - DirectoryInfo di = new DirectoryInfo("."); - FileInfo[] fileInfos = di.GetFiles("skyscraper5.Storage.*.dll"); - foreach (KeyValuePair keyValuePair in connectionManager.GetKnownFactories()) + StorageConnectionManager connectionManager = StorageConnectionManager.GetInstance(); + + IEnumerable> allKnownFactoryNames = connectionManager.GetAllKnownFactoryNames(); + foreach (Tuple knownFactoryName in allKnownFactoryNames) { - Console.WriteLine("Found Storage Factory #{0}, {1}", keyValuePair.Key.Id, keyValuePair.Key.DisplayName); + logger.InfoFormat("Found {0} Storage Factory #{1}, {2}",knownFactoryName.Item2 ? "Data" : "Object",knownFactoryName.Item1,knownFactoryName.Item3); } - string iniCategoryName = String.Format("storage{0}", requiredFactoryId); - if (!ini.ContainsKey(iniCategoryName)) + logger.Debug("Acquiring Default Data Storage..."); + DataStorageFactory dataStorageFactory = connectionManager.GetDefaultDataStorageFactory(); + logger.Debug("Acquiring Default Object Storage..."); + ObjectStorageFactory objectStorageFactory = connectionManager.GetDefaultObjectStorageFactory(); + logger.Debug("Acquiring Data Storage..."); + DataStorage = dataStorageFactory.CreateDataStorage(); + if (DataStorage == null) { - Console.WriteLine("Could not find configuration for the storage factory. Configure it using the UI!"); - return false; + logger.FatalFormat("The data storage factory didn't create a data storage."); + return false; } - KeyValuePair valuePair = connectionManager.GetKnownFactories().First(x => x.Key.Id == requiredFactoryId); - if (valuePair.Key == null) + bool isEquivalent = objectStorageFactory.IsEquivalent(dataStorageFactory); + if (isEquivalent) { - Console.WriteLine("Storage Factory {0} was not loaded. Reconfigure with the UI!", requiredFactoryId); - return false; + logger.Debug("Using the Data Storage as Object Storage."); + ObjectStorage = (ObjectStorage)DataStorage; } - - string factoryCname = String.Format("storage{0}", valuePair.Key.Id); - PluginManager.GetInstance().AutoconfigureObject(factoryCname, valuePair.Value); - - Console.WriteLine("Booting {0}...", valuePair.Key.DisplayName); - ScraperStorage = valuePair.Value.CreateScraperStroage(); - if (ScraperStorage == null) + else { - Console.WriteLine("The storage factory didn't create a storage."); - return false; + logger.Debug("Acquiring Object Storage..."); + ObjectStorage = objectStorageFactory.CreateObjectStorage(); + if (ObjectStorage == null) + { + logger.FatalFormat("The object storage factory didn't create an object storage."); + return false; + } } TunerFactoryConnectionManager tunerFactoryConnectionManager = TunerFactoryConnectionManager.GetInstance(); @@ -152,9 +151,9 @@ namespace skyscraper5 continue; } ; - if (ScraperStorage.UiTunerTestFor(foundTuner)) + if (DataStorage.UiTunerTestFor(foundTuner)) { - ScraperStorage.UiTunerGetConfiguration(foundTuner); + DataStorage.UiTunerGetConfiguration(foundTuner); } if (tuners == null) @@ -162,14 +161,14 @@ namespace skyscraper5 tuners.Add(foundTuner); } - satellitePositions = ScraperStorage.UiSatellitesListAll(); + satellitePositions = DataStorage.UiSatellitesListAll(); return true; } private HeadlessJob GetNextJob() { - HeadlessJob headlessJob = ScraperStorage.GetQueuedJob(); + HeadlessJob headlessJob = DataStorage.GetQueuedJob(); if (headlessJob != null) { return headlessJob; @@ -186,7 +185,7 @@ namespace skyscraper5 Run(headlessJob); if (!headlessJob.isSynthetic) { - ScraperStorage.SetQueuedJobComplete(headlessJob); + DataStorage.SetQueuedJobComplete(headlessJob); } } } @@ -225,7 +224,7 @@ namespace skyscraper5 private void ReimportTag(int tag1) { - IReadOnlyList queue = ScraperStorage.ListImportFileByTag1(tag1); + IReadOnlyList queue = DataStorage.ListImportFileByTag1(tag1); foreach(string filename in queue) { FileInfo fi = new FileInfo(filename); @@ -253,7 +252,7 @@ namespace skyscraper5 if (!fi.Extension.ToLowerInvariant().Equals(".ts")) continue; - if (ScraperStorage.ImportFileKnown(fi)) + if (DataStorage.ImportFileKnown(fi)) continue; FileStream fileStream = fi.OpenRead(); @@ -262,8 +261,8 @@ namespace skyscraper5 ScrapeStream(fileStream,true, out tstype); stopwatch.Stop(); Console.WriteLine("Importing {0} took {1}",fi.Name, stopwatch.Elapsed); - ScraperStorage.WaitForCompletion(); - ScraperStorage.ImportMarkFileAsKnown(fi, stopwatch.Elapsed, tstype); + DataStorage.WaitForCompletion(); + DataStorage.ImportMarkFileAsKnown(fi, stopwatch.Elapsed, tstype); fileStream.Close(); } else @@ -283,7 +282,7 @@ namespace skyscraper5 private void ScrapeStream(Stream inStream, bool disk, out int tstype) { - SkyscraperContext skyscraperContext = new SkyscraperContext(new TsContext(), ScraperStorage); + SkyscraperContext skyscraperContext = new SkyscraperContext(new TsContext(), DataStorage,ObjectStorage); skyscraperContext.SourceIsDisk = disk; skyscraperContext.InitalizeFilterChain(); skyscraperContext.IngestFromStream(inStream); diff --git a/skyscraper8/Program.cs b/skyscraper8/Program.cs index b590c45..cfcbc90 100644 --- a/skyscraper8/Program.cs +++ b/skyscraper8/Program.cs @@ -28,6 +28,7 @@ using skyscraper5.T2MI; using skyscraper5.src.Mpeg2.PacketFilter; using skyscraper8.Skyscraper.IO; using log4net; +using skyscraper8.Skyscraper.Scraper.Storage; [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config")] namespace skyscraper5 @@ -149,8 +150,9 @@ namespace skyscraper5 if (args[0].ToLowerInvariant().Equals("importtest")) { DirectoryInfo doThisDir = new DirectoryInfo(args[1]); - IScraperStroage imss = new InMemoryScraperStorage(); - TsFileCollectionImporter importer = new TsFileCollectionImporter(imss, doThisDir); + InMemoryScraperStorage imss = new InMemoryScraperStorage(); + FilesystemStorage fs = new FilesystemStorage(new DirectoryInfo(".")); + TsFileCollectionImporter importer = new TsFileCollectionImporter(imss, fs, doThisDir); importer.Run(); return; } @@ -161,8 +163,8 @@ namespace skyscraper5 { DirectoryInfo srcDir = new DirectoryInfo(args[1]); DirectoryInfo tgtDir = new DirectoryInfo(args[2]); - IScraperStroage fss = new FilesystemScraperStorage(tgtDir); - TsFileCollectionImporter importer = new TsFileCollectionImporter(fss, srcDir); + FilesystemStorage fss = new FilesystemStorage(tgtDir); + TsFileCollectionImporter importer = new TsFileCollectionImporter(fss, fss, srcDir); importer.Run(); return; } @@ -203,13 +205,7 @@ namespace skyscraper5 dummyTsGenerator.Run(); return; } - - if (args[0].ToLowerInvariant().Equals("merge-bl-jobs")) - { - MergeDbBlindscanJobs.RunAsMain(); - return; - } - + if (args[0].ToLowerInvariant().Equals("file-live")) { Program.HandleFileToLiveSystem(args[1]); @@ -248,7 +244,8 @@ namespace skyscraper5 private static void ProcessDirectory(DirectoryInfo di) { - IScraperStroage scraperStroage = new InMemoryScraperStorage(); + DataStorage dataStorage = new InMemoryScraperStorage(); + FilesystemStorage filesystemStorage = new FilesystemStorage(new DirectoryInfo(".")); //DirectoryInfo di = new DirectoryInfo(@"E:\Skyscraper\Astra 19.2"); FileInfo[] fileInfos = di.GetFiles("*.ts"); @@ -256,7 +253,7 @@ namespace skyscraper5 { Console.WriteLine(new string('_', Console.WindowWidth - 1)); Console.WriteLine("Processing: {0}", fileInfo.Name); - SkyscraperContext skyscraper = new SkyscraperContext(new TsContext(), scraperStroage); + SkyscraperContext skyscraper = new SkyscraperContext(new TsContext(), dataStorage,filesystemStorage); //StreamTypeAutodetectionTest streamTypeAutodetectionTest = new StreamTypeAutodetectionTest(); FileStream fileStream = fileInfo.OpenRead(); @@ -293,18 +290,26 @@ namespace skyscraper5 private static void HandleUdpTesting() { - HandleUdpInput(new InMemoryScraperStorage()); + DataStorage data = new InMemoryScraperStorage(); + ObjectStorage objects = new FilesystemStorage(new DirectoryInfo(".")); + HandleUdpInput(data,objects); } private static void HandleUdpLive() { - ScraperStorageFactoryConnectionManager connectionManager = ScraperStorageFactoryConnectionManager.GetInstance(); - IScraperStorageFactory factory = connectionManager.AutoGetDefaultFactory(); - IScraperStroage scraperStorage = factory.CreateScraperStroage(); - HandleUdpInput(scraperStorage); + StorageConnectionManager connectionManager = StorageConnectionManager.GetInstance(); + DataStorageFactory dataFactory = connectionManager.GetDefaultDataStorageFactory(); + ObjectStorageFactory objectFactory = connectionManager.GetDefaultObjectStorageFactory(); + DataStorage dataStorage = dataFactory.CreateDataStorage(); + ObjectStorage objectStorage; + if (objectFactory.IsEquivalent(dataFactory)) + objectStorage = (ObjectStorage)dataStorage; + else + objectStorage = objectFactory.CreateObjectStorage(); + HandleUdpInput(dataStorage,objectStorage); } - private static void HandleUdpInput(IScraperStroage scraperStorage) + private static void HandleUdpInput(DataStorage dataStorage,ObjectStorage objectStorage) { NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface networkInterface in networkInterfaces) @@ -333,7 +338,7 @@ namespace skyscraper5 if (!remote.Equals(oldRemote)) { oldRemote = remote; - skyscraper = new SkyscraperContext(new TsContext(), scraperStorage); + skyscraper = new SkyscraperContext(new TsContext(), dataStorage,objectStorage); skyscraper.InitalizeFilterChain(); skyscraper.EnableTimeout = true; logger.InfoFormat("Got zapped by {0}", remote); @@ -351,23 +356,31 @@ namespace skyscraper5 private static void HandleCrazyScanToTestingSystem(string url) { - IScraperStroage scraperStorage = new InMemoryScraperStorage(); - HandleCrazyScan(url, scraperStorage, true); - } + DataStorage dataStorage = new InMemoryScraperStorage(); + ObjectStorage objectStorage = new FilesystemStorage(new DirectoryInfo(".")); + HandleCrazyScan(url, dataStorage, objectStorage, true); + } private static void HandleFileToLiveSystem(string filename) { - ScraperStorageFactoryConnectionManager connectionManager = ScraperStorageFactoryConnectionManager.GetInstance(); - IScraperStorageFactory factory = connectionManager.AutoGetDefaultFactory(); - IScraperStroage scraperStorage = factory.CreateScraperStroage(); - FileInfo fi = new FileInfo(filename); + StorageConnectionManager connectionManager = StorageConnectionManager.GetInstance(); + DataStorageFactory dataStorageFactory = connectionManager.GetDefaultDataStorageFactory(); + ObjectStorageFactory objectStorageFactory = connectionManager.GetDefaultObjectStorageFactory(); + DataStorage dataStorage = dataStorageFactory.CreateDataStorage(); + ObjectStorage objectStorage; + if (objectStorageFactory.IsEquivalent(dataStorageFactory)) + objectStorage = (ObjectStorage)dataStorage; + else + objectStorage = objectStorageFactory.CreateObjectStorage(); + + FileInfo fi = new FileInfo(filename); if (!fi.Exists) { logger.FatalFormat("{0} not found.", fi.FullName); return; } - SkyscraperContext skyscraper = new SkyscraperContext(new TsContext(), scraperStorage); + SkyscraperContext skyscraper = new SkyscraperContext(new TsContext(), dataStorage,objectStorage); skyscraper.InitalizeFilterChain(); skyscraper.EnableTimeout = false; skyscraper.TcpProxyEnabled = false; @@ -382,14 +395,21 @@ namespace skyscraper5 private static void HandleCrazyScanToLiveSystem(string url, bool withTimeout = true) { - ScraperStorageFactoryConnectionManager connectionManager = ScraperStorageFactoryConnectionManager.GetInstance(); - IScraperStorageFactory factory = connectionManager.AutoGetDefaultFactory(); - IScraperStroage storage = factory.CreateScraperStroage(); - storage.Ping(); - HandleCrazyScan(url, storage, withTimeout); + StorageConnectionManager connectionManager = StorageConnectionManager.GetInstance(); + DataStorageFactory dataStorageFactory = connectionManager.GetDefaultDataStorageFactory(); + ObjectStorageFactory objectStorageFactory = connectionManager.GetDefaultObjectStorageFactory(); + DataStorage dataStorage = dataStorageFactory.CreateDataStorage(); + ObjectStorage objectStorage; + if (objectStorageFactory.IsEquivalent(dataStorageFactory)) + objectStorage = (ObjectStorage)dataStorage; + else + objectStorage = objectStorageFactory.CreateObjectStorage(); + + objectStorage.Ping(); + HandleCrazyScan(url, dataStorage,objectStorage, withTimeout); } - private static void HandleCrazyScan(string url, IScraperStroage scraperStorage, bool timeout) + private static void HandleCrazyScan(string url, DataStorage dataStorage, ObjectStorage objectStorage, bool timeout) { if (!url.StartsWith("tcp://")) { @@ -410,7 +430,7 @@ namespace skyscraper5 TcpClient tcpClient = new TcpClient(hostname, port); - SkyscraperContext skyscraper = new SkyscraperContext(new TsContext(), scraperStorage); + SkyscraperContext skyscraper = new SkyscraperContext(new TsContext(), dataStorage,objectStorage); skyscraper.InitalizeFilterChain(new SkipFilter(1024)); //skyscraper.EnableTimeout = timeout; //skyscraper.TimeoutSeconds = 10; @@ -422,8 +442,9 @@ namespace skyscraper5 { //Environment.CurrentDirectory = fi.Directory.FullName; TsContext tsContext = new TsContext(); - IScraperStroage scraperStorage = new InMemoryScraperStorage(); - SkyscraperContext skyscraper = new SkyscraperContext(tsContext, scraperStorage); + DataStorage dataStorage = new InMemoryScraperStorage(); + ObjectStorage objectStorage = new FilesystemStorage(new DirectoryInfo(".")); + SkyscraperContext skyscraper = new SkyscraperContext(tsContext, dataStorage,objectStorage); skyscraper.InitalizeFilterChain(); FileStream fileStream = fi.OpenRead(); skyscraper.IngestFromStream(fileStream); @@ -441,7 +462,7 @@ namespace skyscraper5 { Console.WriteLine("No PCR detected."); } - Console.WriteLine("DNS Records found: {0}", scraperStorage.DnsCountA()); + Console.WriteLine("DNS Records found: {0}", dataStorage.DnsCountA()); Console.WriteLine(""); Console.WriteLine(new string('-', Console.WindowWidth)); diff --git a/skyscraper8/Scorcher/DummyTsGenerator.cs b/skyscraper8/Scorcher/DummyTsGenerator.cs index 6cb92c4..15441ac 100644 --- a/skyscraper8/Scorcher/DummyTsGenerator.cs +++ b/skyscraper8/Scorcher/DummyTsGenerator.cs @@ -71,7 +71,7 @@ namespace skyscraper5.Scorcher outputStream = fi.OpenRead(); TsContext tsContext = new TsContext(); - SkyscraperContext sc = new SkyscraperContext(tsContext, null, 0); + SkyscraperContext sc = new SkyscraperContext(tsContext, null, null,0); sc.IngestFromStream(outputStream); outputStream.Close(); diff --git a/skyscraper8/Skyscraper/CableFrequencyListGenerator.cs b/skyscraper8/Skyscraper/CableFrequencyListGenerator.cs index b8b5fda..ae7e3a6 100644 --- a/skyscraper8/Skyscraper/CableFrequencyListGenerator.cs +++ b/skyscraper8/Skyscraper/CableFrequencyListGenerator.cs @@ -12,6 +12,7 @@ using skyscraper5.Skyscraper.Plugins; using skyscraper5.Skyscraper.Scraper; using skyscraper5.Skyscraper.Scraper.Storage; using skyscraper5.Skyscraper.Scraper.Storage.InMemory; +using skyscraper8.Skyscraper.Scraper.Storage; using Console = System.Console; namespace skyscraper5.Skyscraper @@ -103,13 +104,13 @@ namespace skyscraper5.Skyscraper streamWriter.WriteLine(outLine); StreamReaderScraperController scraper = new StreamReaderScraperController(streamReader); - scraper.ScraperStroage = new InMemoryScraperStorage(); + scraper.DataStorage = new InMemoryScraperStorage(); scraper.Recording = false; Console.Write("Running PSI acquisition..."); scraper.Run(); Console.WriteLine(".DONE"); - IScraperStroage data = scraper.ScraperStroage; + DataStorage data = scraper.DataStorage; IEnumerable> pmtEntries = data.SelectAllPmt().ToList(); List> tuples = data.SelectAllSdt().ToList(); foreach (var (tsId, networkId, programMapping) in pmtEntries) diff --git a/skyscraper8/Skyscraper/Equipment/EquipmentUtilities.cs b/skyscraper8/Skyscraper/Equipment/EquipmentUtilities.cs index f42877b..69e9637 100644 --- a/skyscraper8/Skyscraper/Equipment/EquipmentUtilities.cs +++ b/skyscraper8/Skyscraper/Equipment/EquipmentUtilities.cs @@ -1,12 +1,13 @@ using System; using System.Collections.Generic; using skyscraper5.Skyscraper.Scraper.Storage; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.Equipment { public static class EquipmentUtilities { - public static void InsertDefaultLnbTypes(IScraperStroage storage) + public static void InsertDefaultLnbTypes(DataStorage storage) { List knownLnbTypes = storage.UiLnbTypesListAll(); foreach (LnbType defaultLnbType in GetDefaultLnbTypes()) @@ -28,7 +29,7 @@ namespace skyscraper5.Skyscraper.Equipment yield return lnbType; } - public static void InsertDefaultDishTypes(IScraperStroage storage) + public static void InsertDefaultDishTypes(DataStorage storage) { List knownDishTypes = storage.UiDishTypesListAll(); foreach (DishType defaultDishType in GetDefaultDishTypes()) diff --git a/skyscraper8/Skyscraper/FrequencyListGenerator/MergeDbBlindscanJobs.cs b/skyscraper8/Skyscraper/FrequencyListGenerator/MergeDbBlindscanJobs.cs deleted file mode 100644 index 37b8a08..0000000 --- a/skyscraper8/Skyscraper/FrequencyListGenerator/MergeDbBlindscanJobs.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using skyscraper5.Skyscraper.Scraper.Storage; - -namespace skyscraper5.src.Skyscraper.FrequencyListGenerator -{ - internal class MergeDbBlindscanJobs - { - public static void RunAsMain() - { - ScraperStorageFactoryConnectionManager storageFactoryConnectionManager = ScraperStorageFactoryConnectionManager.GetInstance(); - IScraperStorageFactory storageFactory = storageFactoryConnectionManager.AutoGetDefaultFactory(); - IScraperStroage storage = storageFactory.CreateScraperStroage(); - - List jobs = GetMergeableBlindscanJobs(storage); - if (jobs.Count <= 1) - { - Console.WriteLine("Nothing to merge!"); - return; - } - - MergeBlindscanJobs(jobs, storage); - } - - public static void MergeBlindscanJobs(List jobs, IDbBlindscanJobStorage storage) - { - //Zuerst schauen ob im Ziel irgendwas gesäubert werden muss. - DbBlindscanJob mergeTarget = jobs[0]; - DbBlindscanJobPolarizationStatus[] targetCleaningModes = new DbBlindscanJobPolarizationStatus[] - { - mergeTarget.HorizontalLowState, mergeTarget.HorizontalHighState, mergeTarget.VerticalLowState, mergeTarget.VerticalHighState - }; - for (int i = 0; i < targetCleaningModes.Length; i++) - { - switch(targetCleaningModes[i]) - { - case DbBlindscanJobPolarizationStatus.SELECTED_DONE: - continue; - case DbBlindscanJobPolarizationStatus.SELECTED_SCRAPING: - storage.DeleteBlindscanResults(mergeTarget.JobGuid, i); - continue; - case DbBlindscanJobPolarizationStatus.SELECTED_WAITING: - continue; - default: - throw new NotImplementedException(targetCleaningModes[i].ToString()); - } - } - - for (int i = 1; i < jobs.Count; i++) - { - DbBlindscanJob mergeSource = jobs[i]; - DbBlindscanJobPolarizationStatus[] modes = new DbBlindscanJobPolarizationStatus[] - { - mergeSource.HorizontalLowState, mergeSource.HorizontalHighState, mergeSource.VerticalLowState, mergeSource.VerticalHighState - }; - for (int j = 0; j < modes.Length; j++) - { - bool deleted = false; - switch(modes[j]) - { - case DbBlindscanJobPolarizationStatus.NOT_SELECTED: - continue; - case DbBlindscanJobPolarizationStatus.SELECTED_SCRAPING: - storage.DeleteBlindscanJob(mergeSource.JobGuid); - deleted = true; - break; - case DbBlindscanJobPolarizationStatus.SELECTED_WAITING: - continue; - case DbBlindscanJobPolarizationStatus.SELECTED_DONE: - storage.MoveBlScanResultsToAnotherJob(mergeSource.JobGuid, mergeTarget.JobGuid, j); - continue; - default: - throw new NotImplementedException(modes[j].ToString()); - } - if (!deleted) - storage.DeleteBlindscanJob(mergeTarget.JobGuid); - } - } - } - - public static List GetMergeableBlindscanJobs(IScraperStroage storage) - { - - List mergableJobs = new List(); - DbBlindscanJob firstJob = null; - bool hl = false, hh = false, vl = false, vh = false; - long offset = 0; - - while (true) - { - DbBlindscanJob blindscanJob = storage.GetPastBlindscanJob(offset++); - if (blindscanJob == null) - break; - - if (blindscanJob.HorizontalLowState == DbBlindscanJobPolarizationStatus.SELECTED_DONE) - hl = true; - if (blindscanJob.HorizontalHighState == DbBlindscanJobPolarizationStatus.SELECTED_DONE) - hh = true; - if (blindscanJob.VerticalLowState == DbBlindscanJobPolarizationStatus.SELECTED_DONE) - vl = true; - if (blindscanJob.VerticalHighState == DbBlindscanJobPolarizationStatus.SELECTED_DONE) - vh = true; - - if (firstJob == null) - { - firstJob = blindscanJob; - mergableJobs.Add(firstJob); - continue; - } - - if (blindscanJob.DiseqCIndex != firstJob.DiseqCIndex) - break; - if (!blindscanJob.SatPosition.Equals(firstJob.SatPosition)) - break; - if (!blindscanJob.TunerMAC.Equals(firstJob.TunerMAC)) - break; - if (blindscanJob.TunerStandard != firstJob.TunerStandard) - break; - - mergableJobs.Add(blindscanJob); - - if (hl && hh && vl && vh) - break; - } - - mergableJobs.Reverse(); - return mergableJobs; - } - } -} diff --git a/skyscraper8/Skyscraper/Gps/WhatCanIReceive.cs b/skyscraper8/Skyscraper/Gps/WhatCanIReceive.cs index 13b8099..6545691 100644 --- a/skyscraper8/Skyscraper/Gps/WhatCanIReceive.cs +++ b/skyscraper8/Skyscraper/Gps/WhatCanIReceive.cs @@ -4,6 +4,7 @@ using System.Threading; using skyscraper5.Skyscraper.Drawing; using skyscraper5.Skyscraper.Plugins; using skyscraper5.Skyscraper.Scraper.Storage; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.Gps { @@ -12,10 +13,10 @@ namespace skyscraper5.Skyscraper.Gps public static void StandaloneProgram() { PluginManager pluginManager = PluginManager.GetInstance(); - IScraperStorageFactory storageFactory = ScraperStorageFactoryConnectionManager.GetInstance().AutoGetDefaultFactory(); - IScraperStroage scraperStroage = storageFactory.CreateScraperStroage(); + DataStorageFactory dataStorageFactory = StorageConnectionManager.GetInstance().GetDefaultDataStorageFactory(); + DataStorage dataStorage = dataStorageFactory.CreateDataStorage(); - WhatCanIReceive instance = new WhatCanIReceive(scraperStroage); + WhatCanIReceive instance = new WhatCanIReceive(dataStorage); int configuredGpsId = GpsManager.GetConfiguredGpsId(); IGpsReceiverFactory receiverFactory = GpsManager.GetGpsReceiverFactoryById(configuredGpsId); @@ -35,9 +36,9 @@ namespace skyscraper5.Skyscraper.Gps gpsReceiver.Stop(); } - public IScraperStroage Storage { get; } + public DataStorage Storage { get; } - public WhatCanIReceive(IScraperStroage storage) + public WhatCanIReceive(DataStorage storage) { Storage = storage; } diff --git a/skyscraper8/Skyscraper/IO/StreamReaderScanController.cs b/skyscraper8/Skyscraper/IO/StreamReaderScanController.cs index 828c6a0..fceeadc 100644 --- a/skyscraper8/Skyscraper/IO/StreamReaderScanController.cs +++ b/skyscraper8/Skyscraper/IO/StreamReaderScanController.cs @@ -8,6 +8,7 @@ using System.Runtime.Serialization; using skyscraper5.Skyscraper.IO.CrazycatStreamReader; using skyscraper5.Skyscraper.Scraper; using skyscraper5.Skyscraper.Scraper.Storage.Filesystem; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.IO { @@ -402,7 +403,8 @@ namespace skyscraper5.Skyscraper.IO srsc2 = new StreamReaderScraperController(streamReader); srsc2.RecordingOutputDirectory = new DirectoryInfo("recordings"); srsc2.Recording = true; - srsc2.ScraperStroage = new FilesystemScraperStorage(new DirectoryInfo("srtest_results")); + srsc2.DataStorage = new FilesystemStorage(new DirectoryInfo("srtest_results")); + srsc2.ObjectStorage = (ObjectStorage)srsc2.DataStorage; } foreach (BlindScanResult blindScanResult in blindScanResults.Transponders) diff --git a/skyscraper8/Skyscraper/IO/StreamReaderScraperController.cs b/skyscraper8/Skyscraper/IO/StreamReaderScraperController.cs index 1ed5e4a..5c3a704 100644 --- a/skyscraper8/Skyscraper/IO/StreamReaderScraperController.cs +++ b/skyscraper8/Skyscraper/IO/StreamReaderScraperController.cs @@ -8,6 +8,7 @@ using skyscraper5.Mpeg2; using skyscraper5.Skyscraper.IO.CrazycatStreamReader; using skyscraper5.Skyscraper.Scraper; using skyscraper5.Skyscraper.Scraper.Storage; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.IO { @@ -23,7 +24,8 @@ namespace skyscraper5.Skyscraper.IO private const string RECORDING_FILENAME_MASK = "skyscraper_{0}.ts"; - public IScraperStroage ScraperStroage { get; set; } + public DataStorage DataStorage { get; set; } + public ObjectStorage ObjectStorage { get; set; } public bool Recording { get; set; } @@ -234,7 +236,7 @@ namespace skyscraper5.Skyscraper.IO } //Use the Filter - skyscraperContext = new SkyscraperContext(new TsContext(), ScraperStroage); + skyscraperContext = new SkyscraperContext(new TsContext(), DataStorage,ObjectStorage); skyscraperContext.TcpProxyEnabled = true; byte[] singlePacketBuffer = new byte[188]; while (!StopConditionMet()) diff --git a/skyscraper8/Skyscraper/Plugins/PluginManager.cs b/skyscraper8/Skyscraper/Plugins/PluginManager.cs index 27356e9..79658db 100644 --- a/skyscraper8/Skyscraper/Plugins/PluginManager.cs +++ b/skyscraper8/Skyscraper/Plugins/PluginManager.cs @@ -17,6 +17,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.Plugins { @@ -32,7 +33,6 @@ namespace skyscraper5.Skyscraper.Plugins descriptorMap = new Dictionary(); _streamTypeAutodetectionContestants = new List(); _t2MiPacketConstructorInfos = new ConstructorInfo[256]; - scraperStorageFactories = new Dictionary(); tunerFactories = new Dictionary(); _docsisMacManagementMessageTypes = new Dictionary(); _userDefinedDescriptors = new Dictionary(); @@ -145,11 +145,13 @@ namespace skyscraper5.Skyscraper.Plugins return _instance; } + private Type storageIdAttributeTyoe = typeof(StorageIdAttribute); + private Type objectStorageFactoryType = typeof(ObjectStorageFactory); + private Type dataStorageFactoryType = typeof(DataStorageFactory); private Type dnsParserPluginType = typeof(IDnsParser); private Type pluginLoadHookType = typeof(IPluginLoadHook); private Type docsisMacManagementType = typeof(MacManagementMessage); private Type tunerFactoryType = typeof(ITunerFactory); - private Type scraperStorageFactoryType = typeof(IScraperStorageFactory); private Type t2MiPacketType = typeof(T2MiPacket); private Type mpePluginType = typeof(ISkyscraperMpePlugin); private Type gpsReceiverFactoryType = typeof(IGpsReceiverFactory); @@ -164,7 +166,6 @@ namespace skyscraper5.Skyscraper.Plugins private Dictionary descriptorBannedTables; private List _streamTypeAutodetectionContestants; private ConstructorInfo[] _t2MiPacketConstructorInfos; - private Dictionary scraperStorageFactories; private Dictionary tunerFactories; private Dictionary _docsisMacManagementMessageTypes; private Dictionary _userDefinedDescriptors; @@ -182,6 +183,21 @@ namespace skyscraper5.Skyscraper.Plugins if (!isSkyscraperPlugin) continue; + bool isStorageFactory = false; + if (type.IsAssignableTo(objectStorageFactoryType)) + { + HandleObjectStorageFactory(type); + isStorageFactory = true; + } + if (type.IsAssignableTo(dataStorageFactoryType)) + { + HandleDataStorageFactory(type); + isStorageFactory = true; + } + + if (isStorageFactory) + continue; + if (type.IsAssignableTo(mpePluginType)) { ISkyscraperMpePlugin mpePlugin = (ISkyscraperMpePlugin)Activator.CreateInstance(type); @@ -210,11 +226,6 @@ namespace skyscraper5.Skyscraper.Plugins HandleT2MiPacketType(type); continue; } - else if (type.IsAssignableTo(scraperStorageFactoryType)) - { - HandleScraperStorageFactory(type); - continue; - } else if (type.IsAssignableTo(tunerFactoryType)) { HandleTunerFactory(type); @@ -268,6 +279,45 @@ namespace skyscraper5.Skyscraper.Plugins _mpePlugins.Sort(sorter); } + #region Scraper Storages + + private Dictionary _dataStorages; + private Dictionary _objectStorages; + private void HandleDataStorageFactory(Type type) + { + Attribute idAttribute = type.GetCustomAttributes(storageIdAttributeTyoe).FirstOrDefault(); + if (idAttribute == null) + { + logger.ErrorFormat("{0} does not have an a {1}", type, storageIdAttributeTyoe.Name); + return; + } + int id = ((StorageIdAttribute)idAttribute).Id; + + if (_dataStorages == null) + _dataStorages = new Dictionary(); + + DataStorageFactory child = (DataStorageFactory)Activator.CreateInstance(type); + _dataStorages.Add(id, child); + } + + private void HandleObjectStorageFactory(Type type) + { + Attribute idAttribute = type.GetCustomAttributes(storageIdAttributeTyoe).FirstOrDefault(); + if (idAttribute == null) + { + logger.ErrorFormat("{0} does not have an a {1}", type, storageIdAttributeTyoe.Name); + return; + } + int id = ((StorageIdAttribute)idAttribute).Id; + + if (_objectStorages == null) + _objectStorages = new Dictionary(); + + ObjectStorageFactory child = (ObjectStorageFactory)Activator.CreateInstance(type); + _objectStorages.Add(id, child); + } + #endregion + #region DNS Plugin private void HandleDnsParser(Type type) { @@ -401,23 +451,7 @@ namespace skyscraper5.Skyscraper.Plugins tunerFactories.Add(attribute, issf); } #endregion - - #region Storage Factory - private Type scraperStorageFactoryIdType = typeof(ScrapeStorageFactoryIdAttribute); - private void HandleScraperStorageFactory(Type type) - { - object[] customAttributes = type.GetCustomAttributes(scraperStorageFactoryIdType, false); - if (customAttributes.Length == 0) - return; - - ScrapeStorageFactoryIdAttribute attribute = (ScrapeStorageFactoryIdAttribute)customAttributes[0]; - - IScraperStorageFactory issf = (IScraperStorageFactory)Activator.CreateInstance(type); - scraperStorageFactories.Add(attribute, issf); - } - - #endregion - + #region T2-MI Packet Types private Type[] t2MiConstructorPattern = new Type[] { typeof(T2MIHeader), typeof(byte[]) }; @@ -536,14 +570,7 @@ namespace skyscraper5.Skyscraper.Plugins new ReadOnlyDictionary(tunerFactories); return result; } - public ReadOnlyDictionary GetScraperStorageFactories() - { - ReadOnlyDictionary result = - new ReadOnlyDictionary( - scraperStorageFactories); - return result; - } - + public ConstructorInfo[] GetT2MiPacketTypes() { ConstructorInfo[] t2MiPacketConstructorInfos = _t2MiPacketConstructorInfos; @@ -596,6 +623,16 @@ namespace skyscraper5.Skyscraper.Plugins return output; } + public ReadOnlyDictionary GetObjectStorages() + { + return _objectStorages.AsReadOnly(); + } + + public ReadOnlyDictionary GetDataStorages() + { + return _dataStorages.AsReadOnly(); + } + public void AutoconfigureObject(string categoryName, object targetObject) { if (Ini == null) diff --git a/skyscraper8/Skyscraper/RecordingImporter/TsFileCollectionImporter.cs b/skyscraper8/Skyscraper/RecordingImporter/TsFileCollectionImporter.cs index 9e1f82b..b65c329 100644 --- a/skyscraper8/Skyscraper/RecordingImporter/TsFileCollectionImporter.cs +++ b/skyscraper8/Skyscraper/RecordingImporter/TsFileCollectionImporter.cs @@ -9,17 +9,20 @@ using System.Threading.Tasks; using skyscraper5.Mpeg2; using skyscraper5.Skyscraper.Scraper; using skyscraper5.Skyscraper.Scraper.Storage; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.RecordingImporter { internal class TsFileCollectionImporter { - public IScraperStroage ScraperStorage { get; } + public DataStorage DataStorage { get; } + public ObjectStorage ObjectStorage { get; } public DirectoryInfo RootDirectory { get; } - public TsFileCollectionImporter(IScraperStroage scraperStorage, DirectoryInfo rootDirectory) + public TsFileCollectionImporter(DataStorage dataStorage, ObjectStorage objectStorage, DirectoryInfo rootDirectory) { - ScraperStorage = scraperStorage; + DataStorage = dataStorage; + ObjectStorage = objectStorage; RootDirectory = rootDirectory; } @@ -43,10 +46,10 @@ namespace skyscraper5.Skyscraper.RecordingImporter private void Import(FileInfo fi) { - if (ScraperStorage.ImportFileKnown(fi)) + if (DataStorage.ImportFileKnown(fi)) return; - SkyscraperContext skyscraper = new SkyscraperContext(new TsContext(), ScraperStorage); + SkyscraperContext skyscraper = new SkyscraperContext(new TsContext(), DataStorage,ObjectStorage); skyscraper.InitalizeFilterChain(); FileStream fileStream = fi.OpenRead(); @@ -59,7 +62,7 @@ namespace skyscraper5.Skyscraper.RecordingImporter Console.WriteLine("Took {0} seconds. " + stopwatch.Elapsed.TotalSeconds); Console.WriteLine("File was: {0}", fi.Name); - ScraperStorage.ImportMarkFileAsKnown(fi, stopwatch.Elapsed, skyscraper.SpecialTsType); + DataStorage.ImportMarkFileAsKnown(fi, stopwatch.Elapsed, skyscraper.SpecialTsType); } } } diff --git a/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs b/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs index bb3f021..987cfdf 100644 --- a/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs +++ b/skyscraper8/Skyscraper/Scraper/SkyscraperContext.cs @@ -39,7 +39,6 @@ using skyscraper5.Skyscraper.Plugins; using skyscraper5.Skyscraper.Scraper.FrameGrabber; using skyscraper5.Skyscraper.Scraper.Storage; using skyscraper5.Skyscraper.Scraper.Storage.InMemory; -using skyscraper5.Skyscraper.Scraper.Storage.Split; using skyscraper5.Skyscraper.Scraper.Storage.Utilities; using skyscraper5.Skyscraper.Scraper.StreamAutodetection; using skyscraper5.Skyscraper.Scraper.Utils; @@ -73,6 +72,7 @@ using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Text; +using skyscraper8.Skyscraper.Scraper.Storage; using Tsubasa.IO; using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; using RntParser = skyscraper5.Dvb.TvAnytime.RntParser; @@ -93,7 +93,9 @@ namespace skyscraper5.Skyscraper.Scraper private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name); public TsContext DvbContext { get; } - public IScraperStroage ScraperStorage { get; } + public DataStorage DataStorage { get; } + public ObjectStorage ObjectStorage { get; } + public bool SourceIsDisk { get; set; } @@ -103,7 +105,7 @@ namespace skyscraper5.Skyscraper.Scraper public PsiDecoder Pid0x11Decoder { get; private set; } public PsiDecoder Pid0x12Decoder { get; private set; } public IPsiDecoderTransformer PmtDecoderTransformer { get; set; } - public SkyscraperContext(TsContext dvbContext, IScraperStroage scraperStorage = null, int skipAtStart = 0, int? currentNetworkId = null, int? currentTransportStreamId = null) + public SkyscraperContext(TsContext dvbContext, DataStorage dataStorage = null, ObjectStorage objectStorage = null, int skipAtStart = 0, int? currentNetworkId = null, int? currentTransportStreamId = null) { TsDescriptorUnpacker descriptorUnpacker = TsDescriptorUnpacker.GetInstance(); for (byte i = 0x80; i < 0xfe; i++) @@ -162,9 +164,18 @@ namespace skyscraper5.Skyscraper.Scraper //PID 0x1F //won't need these. We operate on broadcasted stuff, so we shouldn't encounter partial TS - if (scraperStorage == null) - scraperStorage = new InMemoryScraperStorage(); - ScraperStorage = scraperStorage; + if (dataStorage == null) + { + throw new ArgumentNullException(nameof(dataStorage)); + } + DataStorage = dataStorage; + + if (objectStorage == null) + { + throw new ArgumentNullException(nameof(objectStorage)); + } + ObjectStorage = objectStorage; + CurrentNetworkId = currentNetworkId; CurrentTransportStreamId = currentTransportStreamId; DsmCcsToLookFor = new Dictionary(); @@ -398,7 +409,7 @@ namespace skyscraper5.Skyscraper.Scraper SpecialTsType = 1; if (CurrentNetworkId.HasValue && CurrentTransportStreamId.HasValue) { - ScraperStorage.StorePatEntry(CurrentNetworkId.Value, CurrentTransportStreamId.Value, pmtPid, programId); + DataStorage.StorePatEntry(CurrentNetworkId.Value, CurrentTransportStreamId.Value, pmtPid, programId); } if (DvbContext.IsPidProcessorPresent(pmtPid)) @@ -433,9 +444,9 @@ namespace skyscraper5.Skyscraper.Scraper if (CurrentNetworkId.HasValue && CurrentTransportStreamId.HasValue) { - if (!ScraperStorage.TestForPmtEvent(CurrentNetworkId.Value, CurrentTransportStreamId.Value, result)) + if (!DataStorage.TestForPmtEvent(CurrentNetworkId.Value, CurrentTransportStreamId.Value, result)) { - if (ScraperStorage.StorePmtEvent(CurrentNetworkId.Value, CurrentTransportStreamId.Value, result)) + if (DataStorage.StorePmtEvent(CurrentNetworkId.Value, CurrentTransportStreamId.Value, result)) logworthy = true; } @@ -502,7 +513,7 @@ namespace skyscraper5.Skyscraper.Scraper { if (CurrentNetworkId.HasValue && CurrentTransportStreamId.HasValue) { - if (!ScraperStorage.TestForFramegrab(CurrentNetworkId.Value, CurrentTransportStreamId.Value, result.ProgramNumber, mappingStream.ElementaryPid)) + if (!ObjectStorage.TestForFramegrab(CurrentNetworkId.Value, CurrentTransportStreamId.Value, result.ProgramNumber, mappingStream.ElementaryPid)) { ffmpegFrameGrabber ffmfg = new ffmpegFrameGrabber(CurrentNetworkId.Value, CurrentTransportStreamId.Value, result, mappingStream, this); ffmfg.TsProxyEndPoint = DvbContext.GetTcpProxyEndPoint(); @@ -976,7 +987,7 @@ namespace skyscraper5.Skyscraper.Scraper private EitEvent[] runningEvents; public void OnEitEvent(EitEvent eitEvent) { - if (ScraperStorage.StoreEitEvent(eitEvent)) + if (DataStorage.StoreEitEvent(eitEvent)) LogEvent(SkyscraperContextEvent.EitEvent, eitEvent.EventName); UiJunction?.NotifyEvent(eitEvent); @@ -1024,14 +1035,14 @@ namespace skyscraper5.Skyscraper.Scraper throw new NotImplementedException(transportStream.DeliveryMethod.ToString()); } - if (!ScraperStorage.TestForNitTransportStream(networkId, transportStream)) + if (!DataStorage.TestForNitTransportStream(networkId, transportStream)) { - ScraperStorage.StoreNitTransportStream(networkId, transportStream); + DataStorage.StoreNitTransportStream(networkId, transportStream); LogEvent(SkyscraperContextEvent.OnNitTransportStream, name); return; } - if (ScraperStorage.UpdateNitTransportStream(networkId, transportStream)) + if (DataStorage.UpdateNitTransportStream(networkId, transportStream)) { LogEvent(SkyscraperContextEvent.OnNitTransportStreamUpdate, name); return; @@ -1060,14 +1071,14 @@ namespace skyscraper5.Skyscraper.Scraper } } - if (!ScraperStorage.TestForNitNetwork(nitNetwork)) + if (!DataStorage.TestForNitNetwork(nitNetwork)) { - ScraperStorage.StoreNitNetwork(nitNetwork); + DataStorage.StoreNitNetwork(nitNetwork); LogEvent(SkyscraperContextEvent.OnNitNetwork, nitNetwork.Name); return; } - if (ScraperStorage.UpdateNitNetwork(nitNetwork)) + if (DataStorage.UpdateNitNetwork(nitNetwork)) { LogEvent(SkyscraperContextEvent.OnNitNetworkUpdate, nitNetwork.Name); return; @@ -1120,22 +1131,22 @@ namespace skyscraper5.Skyscraper.Scraper if (!currentTime.HasValue) return; - ScraperStorage.StoreTeletextPage(networkId, transportStreamId, programNumber, magazine, currentTime.Value); + DataStorage.StoreTeletextPage(networkId, transportStreamId, programNumber, magazine, currentTime.Value); } public void OnBatBouquet(BatBouquet batBouquet) { UiJunction?.NotifyBat(batBouquet); - if (ScraperStorage.TestForBatBouquet(batBouquet)) + if (DataStorage.TestForBatBouquet(batBouquet)) { - if (ScraperStorage.UpdateBatBouquet(batBouquet)) + if (DataStorage.UpdateBatBouquet(batBouquet)) { LogEvent(SkyscraperContextEvent.BatBouquetUpdate, batBouquet.BouquetName); } } else { - ScraperStorage.StoreBatBouquet(batBouquet); + DataStorage.StoreBatBouquet(batBouquet); LogEvent(SkyscraperContextEvent.BatBouquet, batBouquet.BouquetName); } } @@ -1144,27 +1155,27 @@ namespace skyscraper5.Skyscraper.Scraper { UiJunction?.NotifyBatTs(batBouquet.BouquetId, child); string name = String.Format("{0},{1}", batBouquet.BouquetId, child.OriginalNetworkId); - if (ScraperStorage.TestForBatTransportStream(batBouquet.BouquetId, child)) + if (DataStorage.TestForBatTransportStream(batBouquet.BouquetId, child)) { - if (ScraperStorage.UpdateBatTransportStream(batBouquet.BouquetId, child)) + if (DataStorage.UpdateBatTransportStream(batBouquet.BouquetId, child)) { LogEvent(SkyscraperContextEvent.BatTransportStreamUpdate, name); } } else { - ScraperStorage.StoreBatTransportStream(batBouquet.BouquetId, child); + DataStorage.StoreBatTransportStream(batBouquet.BouquetId, child); LogEvent(SkyscraperContextEvent.BatTransportStream, name); } } public void OnSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService) { - if (ScraperStorage.TestForSdtService(transportStreamId, originalNetworkId, sdtService)) + if (DataStorage.TestForSdtService(transportStreamId, originalNetworkId, sdtService)) { if (!IsChild) { - if (ScraperStorage.UpdateSdtService(transportStreamId, originalNetworkId, sdtService)) + if (DataStorage.UpdateSdtService(transportStreamId, originalNetworkId, sdtService)) { LogEvent(SkyscraperContextEvent.OnSdtServiceUpdate, sdtService.ServiceName); } @@ -1172,7 +1183,7 @@ namespace skyscraper5.Skyscraper.Scraper } else { - ScraperStorage.StoreSdtService(transportStreamId, originalNetworkId, sdtService); + DataStorage.StoreSdtService(transportStreamId, originalNetworkId, sdtService); LogEvent(SkyscraperContextEvent.OnSdtService, sdtService.ServiceName); } @@ -1199,7 +1210,7 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return; - if (ScraperStorage.UpdateRdsPty(CurrentNetworkId.Value, CurrentTransportStreamId.Value, programNumber, pty)) + if (DataStorage.UpdateRdsPty(CurrentNetworkId.Value, CurrentTransportStreamId.Value, programNumber, pty)) { LogEvent(SkyscraperContextEvent.RdsPty, String.Format("{0} -> {1}", programNumber, pty.ToString())); } @@ -1213,8 +1224,7 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return; - if (ScraperStorage.MarkAsRdsTrafficInformationProgramme(CurrentNetworkId.Value, - CurrentTransportStreamId.Value, programNumber)) + if (DataStorage.MarkAsRdsTrafficInformationProgramme(CurrentNetworkId.Value, CurrentTransportStreamId.Value, programNumber)) { LogEvent(SkyscraperContextEvent.RdsTrafficInfoDetected, String.Format("{0}", programNumber)); } @@ -1231,7 +1241,7 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return; - if (ScraperStorage.UpdateTimeOffsetTable(CurrentNetworkId.Value, CurrentTransportStreamId.Value, utcTime, + if (DataStorage.UpdateTimeOffsetTable(CurrentNetworkId.Value, CurrentTransportStreamId.Value, utcTime, ltod)) LogEvent(SkyscraperContextEvent.TotTime, utcTime.ToString()); } @@ -1247,7 +1257,7 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return; - if (ScraperStorage.UpdateTimeAndDate(CurrentNetworkId.Value, CurrentTransportStreamId.Value, utcTime)) + if (DataStorage.UpdateTimeAndDate(CurrentNetworkId.Value, CurrentTransportStreamId.Value, utcTime)) LogEvent(SkyscraperContextEvent.TdtTime, utcTime.ToString()); } @@ -1274,9 +1284,9 @@ namespace skyscraper5.Skyscraper.Scraper } } - if (!ScraperStorage.TestForAitApplication(aitApplication.ApplicationIdentifier)) + if (!DataStorage.TestForAitApplication(aitApplication.ApplicationIdentifier)) { - ScraperStorage.StoreAitApplication(aitApplication); + DataStorage.StoreAitApplication(aitApplication); LogEvent(SkyscraperContextEvent.AitApplication, aitApplication.TryGetName()); } } @@ -1290,7 +1300,7 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentNetworkId.HasValue) return; - if (ScraperStorage.ObjectCarouselFileArrival(vfsFile, CurrentTransportStreamId.Value, CurrentNetworkId.Value)) + if (ObjectStorage.ObjectCarouselFileArrival(vfsFile, CurrentTransportStreamId.Value, CurrentNetworkId.Value)) { LogEvent(SkyscraperContextEvent.FileArrival, String.Format("PID {0:X4}, Path {1}", vfsFile.SourcePid, vfsFile.ToString())); } @@ -1331,9 +1341,9 @@ namespace skyscraper5.Skyscraper.Scraper if (!fromPmt) { UiJunction?.NotifyCat(caDescriptor); - if (!ScraperStorage.TestForCaSystem(CurrentNetworkId.Value, CurrentTransportStreamId.Value, caDescriptor.CaPid)) + if (!DataStorage.TestForCaSystem(CurrentNetworkId.Value, CurrentTransportStreamId.Value, caDescriptor.CaPid)) { - ScraperStorage.StoreCaSystem(CurrentNetworkId.Value, CurrentTransportStreamId.Value, caDescriptor); + DataStorage.StoreCaSystem(CurrentNetworkId.Value, CurrentTransportStreamId.Value, caDescriptor); LogEvent(SkyscraperContextEvent.CaSystem, String.Format("{0} on PID {1:X4}", CaSystemNames.GetHumanReadableName(caDescriptor.CaSystemId), caDescriptor.CaPid)); } } @@ -1372,7 +1382,7 @@ namespace skyscraper5.Skyscraper.Scraper { foreach (Platform platform in target.Platforms) { - ScraperStorage.StoreUpdateNotification(0, common, compatibility, platform); + DataStorage.StoreUpdateNotification(0, common, compatibility, platform); } } @@ -1411,10 +1421,10 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return false; - if (ScraperStorage.IsDsmCcModuleBlacklisted(CurrentNetworkId.Value, CurrentTransportStreamId.Value, elementaryPid, moduleId, moduleVersion)) + if (DataStorage.IsDsmCcModuleBlacklisted(CurrentNetworkId.Value, CurrentTransportStreamId.Value, elementaryPid, moduleId, moduleVersion)) return false; - if (ScraperStorage.IsDsmCcModuleWanted(CurrentNetworkId.Value, CurrentTransportStreamId.Value, elementaryPid, moduleId, moduleVersion)) + if (ObjectStorage.IsDsmCcModuleWanted(CurrentNetworkId.Value, CurrentTransportStreamId.Value, elementaryPid, moduleId, moduleVersion)) return true; return false; @@ -1436,7 +1446,7 @@ namespace skyscraper5.Skyscraper.Scraper if (dedupModules.Contains(key)) return; - if (ScraperStorage.IsDsmCcModuleWanted(CurrentNetworkId.Value, CurrentTransportStreamId.Value, elementaryPid, moduleInfoModuleId, moduleInfoModuleVersion)) + if (ObjectStorage.IsDsmCcModuleWanted(CurrentNetworkId.Value, CurrentTransportStreamId.Value, elementaryPid, moduleInfoModuleId, moduleInfoModuleVersion)) { if (!_dataCarouselProgresses.ContainsKey(key)) { @@ -1487,7 +1497,7 @@ namespace skyscraper5.Skyscraper.Scraper throw new NotImplementedException(); UiJunction?.SetMemorySaverMode(true); - ScraperStorage.DataCarouselModuleArrival(CurrentNetworkId.Value, CurrentTransportStreamId.Value, elementaryPid, moduleModuleId, moduleModuleVersion, result); + ObjectStorage.DataCarouselModuleArrival(CurrentNetworkId.Value, CurrentTransportStreamId.Value, elementaryPid, moduleModuleId, moduleModuleVersion, result); UiJunction?.SetMemorySaverMode(false); LogEvent(SkyscraperContextEvent.ModuleDownloadComplete, String.Format("Module {0}, Version {1}", moduleModuleId, moduleModuleVersion)); @@ -1506,7 +1516,7 @@ namespace skyscraper5.Skyscraper.Scraper return; if (!currentTime.HasValue) return; - ScraperStorage.StoreDsmCcDoItNowEvent(currentTime.Value, CurrentNetworkId.Value, CurrentNetworkId.Value, programMapping.ProgramNumber, descriptorListStreamEventDescriptor, pid); + DataStorage.StoreDsmCcDoItNowEvent(currentTime.Value, CurrentNetworkId.Value, CurrentNetworkId.Value, programMapping.ProgramNumber, descriptorListStreamEventDescriptor, pid); //These "do-it-now" Events are specific for _EVERY_ application and probably not //worth extending the scraping time. They are most likely subtitles or commands @@ -1522,7 +1532,7 @@ namespace skyscraper5.Skyscraper.Scraper public void SetRdsProgrammeServiceName(int programNumber, string programmeService2) { - if (ScraperStorage.UpdateRdsProgrammeServiceName(CurrentNetworkId.Value, CurrentTransportStreamId.Value, + if (DataStorage.UpdateRdsProgrammeServiceName(CurrentNetworkId.Value, CurrentTransportStreamId.Value, programNumber, programmeService2)) { LogEvent(SkyscraperContextEvent.RdsProgrammeServiceName, @@ -1538,10 +1548,10 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return false; - if (!ScraperStorage.TestForKnownRdsData(CurrentNetworkId.Value, CurrentTransportStreamId.Value, + if (!DataStorage.TestForKnownRdsData(CurrentNetworkId.Value, CurrentTransportStreamId.Value, programNumber)) { - ScraperStorage.EnableRdsCollection(CurrentNetworkId.Value, CurrentTransportStreamId.Value, + DataStorage.EnableRdsCollection(CurrentNetworkId.Value, CurrentTransportStreamId.Value, programNumber); LogEvent(SkyscraperContextEvent.BeginRdsRecording, String.Format("{0:X4},{1:X4},{2:X4}", CurrentNetworkId.Value, CurrentTransportStreamId.Value, @@ -1553,7 +1563,7 @@ namespace skyscraper5.Skyscraper.Scraper public void SetRdsRadioText(int programNumber, string text) { - if (ScraperStorage.UpdateRdsRadioText(CurrentNetworkId.Value, CurrentTransportStreamId.Value, programNumber, + if (DataStorage.UpdateRdsRadioText(CurrentNetworkId.Value, CurrentTransportStreamId.Value, programNumber, text)) { LogEvent(SkyscraperContextEvent.RdsText, String.Format("{0:X4} [{1}]", programNumber, text)); @@ -1569,10 +1579,10 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return; - if (!ScraperStorage.TestForScte35SpliceInsert(CurrentNetworkId.Value, CurrentTransportStreamId.Value, + if (!DataStorage.TestForScte35SpliceInsert(CurrentNetworkId.Value, CurrentTransportStreamId.Value, ProgramNumber, spliceInsert)) { - ScraperStorage.StoreScte35SpliceInsert(CurrentNetworkId.Value, CurrentTransportStreamId.Value, ProgramNumber, spliceInsert); + DataStorage.StoreScte35SpliceInsert(CurrentNetworkId.Value, CurrentTransportStreamId.Value, ProgramNumber, spliceInsert); LogEvent(SkyscraperContextEvent.Scte35Splice, String.Format("Program {0:X4}, Splice at {1:X16}", ProgramNumber, spliceInsert.SpliceTime)); } @@ -1590,7 +1600,7 @@ namespace skyscraper5.Skyscraper.Scraper if (!currentTime.HasValue) return; - ScraperStorage.SetScte35TimeSignal(CurrentNetworkId.Value, CurrentTransportStreamId.Value, currentTime.Value, programNumber, timeSignal); + DataStorage.SetScte35TimeSignal(CurrentNetworkId.Value, CurrentTransportStreamId.Value, currentTime.Value, programNumber, timeSignal); LogEvent(SkyscraperContextEvent.Scte35TimeSignal, String.Format("Program {0:X4}, Time Signal {1:X16}", programNumber, timeSignal.Value)); } @@ -1602,9 +1612,9 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return; - if (!ScraperStorage.IsCompliant(CurrentNetworkId.Value, CurrentTransportStreamId.Value, compliance)) + if (!DataStorage.IsCompliant(CurrentNetworkId.Value, CurrentTransportStreamId.Value, compliance)) { - ScraperStorage.MarkAsCompliant(CurrentNetworkId.Value, CurrentTransportStreamId.Value, compliance); + DataStorage.MarkAsCompliant(CurrentNetworkId.Value, CurrentTransportStreamId.Value, compliance); LogEvent(SkyscraperContextEvent.Compliance, compliance); } } @@ -1617,7 +1627,7 @@ namespace skyscraper5.Skyscraper.Scraper if (!CurrentTransportStreamId.HasValue) return; - if (ScraperStorage.SetStationIdentification(CurrentNetworkId.Value, CurrentTransportStreamId.Value, + if (DataStorage.SetStationIdentification(CurrentNetworkId.Value, CurrentTransportStreamId.Value, stationIdentification)) { LogEvent(SkyscraperContextEvent.StationIdentification, stationIdentification); @@ -1689,7 +1699,7 @@ namespace skyscraper5.Skyscraper.Scraper private bool ProcessDns(IpTrafficInfo trafficInfo, byte[] ipv4Packet) { if (DnsCache == null) - DnsCache = new SkyscraperDnsCache(ScraperStorage); + DnsCache = new SkyscraperDnsCache(DataStorage); //Handle DNS bool result = false; if (trafficInfo.Protocol == 0x11) @@ -1735,7 +1745,7 @@ namespace skyscraper5.Skyscraper.Scraper if (mpePlugins == null) { mpePlugins = PluginManager.GetInstance().GetMpePlugins(); - object[] connector = ScraperStorage.GetPluginConnector(); + object[] connector = StorageConnectionManager.GetPluginConnectors(DataStorage, ObjectStorage); foreach (ISkyscraperMpePlugin plugin in mpePlugins) { try @@ -1796,7 +1806,7 @@ namespace skyscraper5.Skyscraper.Scraper if (!currentTime.HasValue) return; - if (ScraperStorage.StoreRunningStatus(transportStreamId, originalNetworkId, serviceId, eventId, runningStatus, currentTime.Value)) + if (DataStorage.StoreRunningStatus(transportStreamId, originalNetworkId, serviceId, eventId, runningStatus, currentTime.Value)) { LogEvent(SkyscraperContextEvent.RunningStatusChange, String.Format("({0:X4},{1:X4},{2:X4},{3:X4}) -> {4}", originalNetworkId, transportStreamId, serviceId, eventId, runningStatus)); } @@ -1855,7 +1865,7 @@ namespace skyscraper5.Skyscraper.Scraper } if (childSkyscrapers[pid][basebandFramePlpId] == null) { - childSkyscrapers[pid][basebandFramePlpId] = new SkyscraperContext(new TsContext(), ScraperStorage); + childSkyscrapers[pid][basebandFramePlpId] = new SkyscraperContext(new TsContext(), DataStorage,ObjectStorage); childSkyscrapers[pid][basebandFramePlpId].IsChild = true; childSkyscrapers[pid][basebandFramePlpId].ChildName = String.Format("PLP {0}", basebandFramePlpId); @@ -1901,10 +1911,10 @@ namespace skyscraper5.Skyscraper.Scraper return; DateTime resolveTime = t2Timestamp.ResolveTime(); - DateTime knownTimestamp = ScraperStorage.T2MiGetTimestamp(CurrentNetworkId.Value, CurrentTransportStreamId.Value, pid); + DateTime knownTimestamp = DataStorage.T2MiGetTimestamp(CurrentNetworkId.Value, CurrentTransportStreamId.Value, pid); if (resolveTime > knownTimestamp) { - ScraperStorage.T2MiSetTimestamp(CurrentNetworkId.Value, CurrentTransportStreamId.Value, pid, resolveTime); + DataStorage.T2MiSetTimestamp(CurrentNetworkId.Value, CurrentTransportStreamId.Value, pid, resolveTime); } } @@ -1962,14 +1972,14 @@ namespace skyscraper5.Skyscraper.Scraper foreach (AddressingFunction function in individualAddressing.Commands) { - if (!ScraperStorage.T2MiTestForTransmitter(CurrentNetworkId, CurrentTransportStreamId, relatedPid, function.TxIdentifier)) - ScraperStorage.T2MiRememberTransmitter(CurrentNetworkId, CurrentTransportStreamId, relatedPid, function.TxIdentifier); + if (!DataStorage.T2MiTestForTransmitter(CurrentNetworkId, CurrentTransportStreamId, relatedPid, function.TxIdentifier)) + DataStorage.T2MiRememberTransmitter(CurrentNetworkId, CurrentTransportStreamId, relatedPid, function.TxIdentifier); switch (function.Tag) { case 0x00: _0x00_TransmitterTimeOffset tto = (_0x00_TransmitterTimeOffset)function; - ScraperStorage.T2MiSetTransmitterTimeOffset(CurrentNetworkId, CurrentTransportStreamId, relatedPid, function.TxIdentifier, tto.TimeOffset); + DataStorage.T2MiSetTransmitterTimeOffset(CurrentNetworkId, CurrentTransportStreamId, relatedPid, function.TxIdentifier, tto.TimeOffset); break; default: throw new NotImplementedException(String.Format("Individual Addressing function 0x{0:X2}", function.Tag)); @@ -2021,23 +2031,23 @@ namespace skyscraper5.Skyscraper.Scraper if (item.Value == 0.0) continue; - ScraperStorage.FailDsmCcDownload(item.Key, item.Value); + DataStorage.FailDsmCcDownload(item.Key, item.Value); } } } - ScraperStorage.WaitForCompletion(); + DataStorage.WaitForCompletion(); } public bool TestForFrame(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, int mappingStreamElementaryPid) { - return ScraperStorage.TestForFramegrab(currentNetworkId, transportStreamId, mappingProgramNumber, mappingStreamElementaryPid); + return ObjectStorage.TestForFramegrab(currentNetworkId, transportStreamId, mappingProgramNumber, mappingStreamElementaryPid); } public void NotifyCompletedFrame(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, int mappingStreamElementaryPid, byte[] imageData) { - ScraperStorage.StoreFramegrab(currentNetworkId, transportStreamId, mappingProgramNumber, (ushort)mappingStreamElementaryPid, imageData); + ObjectStorage.StoreFramegrab(currentNetworkId, transportStreamId, mappingProgramNumber, (ushort)mappingStreamElementaryPid, imageData); LogEvent(SkyscraperContextEvent.GotFramegrab, String.Format("Program {0:X4}, PID {1:X4}", mappingProgramNumber, mappingStreamElementaryPid)); UiJunction?.ShowFramegrab(currentNetworkId, transportStreamId, mappingProgramNumber, mappingStreamElementaryPid, imageData); } @@ -2047,9 +2057,9 @@ namespace skyscraper5.Skyscraper.Scraper IEnumerable ipMacNotifications = IpMacNotification.FlatMap(platform, target, operational); foreach (IpMacNotification notification in ipMacNotifications) { - if (!ScraperStorage.TestForIpMacNotification(notification)) + if (!DataStorage.TestForIpMacNotification(notification)) { - ScraperStorage.StoreIpMacNotification(notification); + DataStorage.StoreIpMacNotification(notification); LogEvent(SkyscraperContextEvent.IpMacNotification, String.Format("{0} -> {1}", platform.Name, notification.TargetName)); } } @@ -2068,9 +2078,9 @@ namespace skyscraper5.Skyscraper.Scraper foreach (RctLinkInfo rctLinkInfo in result.LinkInfo) { - if (!ScraperStorage.TestForRelatedContent(lEvent, rctLinkInfo)) + if (!DataStorage.TestForRelatedContent(lEvent, rctLinkInfo)) { - ScraperStorage.SetRelatedContent(lEvent, rctLinkInfo); + DataStorage.SetRelatedContent(lEvent, rctLinkInfo); LogEvent(SkyscraperContextEvent.RelatedContent, String.Format("Program {0}, Event {1} -> {2}", resultProgramNumber, lEvent.EventId, rctLinkInfo.GetIdentifierString())); } } @@ -2089,11 +2099,11 @@ namespace skyscraper5.Skyscraper.Scraper public void OnParticipantDetected(PhysicalAddress pa) { - int? currentLocation = ScraperStorage.GetCurrentLocationId(); + int? currentLocation = DataStorage.GetCurrentLocationId(); if (currentLocation.HasValue) { LogEvent(SkyscraperContextEvent.DocsisParticipant, BitConverter.ToString(pa.GetAddressBytes())); - ScraperStorage.StoreDocsisParticipant(pa, currentLocation.Value); + DataStorage.StoreDocsisParticipant(pa, currentLocation.Value); } else { @@ -2112,16 +2122,16 @@ namespace skyscraper5.Skyscraper.Scraper if (!mmm.Frequency.HasValue) return; - int? currentLocation = ScraperStorage.GetCurrentLocationId(); + int? currentLocation = DataStorage.GetCurrentLocationId(); if (!currentLocation.HasValue) { WarnMissingLocation(); return; } - if (!ScraperStorage.TestForDocsisUpstreamChannel(mmm.Source, mmm.Frequency.Value,currentLocation.Value)) + if (!DataStorage.TestForDocsisUpstreamChannel(mmm.Source, mmm.Frequency.Value,currentLocation.Value)) { - ScraperStorage.StoreDocsisUpstreamChannel(mmm, currentLocation.Value); + DataStorage.StoreDocsisUpstreamChannel(mmm, currentLocation.Value); LogEvent(SkyscraperContextEvent.DocsisUpstreamChannel, String.Format("{0} -> {1}", mmm.Source.ToString(), mmm.Frequency.Value)); } } @@ -2133,30 +2143,30 @@ namespace skyscraper5.Skyscraper.Scraper if (!downstreamActiveChannel.Frequency.HasValue) return; - int? currentLocation = ScraperStorage.GetCurrentLocationId(); + int? currentLocation = DataStorage.GetCurrentLocationId(); if (!currentLocation.HasValue) { WarnMissingLocation(); return; } - if (!ScraperStorage.TestForDocsisDownstreamChannel(physicalAddress, downstreamActiveChannel,currentLocation.Value)) + if (!DataStorage.TestForDocsisDownstreamChannel(physicalAddress, downstreamActiveChannel,currentLocation.Value)) { - ScraperStorage.StoreDocsisDownstreamChannel(physicalAddress, downstreamActiveChannel,currentLocation.Value); + DataStorage.StoreDocsisDownstreamChannel(physicalAddress, downstreamActiveChannel,currentLocation.Value); LogEvent(SkyscraperContextEvent.DocsisDownstreamChannel, String.Format("{0} -> {1}", physicalAddress.ToString(), downstreamActiveChannel.Frequency.Value)); } } public void OnLearnedIpFromMac(PhysicalAddress arpHeaderSenderHardwareAddress, IPAddress arpHeaderSenderProtocolAddress) { - int? currentLocation = ScraperStorage.GetCurrentLocationId(); + int? currentLocation = DataStorage.GetCurrentLocationId(); if (!currentLocation.HasValue) { WarnMissingLocation(); return; } - if (ScraperStorage.SetCmtsIp(arpHeaderSenderHardwareAddress, arpHeaderSenderProtocolAddress)) + if (DataStorage.SetCmtsIp(arpHeaderSenderHardwareAddress, arpHeaderSenderProtocolAddress)) { LogEvent(SkyscraperContextEvent.LearnedCmtsIp,String.Format("{0} -> {1}",arpHeaderSenderHardwareAddress.ToString(),arpHeaderSenderProtocolAddress.ToString())); } @@ -2170,7 +2180,7 @@ namespace skyscraper5.Skyscraper.Scraper childSkyscrapers[pid] = new SkyscraperContext[1]; if (childSkyscrapers[pid][0] == null) { - childSkyscrapers[pid][0] = new SkyscraperContext(new TsContext(), ScraperStorage); + childSkyscrapers[pid][0] = new SkyscraperContext(new TsContext(), DataStorage, ObjectStorage); childSkyscrapers[pid][0].IsChild = true; childSkyscrapers[pid][0].ChildName = String.Format("Abertis Tunnel on PID {0:X4}", pid); } @@ -2213,10 +2223,10 @@ namespace skyscraper5.Skyscraper.Scraper { foreach(Cmt.CmtEntry entry in cmt.Entries) { - if (!ScraperStorage.TestForCmtEntry(interactiveNetworkId,entry)) + if (!DataStorage.TestForCmtEntry(interactiveNetworkId,entry)) { LogEvent(SkyscraperContextEvent.CorrectionMessage, String.Format("Network ID = {0}, Group ID = {1}, Logon ID = {2}", interactiveNetworkId, entry.GroupId, entry.LoginId)); - ScraperStorage.InsertCmtEntry(interactiveNetworkId, entry); + DataStorage.InsertCmtEntry(interactiveNetworkId, entry); } } } @@ -2225,10 +2235,10 @@ namespace skyscraper5.Skyscraper.Scraper { foreach(Fct.Frame frame in fct.Frames) { - if (!ScraperStorage.TestForFrameComposition(interactiveNetworkId,frame)) + if (!DataStorage.TestForFrameComposition(interactiveNetworkId,frame)) { LogEvent(SkyscraperContextEvent.FrameComposition, String.Format("Network ID = {0}, Frame = {1}", interactiveNetworkId, frame.FrameId)); - ScraperStorage.InsertFctFrame(interactiveNetworkId, frame); + DataStorage.InsertFctFrame(interactiveNetworkId, frame); } } } @@ -2254,10 +2264,10 @@ namespace skyscraper5.Skyscraper.Scraper { foreach(_0x4a_LinkageDescriptor linkage in rmt.Linkages) { - if (!ScraperStorage.TestForRmtLinkage(linkage)) + if (!DataStorage.TestForRmtLinkage(linkage)) { LogEvent(SkyscraperContextEvent.RmtLinkage, String.Format("{0} -> {1},{2}", linkage.InteractiveNetworkId, linkage.OriginalNetworkId, linkage.TransportStreamId)); - ScraperStorage.InsertRmtLinkage(linkage); + DataStorage.InsertRmtLinkage(linkage); } } } @@ -2265,10 +2275,10 @@ namespace skyscraper5.Skyscraper.Scraper { foreach(Rmt.TransportStream transportStream in rmt.TransportStreams) { - if (!ScraperStorage.TestForRmtTransportStream(rmt.NetworkId, transportStream)) + if (!DataStorage.TestForRmtTransportStream(rmt.NetworkId, transportStream)) { LogEvent(SkyscraperContextEvent.RmtTransportStream, String.Format("{0} -> {1},{2}", rmt.NetworkId, transportStream.OriginalNetworkId, transportStream.TransportStreamId)); - ScraperStorage.InsertRmtTransportStream(rmt.NetworkId, transportStream); + DataStorage.InsertRmtTransportStream(rmt.NetworkId, transportStream); } } } @@ -2278,10 +2288,10 @@ namespace skyscraper5.Skyscraper.Scraper { foreach (Spt.Satellite satellite in spt.Satellites) { - if (!ScraperStorage.TestForSatellitePosition(interactiveNetworkId,satellite)) + if (!DataStorage.TestForSatellitePosition(interactiveNetworkId,satellite)) { LogEvent(SkyscraperContextEvent.SatellitePosition, String.Format("NID = {0}, Satellite ID = {1}", interactiveNetworkId, satellite.Id)); - ScraperStorage.StoreSatellitePosition(interactiveNetworkId, satellite); + DataStorage.StoreSatellitePosition(interactiveNetworkId, satellite); } } } @@ -2290,10 +2300,10 @@ namespace skyscraper5.Skyscraper.Scraper { foreach(Sct.Superframe superframe in sct.Superframes) { - if (!ScraperStorage.TestForSuperframeComposition(interactiveNetworkId,superframe)) + if (!DataStorage.TestForSuperframeComposition(interactiveNetworkId,superframe)) { LogEvent(SkyscraperContextEvent.SuperframeComposition, String.Format("Network ID = {0}, Superframe ID = {1}", interactiveNetworkId, superframe.SuperframeId)); - ScraperStorage.StoreSuperframeComposition(interactiveNetworkId, superframe); + DataStorage.StoreSuperframeComposition(interactiveNetworkId, superframe); } } } @@ -2304,10 +2314,10 @@ namespace skyscraper5.Skyscraper.Scraper { foreach (Tbtp.TbtpFrame.BtpEntity btp in frame.BTP) { - if (ScraperStorage.TestForTerminalBurstTimePlan(interactiveNetworkId,tbtp.GroupId,btp.LogonId)) + if (DataStorage.TestForTerminalBurstTimePlan(interactiveNetworkId,tbtp.GroupId,btp.LogonId)) { LogEvent(SkyscraperContextEvent.TerminalBurstTimePlan, String.Format("Network ID = {0}, Group ID = {1}, Logon ID = {2}", interactiveNetworkId, tbtp.GroupId, btp.LogonId)); - ScraperStorage.StoreTerminalBurstTimePlan(interactiveNetworkId, tbtp.GroupId, tbtp.SuperframeCount, frame.FrameNumber, btp); + DataStorage.StoreTerminalBurstTimePlan(interactiveNetworkId, tbtp.GroupId, tbtp.SuperframeCount, frame.FrameNumber, btp); } } } @@ -2320,12 +2330,12 @@ namespace skyscraper5.Skyscraper.Scraper public void OnCorrectionMessage(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd) { - if (!ScraperStorage.TestForTim(mac)) + if (!DataStorage.TestForTim(mac)) { LogEvent(SkyscraperContextEvent.Tim, String.Format("for participant {0}", mac.ToString())); - ScraperStorage.CreateTim(mac); + DataStorage.CreateTim(mac); } - if (ScraperStorage.CorrectTim(mac, cmd)) + if (DataStorage.CorrectTim(mac, cmd)) { LogEvent(SkyscraperContextEvent.TimCorrection, String.Format("for participant {0}", mac.ToString())); } @@ -2333,12 +2343,12 @@ namespace skyscraper5.Skyscraper.Scraper public void OnContentionControl(PhysicalAddress mac, _0xab_ContentionControlDescriptor ccdNew) { - if (!ScraperStorage.TestForTim(mac)) + if (!DataStorage.TestForTim(mac)) { LogEvent(SkyscraperContextEvent.Tim, String.Format("for participant {0}", mac.ToString())); - ScraperStorage.CreateTim(mac); + DataStorage.CreateTim(mac); } - if (ScraperStorage.ContentionTim(mac,ccdNew)) + if (DataStorage.ContentionTim(mac,ccdNew)) { LogEvent(SkyscraperContextEvent.TimContentionControl, String.Format("for participant {0}", mac.ToString())); } @@ -2346,12 +2356,12 @@ namespace skyscraper5.Skyscraper.Scraper public void OnCorrectionControl(PhysicalAddress mac, _0xac_CorrectionControlDescriptor descriptor) { - if (!ScraperStorage.TestForTim(mac)) + if (!DataStorage.TestForTim(mac)) { LogEvent(SkyscraperContextEvent.Tim, String.Format("for participant {0}", mac.ToString())); - ScraperStorage.CreateTim(mac); + DataStorage.CreateTim(mac); } - if (ScraperStorage.CorrectionControlTim(mac,descriptor)) + if (DataStorage.CorrectionControlTim(mac,descriptor)) { LogEvent(SkyscraperContextEvent.TimCorrectionControl, String.Format("for participant {0}", mac.ToString())); } @@ -2362,12 +2372,12 @@ namespace skyscraper5.Skyscraper.Scraper { if (currentTimeForTim == null) return; - if (!ScraperStorage.TestForTim(mac)) + if (!DataStorage.TestForTim(mac)) { LogEvent(SkyscraperContextEvent.Tim, String.Format("for participant {0}", mac.ToString())); - ScraperStorage.CreateTim(mac); + DataStorage.CreateTim(mac); } - if (ScraperStorage.NetworkLayerInfoTim(mac,nlid,currentTimeForTim.Value)) + if (DataStorage.NetworkLayerInfoTim(mac,nlid,currentTimeForTim.Value)) { if (networkLayerInfos == null) networkLayerInfos = new List(); @@ -2381,22 +2391,22 @@ namespace skyscraper5.Skyscraper.Scraper void InteractionChannelHandler.OnTransmissionModeSupport(ushort interactiveNetworkId, Tmst tmst) { - byte[] knownTmst = ScraperStorage.GetTmst(interactiveNetworkId); + byte[] knownTmst = DataStorage.GetTmst(interactiveNetworkId); if (knownTmst == null) { LogEvent(SkyscraperContextEvent.TransmissionModeSupport, String.Format("Network ID = {0}, Modes = {1}", interactiveNetworkId, BitConverter.ToString(tmst.Modes))); - ScraperStorage.InsertTmst(interactiveNetworkId, tmst.Modes); + DataStorage.InsertTmst(interactiveNetworkId, tmst.Modes); } else if (Array.Equals(knownTmst,tmst.Modes)) { LogEvent(SkyscraperContextEvent.TransmissionModeUpdate,String.Format("Network ID = {0}, Old Modes = {2}, New Modes = {1}", interactiveNetworkId, BitConverter.ToString(tmst.Modes), BitConverter.ToString(knownTmst))); - ScraperStorage.UpdateTmst(interactiveNetworkId, tmst.Modes); + DataStorage.UpdateTmst(interactiveNetworkId, tmst.Modes); } } public int GetRmtTransmissionStandard(ushort networkId) { - return ScraperStorage.GetRmtTransmissionStandard(networkId); + return DataStorage.GetRmtTransmissionStandard(networkId); } public void AutodetectionRuleOut(int pid, Contestant contestant, ProgramContext programContext) @@ -2406,10 +2416,10 @@ namespace skyscraper5.Skyscraper.Scraper void SgtEventHandler.AnnounceSgtList(SgtList list) { - if (!ScraperStorage.TestForSgtList(list)) + if (!DataStorage.TestForSgtList(list)) { LogEvent(SkyscraperContextEvent.SgtList, String.Format("List #{0} ({1})", list.ServiceListId, list.GetName())); - ScraperStorage.InsertSgtList(list); + DataStorage.InsertSgtList(list); } } @@ -2420,16 +2430,17 @@ namespace skyscraper5.Skyscraper.Scraper void SgtEventHandler.OnSgtService(SgtService child) { - if (!ScraperStorage.TestForSgtService(child)) + if (!DataStorage.TestForSgtService(child)) { LogEvent(SkyscraperContextEvent.SgtService, String.Format("LCN #{0} in List #{1} ({2})", child.Lcn, child.ServiceListId, child.GetName())); - ScraperStorage.InsertSgtService(child); + DataStorage.InsertSgtService(child); } } public void ProcessVirtualFilesystem(IFilesystem vfs, ProgramMappingStream programMappingStream) { yo3explorerToSkyscraperContextBridge context = new yo3explorerToSkyscraperContextBridge(); + context.DataStorage = DataStorage; if (!currentTime.HasValue) return; context.CurrentTime = currentTime.Value; @@ -2437,7 +2448,6 @@ namespace skyscraper5.Skyscraper.Scraper context.OriginalNetworkId = CurrentNetworkId; context.TransportStreamId = CurrentTransportStreamId; context.PID = programMappingStream.ElementaryPid; - context.DataStorage = ScraperStorage; yo3explorerState state = yo3explorerState.GetInstance(); @@ -2455,7 +2465,7 @@ namespace skyscraper5.Skyscraper.Scraper string extension = Path.GetExtension(listener.FileAssociation.ContentLocation).ToLowerInvariant(); if (!DvbNipUtilities.IsContinuousFileType(extension)) LogEvent(SkyscraperContextEvent.FluteFileArrival, listener.FileAssociation.ContentLocation); - ScraperStorage.DvbNipFileArrival(carrier, listener); + ObjectStorage.DvbNipFileArrival(carrier, listener); } public void OnMulticastGatewayConfiguration(NipActualCarrierInformation carrier, MulticastGatewayConfigurationType multicastGatewayConfiguration) @@ -2464,10 +2474,10 @@ namespace skyscraper5.Skyscraper.Scraper { foreach (MulticastSessionType multicastSession in multicastGatewayConfiguration.MulticastSession) { - if (!ScraperStorage.DvbNipTestForMulticastSession(multicastSession)) + if (!DataStorage.DvbNipTestForMulticastSession(multicastSession)) { LogEvent(SkyscraperContextEvent.DvbNipMulticastSession, multicastSession.serviceIdentifier); - ScraperStorage.DvbNipInsertMulticastSession(multicastSession); + DataStorage.DvbNipInsertMulticastSession(multicastSession); } } } @@ -2480,13 +2490,13 @@ namespace skyscraper5.Skyscraper.Scraper continue; MulticastEndpointAddressType endpointAddress = multicastGatewayConfigurationTransportSession.EndpointAddress[0]; - if (!ScraperStorage.DvbNipTestForMulticastGatewayConfigurationTransportSession(carrier, endpointAddress)) + if (!DataStorage.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, endpointAddress); + DataStorage.DvbNipInsertMulticastGatewayConfigurationTransportSession(carrier, endpointAddress); } } } @@ -2500,9 +2510,9 @@ namespace skyscraper5.Skyscraper.Scraper public void OnNipCarrierDetected(NipActualCarrierInformation currentCarrierInformation) { LogEvent(SkyscraperContextEvent.NipCarrierDetected, String.Format("{0}", currentCarrierInformation.NipStreamProviderName)); - if (!ScraperStorage.DvbNipTestForCarrier(currentCarrierInformation)) + if (!DataStorage.DvbNipTestForCarrier(currentCarrierInformation)) { - ScraperStorage.DvbNipInsertCarrier(currentCarrierInformation); + DataStorage.DvbNipInsertCarrier(currentCarrierInformation); } } @@ -2511,7 +2521,7 @@ namespace skyscraper5.Skyscraper.Scraper if (announcedFileContentLocation.StartsWith("urn:dvb")) return true; - return !ScraperStorage.DvbNipTestForFile(announcedFileContentLocation); + return !ObjectStorage.DvbNipTestForFile(announcedFileContentLocation); } public void OnPrivateDataSignallingManifest(NipActualCarrierInformation currentCarrierInformation, PrivateDataSignallingManifestType privateDataSignallingManifest) @@ -2521,7 +2531,7 @@ namespace skyscraper5.Skyscraper.Scraper privateDataProvider.privateDataProviderID.FlipEndian(); uint privateDataSpecifier = BitConverter.ToUInt32(privateDataProvider.privateDataProviderID); List privateDataSessions = privateDataProvider.PrivateDataSession.SelectMany(x => x.TagRef).ToList(); - bool added = ScraperStorage.DvbNipPrivateDataSpecifier(currentCarrierInformation, privateDataSignallingManifest.VersionUpdate, privateDataSpecifier, privateDataSessions); + bool added = DataStorage.DvbNipPrivateDataSpecifier(currentCarrierInformation, privateDataSignallingManifest.VersionUpdate, privateDataSpecifier, privateDataSessions); if (added) { LogEvent(SkyscraperContextEvent.NipPrivateDataSpecifier, String.Format("{0} -> {1}", currentCarrierInformation.NipStreamProviderName, privateDataSpecifier)); @@ -2533,7 +2543,7 @@ namespace skyscraper5.Skyscraper.Scraper { long sourceHash = DvbIUtils.GetSourceHash(ServiceListEntryPointSource.DvbNip, currentCarrierInformation.NipNetworkId, currentCarrierInformation.NipCarrierId, currentCarrierInformation.NipLinkId); serviceListNotifier.SetSourceHash(sourceHash); - DvbIDataStorage dataStorage = ScraperStorage; + DvbIDataStorage dataStorage = DataStorage; if (dataStorage.TestForDvbiServiceListEntryPoints(sourceHash)) { @@ -2585,7 +2595,7 @@ namespace skyscraper5.Skyscraper.Scraper ServiceListType serviceList) { List services = DvbIUtils.FlattenServiceList(serviceList).ToList(); - DvbIDataStorage dataStorage = ScraperStorage; + DvbIDataStorage dataStorage = DataStorage; foreach (DvbIService service in services) { if (dataStorage.TestForDvbiService(service.Id)) @@ -2623,10 +2633,10 @@ namespace skyscraper5.Skyscraper.Scraper foreach (BroadcastNetworkType network in broadcastNetworks) { - if (!ScraperStorage.DvbNipTestForNetwork(network)) + if (!DataStorage.DvbNipTestForNetwork(network)) { LogEvent(SkyscraperContextEvent.DvbNipNetwork, network.NetworkName); - ScraperStorage.DvbNipInsertNetwork(network); + DataStorage.DvbNipInsertNetwork(network); } } } @@ -2635,13 +2645,13 @@ namespace skyscraper5.Skyscraper.Scraper { foreach (BroadcastMediaStreamType broadcastMediaStreamType in serviceInformationFile.BroadcastMediaStream) { - if (!ScraperStorage.DvbNipTestForService(broadcastMediaStreamType)) + if (!DataStorage.DvbNipTestForService(broadcastMediaStreamType)) { string id = String.Format("{0},{1},{2},{3}", broadcastMediaStreamType.NIPNetworkID, broadcastMediaStreamType.NIPCarrierID, broadcastMediaStreamType.NIPLinkID, broadcastMediaStreamType.NIPServiceID); LogEvent(SkyscraperContextEvent.DvbNipService, id); - ScraperStorage.DvbNipInsertService(broadcastMediaStreamType); + DataStorage.DvbNipInsertService(broadcastMediaStreamType); } } } diff --git a/skyscraper8/Skyscraper/Scraper/SkyscraperContextFactory.cs b/skyscraper8/Skyscraper/Scraper/SkyscraperContextFactory.cs index 4bdfcf1..dbe5a4f 100644 --- a/skyscraper8/Skyscraper/Scraper/SkyscraperContextFactory.cs +++ b/skyscraper8/Skyscraper/Scraper/SkyscraperContextFactory.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using skyscraper5.Mpeg2; using skyscraper5.Skyscraper.Scraper.Storage; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.Scraper { @@ -15,10 +16,10 @@ namespace skyscraper5.Skyscraper.Scraper } - public static ISkyscraperContext CreateSkyscraper(IScraperStroage storage) + public static ISkyscraperContext CreateSkyscraper(DataStorage dataStorage,ObjectStorage objectStorage) { TsContext tsContext = new TsContext(); - SkyscraperContext result = new SkyscraperContext(tsContext, storage); + SkyscraperContext result = new SkyscraperContext(tsContext, dataStorage,objectStorage); return result; } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Split/DataStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/DataStorage.cs similarity index 97% rename from skyscraper8/Skyscraper/Scraper/Storage/Split/DataStorage.cs rename to skyscraper8/Skyscraper/Scraper/Storage/DataStorage.cs index 6ecb94f..eeeee89 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/Split/DataStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/DataStorage.cs @@ -5,14 +5,13 @@ using skyscraper5.Dvb.Descriptors; using skyscraper5.Dvb.Psi.Model; using skyscraper5.Dvb.SystemSoftwareUpdate.Model; using skyscraper5.Dvb.TvAnytime; -using skyscraper5.Mhp; using skyscraper5.Mhp.Si; using skyscraper5.Mhp.Si.Model; using skyscraper5.Mpeg2.Descriptors; using skyscraper5.Mpeg2.Psi.Model; using skyscraper5.Rds.Messages; using skyscraper5.Scte35; -using skyscraper5.Scte35.Descriptors; +using skyscraper5.Skyscraper; using skyscraper5.Skyscraper.Equipment; using skyscraper5.Skyscraper.Gps; using skyscraper5.Skyscraper.Headless; @@ -26,19 +25,13 @@ using skyscraper5.Teletext; using skyscraper8.DvbI; using skyscraper8.DvbNip; using skyscraper8.Ses; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using System.Net; using System.Net.NetworkInformation; -using System.Text; -using System.Threading.Tasks; using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; -namespace skyscraper5.Skyscraper.Scraper.Storage.Split +namespace skyscraper8.Skyscraper.Scraper.Storage { - public interface DataStorage : IDbBlindscanJobStorage, IDnsDataSource + public interface DataStorage : IDbBlindscanJobStorage, IDnsDataSource, DvbIDataStorage { bool StoreTeletextPage(int networkId, int transportStreamId, ushort programNumber, TeletextMagazine magazine, DateTime timestamp); bool TestForNitNetwork(NitNetwork nitNetwork); @@ -116,8 +109,6 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split List UiDishTypesListAll(); void UiDishTypesAdd(DishType defaultDishType); - object[] GetPluginConnector(); - void Ping(); IEnumerable> SelectAllPmt(); SdtService SelectSdtById(int networkId, int tsId, ushort programMappingProgramNumber); IEnumerable> SelectAllSdt(); @@ -195,5 +186,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split bool DvbNipTestForCarrier(NipActualCarrierInformation currentCarrierInformation); void DvbNipInsertCarrier(NipActualCarrierInformation currentCarrierInformation); - } + + object[] GetPluginConnector(); + } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/DataStorageFactory.cs b/skyscraper8/Skyscraper/Scraper/Storage/DataStorageFactory.cs new file mode 100644 index 0000000..84cfe78 --- /dev/null +++ b/skyscraper8/Skyscraper/Scraper/Storage/DataStorageFactory.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper.Scraper.Storage +{ + public interface DataStorageFactory + { + DataStorage CreateDataStorage(); + } +} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorageFactory.cs b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorageFactory.cs index ee1e82c..9d28a38 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorageFactory.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorageFactory.cs @@ -4,18 +4,45 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using skyscraper5.Skyscraper.IO; using skyscraper5.Skyscraper.Plugins; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem { [SkyscraperPlugin] - [ScrapeStorageFactoryId(1,"Filesystem",false)] - public class FilesystemScraperStorageFactory : IScraperStorageFactory + [StorageId(2)] + [StorageName("Filesystem")] + public class FilesystemScraperStorageFactory : DataStorageFactory, ObjectStorageFactory { public string Directory { get; set; } - public IScraperStroage CreateScraperStroage() + + public DataStorage CreateDataStorage() { - return new FilesystemScraperStorage(new DirectoryInfo(Directory)); + DirectoryInfo di = new DirectoryInfo(Directory); + if (!di.Exists) + di.EnsureExists(); + return new FilesystemStorage(di); + } + + public ObjectStorage CreateObjectStorage() + { + DirectoryInfo di = new DirectoryInfo(Directory); + if (!di.Exists) + di.EnsureExists(); + return new FilesystemStorage(di); + } + + public bool IsEquivalent(DataStorageFactory dataStorageFactory) + { + FilesystemScraperStorageFactory other = dataStorageFactory as FilesystemScraperStorageFactory; + if (other == null) + return false; + + if (!other.Directory.Equals(this.Directory)) + return false; + + return true; } } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs similarity index 99% rename from skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorage.cs rename to skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs index 0f2947b..ce857af 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemScraperStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs @@ -37,17 +37,18 @@ using skyscraper8.DvbI; using skyscraper8.DvbNip; using skyscraper8.Ietf.FLUTE; using skyscraper8.Ses; +using skyscraper8.Skyscraper.Scraper.Storage; using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem { - internal class FilesystemScraperStorage : IScraperStroage + internal class FilesystemStorage : DataStorage, ObjectStorage { private readonly DirectoryInfo rootDirectory; private readonly string importFilesKnownFilename; private readonly JsonSerializerSettings jsonSerializerSettings; - public FilesystemScraperStorage(DirectoryInfo rootDirectory) + public FilesystemStorage(DirectoryInfo rootDirectory) { EnsureDirectoryExists(rootDirectory); this.rootDirectory = rootDirectory; diff --git a/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorage.cs deleted file mode 100644 index 4d762c5..0000000 --- a/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorage.cs +++ /dev/null @@ -1,200 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.NetworkInformation; -using skyscraper5.Docsis.MacManagement; -using skyscraper5.DsmCc.Descriptors; -using skyscraper5.Dvb.DataBroadcasting.IntModel; -using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; -using skyscraper5.Dvb.Descriptors; -using skyscraper5.Dvb.Psi.Model; -using skyscraper5.Dvb.SystemSoftwareUpdate.Model; -using skyscraper5.Dvb.TvAnytime; -using skyscraper5.Mhp; -using skyscraper5.Mhp.Si; -using skyscraper5.Mhp.Si.Model; -using skyscraper5.Mpeg2.Descriptors; -using skyscraper5.Mpeg2.Psi.Model; -using skyscraper5.Rds.Messages; -using skyscraper5.Scte35; -using skyscraper5.Skyscraper.Equipment; -using skyscraper5.Skyscraper.Gps; -using skyscraper5.Skyscraper.Headless; -using skyscraper5.Skyscraper.Scraper.Storage.Split; -using skyscraper5.Skyscraper.Scraper.Storage.Utilities; -using skyscraper5.src.InteractionChannel.Model; -using skyscraper5.src.InteractionChannel.Model.Descriptors; -using skyscraper5.src.Skyscraper.FrequencyListGenerator; -using skyscraper5.src.Skyscraper.Scraper.Dns; -using skyscraper5.Teletext; -using skyscraper8.DvbI; -using skyscraper8.DvbNip; -using skyscraper8.Ietf.FLUTE; -using skyscraper8.Ses; -using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; - -namespace skyscraper5.Skyscraper.Scraper.Storage -{ - public interface IScraperStroage : DataStorage, ObjectStorage, IDbBlindscanJobStorage, IDnsDataSource, DvbIDataStorage - { - bool TestForNitNetwork(NitNetwork nitNetwork); - void StoreNitNetwork(NitNetwork nitNetwork); - bool UpdateNitNetwork(NitNetwork nitNetwork); - bool TestForNitTransportStream(ushort networkId, NitTransportStream transportStream); - void StoreNitTransportStream(ushort networkId, NitTransportStream transportStream); - bool UpdateNitTransportStream(ushort networkId, NitTransportStream transportStream); - bool StorePatEntry(int currentNetworkId, int currentTransportStreamId, int pmtPid, ushort programId); - bool TestForPmtEvent(int currentNetworkId, int currentTransportStreamId, ProgramMapping result); - bool StorePmtEvent(int currentNetworkId, int currentTransportStreamId, ProgramMapping mapping); - bool StoreTeletextPage(int networkId, int transportStreamId, ushort programNumber, TeletextMagazine magazine, DateTime timestamp); - bool TestForSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService); - bool UpdateSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService); - void StoreSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService); - bool TestForBatBouquet(BatBouquet batBouquet); - bool UpdateBatBouquet(BatBouquet batBouquet); - void StoreBatBouquet(BatBouquet batBouquet); - bool TestForBatTransportStream(ushort batBouquetBouquetId, BatTransportStream child); - bool UpdateBatTransportStream(ushort batBouquetBouquetId, BatTransportStream child); - void StoreBatTransportStream(ushort batBouquetBouquetId, BatTransportStream child); - bool UpdateTimeOffsetTable(int currentNetworkId, int currentTransportStreamId, DateTime utcTime, LocalTimeOffsetDescriptor ltod); - bool UpdateTimeAndDate(int currentNetworkId, int currentTransportStreamId, DateTime utcTime); - bool StoreEitEvent(EitEvent eitEvent); - bool TestForAitApplication(ApplicationIdentifier aitApplicationApplicationIdentifier); - void StoreAitApplication(AitApplication aitApplication); - bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId); - bool TestForCaSystem(int currentNetworkId, int currentTransportStreamId, int caDescriptorCaPid); - void StoreCaSystem(int currentNetworkId, int currentTransportStreamId, CaDescriptor caDescriptor); - void StoreUpdateNotification(int hashCode, UpdateNotificationGroup common, Compatibility compatibility, Platform platform); - void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleModuleId, byte moduleModuleVersion, Stream result); - bool TestForKnownRdsData(int currentNetworkId, int currentTransportStreamId, int programNumber); - void EnableRdsCollection(int currentNetworkId, int currentTransportStreamId, int programNumber); - bool UpdateRdsProgrammeServiceName(int currentNetworkId, int currentTransportStreamId, int programNumber, string programmeService2); - bool UpdateRdsRadioText(int currentNetworkId, int currentTransportStreamId, int programNumber, string text); - bool UpdateRdsPty(int currentNetworkId, int currentTransportStreamId, int programNumber, PTY.ProgrammeTypeCodes pty); - bool MarkAsRdsTrafficInformationProgramme(int currentNetworkId, int currentTransportStreamId, int programNumber); - bool TestForScte35SpliceInsert(int currentNetworkId, int currentTransportStreamId, ushort programNumber, SpliceInsert spliceInsert); - void StoreScte35SpliceInsert(int currentNetworkId, int currentTransportStreamId, ushort programNumber, SpliceInsert spliceInsert); - bool IsCompliant(int currentNetworkId, int currentTransportStreamId, string compliance); - void MarkAsCompliant(int currentNetworkId, int currentTransportStreamId, string compliance); - bool SetStationIdentification(int currentNetworkId, int currentTransportStreamId, string stationIdentification); - bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, byte moduleVersion); - void StoreDsmCcDoItNowEvent(DateTime value, int currentNetworkId, int currentTransportStreamId, int programNumber, StreamEventDescriptor descriptorListStreamEventDescriptor, int pid); - bool StoreRunningStatus(uint transportStreamId, uint originalNetworkId, uint serviceId, uint eventId, RunningStatus runningStatus, DateTime currentTime); - void SetScte35TimeSignal(int currentNetworkId, int currentTransportStreamId, DateTime currentTime, ushort programNumber, TimeSignal timeSignal); - bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, int mappingStreamElementaryPid); - bool TestForIpMacNotification(IpMacNotification notification); - void StoreIpMacNotification(IpMacNotification notification); - bool ImportFileKnown(FileInfo fi); - void ImportMarkFileAsKnown(FileInfo fi, TimeSpan elapsed, int tstype); - DateTime T2MiGetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid); - void T2MiSetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid, DateTime resolveTime); - bool TestForRelatedContent(EitEvent lEvent, RctLinkInfo rctLinkInfo); - void SetRelatedContent(EitEvent lEvent, RctLinkInfo rctLinkInfo); - List UiSatellitesListAll(); - void UiSatellitesAdd(SatellitePosition newPosition); - void UiSatellitesDelete(SatellitePosition satellitePosition); - bool UiTunerTestFor(TunerMetadata tuner); - void UiTunerUpdate(TunerMetadata tuner); - void UiTunerInsert(TunerMetadata tuner); - void UiTunerGetConfiguration(TunerMetadata foundTuner); - void StoreFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, ushort mappingProgramNumber1, byte[] imageData); - bool TestForDocsisUpstreamChannel(PhysicalAddress mmmSource, uint mmmFrequency, int currentLocation); - void StoreDocsisUpstreamChannel(UpstreamChannelDescriptor mmm, int currentLocation); - - bool TestForDocsisDownstreamChannel(PhysicalAddress physicalAddress, MacDomainDescriptor.DownstreamActiveChannel downstreamActiveChannel, int currentLocation); - void StoreDocsisDownstreamChannel(PhysicalAddress physicalAddress, MacDomainDescriptor.DownstreamActiveChannel downstreamActiveChannel, int currentLocation); - bool SetCmtsIp(PhysicalAddress arpHeaderSenderHardwareAddress, IPAddress arpHeaderSenderProtocolAddress); - bool IsDsmCcModuleBlacklisted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, byte moduleVersion); - int? GetCurrentLocationId(); - void StoreDocsisParticipant(PhysicalAddress pa, int currentLocation); - HeadlessJob GetQueuedJob(); - void SetQueuedJobComplete(HeadlessJob headlessJob); - - void WaitForCompletion(); - - /// - /// Tells the underlaying storage which UI Version is used. - /// 1 -> deprecated and buggy. Didn't know anything about dish types and LNB types - /// 2 -> current - /// - /// The underlaying UI Version to assume - void UiSetVersion(int v); - bool T2MiTestForTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier); - void T2MiRememberTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier); - void T2MiSetTransmitterTimeOffset(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier, ushort timeOffset); - List UiLnbTypesListAll(); - void UiLnbTypesAdd(LnbType defaultLnbType); - List UiDishTypesListAll(); - void UiDishTypesAdd(DishType defaultDishType); - object[] GetPluginConnector(); - - /// - /// Checks whether the storage engine is working properly. - /// - void Ping(); - - IEnumerable> SelectAllPmt(); - SdtService SelectSdtById(int networkId, int tsId, ushort programMappingProgramNumber); - IEnumerable> SelectAllSdt(); - void BeamsDisableAll(); - void BeamsEnable(int id, float satpos, string name, DateTime processTimestamp); - void BeamFootprintStore(int databasePointerId, DateTime databasePointerBeamsProcessTimestamp, string name, string getPolygonString, string id); - bool TestForBeamFootprint(int databasePointerId, DateTime databasePointerBeamsProcessTimestamp, string name, string id); - void BeamsDisableSpecific(int databasePointerId, float databasePointerSatpos, string databasePointerName, DateTime databasePointerBeamsProcessTimestamp); - IEnumerable BeamsSelectEnabled(); - List BeamsSelectFootprints(int satelliteBeamId, DateTime satelliteBeamProcessTimestamp); - void FailDsmCcDownload(DatabaseKeyDsmCcModule key, double value); - IReadOnlyList ListImportFileByTag1(int tag1); - bool TestForTerminalBurstTimePlan(ushort interactiveNetworkId, uint groupId, uint logonId); - void StoreTerminalBurstTimePlan(ushort interactiveNetworkId, uint gtoupId, uint superframeCount, uint frameNumber, Tbtp.TbtpFrame.BtpEntity btp); - bool TestForCmtEntry(ushort interactiveNetworkId, Cmt.CmtEntry entry); - void InsertCmtEntry(ushort interactiveNetworkId, Cmt.CmtEntry entry); - - /// - /// Returns the Transmission Standard for an Interaction channel. - /// - /// Make sure this returns 0 if you don't have the necessary data to determine the Transmission Standard. - /// The network id of the Interaction channel in question. - /// The Transmission Standard for an Interaction channel. - int GetRmtTransmissionStandard(ushort networkId); - byte[] GetTmst(ushort interactiveNetworkId); - void InsertTmst(ushort interactiveNetworkId, byte[] modes); - void UpdateTmst(ushort interactiveNetworkId, byte[] modes); - bool TestForRmtLinkage(_0x4a_LinkageDescriptor linkage); - void InsertRmtLinkage(_0x4a_LinkageDescriptor linkage); - bool TestForRmtTransportStream(ushort networkId, Rmt.TransportStream transportStream); - void InsertRmtTransportStream(ushort networkId, Rmt.TransportStream transportStream); - bool TestForSuperframeComposition(ushort interactiveNetworkId, Sct.Superframe superframe); - void StoreSuperframeComposition(ushort interactiveNetworkId, Sct.Superframe superframe); - bool TestForFrameComposition(ushort interactiveNetworkId, Fct.Frame frame); - void InsertFctFrame(ushort interactiveNetworkId, Fct.Frame frame); - bool TestForSatellitePosition(ushort interactiveNetworkId, Spt.Satellite satellite); - void StoreSatellitePosition(ushort interactiveNetworkId, Spt.Satellite satellite); - bool TestForTim(PhysicalAddress mac); - void CreateTim(PhysicalAddress mac); - bool CorrectTim(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd); - bool ContentionTim(PhysicalAddress mac, _0xab_ContentionControlDescriptor ccdNew); - bool CorrectionControlTim(PhysicalAddress mac, _0xac_CorrectionControlDescriptor descriptor); - bool NetworkLayerInfoTim(PhysicalAddress mac, _0xa0_NetworkLayerInfoDescriptor nlid, DateTime timestamp); - - IEnumerable GetDbBlindscanJobs(); - bool TestForSgtList(SgtList list); - void InsertSgtList(SgtList list); - bool TestForSgtService(SgtService child); - void InsertSgtService(SgtService child); - bool DvbNipTestForFile(string announcedFileContentLocation); - void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener); - bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, uint privateDataSpecifier, List privateDataSessions); - bool DvbNipTestForNetwork(BroadcastNetworkType network); - 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, MulticastEndpointAddressType multicastGatewayConfigurationTransportSession); - bool DvbNipTestForCarrier(NipActualCarrierInformation currentCarrierInformation); - void DvbNipInsertCarrier(NipActualCarrierInformation currentCarrierInformation); - } -} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorageFactory.cs b/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorageFactory.cs deleted file mode 100644 index 94aba5c..0000000 --- a/skyscraper8/Skyscraper/Scraper/Storage/IScraperStorageFactory.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace skyscraper5.Skyscraper.Scraper.Storage -{ - public interface IScraperStorageFactory - { - IScraperStroage CreateScraperStroage(); - } -} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs index 145162e..1169b89 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs @@ -37,12 +37,13 @@ using System.Linq; using System.Net; using System.Net.NetworkInformation; using skyscraper8.Ietf.FLUTE; +using skyscraper8.Skyscraper.Scraper.Storage; using skyscraper8.Skyscraper.Scraper.Storage.Utilities; using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory { - internal class InMemoryScraperStorage : IScraperStroage + internal class InMemoryScraperStorage : DataStorage { public InMemoryScraperStorage() { @@ -413,18 +414,6 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory aitApplicationCoordinates.Add(aitApplicationCoordinate); } - 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()); - FileInfo outFileInfo = new FileInfo(outPath); - if (outFileInfo.Exists) - return false; - EnsureDirectoryExists(outFileInfo.Directory); - File.WriteAllBytes(outFileInfo.FullName, vfsFile.FileContent); - return true; - } - public bool TestForCaSystem(int currentNetworkId, int currentTransportStreamId, int caDescriptorCaPid) { InMemoryCaSystem find = caSystems.Find(x => @@ -450,27 +439,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory updateHashes.Add(hashCode); updates.Add(new Tuple(hashCode, compatibility, platform)); } - - 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); - FileInfo fi = new FileInfo(outPath); - if (fi.Exists) - return; - EnsureDirectoryExists(fi.Directory); - FileStream fileStream = fi.OpenWrite(); - result.CopyTo(fileStream); - fileStream.Close(); - fileStream.Dispose(); - - DsmCcModuleXmlMemory.GetInstance().MarkComplete(currentNetworkId, currentTransportStreamId, elementaryPid, - moduleModuleId, moduleModuleVersion); - - } - + public bool TestForKnownRdsData(int currentNetworkId, int currentTransportStreamId, int programNumber) { if (rdsDataPresent == null) @@ -602,14 +571,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory stationIdentification[currentNetworkId][currentTransportStreamId] = newSi; return result; } - - public bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, - ushort moduleId, byte 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) { @@ -629,23 +591,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory { } - - 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))); - return fi.Exists; - } - - 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))); - fi.Directory.EnsureExists(); - File.WriteAllBytes(fi.FullName, imageData); - } + private HashSet _docsisUpstreamChannelCoordinates; @@ -1362,29 +1308,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory sgtServices.Add(child); } - - public bool DvbNipTestForFile(string announcedFileContentLocation) - { - string saneFilename = DvbNipUtilities.MakeFilename(announcedFileContentLocation); - FileInfo fi = new FileInfo(saneFilename); - return fi.Exists; - } - - public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener) - { - string filename = DvbNipUtilities.MakeFilename(listener.FileAssociation.ContentLocation); - FileInfo fi = new FileInfo(filename); - fi.Directory.EnsureExists(); - FileStream outStream = fi.OpenWrite(); - Stream inStream = listener.ToStream(); - inStream.CopyTo(outStream); - outStream.Flush(true); - outStream.Close(); - outStream.Dispose(); - inStream.Close(); - inStream.Dispose(); - } - + private class NipPds { public class NipSubPds diff --git a/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorageFactory.cs b/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorageFactory.cs index 05dd9cb..415d75b 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorageFactory.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorageFactory.cs @@ -4,16 +4,19 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using skyscraper5.Skyscraper.Plugins; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory { [SkyscraperPlugin] - [ScrapeStorageFactoryId(0,"In-Memory",true)] - public class InMemoryScraperStorageFactory : IScraperStorageFactory + [StorageVolatile] + [StorageName("In-Memory")] + [StorageId(1)] + public class InMemoryScraperStorageFactory : DataStorageFactory { - public IScraperStroage CreateScraperStroage() + public DataStorage CreateDataStorage() { - return new InMemoryScraperStorage(); + return new InMemoryScraperStorage(); } } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Split/ObjectStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs similarity index 95% rename from skyscraper8/Skyscraper/Scraper/Storage/Split/ObjectStorage.cs rename to skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs index 7c8433f..183f55e 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/Split/ObjectStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs @@ -9,7 +9,7 @@ using skyscraper5.Teletext; using skyscraper8.DvbNip; using skyscraper8.Ietf.FLUTE; -namespace skyscraper5.Skyscraper.Scraper.Storage.Split +namespace skyscraper8.Skyscraper.Scraper.Storage { public interface ObjectStorage { diff --git a/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorageFactory.cs b/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorageFactory.cs new file mode 100644 index 0000000..aa1e184 --- /dev/null +++ b/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorageFactory.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper.Scraper.Storage +{ + public interface ObjectStorageFactory + { + ObjectStorage CreateObjectStorage(); + bool IsEquivalent(DataStorageFactory dataStorageFactory); + } +} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/ScraperStorageFactoryConnectionManager.cs b/skyscraper8/Skyscraper/Scraper/Storage/ScraperStorageFactoryConnectionManager.cs deleted file mode 100644 index 2c89c24..0000000 --- a/skyscraper8/Skyscraper/Scraper/Storage/ScraperStorageFactoryConnectionManager.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using System.Runtime.Serialization; -using System.Text; -using System.Threading.Tasks; -using System.Xml.XPath; -using skyscraper5.Skyscraper.Plugins; - -namespace skyscraper5.Skyscraper.Scraper.Storage -{ - public sealed class ScraperStorageFactoryConnectionManager - { - private ScraperStorageFactoryConnectionManager() - { - factories = PluginManager.GetInstance().GetScraperStorageFactories(); - if (factories.Count == 0) - { - throw new NullReferenceException("We didn't get an ScraperStorages. There's something wrong here."); - } - } - - private static ScraperStorageFactoryConnectionManager _instance; - - public static ScraperStorageFactoryConnectionManager GetInstance() - { - if (_instance == null) - { - _instance = new ScraperStorageFactoryConnectionManager(); - } - return _instance; - } - - private ReadOnlyDictionary factories; - - public ReadOnlyCollection> GetKnownFactories() - { - ReadOnlyCollection> readOnlyCollection = factories.ToList().AsReadOnly(); - return readOnlyCollection; - } - - public static void ConfigureFactoryFromIni(KeyValuePair bootingStorage, Ini ini) - { - string catName = String.Format("storage{0}", bootingStorage.Key.Id); - PluginManager.GetInstance().AutoconfigureObject(catName, bootingStorage.Value); - } - - public IScraperStorageFactory AutoGetDefaultFactory() - { - Ini ini = PluginManager.GetInstance().Ini; - int factoryId = ini.ReadValue("startup", "storage", -1); - if (factoryId == -1) - throw new NoStorageFactoryConfiguredException(); - - IScraperStorageFactory result = null; - foreach (KeyValuePair entry in GetKnownFactories()) - { - if (factoryId == entry.Key.Id) - { - ConfigureFactoryFromIni(entry, ini); - result = entry.Value; - break; - } - } - - - if (result == null) - throw new StorageFactoryPluginNotLoadedException(); - return result; - } - } - - -} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/ScraperStorageFactoryId.cs b/skyscraper8/Skyscraper/Scraper/Storage/ScraperStorageFactoryId.cs deleted file mode 100644 index c1d0497..0000000 --- a/skyscraper8/Skyscraper/Scraper/Storage/ScraperStorageFactoryId.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace skyscraper5.Skyscraper.Scraper.Storage -{ - - [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] - public sealed class ScrapeStorageFactoryIdAttribute : Attribute - { - public int Id { get; } - public string DisplayName { get; } - public bool VolatileStorage { get; } - - public string TemporaryUUID { get; } - - public ScrapeStorageFactoryIdAttribute(int id, string displayName, bool volatileStorage) - { - Id = id; - DisplayName = displayName; - VolatileStorage = volatileStorage; - TemporaryUUID = Guid.NewGuid().ToString(); - } - } -} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Split/SplitScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/Split/SplitScraperStorage.cs deleted file mode 100644 index 38384b2..0000000 --- a/skyscraper8/Skyscraper/Scraper/Storage/Split/SplitScraperStorage.cs +++ /dev/null @@ -1,1063 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Net; -using System.Net.NetworkInformation; -using skyscraper5.Docsis.MacManagement; -using skyscraper5.DsmCc.Descriptors; -using skyscraper5.Dvb.DataBroadcasting.IntModel; -using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; -using skyscraper5.Dvb.Descriptors; -using skyscraper5.Dvb.Psi.Model; -using skyscraper5.Dvb.SystemSoftwareUpdate.Model; -using skyscraper5.Dvb.TvAnytime; -using skyscraper5.Mhp.Si; -using skyscraper5.Mhp.Si.Model; -using skyscraper5.Mpeg2.Descriptors; -using skyscraper5.Mpeg2.Psi.Model; -using skyscraper5.Rds.Messages; -using skyscraper5.Scte35; -using skyscraper5.Skyscraper.Equipment; -using skyscraper5.Skyscraper.Gps; -using skyscraper5.Skyscraper.Headless; -using skyscraper5.Skyscraper.IO.CrazycatStreamReader; -using skyscraper5.Skyscraper.Scraper.Storage.Utilities; -using skyscraper5.src.InteractionChannel.Model; -using skyscraper5.src.InteractionChannel.Model.Descriptors; -using skyscraper5.src.Skyscraper.FrequencyListGenerator; -using skyscraper5.src.Skyscraper.Scraper.Dns; -using skyscraper5.Teletext; -using skyscraper8.DvbI; -using skyscraper8.DvbNip; -using skyscraper8.Ietf.FLUTE; -using skyscraper8.Ses; -using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform; - -namespace skyscraper5.Skyscraper.Scraper.Storage.Split -{ - public class SplitScraperStorage : IScraperStroage - { - private readonly DataStorage dataStorage; - private readonly ObjectStorage objectStorage; - - public SplitScraperStorage(DataStorage dataStorage, ObjectStorage objectStorage) - { - this.dataStorage = dataStorage; - this.objectStorage = objectStorage; - } - - [DebuggerStepThrough] - public bool TestForNitNetwork(NitNetwork nitNetwork) - { - return dataStorage.TestForNitNetwork(nitNetwork); - } - - [DebuggerStepThrough] - public void StoreNitNetwork(NitNetwork nitNetwork) - { - dataStorage.StoreNitNetwork(nitNetwork); - } - - [DebuggerStepThrough] - public bool UpdateNitNetwork(NitNetwork nitNetwork) - { - return dataStorage.UpdateNitNetwork(nitNetwork); - } - - [DebuggerStepThrough] - public bool TestForNitTransportStream(ushort networkId, NitTransportStream transportStream) - { - return dataStorage.TestForNitTransportStream(networkId, transportStream); - } - - [DebuggerStepThrough] - public void StoreNitTransportStream(ushort networkId, NitTransportStream transportStream) - { - dataStorage.StoreNitTransportStream(networkId, transportStream); - } - - [DebuggerStepThrough] - public bool UpdateNitTransportStream(ushort networkId, NitTransportStream transportStream) - { - return dataStorage.UpdateNitTransportStream(networkId, transportStream); - } - - [DebuggerStepThrough] - public bool StorePatEntry(int currentNetworkId, int currentTransportStreamId, int pmtPid, ushort programId) - { - return dataStorage.StorePatEntry(currentNetworkId, currentTransportStreamId, pmtPid, programId); - } - - [DebuggerStepThrough] - public bool TestForPmtEvent(int currentNetworkId, int currentTransportStreamId, ProgramMapping result) - { - return dataStorage.TestForPmtEvent(currentNetworkId, currentTransportStreamId, result); - } - - [DebuggerStepThrough] - public bool StorePmtEvent(int currentNetworkId, int currentTransportStreamId, ProgramMapping mapping) - { - return dataStorage.StorePmtEvent(currentNetworkId, currentTransportStreamId, mapping); - } - - public bool StoreTeletextPage(int networkId, int transportStreamId, ushort programNumber, TeletextMagazine magazine, DateTime timestamp) - { - if (magazine.HumanReadablePageNumber > 999) - return false; - - return dataStorage.StoreTeletextPage(networkId, transportStreamId, programNumber, magazine, timestamp); - } - - [DebuggerStepThrough] - public bool TestForSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService) - { - return dataStorage.TestForSdtService(transportStreamId, originalNetworkId, sdtService); - } - - [DebuggerStepThrough] - public bool UpdateSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService) - { - return dataStorage.UpdateSdtService(transportStreamId, originalNetworkId, sdtService); - } - - [DebuggerStepThrough] - public void StoreSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService) - { - dataStorage.StoreSdtService(transportStreamId, originalNetworkId, sdtService); - } - - [DebuggerStepThrough] - public bool TestForBatBouquet(BatBouquet batBouquet) - { - return dataStorage.TestForBatBouquet(batBouquet); - } - - [DebuggerStepThrough] - public bool UpdateBatBouquet(BatBouquet batBouquet) - { - return dataStorage.UpdateBatBouquet(batBouquet); - } - - [DebuggerStepThrough] - public void StoreBatBouquet(BatBouquet batBouquet) - { - dataStorage.StoreBatBouquet(batBouquet); - } - - [DebuggerStepThrough] - public bool TestForBatTransportStream(ushort batBouquetBouquetId, BatTransportStream child) - { - return dataStorage.TestForBatTransportStream(batBouquetBouquetId, child); - } - - [DebuggerStepThrough] - public bool UpdateBatTransportStream(ushort batBouquetBouquetId, BatTransportStream child) - { - return dataStorage.UpdateBatTransportStream(batBouquetBouquetId, child); - } - - [DebuggerStepThrough] - public void StoreBatTransportStream(ushort batBouquetBouquetId, BatTransportStream child) - { - dataStorage.StoreBatTransportStream(batBouquetBouquetId, child); - } - - [DebuggerStepThrough] - public bool UpdateTimeOffsetTable(int currentNetworkId, int currentTransportStreamId, DateTime utcTime, LocalTimeOffsetDescriptor ltod) - { - return dataStorage.UpdateTimeOffsetTable(currentNetworkId, currentTransportStreamId, utcTime, ltod); - } - - [DebuggerStepThrough] - public bool UpdateTimeAndDate(int currentNetworkId, int currentTransportStreamId, DateTime utcTime) - { - return dataStorage.UpdateTimeAndDate(currentNetworkId, currentTransportStreamId, utcTime); - } - - [DebuggerStepThrough] - public bool StoreEitEvent(EitEvent eitEvent) - { - return dataStorage.StoreEitEvent(eitEvent); - } - - [DebuggerStepThrough] - public bool TestForAitApplication(ApplicationIdentifier aitApplicationApplicationIdentifier) - { - return dataStorage.TestForAitApplication(aitApplicationApplicationIdentifier); - } - - [DebuggerStepThrough] - public void StoreAitApplication(AitApplication aitApplication) - { - dataStorage.StoreAitApplication(aitApplication); - } - - [DebuggerStepThrough] - public bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId) - { - return objectStorage.ObjectCarouselFileArrival(vfsFile, transportStreamId, networkId); - } - - [DebuggerStepThrough] - public bool TestForCaSystem(int currentNetworkId, int currentTransportStreamId, int caDescriptorCaPid) - { - return dataStorage.TestForCaSystem(currentNetworkId, currentTransportStreamId, caDescriptorCaPid); - } - - [DebuggerStepThrough] - public void StoreCaSystem(int currentNetworkId, int currentTransportStreamId, CaDescriptor caDescriptor) - { - dataStorage.StoreCaSystem(currentNetworkId, currentTransportStreamId, caDescriptor); - } - - [DebuggerStepThrough] - public void StoreUpdateNotification(int hashCode, UpdateNotificationGroup common, Compatibility compatibility, Platform platform) - { - dataStorage.StoreUpdateNotification(hashCode, common, compatibility, platform); - } - - [DebuggerStepThrough] - public void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleModuleId, byte moduleModuleVersion, Stream result) - { - objectStorage.DataCarouselModuleArrival(currentNetworkId, currentTransportStreamId, elementaryPid, moduleModuleId, moduleModuleVersion, result); - } - - [DebuggerStepThrough] - public bool TestForKnownRdsData(int currentNetworkId, int currentTransportStreamId, int programNumber) - { - return dataStorage.TestForKnownRdsData(currentNetworkId, currentTransportStreamId, programNumber); - } - - [DebuggerStepThrough] - public void EnableRdsCollection(int currentNetworkId, int currentTransportStreamId, int programNumber) - { - dataStorage.EnableRdsCollection(currentNetworkId, currentTransportStreamId, programNumber); - } - - [DebuggerStepThrough] - public bool UpdateRdsProgrammeServiceName(int currentNetworkId, int currentTransportStreamId, int programNumber, string programmeService2) - { - return dataStorage.UpdateRdsProgrammeServiceName(currentNetworkId, currentTransportStreamId, programNumber, programmeService2); - } - - [DebuggerStepThrough] - public bool UpdateRdsRadioText(int currentNetworkId, int currentTransportStreamId, int programNumber, string text) - { - return dataStorage.UpdateRdsRadioText(currentNetworkId, currentTransportStreamId, programNumber, text); - } - - [DebuggerStepThrough] - public bool UpdateRdsPty(int currentNetworkId, int currentTransportStreamId, int programNumber, PTY.ProgrammeTypeCodes pty) - { - return dataStorage.UpdateRdsPty(currentNetworkId, currentTransportStreamId, programNumber, pty); - } - - [DebuggerStepThrough] - public bool MarkAsRdsTrafficInformationProgramme(int currentNetworkId, int currentTransportStreamId, int programNumber) - { - return dataStorage.MarkAsRdsTrafficInformationProgramme(currentNetworkId, currentTransportStreamId, programNumber); - } - - [DebuggerStepThrough] - public bool TestForScte35SpliceInsert(int currentNetworkId, int currentTransportStreamId, ushort programNumber, SpliceInsert spliceInsert) - { - return dataStorage.TestForScte35SpliceInsert(currentNetworkId, currentTransportStreamId, programNumber, spliceInsert); - } - - [DebuggerStepThrough] - public void StoreScte35SpliceInsert(int currentNetworkId, int currentTransportStreamId, ushort programNumber, SpliceInsert spliceInsert) - { - dataStorage.StoreScte35SpliceInsert(currentNetworkId, currentTransportStreamId, programNumber, spliceInsert); - } - - [DebuggerStepThrough] - public bool IsCompliant(int currentNetworkId, int currentTransportStreamId, string compliance) - { - return dataStorage.IsCompliant(currentNetworkId, currentTransportStreamId, compliance); - } - - [DebuggerStepThrough] - public void MarkAsCompliant(int currentNetworkId, int currentTransportStreamId, string compliance) - { - dataStorage.MarkAsCompliant(currentNetworkId, currentTransportStreamId, compliance); - } - - [DebuggerStepThrough] - public bool SetStationIdentification(int currentNetworkId, int currentTransportStreamId, string stationIdentification) - { - return dataStorage.SetStationIdentification(currentNetworkId, currentTransportStreamId, stationIdentification); - } - - [DebuggerStepThrough] - public bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, byte moduleVersion) - { - return objectStorage.IsDsmCcModuleWanted(currentNetworkId, currentTransportStreamId, elementaryPid, moduleId, moduleVersion); - } - - [DebuggerStepThrough] - public void StoreDsmCcDoItNowEvent(DateTime value, int currentNetworkId, int currentTransportStreamId, int programNumber, StreamEventDescriptor descriptorListStreamEventDescriptor, int pid) - { - dataStorage.StoreDsmCcDoItNowEvent(value, currentNetworkId, currentTransportStreamId, programNumber, descriptorListStreamEventDescriptor, pid); - } - - [DebuggerStepThrough] - public bool StoreRunningStatus(uint transportStreamId, uint originalNetworkId, uint serviceId, uint eventId, RunningStatus runningStatus, DateTime currentTime) - { - return dataStorage.StoreRunningStatus(transportStreamId, originalNetworkId, serviceId, eventId, runningStatus, currentTime); - } - - [DebuggerStepThrough] - public void SetScte35TimeSignal(int currentNetworkId, int currentTransportStreamId, DateTime currentTime, ushort programNumber, TimeSignal timeSignal) - { - dataStorage.SetScte35TimeSignal(currentNetworkId, currentTransportStreamId, currentTime, programNumber, timeSignal); - } - - [DebuggerStepThrough] - public bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, int mappingStreamElementaryPid) - { - return objectStorage.TestForFramegrab(currentNetworkId, transportStreamId, mappingProgramNumber, mappingStreamElementaryPid); - } - - [DebuggerStepThrough] - public bool TestForIpMacNotification(IpMacNotification notification) - { - return dataStorage.TestForIpMacNotification(notification); - } - - [DebuggerStepThrough] - public void StoreIpMacNotification(IpMacNotification notification) - { - dataStorage.StoreIpMacNotification(notification); - } - - [DebuggerStepThrough] - public bool ImportFileKnown(FileInfo fi) - { - return dataStorage.ImportFileKnown(fi); - } - - [DebuggerStepThrough] - public void ImportMarkFileAsKnown(FileInfo fi, TimeSpan timeTaken, int tstype) - { - dataStorage.ImportMarkFileAsKnown(fi, timeTaken, tstype); - } - - [DebuggerStepThrough] - public DateTime T2MiGetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid) - { - return dataStorage.T2MiGetTimestamp(currentNetworkId, currentTransportStreamId, pid); - } - - [DebuggerStepThrough] - public void T2MiSetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid, DateTime resolveTime) - { - dataStorage.T2MiSetTimestamp(currentNetworkId, currentTransportStreamId, pid, resolveTime); - } - - [DebuggerStepThrough] - public bool TestForRelatedContent(EitEvent lEvent, RctLinkInfo rctLinkInfo) - { - return dataStorage.TestForRelatedContent(lEvent, rctLinkInfo); - } - - [DebuggerStepThrough] - public void SetRelatedContent(EitEvent lEvent, RctLinkInfo rctLinkInfo) - { - dataStorage.SetRelatedContent(lEvent, rctLinkInfo); - } - - [DebuggerStepThrough] - public List UiSatellitesListAll() - { - return dataStorage.UiSatellitesListAll(); - } - - [DebuggerStepThrough] - public void UiSatellitesAdd(SatellitePosition newPosition) - { - dataStorage.UiSatellitesAdd(newPosition); - } - - [DebuggerStepThrough] - public void UiSatellitesDelete(SatellitePosition satellitePosition) - { - dataStorage.UiSatellitesDelete(satellitePosition); - } - - [DebuggerStepThrough] - public bool UiTunerTestFor(TunerMetadata tuner) - { - return dataStorage.UiTunerTestFor(tuner); - } - - [DebuggerStepThrough] - public void UiTunerUpdate(TunerMetadata tuner) - { - dataStorage.UiTunerUpdate(tuner); - } - - [DebuggerStepThrough] - public void UiTunerInsert(TunerMetadata tuner) - { - dataStorage.UiTunerInsert(tuner); - } - - [DebuggerStepThrough] - public void UiTunerGetConfiguration(TunerMetadata foundTuner) - { - dataStorage.UiTunerGetConfiguration(foundTuner); - } - - [DebuggerStepThrough] - public void StoreFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, ushort pid, byte[] imageData) - { - objectStorage.StoreFramegrab(currentNetworkId, transportStreamId, mappingProgramNumber, pid, imageData); - } - - [DebuggerStepThrough] - public bool TestForDocsisUpstreamChannel(PhysicalAddress mmmSource, uint mmmFrequency, int locationId) - { - return dataStorage.TestForDocsisUpstreamChannel(mmmSource, mmmFrequency, locationId); - } - - [DebuggerStepThrough] - public void StoreDocsisUpstreamChannel(UpstreamChannelDescriptor mmm, int locationId) - { - dataStorage.StoreDocsisUpstreamChannel(mmm, locationId); - } - - [DebuggerStepThrough] - public bool TestForDocsisDownstreamChannel(PhysicalAddress physicalAddress, MacDomainDescriptor.DownstreamActiveChannel downstreamActiveChannel, int locationId) - { - return dataStorage.TestForDocsisDownstreamChannel(physicalAddress, downstreamActiveChannel,locationId); - } - - [DebuggerStepThrough] - public void StoreDocsisDownstreamChannel(PhysicalAddress physicalAddress, MacDomainDescriptor.DownstreamActiveChannel downstreamActiveChannel, int locationId) - { - dataStorage.StoreDocsisDownstreamChannel(physicalAddress, downstreamActiveChannel,locationId); - } - - [DebuggerStepThrough] - public bool SetCmtsIp(PhysicalAddress arpHeaderSenderHardwareAddress, IPAddress arpHeaderSenderProtocolAddress) - { - return dataStorage.SetCmtsIp(arpHeaderSenderHardwareAddress, arpHeaderSenderProtocolAddress); - } - - [DebuggerStepThrough] - public bool IsDsmCcModuleBlacklisted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, - byte moduleVersion) - { - return dataStorage.IsDsmCcModuleBlacklisted(currentNetworkId, currentTransportStreamId, elementaryPid, moduleId, moduleVersion); - } - - [DebuggerStepThrough] - public int? GetCurrentLocationId() - { - return dataStorage.GetCurrentLocationId(); - } - - [DebuggerStepThrough] - public void StoreDocsisParticipant(PhysicalAddress pa, int currentLocation) - { - dataStorage.StoreDocsisParticipant(pa, currentLocation); - } - - [DebuggerStepThrough] - public HeadlessJob GetQueuedJob() - { - return dataStorage.GetQueuedJob(); - } - - [DebuggerStepThrough] - public void SetQueuedJobComplete(HeadlessJob headlessJob) - { - dataStorage.SetQueuedJobComplete(headlessJob); - } - - [DebuggerStepThrough] - public void WaitForCompletion() - { - dataStorage.WaitForCompletion(); - objectStorage.WaitForCompletion(); - } - - [DebuggerStepThrough] - public void UiSetVersion(int version) - { - dataStorage.UiSetVersion(version); - objectStorage.UiSetVersion(version); - } - - [DebuggerStepThrough] - public bool T2MiTestForTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier) - { - return dataStorage.T2MiTestForTransmitter(currentNetworkId, currentTransportStreamId, relatedPid, txIdentifier); - } - - [DebuggerStepThrough] - public void T2MiRememberTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier) - { - dataStorage.T2MiRememberTransmitter(currentNetworkId, currentTransportStreamId, relatedPid, txIdentifier); - } - - [DebuggerStepThrough] - public void T2MiSetTransmitterTimeOffset(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier, ushort timeOffset) - { - dataStorage.T2MiSetTransmitterTimeOffset(currentNetworkId, currentTransportStreamId, relatedPid, txIdentifier, timeOffset); - } - - [DebuggerStepThrough] - public List UiLnbTypesListAll() - { - return dataStorage.UiLnbTypesListAll(); - } - - [DebuggerStepThrough] - public void UiLnbTypesAdd(LnbType defaultLnbType) - { - dataStorage.UiLnbTypesAdd(defaultLnbType); - } - - [DebuggerStepThrough] - public List UiDishTypesListAll() - { - return dataStorage.UiDishTypesListAll(); - } - - [DebuggerStepThrough] - public void UiDishTypesAdd(DishType defaultDishType) - { - dataStorage.UiDishTypesAdd(defaultDishType); - } - - public object[] GetPluginConnector() - { - object[] dataConnector = dataStorage.GetPluginConnector(); - object[] objectConnector = objectStorage.GetPluginConnector(); - - if (dataConnector != null && objectConnector == null) - return dataConnector; - - if (dataConnector == null && objectConnector != null) - return objectConnector; - - object[] result = new object[dataConnector.Length + objectConnector.Length]; - Array.Copy(dataConnector, 0, result, 0, dataConnector.Length); - Array.Copy(objectConnector, 0, result, dataConnector.Length, objectConnector.Length); - return result; - } - - [DebuggerStepThrough] - public void Ping() - { - dataStorage.Ping(); - objectStorage.Ping(); - } - - [DebuggerStepThrough] - public IEnumerable> SelectAllPmt() - { - return dataStorage.SelectAllPmt(); - } - - [DebuggerStepThrough] - public SdtService SelectSdtById(int networkId, int tsId, ushort programMappingProgramNumber) - { - return dataStorage.SelectSdtById(networkId, tsId, programMappingProgramNumber); - } - - [DebuggerStepThrough] - public IEnumerable> SelectAllSdt() - { - return dataStorage.SelectAllSdt(); - } - - [DebuggerStepThrough] - public void BeamsDisableAll() - { - dataStorage.BeamsDisableAll(); - } - - [DebuggerStepThrough] - public void BeamsEnable(int id, float satpos, string name, DateTime processTimestamp) - { - dataStorage.BeamsEnable(id, satpos, name, processTimestamp); - } - - [DebuggerStepThrough] - public void BeamFootprintStore(int databasePointerId, DateTime databasePointerBeamsProcessTimestamp, string name, - string getPolygonString, string id) - { - dataStorage.BeamFootprintStore(databasePointerId, databasePointerBeamsProcessTimestamp, name, getPolygonString, id); - } - - [DebuggerStepThrough] - public bool TestForBeamFootprint(int databasePointerId, DateTime databasePointerBeamsProcessTimestamp, string name, string id) - { - return dataStorage.TestForBeamFootprint(databasePointerId, databasePointerBeamsProcessTimestamp, name, id); - } - - [DebuggerStepThrough] - public void BeamsDisableSpecific(int databasePointerId, float databasePointerSatpos, string databasePointerName, - DateTime databasePointerBeamsProcessTimestamp) - { - dataStorage.BeamsDisableSpecific(databasePointerId, databasePointerSatpos, databasePointerName, databasePointerBeamsProcessTimestamp); - } - - [DebuggerStepThrough] - public IEnumerable BeamsSelectEnabled() - { - return dataStorage.BeamsSelectEnabled(); - } - - [DebuggerStepThrough] - public List BeamsSelectFootprints(int satelliteBeamId, DateTime satelliteBeamProcessTimestamp) - { - return dataStorage.BeamsSelectFootprints(satelliteBeamId, satelliteBeamProcessTimestamp); - } - - [DebuggerStepThrough] - public void InsertBlindscanJob(DbBlindscanJob jobInDb) - { - dataStorage.InsertBlindscanJob(jobInDb); - } - - [DebuggerStepThrough] - public void UpdateJobState(DbBlindscanJob jobInDb) - { - dataStorage.UpdateJobState(jobInDb); - } - - [DebuggerStepThrough] - public void InsertSearchResult(DbBlindscanJob jobInDb, bool satellite, SearchResult searchResult, int polarityIndex, - SearchResult2 searchResult2) - { - dataStorage.InsertSearchResult(jobInDb, satellite, searchResult, polarityIndex, searchResult2); - } - - [DebuggerStepThrough] - public void UpdateTransponderState(DbBlindscanJob jobInDb, bool satellite, SearchResult searchResult, - BlindscanResultState blindscanResultState, SearchResult2 searchResult2) - { - dataStorage.UpdateTransponderState(jobInDb, satellite, searchResult, blindscanResultState, searchResult2); - } - - [DebuggerStepThrough] - public void InsertTransponderService(DbBlindscanJob jobInDb, bool resultSatellite, SearchResult resultSr1, - SearchResult2 resultSr2, HumanReadableService humanReadableService) - { - dataStorage.InsertTransponderService(jobInDb, resultSatellite, resultSr1, resultSr2, humanReadableService); - } - - [DebuggerStepThrough] - public bool TestForIncompleteJob() - { - return dataStorage.TestForIncompleteJob(); - } - - [DebuggerStepThrough] - public DbBlindscanJob GetPastBlindscanJob(long offset) - { - return dataStorage.GetPastBlindscanJob(offset); - } - - [DebuggerStepThrough] - public void DeleteBlindscanJob(Guid guid) - { - dataStorage.DeleteBlindscanJob(guid); - } - - [DebuggerStepThrough] - public void DeleteBlindscanResults(Guid jobGuid, int polarityIndex) - { - dataStorage.DeleteBlindscanResults(jobGuid, polarityIndex); - } - - [DebuggerStepThrough] - public void MoveBlScanResultsToAnotherJob(Guid moveFrom, Guid moveTo, int polarityIndex) - { - dataStorage.MoveBlScanResultsToAnotherJob(moveFrom, moveTo, polarityIndex); - } - - [DebuggerStepThrough] - public void FailDsmCcDownload(DatabaseKeyDsmCcModule key, double value) - { - dataStorage.FailDsmCcDownload(key, value); - } - - [DebuggerStepThrough] - public IReadOnlyList ListImportFileByTag1(int tag1) - { - return dataStorage.ListImportFileByTag1(tag1); - } - - [DebuggerStepThrough] - public bool TestForTerminalBurstTimePlan(ushort interactiveNetworkId, uint groupId, uint logonId) - { - return dataStorage.TestForTerminalBurstTimePlan(interactiveNetworkId, groupId, logonId); - } - - [DebuggerStepThrough] - public void StoreTerminalBurstTimePlan(ushort interactiveNetworkId, uint gtoupId, uint superframeCount, uint frameNumber, Tbtp.TbtpFrame.BtpEntity btp) - { - dataStorage.StoreTerminalBurstTimePlan(interactiveNetworkId, gtoupId, superframeCount, frameNumber, btp); - } - - [DebuggerStepThrough] - public bool TestForCmtEntry(ushort interactiveNetworkId, Cmt.CmtEntry entry) - { - return dataStorage.TestForCmtEntry(interactiveNetworkId, entry); - } - - [DebuggerStepThrough] - public void InsertCmtEntry(ushort interactiveNetworkId, Cmt.CmtEntry entry) - { - dataStorage.InsertCmtEntry(interactiveNetworkId, entry); - } - - [DebuggerStepThrough] - public int GetRmtTransmissionStandard(ushort networkId) - { - return dataStorage.GetRmtTransmissionStandard(networkId); - } - - [DebuggerStepThrough] - public byte[] GetTmst(ushort interactiveNetworkId) - { - return dataStorage.GetTmst(interactiveNetworkId); - } - - [DebuggerStepThrough] - public void InsertTmst(ushort interactiveNetworkId, byte[] modes) - { - dataStorage.InsertTmst(interactiveNetworkId, modes); - } - - [DebuggerStepThrough] - public void UpdateTmst(ushort interactiveNetworkId, byte[] modes) - { - dataStorage.UpdateTmst(interactiveNetworkId, modes); - } - - [DebuggerStepThrough] - public bool TestForRmtLinkage(_0x4a_LinkageDescriptor linkage) - { - return dataStorage.TestForRmtLinkage(linkage); - } - - [DebuggerStepThrough] - public void InsertRmtLinkage(_0x4a_LinkageDescriptor linkage) - { - dataStorage.InsertRmtLinkage(linkage); - } - - [DebuggerStepThrough] - public bool TestForRmtTransportStream(ushort networkId, Rmt.TransportStream transportStream) - { - return dataStorage.TestForRmtTransportStream(networkId, transportStream); - } - - [DebuggerStepThrough] - public void InsertRmtTransportStream(ushort networkId, Rmt.TransportStream transportStream) - { - dataStorage.InsertRmtTransportStream(networkId, transportStream); - } - - [DebuggerStepThrough] - public bool TestForSuperframeComposition(ushort interactiveNetworkId, Sct.Superframe superframe) - { - return dataStorage.TestForSuperframeComposition(interactiveNetworkId, superframe); - } - - [DebuggerStepThrough] - public void StoreSuperframeComposition(ushort interactiveNetworkId, Sct.Superframe superframe) - { - dataStorage.StoreSuperframeComposition(interactiveNetworkId, superframe); - } - - [DebuggerStepThrough] - public bool TestForFrameComposition(ushort interactiveNetworkId, Fct.Frame frame) - { - return dataStorage.TestForFrameComposition(interactiveNetworkId, frame); - } - - [DebuggerStepThrough] - public void InsertFctFrame(ushort interactiveNetworkId, Fct.Frame frame) - { - dataStorage.InsertFctFrame(interactiveNetworkId, frame); - } - - [DebuggerStepThrough] - public bool TestForSatellitePosition(ushort interactiveNetworkId, Spt.Satellite satellite) - { - return dataStorage.TestForSatellitePosition(interactiveNetworkId, satellite); - } - - [DebuggerStepThrough] - public void StoreSatellitePosition(ushort interactiveNetworkId, Spt.Satellite satellite) - { - dataStorage.StoreSatellitePosition(interactiveNetworkId, satellite); - } - - [DebuggerStepThrough] - public bool TestForTim(PhysicalAddress mac) - { - return dataStorage.TestForTim(mac); - } - - [DebuggerStepThrough] - public void CreateTim(PhysicalAddress mac) - { - dataStorage.CreateTim(mac); - } - - [DebuggerStepThrough] - public bool CorrectTim(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd) - { - return dataStorage.CorrectTim(mac, cmd); - } - - [DebuggerStepThrough] - public bool ContentionTim(PhysicalAddress mac, _0xab_ContentionControlDescriptor ccdNew) - { - return dataStorage.ContentionTim(mac, ccdNew); - } - - [DebuggerStepThrough] - public bool CorrectionControlTim(PhysicalAddress mac, _0xac_CorrectionControlDescriptor descriptor) - { - return dataStorage.CorrectionControlTim(mac, descriptor); - } - - [DebuggerStepThrough] - public bool NetworkLayerInfoTim(PhysicalAddress mac, _0xa0_NetworkLayerInfoDescriptor nlid, DateTime timestamped) - { - return dataStorage.NetworkLayerInfoTim(mac, nlid, timestamped); - } - - [DebuggerStepThrough] - public IEnumerable GetDbBlindscanJobs() - { - return dataStorage.GetDbBlindscanJobs(); - } - - [DebuggerStepThrough] - public long DnsCountA() - { - return dataStorage.DnsCountA(); - } - - [DebuggerStepThrough] - public string DnsIpToName(IPAddress source) - { - return dataStorage.DnsIpToName(source); - } - - [DebuggerStepThrough] - public bool TestForIp(IPAddress iP) - { - return dataStorage.TestForIp(iP); - } - - [DebuggerStepThrough] - public void RememberDnsRecord(DnsRecord record) - { - dataStorage.RememberDnsRecord(record); - } - - [DebuggerStepThrough] - public bool TestForSgtList(SgtList list) - { - return dataStorage.TestForSgtList(list); - } - - [DebuggerStepThrough] - public void InsertSgtList(SgtList list) - { - dataStorage.InsertSgtList(list); - } - - [DebuggerStepThrough] - public bool TestForSgtService(SgtService child) - { - return dataStorage.TestForSgtService(child); - } - - [DebuggerStepThrough] - public void InsertSgtService(SgtService child) - { - dataStorage.InsertSgtService(child); - } - - [DebuggerStepThrough] - public bool DvbNipTestForFile(string announcedFileContentLocation) - { - return objectStorage.DvbNipTestForFile(announcedFileContentLocation); - } - - [DebuggerStepThrough] - public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener) - { - objectStorage.DvbNipFileArrival(carrier, listener); - } - - [DebuggerStepThrough] - public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, uint privateDataSpecifier, List privateDataSessions) - { - return dataStorage.DvbNipPrivateDataSpecifier(currentCarrierInformation, versionUpdate, privateDataSpecifier, privateDataSessions); - } - - [DebuggerStepThrough] - public bool DvbNipTestForNetwork(BroadcastNetworkType network) - { - return dataStorage.DvbNipTestForNetwork(network); - } - - [DebuggerStepThrough] - public void DvbNipInsertNetwork(BroadcastNetworkType network) - { - dataStorage.DvbNipInsertNetwork(network); - } - - [DebuggerStepThrough] - public bool DvbNipTestForService(BroadcastMediaStreamType broadcastMediaStreamType) - { - return dataStorage.DvbNipTestForService(broadcastMediaStreamType); - } - - [DebuggerStepThrough] - public void DvbNipInsertService(BroadcastMediaStreamType broadcastMediaStreamType) - { - dataStorage.DvbNipInsertService(broadcastMediaStreamType); - } - - [DebuggerStepThrough] - public bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession) - { - return dataStorage.DvbNipTestForMulticastSession(multicastSession); - } - - [DebuggerStepThrough] - public void DvbNipInsertMulticastSession(MulticastSessionType multicastSession) - { - dataStorage.DvbNipInsertMulticastSession(multicastSession); - } - - [DebuggerStepThrough] - public bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, - MulticastEndpointAddressType multicastEndpointAddressType) - { - return dataStorage.DvbNipTestForMulticastGatewayConfigurationTransportSession(carrier, multicastEndpointAddressType); - } - - [DebuggerStepThrough] - public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastGatewayConfigurationTransportSession) - { - dataStorage.DvbNipInsertMulticastGatewayConfigurationTransportSession(carrier, multicastGatewayConfigurationTransportSession); - } - - [DebuggerStepThrough] - public bool DvbNipTestForCarrier(NipActualCarrierInformation currentCarrierInformation) - { - return dataStorage.DvbNipTestForCarrier(currentCarrierInformation); - } - - [DebuggerStepThrough] - public void DvbNipInsertCarrier(NipActualCarrierInformation currentCarrierInformation) - { - dataStorage.DvbNipInsertCarrier(currentCarrierInformation); - } - - [DebuggerStepThrough] - public void InsertDvbiServiceListEntryPoint(long sourceHash) - { - dataStorage.InsertDvbiServiceListEntryPoint(sourceHash); - } - - [DebuggerStepThrough] - public bool TestForServiceListEntryPoints(long sourceHash) - { - return dataStorage.TestForServiceListEntryPoints(sourceHash); - } - - [DebuggerStepThrough] - public void InsertDvbiServiceList(DvbiServiceList serviceList) - { - dataStorage.InsertDvbiServiceList(serviceList); - } - - [DebuggerStepThrough] - public bool TestForDvbiService(string id) - { - return dataStorage.TestForDvbiService(id); - } - - [DebuggerStepThrough] - public bool TestForDvbiServiceListEntryPoints(long sourceHash) - { - return dataStorage.TestForDvbiServiceListEntryPoints(sourceHash); - } - - [DebuggerStepThrough] - public void UpdateDvbiServiceListLastCheckedDate(string id, DateTime currentTime) - { - dataStorage.UpdateDvbiServiceListLastCheckedDate(id, currentTime); - } - - [DebuggerStepThrough] - public DateTime GetLastDvbiServiceListEntryPointUpdateDate(long sourceHash) - { - return dataStorage.GetLastDvbiServiceListEntryPointUpdateDate(sourceHash); - } - - [DebuggerStepThrough] - public DateTime GetDvbiServiceListLastUpdateDate(string id) - { - return dataStorage.GetDvbiServiceListLastUpdateDate(id); - } - - [DebuggerStepThrough] - public void AddDvbiServiceListToServiceListEntryPoint(DvbiServiceList serviceList, long sourceHash) - { - dataStorage.AddDvbiServiceListToServiceListEntryPoint(serviceList, sourceHash); - } - - [DebuggerStepThrough] - public void AddDvbiServiceToServiceList(string id, string serviceListId) - { - dataStorage.AddDvbiServiceToServiceList(id, serviceListId); - } - - [DebuggerStepThrough] - public int GetDvbiServiceVersion(string id) - { - return dataStorage.GetDvbiServiceVersion(id); - } - - [DebuggerStepThrough] - public void UpdateDvbiService(DvbIService service) - { - dataStorage.UpdateDvbiService(service); - } - - [DebuggerStepThrough] - public void UpdateDvbiServiceListEntryPointUpdateDate(long hash, DateTime currentTime) - { - dataStorage.UpdateDvbiServiceListEntryPointUpdateDate(hash, currentTime); - } - - [DebuggerStepThrough] - public void InsertDvbiService(DvbIService service) - { - dataStorage.InsertDvbiService(service); - } - - [DebuggerStepThrough] - public bool TestForDvbiServiceList(string id) - { - return dataStorage.TestForDvbiServiceList(id); - } - } -} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/StorageConnectionManager.cs b/skyscraper8/Skyscraper/Scraper/Storage/StorageConnectionManager.cs new file mode 100644 index 0000000..cc3a1d2 --- /dev/null +++ b/skyscraper8/Skyscraper/Scraper/Storage/StorageConnectionManager.cs @@ -0,0 +1,129 @@ +using log4net; +using skyscraper5.Skyscraper; +using skyscraper5.Skyscraper.Plugins; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using skyscraper5.Skyscraper.Scraper.Storage; + +namespace skyscraper8.Skyscraper.Scraper.Storage +{ + internal class StorageConnectionManager + { + private StorageConnectionManager() + { + plugins = PluginManager.GetInstance(); + ini = plugins.Ini; + } + + private readonly PluginManager plugins; + private static StorageConnectionManager _instance; + private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name); + private static Type storageNameAttributeType = typeof(StorageNameAttribute); + private readonly Ini ini; + + public static StorageConnectionManager GetInstance() + { + if (_instance == null) + _instance = new StorageConnectionManager(); + return _instance; + } + + public IEnumerable> GetAllKnownFactoryNames() + { + ReadOnlyDictionary dataStorages = plugins.GetDataStorages(); + foreach (KeyValuePair dataStorageFactory in dataStorages) + { + yield return new Tuple(dataStorageFactory.Key, true, GetName(dataStorageFactory.Value)); + } + + ReadOnlyDictionary objectStorages = plugins.GetObjectStorages(); + foreach (KeyValuePair objectStorageFactory in objectStorages) + { + yield return new Tuple(objectStorageFactory.Key, false, GetName(objectStorageFactory.Value)); + } + } + + public string GetName(object o) + { + Type type = o.GetType(); + Attribute attribute = type.GetCustomAttribute(storageNameAttributeType); + StorageNameAttribute storageNameAttribute = attribute as StorageNameAttribute; + if (storageNameAttribute == null) + { + logger.WarnFormat("{0} does not have a {1}.", type.Name, storageNameAttributeType.Name); + return type.Name; + } + return storageNameAttribute.Name; + } + + public DataStorageFactory GetDefaultDataStorageFactory() + { + int requiredDataStorageId = ini.ReadValue("startup", "dataStorage", -1); + if (requiredDataStorageId == -1) + { + throw new ScraperStorageException("Could not determine the data storage factory from ini file. Configure it using the UI!"); + } + + string iniCategoryName = String.Format("dataStorage{0}", requiredDataStorageId); + if (!ini.ContainsKey(iniCategoryName)) + { + throw new ScraperStorageException("Could not find configuration for the storage factory. Configure it using the UI!"); + } + + ReadOnlyDictionary dataStorages = plugins.GetDataStorages(); + KeyValuePair valuePair = dataStorages.First(x => x.Key == requiredDataStorageId); + if (valuePair.Value == null) + { + throw new ScraperStorageException(String.Format("Storage Factory {0} was not loaded. Reconfigure with the UI!", requiredDataStorageId)); + } + + string factoryCname = String.Format("dataStorage{0}", requiredDataStorageId); + PluginManager.GetInstance().AutoconfigureObject(factoryCname, valuePair.Value); + + return valuePair.Value; + } + + public ObjectStorageFactory GetDefaultObjectStorageFactory() + { + int requiredObjectStorageId = ini.ReadValue("startup", "objectStorage", -1); + if (requiredObjectStorageId == -1) + { + throw new ScraperStorageException("Could not determine the object storage factory from ini file. Configure it using the UI!"); + } + + string iniCategoryName = String.Format("objectStorage{0}", requiredObjectStorageId); + if (!ini.ContainsKey(iniCategoryName)) + { + throw new ScraperStorageException("Could not find configuration for the object storage factory. Configure it using the UI!"); + } + + ReadOnlyDictionary dataStorages = plugins.GetObjectStorages(); + KeyValuePair valuePair = dataStorages.First(x => x.Key == requiredObjectStorageId); + if (valuePair.Value == null) + { + throw new ScraperStorageException(String.Format("Object Storage Factory {0} was not loaded. Reconfigure with the UI!", requiredObjectStorageId)); + } + + string factoryCname = String.Format("objectStorage{0}", requiredObjectStorageId); + PluginManager.GetInstance().AutoconfigureObject(factoryCname, valuePair.Value); + + return valuePair.Value; + } + + public static object[] GetPluginConnectors(DataStorage dataStorage, ObjectStorage objectStorage) + { + object[] dataConnector = dataStorage.GetPluginConnector(); + object[] objectConnector = objectStorage.GetPluginConnector(); + object[] result = new object[dataConnector.Length + objectConnector.Length]; + Array.Copy(dataConnector, 0, result, 0, dataConnector.Length); + Array.Copy(objectConnector, 0, result, dataConnector.Length, objectConnector.Length); + return result; + } + + } +} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/StorageIdAttribute.cs b/skyscraper8/Skyscraper/Scraper/Storage/StorageIdAttribute.cs new file mode 100644 index 0000000..ea917de --- /dev/null +++ b/skyscraper8/Skyscraper/Scraper/Storage/StorageIdAttribute.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper.Scraper.Storage +{ + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + public sealed class StorageIdAttribute : Attribute + { + public int Id { get; } + + public StorageIdAttribute(int id) + { + Id = id; + } + } +} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/StorageNameAttribute.cs b/skyscraper8/Skyscraper/Scraper/Storage/StorageNameAttribute.cs new file mode 100644 index 0000000..7d45828 --- /dev/null +++ b/skyscraper8/Skyscraper/Scraper/Storage/StorageNameAttribute.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper.Scraper.Storage +{ + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + public sealed class StorageNameAttribute : Attribute + { + public string Name { get; } + + public StorageNameAttribute(string name) + { + Name = name; + } + } +} diff --git a/skyscraper8/Skyscraper/Scraper/Storage/StorageVolatileAttribute.cs b/skyscraper8/Skyscraper/Scraper/Storage/StorageVolatileAttribute.cs new file mode 100644 index 0000000..7fd5a9a --- /dev/null +++ b/skyscraper8/Skyscraper/Scraper/Storage/StorageVolatileAttribute.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper.Scraper.Storage +{ + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + public sealed class StorageVolatileAttribute : Attribute + { + public StorageVolatileAttribute() + { + + } + } +} diff --git a/skyscraper8/yo3explorer/yo3explorerToSkyscraperContextBridge.cs b/skyscraper8/yo3explorer/yo3explorerToSkyscraperContextBridge.cs index f7d2d46..f6186e0 100644 --- a/skyscraper8/yo3explorer/yo3explorerToSkyscraperContextBridge.cs +++ b/skyscraper8/yo3explorer/yo3explorerToSkyscraperContextBridge.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using skyscraper8.Skyscraper.Scraper.Storage; namespace skyscraper8.yo3explorer { @@ -15,7 +16,7 @@ namespace skyscraper8.yo3explorer public int? OriginalNetworkId { get; internal set; } public int? TransportStreamId { get; internal set; } public int PID { get; internal set; } - public IScraperStroage DataStorage { get; internal set; } + public DataStorage DataStorage { get; set; } public long GetSourceHash() {