Added constant state changers to represent singular/repeating states. Added a DownloadContextBuilder to support fluent building patterns. Changed RetryReporter and DownloadReporter to use RetryReport and DownloadReport structs to simplify type declarations. Made MainArchitecture obsolete by supporting a fluent downloads with DownloadBuilder. Created a 'budge' OpenAI bridge for proof-of-concept translation.
This commit is contained in:
@@ -5,133 +5,131 @@ using Beam.Dynamic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Beam.Temporary.Cli {
|
||||
|
||||
internal static class NovelStatics {
|
||||
public static void Define_LightNovelWorld_Novel_TheLegendaryMechanic(SharedDataDictionary sdd) {
|
||||
var lnwAggregator = new DataKey<WebResource>("aeqw89:document:aggregators:light_novel_world");
|
||||
var lnwAuxiliary = new DataKey<WebResource>("aeqw89:document:auxillaries:light_novel_world");
|
||||
var novel = new TextResource() {
|
||||
Key = new DataKey<TextResource>("novels:the_legendary_mechanic"),
|
||||
AssociatedSource = lnwAggregator,
|
||||
AssociatedMetaSource = lnwAuxiliary,
|
||||
TemplateInitialData = ["the-legendary-mechanic-245", "1"],
|
||||
MetaTemplateInitialData = ["the-legendary-mechanic"]
|
||||
};
|
||||
sdd.Novels.TryAdd(novel.Key, novel);
|
||||
public static class NovelStatics {
|
||||
//public static void Define_LightNovelWorld_Novel_TheLegendaryMechanic(SharedDataDictionary sdd) {
|
||||
// var lnwAggregator = new DataKey<WebResource>("aeqw89:document:aggregators:light_novel_world");
|
||||
// var lnwAuxiliary = new DataKey<WebResource>("aeqw89:document:auxillaries:light_novel_world");
|
||||
// var novel = new TextResource() {
|
||||
// Key = new DataKey<TextResource>("novels:the_legendary_mechanic"),
|
||||
// AssociatedSource = lnwAggregator,
|
||||
// AssociatedMetaSource = lnwAuxiliary,
|
||||
// TemplateInitialData = ["the-legendary-mechanic-245", "1"],
|
||||
// MetaTemplateInitialData = ["the-legendary-mechanic"]
|
||||
// };
|
||||
// sdd.Novels.TryAdd(novel.Key, novel);
|
||||
|
||||
sdd.AggregatorNovels.TryAdd(lnwAggregator, [novel.Key]);
|
||||
}
|
||||
// sdd.AggregatorNovels.TryAdd(lnwAggregator, [novel.Key]);
|
||||
//}
|
||||
|
||||
public static void Define_LightNovelWorl_Novel_IAloneLevelUp(SharedDataDictionary sdd) {
|
||||
var lnwAggregator = new DataKey("light_novel_world").ToAggregator().As<WebResource>();
|
||||
var lnwAuxiliary = new DataKey("light_novel_world").ToAuxiliary().As<WebResource>();
|
||||
//public static void Define_LightNovelWorl_Novel_IAloneLevelUp(SharedDataDictionary sdd) {
|
||||
// var lnwAggregator = new DataKey("light_novel_world").ToAggregator().As<WebResource>();
|
||||
// var lnwAuxiliary = new DataKey("light_novel_world").ToAuxiliary().As<WebResource>();
|
||||
// var novel = new TextResource() {
|
||||
// Key = new DataKey<TextResource>("novels:i_alone_level_up"),
|
||||
// AssociatedSource = lnwAggregator,
|
||||
// AssociatedMetaSource = lnwAuxiliary,
|
||||
// TemplateInitialData = ["i-alone-level-up-236", "1"],
|
||||
// MetaTemplateInitialData = ["i-alone-level-up-solo-leveling-05122225"]
|
||||
// };
|
||||
|
||||
// sdd.Novels.TryAdd(novel.Key, novel);
|
||||
|
||||
// sdd.AggregatorNovels.TryAdd(lnwAggregator, [novel.Key]);
|
||||
//}
|
||||
|
||||
public static void Define_WoDuShu_HouseOfHorrors(BeamDataDictionary sdd) {
|
||||
var (wdsAgg, wdsAux) = CreateKeyPair<WebResource>("aggregators", "auxillaries", "wodushu", "aeqw89:document");
|
||||
var novel = new TextResource() {
|
||||
Key = new DataKey<TextResource>("novels:i_alone_level_up"),
|
||||
AssociatedSource = lnwAggregator,
|
||||
AssociatedMetaSource = lnwAuxiliary,
|
||||
TemplateInitialData = ["i-alone-level-up-236", "1"],
|
||||
MetaTemplateInitialData = ["i-alone-level-up-solo-leveling-05122225"]
|
||||
Key = new DataKey<TextResource>("novels:house_of_horrors"),
|
||||
FriendlyName = "My House Of Horrors",
|
||||
AssociatedSource = wdsAgg,
|
||||
AssociatedMetaSource = wdsAux,
|
||||
TemplateInitialData = new State(["24349", "2896325"]),
|
||||
MetaTemplateInitialData = new State(["24349"])
|
||||
};
|
||||
|
||||
sdd.Novels.TryAdd(novel.Key, novel);
|
||||
|
||||
sdd.AggregatorNovels.TryAdd(lnwAggregator, [novel.Key]);
|
||||
sdd.AggregatorNovels.TryAdd(wdsAgg, [novel.Key]);
|
||||
}
|
||||
|
||||
public static void Define_NovelFull(SharedDataDictionary sdd) {
|
||||
var docNamespace = "aeqw89:document";
|
||||
var nfAgg = new DataKey<WebResource>("aggregators:novel_full").WithNamespace(docNamespace);
|
||||
var nfAux = new DataKey<WebResource>("auxillaries:novel_full").WithNamespace(docNamespace);
|
||||
var nfBindings = new DataKey<DataBindings>("aeqw89:bindings:light_novel_world");
|
||||
var aggregator = new WebResource(nfAgg) {
|
||||
Name = "Novel Full",
|
||||
Description = "A novel aggregator site",
|
||||
Domain = "https://novelfull.net",
|
||||
Bindings = nfBindings
|
||||
};
|
||||
var auxiliary = new WebResource(nfAux) {
|
||||
Name = "Novel Full",
|
||||
Description = "A novel aggregator site",
|
||||
Domain = "https://novelfull.net",
|
||||
Bindings = nfBindings.WithSuffix("_aux")
|
||||
};
|
||||
|
||||
sdd.Templates.TryAdd(nfAgg, new() {
|
||||
Template = ""
|
||||
});
|
||||
private static (DataKey<T>, DataKey<T>) CreateKeyPair<T>(string pref1, string pref2, string common, string @namespace) {
|
||||
return (
|
||||
new DataKey<T>(pref1 + ":" + common).WithNamespace(@namespace),
|
||||
new DataKey<T>(pref2 + ":" + common).WithNamespace(@namespace)
|
||||
);
|
||||
}
|
||||
|
||||
public static void Define_LightNovelWorld(SharedDataDictionary sdd) {
|
||||
var lnwAggregator = new DataKey<WebResource>("aeqw89:document:aggregators:light_novel_world");
|
||||
var lnwAuxiliary = new DataKey<WebResource>("aeqw89:document:auxillaries:light_novel_world");
|
||||
const string lnwBindingsA = "aeqw89:bindings:light_novel_world";
|
||||
var aggregator = new WebResource(lnwAggregator) {
|
||||
Name = "Light Novel World",
|
||||
Description = "A novel aggregator site maintained by NetherClaw",
|
||||
Domain = "https://www.lightnovelworld.co",
|
||||
Bindings = new DataKey<DataBindings>(lnwBindingsA)
|
||||
public static void Define_WoDuShu(BeamDataDictionary sdd) {
|
||||
var (wdsAgg, wdsAux) = CreateKeyPair<WebResource>("aggregators", "auxillaries", "wodushu", "aeqw89:document");
|
||||
var bindings = new DataKey<DataBindings>("aeqw89:bindings:wodushu");
|
||||
var aggregator = new WebResource(wdsAgg) {
|
||||
Name = "WoDuShu.com",
|
||||
Description = "A Chinese novel aggregator site",
|
||||
Domain = "https://wodushu.com",
|
||||
Bindings = bindings
|
||||
};
|
||||
const string lnwBindingsB = "aeqw89:bindings:light_novel_world_aux";
|
||||
var auxiliary = new WebResource(lnwAuxiliary) {
|
||||
Name = "Light Novel World",
|
||||
Description = "A novel aggregator site maintained by NetherClaw",
|
||||
Domain = "https://www.lightnovelworld.co",
|
||||
Bindings = new DataKey<DataBindings>(lnwBindingsB)
|
||||
var auxiliary = new WebResource(wdsAux) {
|
||||
Name = "WoDuShu.com",
|
||||
Description = "A Chinese novel aggregator site",
|
||||
Domain = "https://wodushu.com",
|
||||
Bindings = bindings.WithSuffix("_aux")
|
||||
};
|
||||
|
||||
sdd.Templates.TryAdd(lnwAuxiliary, new() {
|
||||
Template = "https://www.lightnovelworld.co/novel/{0}",
|
||||
IndexOfChapterIndex = -1
|
||||
sdd.Templates.TryAdd(wdsAgg, new() {
|
||||
Factory = new(StateChangerFactory.LastAsNumber),
|
||||
Builder = new SourceLinkBuilder("www.wodushu.com")
|
||||
.WithSegments("read", "", "")
|
||||
.WithParameters(1, "")
|
||||
.WithParameters(2, (".html", Position.After))
|
||||
});
|
||||
sdd.Templates.TryAdd(lnwAggregator, new() {
|
||||
Template = "https://www.lightnovelworld.co/novel/{0}/chapter-{1}",
|
||||
IndexOfChapterIndex = 1
|
||||
sdd.Templates.TryAdd(wdsAux, new() {
|
||||
Factory = new(StateChangerFactory.Constant),
|
||||
Builder = new SourceLinkBuilder("www.wodushu.com")
|
||||
.WithSegments("book", "")
|
||||
.WithParameters(1, "")
|
||||
});
|
||||
|
||||
sdd.Aggregators.TryAdd(aggregator.Key, aggregator);
|
||||
sdd.Auxillaries.TryAdd(auxiliary.Key, auxiliary);
|
||||
sdd.Aggregators.TryAdd(wdsAgg, aggregator);
|
||||
sdd.Auxillaries.TryAdd(wdsAux, auxiliary);
|
||||
|
||||
var lnwBindings = new DataKey<DataBindings>(lnwBindingsA);
|
||||
var lnwBindingsAux = new DataKey<DataBindings>(lnwBindingsB);
|
||||
sdd.Bindings.TryAdd(lnwBindings, new DataBindings() {
|
||||
Title = new Binding("aeqw89:binding:light_novel_world:title") {
|
||||
XPath = "/html/body/main/article/section/div[1]/h1/span[2]",
|
||||
var binding_agg = new DataKey<DataBindings>("aeqw89:bindings:wodushu");
|
||||
var binding_aux = new DataKey<DataBindings>("aeqw89:bindings:wodushu_aux");
|
||||
|
||||
sdd.Bindings.Add(binding_agg, new() {
|
||||
Title = new Binding() {
|
||||
XPath = "/html/body/div[4]/div/div/div[2]/h1",
|
||||
Type = BindingType.Single
|
||||
},
|
||||
Content = new("aeqw89:binding:light_novel_world:content") {
|
||||
Content = new Binding() {
|
||||
Type = BindingType.UseProvider,
|
||||
Provider = new ParagraphedContentDataProvider() {
|
||||
Content = new Binding() {
|
||||
XPath = "//*[@id=\"chapter-container\"]"
|
||||
XPath = "//*[@id=\"content\"]"
|
||||
}
|
||||
},
|
||||
Type = BindingType.UseProvider
|
||||
}
|
||||
},
|
||||
});
|
||||
sdd.Bindings.TryAdd(lnwBindingsAux, new DataBindings() {
|
||||
Title = new("aeqw89:binding:light_novel_world_aux:title") {
|
||||
XPath = "/html/body/main/article/header/div[2]/div[2]/div[1]/h1",
|
||||
|
||||
sdd.Bindings.Add(binding_aux, new() {
|
||||
Title = new Binding() {
|
||||
XPath = "/html/body/div[3]/div[1]/div/div/div[2]/div[1]/h1",
|
||||
Type = BindingType.Single
|
||||
},
|
||||
Authors = new("aeqw89:binding:light_novel_world_aux:authors") {
|
||||
XPath = "/html/body/main/article/header/div[2]/div[2]/div[1]/div[1]/a",
|
||||
Authors = new Binding() {
|
||||
XPath = "/html/body/div[3]/div[1]/div/div/div[2]/div[1]/div/p[1]/a",
|
||||
Type = BindingType.Single
|
||||
},
|
||||
Description = new("aeqw89:binding:light_novel_world_aux:description") {
|
||||
Description = new Binding() {
|
||||
Provider = new ParagraphedContentDataProvider() {
|
||||
Content = new() {
|
||||
XPath = "/html/body/main/article/div/section/div[1]/div"
|
||||
}
|
||||
},
|
||||
Type = BindingType.UseProvider
|
||||
},
|
||||
Tags = new("aeqw89:binding:light_novel_world_aux:tags") {
|
||||
Provider = new ListContentDataProvider() {
|
||||
Content = new() {
|
||||
XPath = "/html/body/main/article/header/div[2]/div[2]/div[3]/ul"
|
||||
Content = new Binding() {
|
||||
XPath = "/html/body/div[3]/div[1]/div/div/div[2]/div[2]"
|
||||
}
|
||||
},
|
||||
Type = BindingType.UseProvider
|
||||
@@ -139,6 +137,107 @@ namespace Beam.Temporary.Cli {
|
||||
});
|
||||
}
|
||||
|
||||
//public static void Define_NovelFull(SharedDataDictionary sdd) {
|
||||
// var docNamespace = "aeqw89:document";
|
||||
// var nfAgg = new DataKey<WebResource>("aggregators:novel_full").WithNamespace(docNamespace);
|
||||
// var nfAux = new DataKey<WebResource>("auxillaries:novel_full").WithNamespace(docNamespace);
|
||||
// var nfBindings = new DataKey<DataBindings>("aeqw89:bindings:light_novel_world");
|
||||
// var aggregator = new WebResource(nfAgg) {
|
||||
// Name = "Novel Full",
|
||||
// Description = "A novel aggregator site",
|
||||
// Domain = "https://novelfull.net",
|
||||
// Bindings = nfBindings
|
||||
// };
|
||||
// var auxiliary = new WebResource(nfAux) {
|
||||
// Name = "Novel Full",
|
||||
// Description = "A novel aggregator site",
|
||||
// Domain = "https://novelfull.net",
|
||||
// Bindings = nfBindings.WithSuffix("_aux")
|
||||
// };
|
||||
|
||||
// sdd.Templates.TryAdd(nfAux, new(StateChangerFactory.LastAsNumberPrefixed));
|
||||
|
||||
// sdd.Aggregators.TryAdd(nfAgg, aggregator);
|
||||
// sdd.Auxillaries.TryAdd(nfAux, auxiliary);
|
||||
|
||||
// var binding_agg = new DataKey<DataBindings>("aeqw89:bindings:be")
|
||||
|
||||
//}
|
||||
|
||||
//public static void Define_LightNovelWorld(SharedDataDictionary sdd) {
|
||||
// var lnwAggregator = new DataKey<WebResource>("aeqw89:document:aggregators:light_novel_world");
|
||||
// var lnwAuxiliary = new DataKey<WebResource>("aeqw89:document:auxillaries:light_novel_world");
|
||||
// const string lnwBindingsA = "aeqw89:bindings:light_novel_world";
|
||||
// var aggregator = new WebResource(lnwAggregator) {
|
||||
// Name = "Light Novel World",
|
||||
// Description = "A novel aggregator site maintained by NetherClaw",
|
||||
// Domain = "https://www.lightnovelworld.co",
|
||||
// Bindings = new DataKey<DataBindings>(lnwBindingsA)
|
||||
// };
|
||||
// const string lnwBindingsB = "aeqw89:bindings:light_novel_world_aux";
|
||||
// var auxiliary = new WebResource(lnwAuxiliary) {
|
||||
// Name = "Light Novel World",
|
||||
// Description = "A novel aggregator site maintained by NetherClaw",
|
||||
// Domain = "https://www.lightnovelworld.co",
|
||||
// Bindings = new DataKey<DataBindings>(lnwBindingsB)
|
||||
// };
|
||||
|
||||
// sdd.Templates.TryAdd(lnwAuxiliary, new() {
|
||||
// Template = "https://www.lightnovelworld.co/novel/{0}",
|
||||
// IndexOfChapterIndex = -1
|
||||
// });
|
||||
// sdd.Templates.TryAdd(lnwAggregator, new() {
|
||||
// Template = "https://www.lightnovelworld.co/novel/{0}/chapter-{1}",
|
||||
// IndexOfChapterIndex = 1
|
||||
// });
|
||||
|
||||
// sdd.Aggregators.TryAdd(aggregator.Key, aggregator);
|
||||
// sdd.Auxillaries.TryAdd(auxiliary.Key, auxiliary);
|
||||
|
||||
// var lnwBindings = new DataKey<DataBindings>(lnwBindingsA);
|
||||
// var lnwBindingsAux = new DataKey<DataBindings>(lnwBindingsB);
|
||||
// sdd.Bindings.TryAdd(lnwBindings, new DataBindings() {
|
||||
// Title = new Binding("aeqw89:binding:light_novel_world:title") {
|
||||
// XPath = "/html/body/main/article/section/div[1]/h1/span[2]",
|
||||
// Type = BindingType.Single
|
||||
// },
|
||||
// Content = new("aeqw89:binding:light_novel_world:content") {
|
||||
// Provider = new ParagraphedContentDataProvider() {
|
||||
// Content = new Binding() {
|
||||
// XPath = "//*[@id=\"chapter-container\"]"
|
||||
// }
|
||||
// },
|
||||
// Type = BindingType.UseProvider
|
||||
// },
|
||||
// });
|
||||
// sdd.Bindings.TryAdd(lnwBindingsAux, new DataBindings() {
|
||||
// Title = new("aeqw89:binding:light_novel_world_aux:title") {
|
||||
// XPath = "/html/body/main/article/header/div[2]/div[2]/div[1]/h1",
|
||||
// Type = BindingType.Single
|
||||
// },
|
||||
// Authors = new("aeqw89:binding:light_novel_world_aux:authors") {
|
||||
// XPath = "/html/body/main/article/header/div[2]/div[2]/div[1]/div[1]/a",
|
||||
// Type = BindingType.Single
|
||||
// },
|
||||
// Description = new("aeqw89:binding:light_novel_world_aux:description") {
|
||||
// Provider = new ParagraphedContentDataProvider() {
|
||||
// Content = new() {
|
||||
// XPath = "/html/body/main/article/div/section/div[1]/div"
|
||||
// }
|
||||
// },
|
||||
// Type = BindingType.UseProvider
|
||||
// },
|
||||
// Tags = new("aeqw89:binding:light_novel_world_aux:tags") {
|
||||
// Provider = new ListContentDataProvider() {
|
||||
// Content = new() {
|
||||
// XPath = "/html/body/main/article/header/div[2]/div[2]/div[3]/ul"
|
||||
// }
|
||||
// },
|
||||
// Type = BindingType.UseProvider
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user