added rate limiter on the downloader and updated comparison to only look for files from updated or missing series ids.
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace dbsync.Config
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
public GlobalSettings? Global { get; set; }
|
||||
public DbSettings? DbSettings { get; set; }
|
||||
public ApiSettings? Api { get; set; }
|
||||
public JsonSettings? Json { get; set; }
|
||||
public DatabaseSettings? Database { get; set; }
|
||||
public UpdateTypeSettings? UpdateType { get; set; }
|
||||
|
||||
public static Settings Load(string filePath)
|
||||
{
|
||||
if (!File.Exists(filePath))
|
||||
throw new FileNotFoundException($"Settings file not found: {filePath}");
|
||||
|
||||
var json = File.ReadAllText(filePath);
|
||||
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
ReadCommentHandling = JsonCommentHandling.Skip,
|
||||
AllowTrailingCommas = true
|
||||
};
|
||||
|
||||
return JsonSerializer.Deserialize<Settings>(json, options)!;
|
||||
}
|
||||
}
|
||||
|
||||
public class GlobalSettings
|
||||
{
|
||||
public string? LogLevel { get; set; }
|
||||
public int? MaxParallelDownloads { get; set; }
|
||||
}
|
||||
|
||||
public class DbSettings
|
||||
{
|
||||
public string? SqlServerDriver { get; set; }
|
||||
public string? Hostname { get; set; }
|
||||
public string? MgHostname { get; set; }
|
||||
public string? DbName { get; set; }
|
||||
public string? MgDbName { get; set; }
|
||||
public string? MysqlUsername { get; set; }
|
||||
public string? PgsqlUsername { get; set; }
|
||||
public string? MssqlUsername { get; set; }
|
||||
public string? MysqlPassword { get; set; }
|
||||
public string? PgsqlPassword { get; set; }
|
||||
public string? MssqlPassword { get; set; }
|
||||
public int PgsqlPort { get; set; }
|
||||
public int MysqlPort { get; set; }
|
||||
public int MssqlPort { get; set; }
|
||||
public int MgPort { get; set; }
|
||||
}
|
||||
|
||||
public class ApiSettings
|
||||
{
|
||||
public string? Type { get; set; }
|
||||
}
|
||||
|
||||
public class JsonSettings
|
||||
{
|
||||
public string? SeriesApi { get; set; }
|
||||
public string? ShowApi { get; set; }
|
||||
public string? EpisodeApi { get; set; }
|
||||
public string? AliasApi { get; set; }
|
||||
public string? CastApi { get; set; }
|
||||
public string? CrewApi { get; set; }
|
||||
public string? CreditsApi { get; set; }
|
||||
public string? UpdatesApi { get; set; }
|
||||
public string? GuestCastApi { get; set; }
|
||||
public string? GuestCrewApi { get; set; }
|
||||
}
|
||||
|
||||
public class DatabaseSettings
|
||||
{
|
||||
public string? DbType { get; set; }
|
||||
public string? UpdateSchema { get; set; }
|
||||
public int Initialize { get; set; }
|
||||
public int InitLoad { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateTypeSettings
|
||||
{
|
||||
public string? Type { get; set; }
|
||||
public string? Full { get; set; }
|
||||
public long Monthly { get; set; }
|
||||
public long Weekly { get; set; }
|
||||
public long Daily { get; set; }
|
||||
|
||||
[JsonPropertyName("12h")]
|
||||
public long H12 { get; set; }
|
||||
|
||||
[JsonPropertyName("6h")]
|
||||
public long H6 { get; set; }
|
||||
|
||||
public long Custom { get; set; }
|
||||
public int CacheSkip { get; set; }
|
||||
public int RefreshCache { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"global": {
|
||||
"loglevel": "info",
|
||||
"MaxParallelDownloads": 5
|
||||
},
|
||||
"dbsettings": {
|
||||
"sqlserver_driver": "ODBC Driver 13 for SQL Server",
|
||||
"hostname": "192.168.129.248",
|
||||
"mghostname": "192.168.128.24",
|
||||
"dbname": "media_dbsync3",
|
||||
"mgdbname": "tvdata",
|
||||
"mysqlusername": "root",
|
||||
"pgsqlusername": "postgres",
|
||||
"mssqlusername": "sa",
|
||||
"mysqlpassword": "Optimus0329",
|
||||
"pgsqlpassword": "Optimus0329",
|
||||
"mssqlpassword": "Optimus0329",
|
||||
"pgsqlport": 5432,
|
||||
"mysqlport": 3306,
|
||||
"mssqlport": 1433,
|
||||
"mgport": 27017
|
||||
},
|
||||
"api": {
|
||||
"type": "tvmaze"
|
||||
},
|
||||
"json": {
|
||||
// "seriesapi": "http://api.tvmaze.com/shows?page=<pagenum>",
|
||||
"showapi": "http://api.tvmaze.com/shows/<tvmazeid>",
|
||||
"episodeapi": "http://api.tvmaze.com/shows/<tvmazeid>/episodes",
|
||||
"aliasapi": "http://api.tvmaze.com/shows/<tvmazeid>/akas",
|
||||
"castapi": "http://api.tvmaze.com/shows/<tvmazeid>/cast",
|
||||
"crewapi": "http://api.tvmaze.com/shows/<tvmazeid>/crew",
|
||||
"creditsapi": "http://api.tvmaze.com/people/<actorid>/castcredits",
|
||||
"guestcrewapi": "https://api.tvmaze.com/episodes/1/guestcrew",
|
||||
"guestcastapi": "https://api.tvmaze.com/episodes/1/guestcast",
|
||||
"updatesapi": "http://api.tvmaze.com/updates/shows"
|
||||
},
|
||||
"database": {
|
||||
"dbtype": "pgsql",
|
||||
"updateschema": "updates",
|
||||
"initialize": 0,
|
||||
"initload": 0
|
||||
},
|
||||
"updatetype": {
|
||||
"type": "full",
|
||||
"full": "full",
|
||||
"monthly": 1219200,
|
||||
"weekly": 604800,
|
||||
"daily": 86400,
|
||||
"12h": 23200,
|
||||
"6h": 16600,
|
||||
"custom": 4150,
|
||||
"cacheskip": 1,
|
||||
"refreshcache": 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user