refactoring with internal

This commit is contained in:
github_username_here
2026-03-04 14:21:24 +01:00
parent 8fdf7c190a
commit 7355158ff9
6 changed files with 88 additions and 70 deletions

View File

@@ -1,9 +1,11 @@
package main
import(
"project.hechon.fr/internal/fetcher"
"log"
"os"
"strings"
"project.hechon.fr/internal/config"
)
func loadExclude(path string) (map[string]struct{}, error) {
@@ -20,28 +22,47 @@ func loadExclude(path string) (map[string]struct{}, error) {
func main (){
properName, err:= loadExclude("properName.txt")
book := config.Book{
Name: "Psaumes",
Version: "LSG",
}
cfg := config.Cfg{
ConfigPath: "internal/config/",
YamlPath: "data",
HtmlPath: "Public",
BookList: map[string]int{
"ps": 150,
"pr": 31,
},
Book: book,
}
properName, err:= loadExclude(cfg.ConfigPath + "properName.txt")
if err != nil{
log.Printf("cant open the proper names file")
os.Exit(1)
}
book := "Psaumes"
searchedChapter := "2"
version := "LSG"
cfg.ProperName = properName
Chapter, err := fetchChapter(book, searchedChapter, version)
searchedChapter := "2"
err = fetcher.FetchChapter(&cfg, searchedChapter)
if err != nil {
log.Printf("GET %s %s %s failed\n", book, searchedChapter, version)
log.Printf("GET %s %s %s failed\n", book, searchedChapter, cfg.Book.Version)
os.Exit(1)
}
Chapter = stripAlternativeVersification(Chapter)
for i, verse := range Chapter.verses{
/*
for i, verse := range cfg.Book.Chapters[0].Verses{
log.Printf("==== Verse: %v ====", i+1)
splitInPart(verse, properName)
fetcher.SplitInPart(verse, properName)
}
*/
os.Exit(0)
}